Open Inventor Reference
SoTabPlaneDragger Class Reference

Object you can translate or scale within a plane by dragging with the mouse. More...

#include <Inventor/draggers/SoTabPlaneDragger.h>

Inheritance diagram for SoTabPlaneDragger:
SoDragger SoInteractionKit SoBaseKit SoNode SoFieldContainer SoBase

List of all members.

Public Member Functions

 SoTabPlaneDragger ()
 Constructor.
void adjustScaleTabSize ()
 Cause the scale tab sizes to be re-adjusted so that they remain a near constant screen space size.

Static Public Member Functions

static void initClass ()
 initialize the class

Public Attributes

SoSFVec3f translation
SoSFVec3f scaleFactor

Protected Types

enum  State {
  INACTIVE, TRANSLATING, EDGE_SCALING, CORNER_SCALING,
  UNIFORM_SCALING
}

Protected Member Functions

virtual void GLRender (SoGLRenderAction *action)
 These virtual functions implement all of the actions for nodes, Most of the default implementations do nothing.
void dragStart ()
void drag ()
void dragFinish ()
void translateStart ()
void translateDrag ()
void edgeScaleStart ()
void edgeScaleDrag ()
void cornerScaleStart ()
void cornerScaleDrag ()
void scaleUniformStart ()
void scaleUniformDrag ()
void reallyAdjustScaleTabSize (SoGLRenderAction *action)
void getXYScreenLengths (SbVec2f &lengths, const SbMatrix &localToScreen, const SbVec2s &winSize)
virtual SbBool setUpConnections (SbBool onOff, SbBool doItAlways=FALSE)
 detach/attach any sensors, callbacks, and/or field connections.
virtual void setDefaultOnNonWritingFields ()
 Called by the SoBaseKit::write() method.
virtual ~SoTabPlaneDragger ()

Static Protected Member Functions

static void startCB (void *, SoDragger *)
static void motionCB (void *, SoDragger *)
static void finishCB (void *, SoDragger *)
static void metaKeyChangeCB (void *, SoDragger *)
static void fieldSensorCB (void *, SoSensor *)
static void valueChangedCB (void *, SoDragger *)

Protected Attributes

SbLineProjectorlineProj
SbPlaneProjectorplaneProj
SoFieldSensortranslFieldSensor
SoFieldSensorscaleFieldSensor
SbVec3f worldRestartPt
int currentScalePatch
SbBool shftDown
State currentState
State restartState
int translateDir
SbVec3f scaleCenter
SbBool needScaleTabAdjustment

Detailed Description

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. Dragging an edge tab performs 1D scaling about the opposite edge. The rest of the dragger is invisible but pickable; selecting it initiates translation within the plane.

The dragger tries to keep the small tabs a constant size in screen space. Every time a drag begins or ends, the size is recalculated based on the viewing and modeling matrix.

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 /usr/share/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.

File Format/Default
See Also
SoInteractionKit, SoDragger, SoCenterballDragger, SoDirectionalLightDragger, SoDragPointDragger, SoHandleBoxDragger, SoJackDragger, SoPointLightDragger, SoRotateCylindricalDragger, SoRotateDiscDragger, SoRotateSphericalDragger, SoScale1Dragger, SoScale2Dragger, SoScale2UniformDragger, SoScaleUniformDragger, SoSpotLightDragger, SoTabBoxDragger, SoTrackballDragger, SoTransformBoxDragger, SoTransformerDragger, SoTranslate1Dragger, SoTranslate2Dragger

Definition at line 172 of file SoTabPlaneDragger.h.


Member Enumeration Documentation

enum SoTabPlaneDragger::State [protected]
Enumerator:
INACTIVE 
TRANSLATING 
EDGE_SCALING 
CORNER_SCALING 
UNIFORM_SCALING 

Definition at line 250 of file SoTabPlaneDragger.h.


Constructor & Destructor Documentation

SoTabPlaneDragger::SoTabPlaneDragger ( )
virtual SoTabPlaneDragger::~SoTabPlaneDragger ( ) [protected, virtual]

