Open Inventor Reference
SoHandleBoxDragger Class Reference

Box you can scale, stretch and translate by dragging with the mouse. More...

#include <Inventor/draggers/SoHandleBoxDragger.h>

Inheritance diagram for SoHandleBoxDragger:
SoDragger SoInteractionKit SoBaseKit SoNode SoFieldContainer SoBase

List of all members.

Public Member Functions

 SoHandleBoxDragger ()
 Constructor.

Static Public Member Functions

static void initClass ()
 initialize the class

Public Attributes

SoSFVec3f translation
SoSFVec3f scaleFactor

Protected Member Functions

void dragStart ()
 These really do the work during startCB, motionCB, and finishCB.
void drag ()
void dragFinish ()
void setAllPartsActive (SbBool onOrOff)
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 ~SoHandleBoxDragger ()

Static Protected Member Functions

static void startCB (void *, SoDragger *)
 Callbacks for drag start, motion, and finish.
static void motionCB (void *, SoDragger *)
static void finishCB (void *, SoDragger *)
static void fieldSensorCB (void *, SoSensor *)
static void valueChangedCB (void *, SoDragger *)
static void metaKeyChangeCB (void *, SoDragger *)
 Callbacks for pressing and releasing the meta keys.

Protected Attributes

SoFieldSensortranslFieldSensor
SoFieldSensorscaleFieldSensor

Detailed Description

SoHandleBoxDragger is a dragger shaped like a wireframe box with small corner cubes mounted on each corner. Click and drag any of these cubes to scale the box uniformly. Six other center cubes are centered on the sides of the box; white lines connect them to the center of the dragger. Drag one of the center cubes along its line to stretch the box in that direction. Dragging a face of the box translates the dragger within that plane.

While you drag a face of the box, purple feedback arrows display the possible directions of motion. Press the <Shift> key to constrain the motion to one of the two major directions in the plane. The constraint direction is chosen based on the next user gesture. Press the <Control> key and the dragger will translate perpendicular to that plane. The translation field is modified as the face is dragged.

By default, dragging any of the small cubes scales about the center of the object. Pressing the <Control> key changes this: A corner cube will scale about its opposite corner. A center cube will scale about the center of its opposite face. Dragging one of the small cubes will usually result in changes to both the scaleFactor and translation fields. This is because any scale about a point other than the origin has a translation element.

As with all draggers, if you change the fields the dragger will move to match the new settings.

Remember: This is not an SoTransform!. If you want to move other objects with this dragger, you can either:

[a] Use an SoHandleBoxManip, which is subclassed from SoTransform. It creates one of these draggers and uses it as the interface to change its fields. (see the SoHandleBoxManip reference page).

[b] Use field-to-field connections to connect the fields of this dragger to those of any SoTransformation node.

You can change the parts in any instance of this dragger using setPart(). The default part geometries are defined as resources for this SoHandleBoxDragger class. They are detailed in the Dragger Resources section of the online reference page for this class. You can make your program use different default resources for the parts by copying the file /usr/share/data/draggerDefaults/handleBoxDragger.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
NOTE Unlike most multi-function draggers, SoHandleBoxDragger is not a compound dragger made up of other draggers that perform its smaller tasks. This is not because it was inappropriate, but because was written before implementation of the methods that synchronize multiple child draggers. The younger SoTransformBoxDragger has similarities to the handle box dragger, but the transform box dragger is a compound dragger.
See Also
SoInteractionKit, SoDragger, SoCenterballDragger, SoDirectionalLightDragger, SoDragPointDragger, SoJackDragger, SoPointLightDragger, SoRotateCylindricalDragger, SoRotateDiscDragger, SoRotateSphericalDragger, SoScale1Dragger, SoScale2Dragger, SoScale2UniformDragger, SoScaleUniformDragger, SoSpotLightDragger, SoTabBoxDragger, SoTabPlaneDragger, SoTrackballDragger, SoTransformBoxDragger, SoTransformerDragger, SoTranslate1Dragger, SoTranslate2Dragger

Definition at line 204 of file SoHandleBoxDragger.h.


Constructor & Destructor Documentation

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

Member Function Documentation

void SoHandleBoxDragger::drag ( ) [protected]
void SoHandleBoxDragger::dragFinish ( ) [protected]
void SoHandleBoxDragger::dragStart ( ) [protected]
static void SoHandleBoxDragger::fieldSensorCB ( void *  ,
SoSensor  
) [static, protected]

Reimplemented from SoInteractionKit.

static void SoHandleBoxDragger::finishCB ( void *  ,
SoDragger  
) [static, protected]
static void SoHandleBoxDragger::initClass ( ) [static]

Reimplemented from SoDragger.

static void SoHandleBoxDragger::metaKeyChangeCB ( void *  ,
SoDragger  
) [static, protected]
static void SoHandleBoxDragger::motionCB ( void *  ,
SoDragger  
) [static, protected]
void SoHandleBoxDragger::setAllPartsActive ( SbBool  onOrOff) [protected]
virtual void SoHandleBoxDragger::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 SoHandleBoxDragger::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 SoHandleBoxDragger::startCB ( void *  ,
SoDragger  
) [static, protected]
static void SoHandleBoxDragger::valueChangedCB ( void *  ,
SoDragger  
) [static, protected]

Member Data Documentation


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