Open Inventor Reference
|
Object you can translate or scale within a plane by dragging with the mouse. More...
#include <Inventor/draggers/SoTabPlaneDragger.h>
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 | |
SbLineProjector * | lineProj |
SbPlaneProjector * | planeProj |
SoFieldSensor * | translFieldSensor |
SoFieldSensor * | scaleFieldSensor |
SbVec3f | worldRestartPt |
int | currentScalePatch |
SbBool | shftDown |
State | currentState |
State | restartState |
int | translateDir |
SbVec3f | scaleCenter |
SbBool | needScaleTabAdjustment |
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.
TabPlaneDragger { renderCaching AUTO boundingBoxCaching AUTO renderCulling AUTO pickCulling AUTO isActive FALSE translation 0 0 0 scaleFactor 1 1 1 }
Definition at line 172 of file SoTabPlaneDragger.h.
enum SoTabPlaneDragger::State [protected] |
Definition at line 250 of file SoTabPlaneDragger.h.
SoTabPlaneDragger::SoTabPlaneDragger | ( | ) |
virtual SoTabPlaneDragger::~SoTabPlaneDragger | ( | ) | [protected, virtual] |
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] |
int SoTabPlaneDragger::currentScalePatch [protected] |
Definition at line 248 of file SoTabPlaneDragger.h.
State SoTabPlaneDragger::currentState [protected] |
Definition at line 255 of file SoTabPlaneDragger.h.
SbLineProjector* SoTabPlaneDragger::lineProj [protected] |
Definition at line 221 of file SoTabPlaneDragger.h.
SbBool SoTabPlaneDragger::needScaleTabAdjustment [protected] |
Definition at line 261 of file SoTabPlaneDragger.h.
SbPlaneProjector* SoTabPlaneDragger::planeProj [protected] |
Definition at line 222 of file SoTabPlaneDragger.h.
State SoTabPlaneDragger::restartState [protected] |
Definition at line 256 of file SoTabPlaneDragger.h.
SbVec3f SoTabPlaneDragger::scaleCenter [protected] |
Definition at line 259 of file SoTabPlaneDragger.h.
Definition at line 202 of file SoTabPlaneDragger.h.
SoFieldSensor* SoTabPlaneDragger::scaleFieldSensor [protected] |
Definition at line 225 of file SoTabPlaneDragger.h.
SbBool SoTabPlaneDragger::shftDown [protected] |
Definition at line 253 of file SoTabPlaneDragger.h.
int SoTabPlaneDragger::translateDir [protected] |
Definition at line 257 of file SoTabPlaneDragger.h.
Definition at line 201 of file SoTabPlaneDragger.h.
SoFieldSensor* SoTabPlaneDragger::translFieldSensor [protected] |
Definition at line 224 of file SoTabPlaneDragger.h.
SbVec3f SoTabPlaneDragger::worldRestartPt [protected] |
Definition at line 247 of file SoTabPlaneDragger.h.