Member Function Documentation

void SoTabPlaneDragger::adjustScaleTabSize ( )

This happens automatically upon dragger finish. Call this to adjust the scale tab sizes at other times, for instance after the camera has changed in a viewer finish callback.

void SoTabPlaneDragger::cornerScaleDrag ( ) [protected]
void SoTabPlaneDragger::cornerScaleStart ( ) [protected]
void SoTabPlaneDragger::drag ( ) [protected]
void SoTabPlaneDragger::dragFinish ( ) [protected]
void SoTabPlaneDragger::dragStart ( ) [protected]
void SoTabPlaneDragger::edgeScaleDrag ( ) [protected]
void SoTabPlaneDragger::edgeScaleStart ( ) [protected]
static void SoTabPlaneDragger::fieldSensorCB ( void *  ,
SoSensor  
) [static, protected]

Reimplemented from SoInteractionKit.

static void SoTabPlaneDragger::finishCB ( void *  ,
SoDragger  
) [static, protected]
void SoTabPlaneDragger::getXYScreenLengths ( SbVec2f lengths,
const SbMatrix localToScreen,
const SbVec2s winSize 
) [protected]
virtual void SoTabPlaneDragger::GLRender ( SoGLRenderAction action) [protected, virtual]

Reimplemented from SoBaseKit.

static void SoTabPlaneDragger::initClass ( ) [static]

Reimplemented from SoDragger.

static void SoTabPlaneDragger::metaKeyChangeCB ( void *  ,
SoDragger  
) [static, protected]
static void SoTabPlaneDragger::motionCB ( void *  ,
SoDragger  
) [static, protected]
void SoTabPlaneDragger::reallyAdjustScaleTabSize ( SoGLRenderAction action) [protected]
void SoTabPlaneDragger::scaleUniformDrag ( ) [protected]
void SoTabPlaneDragger::scaleUniformStart ( ) [protected]
virtual void SoTabPlaneDragger::setDefaultOnNonWritingFields ( ) [protected, virtual]

Draggers don't want to write out fields if they have default vals.

sets isActive to default if default and not connected.

Looks for fields named: 'rotation' with value SbRotation::identity() 'translation' with value (0,0,0) 'center' with value (0,0,0) 'scaleFactor' with value (1,1,1) and sets them to default if they are not connected from a field. (most draggers are missing at least some of these, but thats okay)

Then calls the method for SoInteractionKit.

NOTE: Parts which are set to default may still wind up writing to file if, for example, they lie on a path.

Reimplemented from SoDragger.

virtual SbBool SoTabPlaneDragger::setUpConnections ( SbBool  onOff,
SbBool  doItAlways = FALSE 
) [protected, virtual]

Called by: start/end of SoBaseKit::readInstance and on new copy by: start/end of SoBaseKit::copy. Classes that redefine must call setUpConnections(TRUE,TRUE) at end of constructor. Returns the state of the node when this was called.

Reimplemented from SoInteractionKit.

static void SoTabPlaneDragger::startCB ( void *  ,
SoDragger  
) [static, protected]
void SoTabPlaneDragger::translateDrag ( ) [protected]
void SoTabPlaneDragger::translateStart ( ) [protected]
static void SoTabPlaneDragger::valueChangedCB ( void *  ,
SoDragger  
) [static, protected]

Member Data Documentation

Definition at line 248 of file SoTabPlaneDragger.h.

Definition at line 255 of file SoTabPlaneDragger.h.

Definition at line 221 of file SoTabPlaneDragger.h.

Definition at line 222 of file SoTabPlaneDragger.h.

Definition at line 256 of file SoTabPlaneDragger.h.

Definition at line 259 of file SoTabPlaneDragger.h.

Definition at line 253 of file SoTabPlaneDragger.h.

Definition at line 257 of file SoTabPlaneDragger.h.

Definition at line 247 of file SoTabPlaneDragger.h.


The documentation for this class was generated from the following file: