Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#177 selection of isosurfaces

closed
nobody
5
2010-06-10
2010-06-08
David Koes
No

For my application I need to be able to select isosurfaces (mostly spheres) and for the selected surface to be the one on top in the current view. I've attached the diff of my code that enables this feature with the current svn snapshot. There are some changes to navigation by surfaces that are necessary to support both modes. It would be really great if this feature could be rolled into the official Jmol source.

Thanks, -Dave

Discussion

  • David Koes
    David Koes
    2010-06-08

    diff of changes necessary for isosurface selection

     
    Attachments
  • Bob Hanson
    Bob Hanson
    2010-06-10

    define "the one on top" please. A few comments would be nice so I could understand what you are after there in the code. Question:

    - if (isBound(action, ACTION_pickAtom) || isBound(action, ACTION_pickPoint)
    - || isDragSelected) {
    + if (nearestAtomIndex >= 0 && (isBound(action, ACTION_pickAtom) || isBound(action, ACTION_pickPoint)
    + || isDragSelected)) {

    Isn't nearestAtomIndex == -1 when a draw atom is picked in the mode

    set picking draw

    ?

     
  • Bob Hanson
    Bob Hanson
    2010-06-10

    Oh, also, I need to see changes to development branch, not 11.8. Nothing new is going into 11.8.

    Thanks.

     
  • Bob Hanson
    Bob Hanson
    2010-06-10

    sorry -- I should read more carefully!

     
  • Bob Hanson
    Bob Hanson
    2010-06-10

    I don't think this is going to work:

    - if (isBound(action, ACTION_pickAtom) || isBound(action, ACTION_pickPoint)
    - || isDragSelected) {
    + if (nearestAtomIndex >= 0 && (isBound(action, ACTION_pickAtom) || isBound(action, ACTION_pickPoint)
    + || isDragSelected)) {

    atomPicked(nearestAtomIndex, nearestPoint, isDragSelected ? 0 : action);

    because we need to enter that routine for some draw picking (set drawPicking)

    I suggest (having renamed that method to make it more clear:

    if (tokType != Token.isosurface)
    atomOrPointPicked(nearestAtomIndex, nearestPoint, isDragSelected ? 0 : action);

     
  • Bob Hanson
    Bob Hanson
    2010-06-10

    - bind(SINGLE_CLICK+ALT+LEFT, ActionManager.ACTION_pickIsosurface);
    + bind(SINGLE_CLICK+LEFT, ActionManager.ACTION_pickIsosurface);

    You need to set the binding yourself for this specialized application. I don't think it's appropriate to be generally picking isosurface points. With a large isosurface this could be VERY time intensive.

     
  • Bob Hanson
    Bob Hanson
    2010-06-10

    for this:

    - if (viewer.getNavigationMode() && viewer.getNavigateSurface()
    - && (shape = shapes[JmolConstants.SHAPE_ISOSURFACE]) != null &&
    + if ((shape = shapes[JmolConstants.SHAPE_ISOSURFACE]) != null &&
    (pt = shape.checkObjectClicked(x, y, modifiers, bsVisible)) != null)

    I'd rather tie this into

    set drawPicking

    same as we have now:

    set drawHover

    shows isosurface points upon hovering.

     
  • Bob Hanson
    Bob Hanson
    2010-06-10

    checked in. Slight differences to suggestions --

    --requires set drawPicking
    --reports similar information as when clicking a drawn point, including id, mesh number, face number, x, y, and z, and title

    --doesn't break navigation mode.

     
  • Bob Hanson
    Bob Hanson
    2010-06-10

    • status: open --> closed
     
  • David Koes
    David Koes
    2010-06-10

    For what it's worth, one of the reasons I got read of the ALT+LEFT binding is that this gets intercepted by my window manager (to move the window) and is never seen by the applet.

     
  • Bob Hanson
    Bob Hanson
    2010-06-10

    That's fine. I figured as much. You know, you can use the

    BIND

    command to associate any mouse action with a whole set of Jmol actions, including _pickIsosurface.

    Originally I had it so that you could use alt because the left button was in use for other things, but with it set to require

    set drawPicking

    that's no longer necessary. With another slight tweak I think you should be able to incorporate these points into measurements. Measure distances to a surface. Could be useful. But that's not in there.