Class SoTabPlaneDragger

  • All Implemented Interfaces:
    SafeDisposable
    Direct Known Subclasses:
    SoEllipsoidDragger

    public class SoTabPlaneDragger
    extends SoDragger
    Object you can translate or scale within a plane by dragging with the mouse. SoTabPlaneDragger is a dragger which allows the user to interactively translate and scale in a plane. It looks like a square white outline with smaller green squares (or tabs ) set in the corners and along the center of each edge.

    Dragging a corner tab scales the dragger in 2D by scaling about the opposite corner. Holding the SHIFT key while while dragging a corner tab forces uniform scaling.

    Dragging an edge tab performs 1D scaling about the opposite edge.

    Uniform scaling can also be forced by setting the scaleUniform field to true.

    Clicking and dragging a face does translation within the plane of the face. Although the face of the dragger is invisible (using the default dragger geometry) it is pickable.

    The dragger tries to keep the small tabs a constant size in screen space. Before version 7.0, this adjustment was only done when a drag operation started and ended, or when the adjustScaleTabSize method was called. Now as long as the resizeHandles field is set to true (the default), the tab size is automatically recalculated whenever the view matrix changes (normally because the camera position or orientation changed).

    If the dragger becomes too small in one dimension to contain all three tabs (two corner tabs plus the edge tab), the middle (edge) tab will not be drawn. If the dragger becomes very small (or flat) in one dimension, it may not be possible for the user to resize using the tabs. One solution for this is to provide a "reset dragger" button in the application.

    When dragging the translator part, press the <Shift> key and you can constrain motion to either the local x axis or the y axis . The direction is determined by your initial mouse gesture after pressing the key. Releasing the key removes the constraint.

    When the translator part drags, the dragger updates its translation field. The various scaling parts cause changes to both the scaleFactor and translation field, since scaling about a point other than the center adds translation to the center of the dragger. If you set the field, the dragger will move accordingly. You can also connect fields of other nodes or engines from this one to make them follow the dragger's motion.

    You can not change the shape used to draw the tabs. This part is kept privately and may not be changed; the coordinates for the tabs are edited during adjustScaleTabSize().

    The SoTabPlaneDragger class does contain three other parts you can change: tabPlaneTranslator , tabPlaneScaleTabMaterial and tabPlaneScaleTabHints .

    Each of these is set by default from a resource described in the Dragger Resources section of the online reference page for this class. You can change the parts in any instance of this dragger using setPart().

    You can make your program use different default resources for the parts by copying the file $OIVHOME/data/draggerDefaults/tabPlaneDragger.iv into your own directory, editing the file, and then setting the environment variable SO_DRAGGER_DIR to be a path to that directory.

    See SoDragger for more information about using and customizing draggers, including code examples, using draggers in an immersive VR environment and using WYSIWYG draggers.

    File format/default:

    TabPlaneDragger {

      boundingBoxCaching AUTO
      renderCulling AUTO
      pickCulling AUTO
      isActive false
      resizeHandles true
      translation 0 0 0
      scaleFactor 1 1 1
      scaleUniform false
      twoSidedLighting false
      lineWidth 1
      tabPixelSize 8
      callbackList NULL
      translator <tabPlaneTranslator resource>
      scaleTabMaterial <tabPlaneScaleTabMaterial resource>
      scaleTabHints <tabPlaneScaleTabHints resource>
    }

    DRAGGER RESOURCES

      Resource: tabPlaneTranslator
      Part: translator
      Appearance: Outline of a Square. The region within it is pickable
      Description: Begins translation within the plane

      Resource: tabPlaneScaleTabMaterial
      Part: scaleTabMaterial
      Appearance: Green - half diffuse, half emissive.
      Description: Used as material for scaling tabs.

      Resource: tabPlaneScaleTabHints
      Part: scaleTabHints
      Appearance: shapeHints node:COUNTERCLOCKWISE/SOLID/CONVEX
      Description: Property for the tab nodes.

    CATALOG PARTS

    All Parts

      Part NamePart TypeDefault TypeNULL Default
      callbackList NodeKitListPart yes
      translator Separator yes
      scaleTabMaterial Material yes
      scaleTabHints ShapeHints yes
      translatorDrawStyle DrawStyle no
      translatorMaterial Material no

    Extra Information for List Parts from Above Table

      Part NameContainer TypePossible Types
      callbackList Separator Callback, EventCallback

    See Also:
    SoInteractionKit, SoDragger, SoCenterballDragger, SoDirectionalLightDragger, SoDragPointDragger, SoHandleBoxDragger, SoJackDragger, SoPointLightDragger, SoRotateCylindricalDragger, SoRotateDiscDragger, SoRotateSphericalDragger, SoScale1Dragger, SoScale2Dragger, SoScale2UniformDragger, SoScaleUniformDragger, SoSpotLightDragger, SoTabBoxDragger, SoTrackballDragger, SoTransformBoxDragger, SoTransformerDragger, SoTranslate1Dragger, SoTranslate2Dragger
    • Field Detail

      • translation

        public final SoSFVec3f translation
        Position of the dragger. Default is (0,0,0).
      • scaleFactor

        public final SoSFVec3f scaleFactor
        Scale factor affecting the dragger. Default is (1,1,1).
      • resizeHandles

        public final SoSFBool resizeHandles
        If set to true, handles will be resized automatically when the view matrix (camera) changes. Default is true.

        Since:
        Open Inventor 7.0

      • scaleUniform

        public final SoSFBool scaleUniform
        If set to true, scaling will always be uniform. Default is false.

        Since:
        Open Inventor 7.1

      • twoSidedLighting

        public final SoSFBool twoSidedLighting
        If set to true, OpenGL two sided lighting will be enabled. Default is false.

        Since:
        Open Inventor 7.1

      • lineWidth

        public final SoSFFloat lineWidth
        Specifies the line width for the outline box. Default is 1.0

        Since:
        Open Inventor 7.1

      • tabPixelSize

        public final SoSFInt32 tabPixelSize
        Specifies the size of the green tabs in pixels. Default is 8

        Since:
        Open Inventor 9.2

    • Constructor Detail

      • SoTabPlaneDragger

        public SoTabPlaneDragger()
        Constructor.
    • Method Detail

      • showEdgeScales

        public void showEdgeScales​(boolean show)
        show or hide edges
      • showCornerScales

        public void showCornerScales​(boolean show)
        show or hide corners
      • adjustScaleTabSize

        public void adjustScaleTabSize()
        Causes the scale tab sizes to be adjusted so that they remain a near constant screen space size. This happens automatically upon dragger finish. Call this to manually adjust the scale tab sizes at other times, for instance after the camera has changed in a viewer finish callback . Note that (since version 7.0) handles are automatically resized when the camera changes, as long as the resizeHandles field is set to true.