Open Inventor Reference
SoCenterballDragger Class Reference

Striped ball you rotate and re-center by dragging with the mouse. More...

#include <Inventor/draggers/SoCenterballDragger.h>

Inheritance diagram for SoCenterballDragger:
SoDragger SoInteractionKit SoBaseKit SoNode SoFieldContainer SoBase

List of all members.

Public Member Functions

 SoCenterballDragger ()
 Constructor.
virtual void saveStartParameters ()
 Saves the matrix that moves the center relative to the motionMatrix after it calls the default SoDragger method.

Static Public Member Functions

static void initClass ()
 initialize the class

Public Attributes

SoSFRotation rotation
SoSFVec3f center

Protected Member Functions

void transferCenterDraggerMotion (SoDragger *childDragger)
virtual void getBoundingBox (SoGetBoundingBoxAction *action)
 Differs from SoDragger as follows: If it has a surroundScale node with 'ignoreInBbox' set to TRUE, this means surroundScale is calculating its bbox for sizing.
virtual void getMatrix (SoGetMatrixAction *action)
void setSwitches (SoDragger *activeChild)
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.
 ~SoCenterballDragger ()

Static Protected Member Functions

static void fieldSensorCB (void *, SoSensor *)
static void valueChangedCB (void *, SoDragger *)
static void kidStartCB (void *, SoDragger *)
static void kidFinishCB (void *, SoDragger *)

Protected Attributes

SoFieldSensorrotFieldSensor
SoFieldSensorcenterFieldSensor

Detailed Description

SoCenterballDragger is a composite dragger. Its shape is a sphere defined by three intersecting circles. Where the circles intersect (at the ends of the x, y and z axes) there are sets of small green crosshairs. Dragging a pair of crosshairs translates the entire centerball within the plane of the crosshairs. The interface of the sphere and circles is just like SoTrackballDragger. Dragging a circle rotates about a constrained axis and dragging the areas between them rotates the sphere freely about the center. An invisible but pickable sphere initiates the free-rotation dragging.

When you drag the crosshairs, the center field is updated; there is no translation field. Dragging other parts of the centerball updates the rotation field. As with all draggers, if you change the fields the dragger moves in response.

The draggers used for the crosshair parts are SoTranslate2Draggers, so pressing the <Shift> key allows you to constrain motion to slide along either the local x axis or y axis of that crosshair.. The direction is determined by your initial mouse gesture after pressing the key. Releasing the key removes the constraint.

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

[a] Use an SoCenterballManip, which is subclassed from SoTransform. The manipulator creates one of these draggers and uses it as the interface to edit the manipulator's fields. (See the SoCenterballManip man 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 SoCenterballDragger 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/centerballDragger.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, SoDirectionalLightDragger, SoDragPointDragger, SoHandleBoxDragger, SoJackDragger, SoPointLightDragger, SoRotateCylindricalDragger, SoRotateDiscDragger, SoRotateSphericalDragger, SoScale1Dragger, SoScale2Dragger, SoScale2UniformDragger, SoScaleUniformDragger, SoSpotLightDragger, SoTabBoxDragger, SoTabPlaneDragger, SoTrackballDragger, SoTransformBoxDragger, SoTranslate1Dragger, SoTranslate2Dragger

Definition at line 191 of file SoCenterballDragger.h.


Constructor & Destructor Documentation

SoCenterballDragger::SoCenterballDragger ( )
SoCenterballDragger::~SoCenterballDragger ( ) [protected]

Member Function Documentation

static void SoCenterballDragger::fieldSensorCB ( void *  ,
SoSensor  
) [static, protected]

Reimplemented from SoInteractionKit.

virtual void SoCenterballDragger::getBoundingBox ( SoGetBoundingBoxAction action) [protected, virtual]

So we also need to ignore the 'translateToCenter' matrix. Take care of this by disabling notification of 'translateToCenter', changing it to identity, running action, and then putting everything back.

Reimplemented from SoDragger.

virtual void SoCenterballDragger::getMatrix ( SoGetMatrixAction action) [protected, virtual]

Reimplemented from SoBaseKit.

static void SoCenterballDragger::initClass ( ) [static]

Reimplemented from SoDragger.

static void SoCenterballDragger::kidFinishCB ( void *  ,
SoDragger  
) [static, protected]
static void SoCenterballDragger::kidStartCB ( void *  ,
SoDragger  
) [static, protected]
virtual void SoCenterballDragger::saveStartParameters ( ) [virtual]

Reimplemented from SoDragger.

virtual void SoCenterballDragger::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.

void SoCenterballDragger::setSwitches ( SoDragger activeChild) [protected]
virtual SbBool SoCenterballDragger::setUpConnections ( SbBool  onOff,
SbBool  doItAlways = FALSE 
) [protected, virtual]

Also set geometry of childDraggers to be our default instead of their regular default, using our resources. 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.

void SoCenterballDragger::transferCenterDraggerMotion ( SoDragger childDragger) [protected]
static void SoCenterballDragger::valueChangedCB ( void *  ,
SoDragger  
) [static, protected]

Member Data Documentation


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