Esempio n. 1
0
SoXipImage::SoXipImage()
{
    mApplyLut = 0;
    mTexture = 0;
    mMatrix = 0;
    mQuad = 0;
    mTextureMode = 0;
    mConnectionsSet = false;
    mImageDirty = true;
    mHasLut = false;

    SO_KIT_CONSTRUCTOR(SoXipImage);

    SO_NODE_ADD_FIELD(image, (NULL));

    SO_KIT_ADD_CATALOG_ENTRY(top,      SoSeparator,          FALSE, this, \x0, FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(applylut, SoXipApplyLutToImage, FALSE,  top, \x0, FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(texture,  SoXipTexture,         FALSE,  top, \x0, FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(matrix,   SoMatrixTransform,    FALSE,  top, \x0, FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(quad,     SoXipQuad,            FALSE,  top, \x0, FALSE);

    SO_KIT_INIT_INSTANCE();

    mImageSensor = new SoFieldSensor(&fieldSensorCBFunc, this);
    mImageSensor->setPriority(0);
    mImageSensor->attach(&image);
}
SoXipPlot2Columns::SoXipPlot2Columns()
{
    SO_KIT_CONSTRUCTOR( SoXipPlot2Columns );

    SO_KIT_ADD_CATALOG_ENTRY( mMainSeparator, SoSeparator, FALSE, this, \x0, TRUE );

    SO_KIT_ADD_CATALOG_ENTRY( mVertices, SoCoordinate3, FALSE, mMainSeparator, \x0, FALSE );

    SO_KIT_ADD_CATALOG_ENTRY( mFaceSeparator, SoSeparator, FALSE, mMainSeparator, \x0, FALSE );
    SO_KIT_ADD_CATALOG_ENTRY( mFaceMaterial, SoMaterial, FALSE, mFaceSeparator, \x0, FALSE );
    SO_KIT_ADD_CATALOG_ENTRY( mFaces, SoFaceSet,  FALSE, mFaceSeparator, \x0, FALSE );

    SO_KIT_ADD_CATALOG_ENTRY( mBorderSeparator, SoSeparator,  FALSE, mMainSeparator, \x0, FALSE );
    SO_KIT_ADD_CATALOG_ENTRY( mBorderColor, SoBaseColor,  FALSE, mBorderSeparator, \x0, FALSE );
    SO_KIT_ADD_CATALOG_ENTRY( mBorderStyle, SoDrawStyle,  FALSE, mBorderSeparator, \x0, FALSE );
    SO_KIT_ADD_CATALOG_ENTRY( mBorderLines, SoLineSet,  FALSE, mBorderSeparator, \x0, FALSE );

    SO_NODE_ADD_FIELD( label, ("Columns") );
    SO_NODE_ADD_FIELD( data, (0) );
    data.setNum(0);
    SO_NODE_ADD_FIELD( faceColor, (0.2, 0.2, 0.2) );
    SO_NODE_ADD_FIELD( faceTransparency, (0) );
    SO_NODE_ADD_FIELD( borderColor, (0, 0, 0) );
    SO_NODE_ADD_FIELD( borderWidth, (1) );

    SO_KIT_INIT_INSTANCE();

    setVertices();

    mDataSensor = new SoFieldSensor( dataSensorCB, this );
    mDataSensor->attach( &data );

    setUpConnections( TRUE, TRUE );
}
Esempio n. 3
0
SoForeignFileKit::SoForeignFileKit(void)
{
  PRIVATE(this) = NULL;
  // PRIVATE(this) = new SoForeignFileKitP(this);

  SO_KIT_INTERNAL_CONSTRUCTOR(SoForeignFileKit);

  SO_KIT_ADD_CATALOG_ENTRY(topSeparator, SoSeparator, TRUE, this, \x0, FALSE);

  SO_KIT_INIT_INSTANCE();
}
Esempio n. 4
0
/**
 * Creates a new TSeparatorKit node.
 */
TSeparatorKit::TSeparatorKit()
{
    SO_KIT_CONSTRUCTOR(TSeparatorKit);

	SO_KIT_ADD_CATALOG_ABSTRACT_ENTRY(tracker, SoNode, TDefaultTracker, TRUE, this, "", TRUE);
	SO_KIT_INIT_INSTANCE();

	SoTransform* transform = new SoTransform;
	setPart("transform", transform);

}
SoFileSubgraph::SoFileSubgraph()
{
    SO_KIT_CONSTRUCTOR(SoFileSubgraph);
    SO_KIT_ADD_CATALOG_ENTRY(root, SoSeparator, FALSE, this, \0 ,TRUE);
    SO_KIT_ADD_FIELD(fileName, (""));
    SO_KIT_INIT_INSTANCE();

    setSearchingChildren(TRUE);

    fileNameSensor=new SoFieldSensor(fileNameCB,this);
    setUpConnections(TRUE,TRUE);
}
Esempio n. 6
0
/**
 * Creates a new TSceneKit node.
 */
TSceneKit::TSceneKit()
{
    SO_KIT_CONSTRUCTOR(TSceneKit);
    SO_KIT_ADD_CATALOG_ABSTRACT_ENTRY( transmissivity, TTransmissivity, TDefaultTransmissivity, TRUE, topSeparator, "", TRUE);


	SO_NODE_ADD_FIELD( azimuth, ( gc::Pi ) );
	SO_NODE_ADD_FIELD( zenith, ( 0.0f ) );

    SO_KIT_INIT_INSTANCE();

}
Esempio n. 7
0
/*!
  Constructor.
*/
SoLightKit::SoLightKit(void)
{
  SO_KIT_INTERNAL_CONSTRUCTOR(SoLightKit);

  // Note: we must use "" instead of , , to humour MS VisualC++ 6.

  SO_KIT_ADD_CATALOG_ENTRY(transformGroup, SoTransformSeparator, TRUE, this, "", FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(transform, SoTransform, TRUE, transformGroup, light, TRUE);
  SO_KIT_ADD_CATALOG_ABSTRACT_ENTRY(light, SoLight, SoDirectionalLight, FALSE, transformGroup, iconSeparator, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(iconSeparator, SoSeparator, TRUE, transformGroup, "", FALSE);
  SO_KIT_ADD_CATALOG_ABSTRACT_ENTRY(icon, SoNode, SoCube, TRUE, iconSeparator, "", TRUE);

  SO_KIT_INIT_INSTANCE();
}
/*!
  \DRAGGER_CONSTRUCTOR

  \NODEKIT_PRE_DIAGRAM

  \verbatim
  CLASS SoRotateSphericalDragger
  -->"this"
        "callbackList"
        "topSeparator"
           "motionMatrix"
           "geomSeparator"
  -->         "rotatorSwitch"
  -->            "rotator"
  -->            "rotatorActive"
  -->         "feedbackSwitch"
  -->            "feedback"
  -->            "feedbackActive"
  \endverbatim

  \NODEKIT_POST_DIAGRAM


  \NODEKIT_PRE_TABLE

  \verbatim
  CLASS SoRotateSphericalDragger
  PVT   "this",  SoRotateSphericalDragger  ---
        "callbackList",  SoNodeKitListPart [ SoCallback, SoEventCallback ]
  PVT   "topSeparator",  SoSeparator  ---
  PVT   "motionMatrix",  SoMatrixTransform  ---
  PVT   "geomSeparator",  SoSeparator  ---
  PVT   "rotatorSwitch",  SoSwitch  ---
        "rotator",  SoSeparator  ---
        "rotatorActive",  SoSeparator  ---
  PVT   "feedbackSwitch",  SoSwitch  ---
        "feedback",  SoSeparator  ---
        "feedbackActive",  SoSeparator  ---
  \endverbatim

  \NODEKIT_POST_TABLE
*/
SoRotateSphericalDragger::SoRotateSphericalDragger(void)
{
  SO_KIT_INTERNAL_CONSTRUCTOR(SoRotateSphericalDragger);

  SO_KIT_ADD_CATALOG_ENTRY(rotatorSwitch, SoSwitch, TRUE, geomSeparator, feedbackSwitch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(rotator, SoSeparator, TRUE, rotatorSwitch, rotatorActive, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(rotatorActive, SoSeparator, TRUE, rotatorSwitch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(feedbackSwitch, SoSwitch, TRUE, geomSeparator, "", FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(feedback, SoSeparator, TRUE, feedbackSwitch, feedbackActive, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(feedbackActive, SoSeparator, TRUE, feedbackSwitch, "", TRUE);

  if (SO_KIT_IS_FIRST_INSTANCE()) {
    SoInteractionKit::readDefaultParts("rotateSphericalDragger.iv",
                                       ROTATESPHERICALDRAGGER_draggergeometry,
                                       static_cast<int>(strlen(ROTATESPHERICALDRAGGER_draggergeometry)));
  }

  SO_KIT_ADD_FIELD(rotation, (SbRotation(SbVec3f(0.0f, 0.0f, 1.0f), 0.0f)));
  SO_KIT_INIT_INSTANCE();

  // initialize default parts
  this->setPartAsDefault("rotator", "rotateSphericalRotator");
  this->setPartAsDefault("rotatorActive", "rotateSphericalRotatorActive");
  this->setPartAsDefault("feedback", "rotateSphericalFeedback");
  this->setPartAsDefault("feedbackActive", "rotateSphericalFeedbackActive");

  // initialize swich values
  SoSwitch *sw;
  sw = SO_GET_ANY_PART(this, "rotatorSwitch", SoSwitch);
  SoInteractionKit::setSwitchValue(sw, 0);
  sw = SO_GET_ANY_PART(this, "feedbackSwitch", SoSwitch);
  SoInteractionKit::setSwitchValue(sw, 0);

  // setup projector
  this->sphereProj = new SbSpherePlaneProjector();
  this->userProj = FALSE;
  this->addStartCallback(SoRotateSphericalDragger::startCB);
  this->addMotionCallback(SoRotateSphericalDragger::motionCB);
  this->addFinishCallback(SoRotateSphericalDragger::doneCB);

  this->addValueChangedCallback(SoRotateSphericalDragger::valueChangedCB);

  this->fieldSensor = new SoFieldSensor(SoRotateSphericalDragger::fieldSensorCB, this);
  this->fieldSensor->setPriority(0);

  this->setUpConnections(TRUE, TRUE);
}
Esempio n. 9
0
/*!
  \DRAGGER_CONSTRUCTOR

  \NODEKIT_PRE_DIAGRAM

  \verbatim
  CLASS SoScale2Dragger
  -->"this"
        "callbackList"
        "topSeparator"
           "motionMatrix"
           "geomSeparator"
  -->         "scalerSwitch"
  -->            "scaler"
  -->            "scalerActive"
  -->         "feedbackSwitch"
  -->            "feedback"
  -->            "feedbackActive"
  \endverbatim

  \NODEKIT_POST_DIAGRAM


  \NODEKIT_PRE_TABLE

  \verbatim
  CLASS SoScale2Dragger
  PVT   "this",  SoScale2Dragger  --- 
        "callbackList",  SoNodeKitListPart [ SoCallback, SoEventCallback ] 
  PVT   "topSeparator",  SoSeparator  --- 
  PVT   "motionMatrix",  SoMatrixTransform  --- 
  PVT   "geomSeparator",  SoSeparator  --- 
  PVT   "scalerSwitch",  SoSwitch  --- 
        "scaler",  SoSeparator  --- 
        "scalerActive",  SoSeparator  --- 
  PVT   "feedbackSwitch",  SoSwitch  --- 
        "feedback",  SoSeparator  --- 
        "feedbackActive",  SoSeparator  --- 
  \endverbatim

  \NODEKIT_POST_TABLE
*/
SoScale2Dragger::SoScale2Dragger(void)
{
  SO_KIT_INTERNAL_CONSTRUCTOR(SoScale2Dragger);

  SO_KIT_ADD_CATALOG_ENTRY(scalerSwitch, SoSwitch, TRUE, geomSeparator, feedbackSwitch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(scaler, SoSeparator, TRUE, scalerSwitch, scalerActive, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(scalerActive, SoSeparator, TRUE, scalerSwitch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(feedbackSwitch, SoSwitch, TRUE, geomSeparator, "", FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(feedback, SoSeparator, TRUE, feedbackSwitch, feedbackActive, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(feedbackActive, SoSeparator, TRUE, feedbackSwitch, "", TRUE);

  if (SO_KIT_IS_FIRST_INSTANCE()) {
    SoInteractionKit::readDefaultParts("scale2Dragger.iv",
                                       SCALE2DRAGGER_draggergeometry,
                                       static_cast<int>(strlen(SCALE2DRAGGER_draggergeometry)));
  }

  SO_KIT_ADD_FIELD(scaleFactor, (1.0f, 1.0f, 1.0f));
  SO_KIT_INIT_INSTANCE();

  // initialize default parts
  this->setPartAsDefault("scaler", "scale2Scaler");
  this->setPartAsDefault("scalerActive", "scale2ScalerActive");
  this->setPartAsDefault("feedback", "scale2Feedback");
  this->setPartAsDefault("feedbackActive", "scale2FeedbackActive");

  // initialize swich values
  SoSwitch *sw;
  sw = SO_GET_ANY_PART(this, "scalerSwitch", SoSwitch);
  SoInteractionKit::setSwitchValue(sw, 0);
  sw = SO_GET_ANY_PART(this, "feedbackSwitch", SoSwitch);
  SoInteractionKit::setSwitchValue(sw, 0);

  // setup projector
  this->planeProj = new SbPlaneProjector();
  this->addStartCallback(SoScale2Dragger::startCB);
  this->addMotionCallback(SoScale2Dragger::motionCB);
  this->addFinishCallback(SoScale2Dragger::finishCB);

  this->addValueChangedCallback(SoScale2Dragger::valueChangedCB);

  this->fieldSensor = new SoFieldSensor(SoScale2Dragger::fieldSensorCB, this);
  this->fieldSensor->setPriority(0);

  this->setUpConnections(TRUE, TRUE);
}
Esempio n. 10
0
/*!
  Constructor.
*/
SoSeparatorKit::SoSeparatorKit(void)
{
  PRIVATE(this) = new SoSeparatorKitP(this);
  SO_KIT_INTERNAL_CONSTRUCTOR(SoSeparatorKit);

  SO_KIT_ADD_FIELD(renderCaching, (SoSeparatorKit::AUTO));
  SO_KIT_ADD_FIELD(boundingBoxCaching, (SoSeparatorKit::AUTO));
  SO_KIT_ADD_FIELD(renderCulling, (SoSeparatorKit::AUTO));
  SO_KIT_ADD_FIELD(pickCulling, (SoSeparatorKit::AUTO));

  SO_KIT_DEFINE_ENUM_VALUE(CacheEnabled, ON);
  SO_KIT_DEFINE_ENUM_VALUE(CacheEnabled, OFF);
  SO_KIT_DEFINE_ENUM_VALUE(CacheEnabled, AUTO);

  SO_KIT_SET_SF_ENUM_TYPE(renderCaching, CacheEnabled);
  SO_KIT_SET_SF_ENUM_TYPE(boundingBoxCaching, CacheEnabled);
  SO_KIT_SET_SF_ENUM_TYPE(renderCulling, CacheEnabled);
  SO_KIT_SET_SF_ENUM_TYPE(pickCulling, CacheEnabled);

  // Note: we must use "" instead of , , to humour MS VisualC++ 6.

  SO_KIT_ADD_CATALOG_ENTRY(topSeparator, SoSeparator, TRUE, this, "", FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(pickStyle, SoPickStyle, TRUE, topSeparator, appearance, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(appearance, SoAppearanceKit, TRUE, topSeparator, units, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(units, SoUnits, TRUE, topSeparator, transform, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(transform, SoTransform, TRUE, topSeparator, texture2Transform, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(texture2Transform, SoTexture2Transform, TRUE, topSeparator, childList, TRUE);
  SO_KIT_ADD_CATALOG_LIST_ENTRY(childList, SoSeparator, TRUE, topSeparator, "", SoShapeKit, TRUE);
  SO_KIT_ADD_LIST_ITEM_TYPE(childList, SoSeparatorKit);

  PRIVATE(this)->connectedseparator = NULL;
  PRIVATE(this)->fieldsensor = new SoFieldSensor(SoSeparatorKitP::sensorCB, PRIVATE(this));
  PRIVATE(this)->fieldsensor->setPriority(0);

  SO_KIT_INIT_INSTANCE();

  this->setUpConnections(TRUE, TRUE);
}
Esempio n. 11
0
SmTrackPointKit::SmTrackPointKit(void)
{
  SO_KIT_CONSTRUCTOR(SmTrackPointKit);

  SO_KIT_ADD_CATALOG_ENTRY(topSeparator, SoSeparator, FALSE, this, "", FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(utmPosition, UTMPosition, FALSE, topSeparator, appearanceKit, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(appearanceKit, SoAppearanceKit, FALSE, topSeparator, track, FALSE); 
  SO_KIT_ADD_CATALOG_ENTRY(track, SmTrack, FALSE, topSeparator, "", FALSE);
  
  SO_KIT_ADD_FIELD(trackLength, (22.0f));
  SO_KIT_ADD_FIELD(pointInterval, (1));
  SO_KIT_ADD_FIELD(lineInterval, (0));
  SO_KIT_ADD_FIELD(tickInterval, (0));
  SO_KIT_ADD_FIELD(tickSize, (1.0f));
  SO_KIT_INIT_INSTANCE();
  
  getTrack()->trackLength.connectFrom(&this->trackLength);
  getTrack()->pointInterval.connectFrom(&this->pointInterval);
  getTrack()->lineInterval.connectFrom(&this->lineInterval);
  getTrack()->tickInterval.connectFrom(&this->tickInterval);
  getTrack()->tickSize.connectFrom(&this->tickSize);
  this->set("appearanceKit.drawStyle { pointSize 3 }");
}
Esempio n. 12
0
SoAppearanceKit::SoAppearanceKit()
//
////////////////////////////////////////////////////////////////////////
{
    SO_KIT_CONSTRUCTOR(SoAppearanceKit);

    isBuiltIn = TRUE;

    // Initialize children catalog and add entries to it
    // These are the macros you use to make a catalog.
    // Use combinations of ...ADD_CATALOG_ENTRY 
    // and ...ADD_CATALOG_LIST_ENTRY.  See SoSubKit.h for more info
    // on syntax of these macros.
    SO_KIT_ADD_CATALOG_ENTRY(lightModel,  SoLightModel, TRUE, this,\x0,TRUE );
    SO_KIT_ADD_CATALOG_ENTRY(environment, SoEnvironment,TRUE, this,\x0,TRUE );
    SO_KIT_ADD_CATALOG_ENTRY(drawStyle,   SoDrawStyle,  TRUE, this,\x0,TRUE );
    SO_KIT_ADD_CATALOG_ENTRY(material,    SoMaterial,   TRUE, this,\x0,TRUE );
    SO_KIT_ADD_CATALOG_ENTRY(complexity,  SoComplexity, TRUE, this,\x0,TRUE );
    SO_KIT_ADD_CATALOG_ENTRY(texture2,    SoTexture2,   TRUE, this,\x0,TRUE );

    SO_KIT_ADD_CATALOG_ENTRY(font,        SoFont,     TRUE, this,\x0,TRUE );

    SO_KIT_INIT_INSTANCE();
}
Esempio n. 13
0
/*!
  \DRAGGER_CONSTRUCTOR

  \NODEKIT_PRE_DIAGRAM

  \verbatim
  CLASS SoHandleBoxDragger
  -->"this"
        "callbackList"
        "topSeparator"
           "motionMatrix"
  -->      "surroundScale"
           "geomSeparator"
  -->         "drawStyle"
  -->         "translator1Switch"
  -->            "translator1"
  -->            "translator1Active"
  -->         "translator2Switch"
  -->            "translator2"
  -->            "translator2Active"
  -->         "translator3Switch"
  -->            "translator3"
  -->            "translator3Active"
  -->         "translator4Switch"
  -->            "translator4"
  -->            "translator4Active"
  -->         "translator5Switch"
  -->            "translator5"
  -->            "translator5Active"
  -->         "translator6Switch"
  -->            "translator6"
  -->            "translator6Active"
  -->         "extruder1Switch"
  -->            "extruder1"
  -->            "extruder1Active"
  -->         "extruder2Switch"
  -->            "extruder2"
  -->            "extruder2Active"
  -->         "extruder3Switch"
  -->            "extruder3"
  -->            "extruder3Active"
  -->         "extruder4Switch"
  -->            "extruder4"
  -->            "extruder4Active"
  -->         "extruder5Switch"
  -->            "extruder5"
  -->            "extruder5Active"
  -->         "extruder6Switch"
  -->            "extruder6"
  -->            "extruder6Active"
  -->         "uniform1Switch"
  -->            "uniform1"
  -->            "uniform1Active"
  -->         "uniform2Switch"
  -->            "uniform2"
  -->            "uniform2Active"
  -->         "uniform3Switch"
  -->            "uniform3"
  -->            "uniform3Active"
  -->         "uniform4Switch"
  -->            "uniform4"
  -->            "uniform4Active"
  -->         "uniform5Switch"
  -->            "uniform5"
  -->            "uniform5Active"
  -->         "uniform6Switch"
  -->            "uniform6"
  -->            "uniform6Active"
  -->         "uniform7Switch"
  -->            "uniform7"
  -->            "uniform7Active"
  -->         "uniform8Switch"
  -->            "uniform8"
  -->            "uniform8Active"
  -->         "arrowTranslation"
  -->         "arrow1Switch"
  -->            "arrow1"
  -->         "arrow2Switch"
  -->            "arrow2"
  -->         "arrow3Switch"
  -->            "arrow3"
  -->         "arrow4Switch"
  -->            "arrow4"
  -->         "arrow5Switch"
  -->            "arrow5"
  -->         "arrow6Switch"
  -->            "arrow6"
  \endverbatim

  \NODEKIT_POST_DIAGRAM


  \NODEKIT_PRE_TABLE

  \verbatim
  CLASS SoHandleBoxDragger
  PVT   "this",  SoHandleBoxDragger  ---
        "callbackList",  SoNodeKitListPart [ SoCallback, SoEventCallback ]
  PVT   "topSeparator",  SoSeparator  ---
  PVT   "motionMatrix",  SoMatrixTransform  ---
        "surroundScale",  SoSurroundScale  ---
  PVT   "geomSeparator",  SoSeparator  ---
  PVT   "drawStyle",  SoDrawStyle  ---
  PVT   "translator1Switch",  SoSwitch  ---
        "translator1",  SoSeparator  ---
        "translator1Active",  SoSeparator  ---
  PVT   "translator2Switch",  SoSwitch  ---
        "translator2",  SoSeparator  ---
        "translator2Active",  SoSeparator  ---
  PVT   "translator3Switch",  SoSwitch  ---
        "translator3",  SoSeparator  ---
        "translator3Active",  SoSeparator  ---
  PVT   "translator4Switch",  SoSwitch  ---
        "translator4",  SoSeparator  ---
        "translator4Active",  SoSeparator  ---
  PVT   "translator5Switch",  SoSwitch  ---
        "translator5",  SoSeparator  ---
        "translator5Active",  SoSeparator  ---
  PVT   "translator6Switch",  SoSwitch  ---
        "translator6",  SoSeparator  ---
        "translator6Active",  SoSeparator  ---
  PVT   "extruder1Switch",  SoSwitch  ---
        "extruder1",  SoSeparator  ---
        "extruder1Active",  SoSeparator  ---
  PVT   "extruder2Switch",  SoSwitch  ---
        "extruder2",  SoSeparator  ---
        "extruder2Active",  SoSeparator  ---
  PVT   "extruder3Switch",  SoSwitch  ---
        "extruder3",  SoSeparator  ---
        "extruder3Active",  SoSeparator  ---
  PVT   "extruder4Switch",  SoSwitch  ---
        "extruder4",  SoSeparator  ---
        "extruder4Active",  SoSeparator  ---
  PVT   "extruder5Switch",  SoSwitch  ---
        "extruder5",  SoSeparator  ---
        "extruder5Active",  SoSeparator  ---
  PVT   "extruder6Switch",  SoSwitch  ---
        "extruder6",  SoSeparator  ---
        "extruder6Active",  SoSeparator  ---
  PVT   "uniform1Switch",  SoSwitch  ---
        "uniform1",  SoSeparator  ---
        "uniform1Active",  SoSeparator  ---
  PVT   "uniform2Switch",  SoSwitch  ---
        "uniform2",  SoSeparator  ---
        "uniform2Active",  SoSeparator  ---
  PVT   "uniform3Switch",  SoSwitch  ---
        "uniform3",  SoSeparator  ---
        "uniform3Active",  SoSeparator  ---
  PVT   "uniform4Switch",  SoSwitch  ---
        "uniform4",  SoSeparator  ---
        "uniform4Active",  SoSeparator  ---
  PVT   "uniform5Switch",  SoSwitch  ---
        "uniform5",  SoSeparator  ---
        "uniform5Active",  SoSeparator  ---
  PVT   "uniform6Switch",  SoSwitch  ---
        "uniform6",  SoSeparator  ---
        "uniform6Active",  SoSeparator  ---
  PVT   "uniform7Switch",  SoSwitch  ---
        "uniform7",  SoSeparator  ---
        "uniform7Active",  SoSeparator  ---
  PVT   "uniform8Switch",  SoSwitch  ---
        "uniform8",  SoSeparator  ---
        "uniform8Active",  SoSeparator  ---
  PVT   "arrowTranslation",  SoTranslation  ---
  PVT   "arrow1Switch",  SoSwitch  ---
        "arrow1",  SoSeparator  ---
  PVT   "arrow2Switch",  SoSwitch  ---
        "arrow2",  SoSeparator  ---
  PVT   "arrow3Switch",  SoSwitch  ---
        "arrow3",  SoSeparator  ---
  PVT   "arrow4Switch",  SoSwitch  ---
        "arrow4",  SoSeparator  ---
  PVT   "arrow5Switch",  SoSwitch  ---
        "arrow5",  SoSeparator  ---
  PVT   "arrow6Switch",  SoSwitch  ---
        "arrow6",  SoSeparator  ---
  \endverbatim

  \NODEKIT_POST_TABLE
*/
SoHandleBoxDragger::SoHandleBoxDragger(void)
{
  SO_KIT_INTERNAL_CONSTRUCTOR(SoHandleBoxDragger);

  SO_KIT_ADD_CATALOG_ENTRY(surroundScale, SoSurroundScale, TRUE, topSeparator, geomSeparator, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(drawStyle, SoDrawStyle, TRUE, geomSeparator, translator1Switch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(translator1Switch, SoSwitch, TRUE, geomSeparator, translator2Switch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(translator1, SoSeparator, TRUE, translator1Switch, translator1Active, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(translator1Active, SoSeparator, TRUE, translator1Switch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(translator2Switch, SoSwitch, TRUE, geomSeparator, translator3Switch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(translator2, SoSeparator, TRUE, translator2Switch, translator2Active, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(translator2Active, SoSeparator, TRUE, translator2Switch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(translator3Switch, SoSwitch, TRUE, geomSeparator, translator4Switch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(translator3, SoSeparator, TRUE, translator3Switch, translator3Active, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(translator3Active, SoSeparator, TRUE, translator3Switch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(translator4Switch, SoSwitch, TRUE, geomSeparator, translator5Switch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(translator4, SoSeparator, TRUE, translator4Switch, translator4Active, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(translator4Active, SoSeparator, TRUE, translator4Switch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(translator5Switch, SoSwitch, TRUE, geomSeparator, translator6Switch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(translator5, SoSeparator, TRUE, translator5Switch, translator5Active, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(translator5Active, SoSeparator, TRUE, translator5Switch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(translator6Switch, SoSwitch, TRUE, geomSeparator, extruder1Switch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(translator6, SoSeparator, TRUE, translator6Switch, translator6Active, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(translator6Active, SoSeparator, TRUE, translator6Switch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(extruder1Switch, SoSwitch, TRUE, geomSeparator, extruder2Switch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(extruder1, SoSeparator, TRUE, extruder1Switch, extruder1Active, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(extruder1Active, SoSeparator, TRUE, extruder1Switch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(extruder2Switch, SoSwitch, TRUE, geomSeparator, extruder3Switch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(extruder2, SoSeparator, TRUE, extruder2Switch, extruder2Active, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(extruder2Active, SoSeparator, TRUE, extruder2Switch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(extruder3Switch, SoSwitch, TRUE, geomSeparator, extruder4Switch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(extruder3, SoSeparator, TRUE, extruder3Switch, extruder3Active, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(extruder3Active, SoSeparator, TRUE, extruder3Switch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(extruder4Switch, SoSwitch, TRUE, geomSeparator, extruder5Switch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(extruder4, SoSeparator, TRUE, extruder4Switch, extruder4Active, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(extruder4Active, SoSeparator, TRUE, extruder4Switch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(extruder5Switch, SoSwitch, TRUE, geomSeparator, extruder6Switch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(extruder5, SoSeparator, TRUE, extruder5Switch, extruder5Active, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(extruder5Active, SoSeparator, TRUE, extruder5Switch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(extruder6Switch, SoSwitch, TRUE, geomSeparator, uniform1Switch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(extruder6, SoSeparator, TRUE, extruder6Switch, extruder6Active, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(extruder6Active, SoSeparator, TRUE, extruder6Switch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(uniform1Switch, SoSwitch, TRUE, geomSeparator, uniform2Switch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(uniform1, SoSeparator, TRUE, uniform1Switch, uniform1Active, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(uniform1Active, SoSeparator, TRUE, uniform1Switch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(uniform2Switch, SoSwitch, TRUE, geomSeparator, uniform3Switch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(uniform2, SoSeparator, TRUE, uniform2Switch, uniform2Active, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(uniform2Active, SoSeparator, TRUE, uniform2Switch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(uniform3Switch, SoSwitch, TRUE, geomSeparator, uniform4Switch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(uniform3, SoSeparator, TRUE, uniform3Switch, uniform3Active, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(uniform3Active, SoSeparator, TRUE, uniform3Switch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(uniform4Switch, SoSwitch, TRUE, geomSeparator, uniform5Switch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(uniform4, SoSeparator, TRUE, uniform4Switch, uniform4Active, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(uniform4Active, SoSeparator, TRUE, uniform4Switch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(uniform5Switch, SoSwitch, TRUE, geomSeparator, uniform6Switch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(uniform5, SoSeparator, TRUE, uniform5Switch, uniform5Active, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(uniform5Active, SoSeparator, TRUE, uniform5Switch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(uniform6Switch, SoSwitch, TRUE, geomSeparator, uniform7Switch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(uniform6, SoSeparator, TRUE, uniform6Switch, uniform6Active, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(uniform6Active, SoSeparator, TRUE, uniform6Switch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(uniform7Switch, SoSwitch, TRUE, geomSeparator, uniform8Switch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(uniform7, SoSeparator, TRUE, uniform7Switch, uniform7Active, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(uniform7Active, SoSeparator, TRUE, uniform7Switch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(uniform8Switch, SoSwitch, TRUE, geomSeparator, arrowTranslation, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(uniform8, SoSeparator, TRUE, uniform8Switch, uniform8Active, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(uniform8Active, SoSeparator, TRUE, uniform8Switch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(arrowTranslation, SoTranslation, TRUE, geomSeparator, arrow1Switch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(arrow1Switch, SoSwitch, TRUE, geomSeparator, arrow2Switch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(arrow1, SoSeparator, TRUE, arrow1Switch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(arrow2Switch, SoSwitch, TRUE, geomSeparator, arrow3Switch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(arrow2, SoSeparator, TRUE, arrow2Switch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(arrow3Switch, SoSwitch, TRUE, geomSeparator, arrow4Switch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(arrow3, SoSeparator, TRUE, arrow3Switch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(arrow4Switch, SoSwitch, TRUE, geomSeparator, arrow5Switch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(arrow4, SoSeparator, TRUE, arrow4Switch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(arrow5Switch, SoSwitch, TRUE, geomSeparator, arrow6Switch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(arrow5, SoSeparator, TRUE, arrow5Switch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(arrow6Switch, SoSwitch, TRUE, geomSeparator, "", FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(arrow6, SoSeparator, TRUE, arrow6Switch, "", TRUE);

  if (SO_KIT_IS_FIRST_INSTANCE()) {
    SoInteractionKit::readDefaultParts("handleBoxDragger.iv",
                                       HANDLEBOXDRAGGER_draggergeometry,
                                       static_cast<int>(strlen(HANDLEBOXDRAGGER_draggergeometry)));
  }

  SO_KIT_ADD_FIELD(translation, (0.0f, 0.0f, 0.0f));
  SO_KIT_ADD_FIELD(scaleFactor, (1.0f, 1.0f, 1.0f));

  SO_KIT_INIT_INSTANCE();

  this->setPartAsDefault("translator1", "handleBoxTranslator1");
  this->setPartAsDefault("translator2", "handleBoxTranslator2");
  this->setPartAsDefault("translator3", "handleBoxTranslator3");
  this->setPartAsDefault("translator4", "handleBoxTranslator4");
  this->setPartAsDefault("translator5", "handleBoxTranslator5");
  this->setPartAsDefault("translator6", "handleBoxTranslator6");

  this->setPartAsDefault("translator1Active", "handleBoxTranslator1Active");
  this->setPartAsDefault("translator2Active", "handleBoxTranslator2Active");
  this->setPartAsDefault("translator3Active", "handleBoxTranslator3Active");
  this->setPartAsDefault("translator4Active", "handleBoxTranslator4Active");
  this->setPartAsDefault("translator5Active", "handleBoxTranslator5Active");
  this->setPartAsDefault("translator6Active", "handleBoxTranslator6Active");

  this->setPartAsDefault("extruder1", "handleBoxExtruder1");
  this->setPartAsDefault("extruder2", "handleBoxExtruder2");
  this->setPartAsDefault("extruder3", "handleBoxExtruder3");
  this->setPartAsDefault("extruder4", "handleBoxExtruder4");
  this->setPartAsDefault("extruder5", "handleBoxExtruder5");
  this->setPartAsDefault("extruder6", "handleBoxExtruder6");

  this->setPartAsDefault("extruder1Active", "handleBoxExtruder1Active");
  this->setPartAsDefault("extruder2Active", "handleBoxExtruder2Active");
  this->setPartAsDefault("extruder3Active", "handleBoxExtruder3Active");
  this->setPartAsDefault("extruder4Active", "handleBoxExtruder4Active");
  this->setPartAsDefault("extruder5Active", "handleBoxExtruder5Active");
  this->setPartAsDefault("extruder6Active", "handleBoxExtruder6Active");

  this->setPartAsDefault("uniform1", "handleBoxUniform1");
  this->setPartAsDefault("uniform2", "handleBoxUniform2");
  this->setPartAsDefault("uniform3", "handleBoxUniform3");
  this->setPartAsDefault("uniform4", "handleBoxUniform4");
  this->setPartAsDefault("uniform5", "handleBoxUniform5");
  this->setPartAsDefault("uniform6", "handleBoxUniform6");
  this->setPartAsDefault("uniform7", "handleBoxUniform7");
  this->setPartAsDefault("uniform8", "handleBoxUniform8");

  this->setPartAsDefault("uniform1Active", "handleBoxUniform1Active");
  this->setPartAsDefault("uniform2Active", "handleBoxUniform2Active");
  this->setPartAsDefault("uniform3Active", "handleBoxUniform3Active");
  this->setPartAsDefault("uniform4Active", "handleBoxUniform4Active");
  this->setPartAsDefault("uniform5Active", "handleBoxUniform5Active");
  this->setPartAsDefault("uniform6Active", "handleBoxUniform6Active");
  this->setPartAsDefault("uniform7Active", "handleBoxUniform7Active");
  this->setPartAsDefault("uniform8Active", "handleBoxUniform8Active");

  this->setPartAsDefault("arrow1", "handleBoxArrow1");
  this->setPartAsDefault("arrow2", "handleBoxArrow2");
  this->setPartAsDefault("arrow3", "handleBoxArrow3");
  this->setPartAsDefault("arrow4", "handleBoxArrow4");
  this->setPartAsDefault("arrow5", "handleBoxArrow5");
  this->setPartAsDefault("arrow6", "handleBoxArrow6");

  this->constraintState = CONSTRAINT_OFF;
  this->whatkind = WHATKIND_NONE;

  this->setAllPartsActive(FALSE);

  this->planeProj = new SbPlaneProjector;
  this->lineProj = new SbLineProjector;

  this->addStartCallback(SoHandleBoxDragger::startCB);
  this->addMotionCallback(SoHandleBoxDragger::motionCB);
  this->addFinishCallback(SoHandleBoxDragger::finishCB);
  this->addValueChangedCallback(SoHandleBoxDragger::valueChangedCB);
  this->addOtherEventCallback(SoHandleBoxDragger::metaKeyChangeCB);

  this->translFieldSensor = new SoFieldSensor(SoHandleBoxDragger::fieldSensorCB, this);
  this->translFieldSensor->setPriority(0);
  this->scaleFieldSensor = new SoFieldSensor(SoHandleBoxDragger::fieldSensorCB, this);
  this->scaleFieldSensor->setPriority(0);

  this->setUpConnections(TRUE, TRUE);
}
////////////////////////////////////////////////////////////////////////
//
// Description:
//    Constructor
//
SoTranslate2Dragger::SoTranslate2Dragger()
//
////////////////////////////////////////////////////////////////////////
{
    SO_KIT_CONSTRUCTOR(SoTranslate2Dragger);

    isBuiltIn = TRUE;

    // Put this stuff under the geomSeparator so it will draw more
    // efficiently.
    SO_KIT_ADD_CATALOG_ENTRY(translatorSwitch, SoSwitch, TRUE,
				geomSeparator,\x0,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(translator, SoSeparator, TRUE,
				translatorSwitch,\x0,TRUE);
    SO_KIT_ADD_CATALOG_ENTRY(translatorActive, SoSeparator, TRUE,
				translatorSwitch,\x0,TRUE);
    SO_KIT_ADD_CATALOG_ENTRY(feedbackSwitch, SoSwitch, TRUE,
				geomSeparator,\x0,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(feedback, SoSeparator, TRUE,
				feedbackSwitch,\x0,TRUE);
    SO_KIT_ADD_CATALOG_ENTRY(feedbackActive, SoSeparator, TRUE,
				feedbackSwitch,\x0,TRUE);
    SO_KIT_ADD_CATALOG_ENTRY(axisFeedbackSwitch, SoSwitch, TRUE,
				geomSeparator,\x0,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(xAxisFeedback, SoSeparator, TRUE,
				axisFeedbackSwitch,\x0,TRUE);
    SO_KIT_ADD_CATALOG_ENTRY(yAxisFeedback, SoSeparator, TRUE,
				axisFeedbackSwitch,\x0,TRUE);

    // read geometry for shared parts
    if (SO_KIT_IS_FIRST_INSTANCE())
	readDefaultParts("translate2Dragger.iv", geomBuffer, sizeof(geomBuffer) );

    SO_KIT_ADD_FIELD(translation, (0.0, 0.0, 0.0));

    SO_KIT_INIT_INSTANCE();

    // create the parts...
   setPartAsDefault("translator",      "translate2Translator");
   setPartAsDefault("translatorActive","translate2TranslatorActive");
   setPartAsDefault("feedback",        "translate2Feedback");
   setPartAsDefault("feedbackActive",  "translate2FeedbackActive");
   setPartAsDefault("xAxisFeedback",  "translate2XAxisFeedback");
   setPartAsDefault("yAxisFeedback",  "translate2YAxisFeedback");

    // Set the switches to 0...
    setSwitchValue( translatorSwitch.getValue(), 0 );
    setSwitchValue( feedbackSwitch.getValue(), 0 );

    // Set the axis feedback switch to SO_SWITCH_NONE
    // They're only displayed while dragging
    setSwitchValue( axisFeedbackSwitch.getValue(), SO_SWITCH_NONE );

    // Create the line projector
    planeProj = new SbPlaneProjector();

    // add the callbacks to perform the dragging
    addStartCallback(  &SoTranslate2Dragger::startCB );
    addMotionCallback( &SoTranslate2Dragger::motionCB );
    addFinishCallback(   &SoTranslate2Dragger::finishCB );

    // add callback to respond to the shift key, for constraining motion
    // to a line within the plane.
    addOtherEventCallback( &SoTranslate2Dragger::metaKeyChangeCB );

    // Updates the translation field when the motionMatrix is set.
    addValueChangedCallback( &SoTranslate2Dragger::valueChangedCB );

    // Updates the motionMatrix when the translation field is set.
    fieldSensor = new SoFieldSensor( &SoTranslate2Dragger::fieldSensorCB, this);
    fieldSensor->setPriority( 0 );

    setUpConnections( TRUE, TRUE );
}
Esempio n. 15
0
/*!
  \DRAGGER_CONSTRUCTOR

  \NODEKIT_PRE_DIAGRAM

  \verbatim
  CLASS SoCenterballDragger
  -->"this"
        "callbackList"
        "topSeparator"
           "motionMatrix"
  -->      "translateToCenter"
  -->      "surroundScale"
  -->      "antiSquish"
  -->      "lightModel"
           "geomSeparator"
  -->         "XAxisSwitch"
  -->            "XAxis"
  -->         "YAxisSwitch"
  -->            "YAxis"
  -->         "ZAxisSwitch"
  -->            "ZAxis"
  -->      "rotator"
  -->      "YRotator"
  -->      "ZCenterChanger"
  -->      "rotX90"
  -->      "ZRotator"
  -->      "YCenterChanger"
  -->      "rotY90"
  -->      "XCenterChanger"
  -->      "rot2X90"
  -->      "XRotator"
  \endverbatim

  \NODEKIT_POST_DIAGRAM


  \NODEKIT_PRE_TABLE

  \verbatim
  CLASS SoCenterballDragger
  PVT   "this",  SoCenterballDragger  ---
        "callbackList",  SoNodeKitListPart [ SoCallback, SoEventCallback ]
  PVT   "topSeparator",  SoSeparator  ---
  PVT   "motionMatrix",  SoMatrixTransform  ---
        "translateToCenter",  SoMatrixTransform  ---
        "surroundScale",  SoSurroundScale  ---
        "antiSquish",  SoAntiSquish  ---
        "lightModel",  SoLightModel  ---
  PVT   "geomSeparator",  SoSeparator  ---
        "rotator",  SoRotateSphericalDragger  ---
        "YRotator",  SoRotateCylindricalDragger  ---
        "ZCenterChanger",  SoTranslate2Dragger  ---
  PVT   "rotX90",  SoRotation  ---
        "ZRotator",  SoRotateCylindricalDragger  ---
        "YCenterChanger",  SoTranslate2Dragger  ---
  PVT   "rotY90",  SoRotation  ---
        "XCenterChanger",  SoTranslate2Dragger  ---
  PVT   "rot2X90",  SoRotation  ---
  PVT   "XAxisSwitch",  SoSwitch  ---
        "XAxis",  SoSeparator  ---
  PVT   "YAxisSwitch",  SoSwitch  ---
        "YAxis",  SoSeparator  ---
  PVT   "ZAxisSwitch",  SoSwitch  ---
        "ZAxis",  SoSeparator  ---
        "XRotator",  SoRotateCylindricalDragger  ---
  \endverbatim

  \NODEKIT_POST_TABLE
 */
SoCenterballDragger::SoCenterballDragger(void)
{
  SO_KIT_INTERNAL_CONSTRUCTOR(SoCenterballDragger);
  SO_KIT_ADD_CATALOG_ENTRY(XAxis, SoSeparator, TRUE, XAxisSwitch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(XAxisSwitch, SoSwitch, TRUE, geomSeparator, YAxisSwitch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(XCenterChanger, SoTranslate2Dragger, TRUE, topSeparator, rot2X90, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(XRotator, SoRotateCylindricalDragger, TRUE, topSeparator, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(YAxis, SoSeparator, TRUE, YAxisSwitch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(YAxisSwitch, SoSwitch, TRUE, geomSeparator, ZAxisSwitch, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(YCenterChanger, SoTranslate2Dragger, TRUE, topSeparator, rotY90, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(YRotator, SoRotateCylindricalDragger, TRUE, topSeparator, ZCenterChanger, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(ZAxis, SoSeparator, TRUE, ZAxisSwitch, "", TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(ZAxisSwitch, SoSwitch, TRUE, geomSeparator, "", FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(ZCenterChanger, SoTranslate2Dragger, TRUE, topSeparator, rotX90, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(ZRotator, SoRotateCylindricalDragger, TRUE, topSeparator, YCenterChanger, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(antiSquish, SoAntiSquish, FALSE, topSeparator, lightModel, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(lightModel, SoLightModel, TRUE, topSeparator, geomSeparator, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(rot2X90, SoRotation, TRUE, topSeparator, XRotator, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(rotX90, SoRotation, TRUE, topSeparator, ZRotator, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(rotY90, SoRotation, TRUE, topSeparator, XCenterChanger, FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(rotator, SoRotateSphericalDragger, TRUE, topSeparator, YRotator, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(surroundScale, SoSurroundScale, TRUE, topSeparator, antiSquish, TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(translateToCenter, SoMatrixTransform, TRUE, topSeparator, surroundScale, TRUE);

  if (SO_KIT_IS_FIRST_INSTANCE()) {
    SoInteractionKit::readDefaultParts("centerballDragger.iv",
                                       CENTERBALLDRAGGER_draggergeometry,
                                       static_cast<int>(strlen(CENTERBALLDRAGGER_draggergeometry)));
  }

  SO_KIT_ADD_FIELD(rotation, (SbRotation(SbVec3f(0.0f, 0.0f, 1.0f), 0.0f)));
  SO_KIT_ADD_FIELD(center, (0.0f, 0.0f, 0.0f));

  SO_KIT_INIT_INSTANCE();

  // create subdraggers
  SO_GET_ANY_PART(this, "XCenterChanger", SoTranslate2Dragger);
  SO_GET_ANY_PART(this, "YCenterChanger", SoTranslate2Dragger);
  SO_GET_ANY_PART(this, "ZCenterChanger", SoTranslate2Dragger);
  SO_GET_ANY_PART(this, "XRotator", SoRotateCylindricalDragger);
  SO_GET_ANY_PART(this, "YRotator", SoRotateCylindricalDragger);
  SO_GET_ANY_PART(this, "ZRotator", SoRotateCylindricalDragger);
  SO_GET_ANY_PART(this, "rotator", SoRotateSphericalDragger);

  // create default parts
  this->setPartAsDefault("XAxis", "centerballXAxis");
  this->setPartAsDefault("YAxis", "centerballYAxis");
  this->setPartAsDefault("ZAxis", "centerballZAxis");

  // initialize some nodes
  SoRotation *rot;
  rot = SO_GET_ANY_PART(this, "rot2X90", SoRotation);
  rot->rotation = SbRotation(SbVec3f(1.0f, 0.0f, 0.0f), (static_cast<float>(M_PI))*0.5f);
  rot = SO_GET_ANY_PART(this, "rotX90", SoRotation);
  rot->rotation = SbRotation(SbVec3f(1.0f, 0.0f, 0.0f), (static_cast<float>(M_PI))*0.5f);
  rot = SO_GET_ANY_PART(this, "rotY90", SoRotation);
  rot->rotation = SbRotation(SbVec3f(0.0f, 1.0f, 0.0f), (static_cast<float>(M_PI))*0.5f);

  // reset default flags for parts we set to a default value
  this->rot2X90.setDefault(TRUE);
  this->rotX90.setDefault(TRUE);
  this->rotY90.setDefault(TRUE);

  SoAntiSquish *squish = SO_GET_ANY_PART(this, "antiSquish", SoAntiSquish);
  squish->sizing = SoAntiSquish::LONGEST_DIAGONAL;
  squish->recalcAlways = FALSE;

  SoMatrixTransform *mt = SO_GET_ANY_PART(this, "translateToCenter", SoMatrixTransform);
  mt->matrix = SbMatrix::identity();

  this->addValueChangedCallback(SoCenterballDragger::valueChangedCB);

  this->rotFieldSensor = new SoFieldSensor(SoCenterballDragger::fieldSensorCB, this);
  this->centerFieldSensor = new SoFieldSensor(SoCenterballDragger::fieldSensorCB, this);
  this->setUpConnections(TRUE, TRUE);
}
Esempio n. 16
0
////////////////////////////////////////////////////////////////////////
//
// Description:
//    Constructor
//
SoDragPointDragger::SoDragPointDragger()
//
////////////////////////////////////////////////////////////////////////
{
    SO_KIT_CONSTRUCTOR(SoDragPointDragger);

    isBuiltIn = TRUE;

    SO_KIT_ADD_CATALOG_ENTRY(noRotSep, SoSeparator, FALSE,
				topSeparator, geomSeparator,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(xTranslatorSwitch, SoSwitch, FALSE, 
				noRotSep,\x0,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(xTranslator, SoTranslate1Dragger, TRUE, 
				xTranslatorSwitch,\x0,TRUE);
    SO_KIT_ADD_CATALOG_ENTRY(xyTranslatorSwitch, SoSwitch, FALSE, 
				noRotSep,\x0,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(xyTranslator, SoTranslate2Dragger, TRUE, 
				xyTranslatorSwitch,\x0,TRUE);

    SO_KIT_ADD_CATALOG_ENTRY(rotXSep, SoSeparator, FALSE,
				topSeparator, geomSeparator,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(rotX, SoRotation, TRUE, 
				rotXSep,\x0,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(xzTranslatorSwitch, SoSwitch, FALSE, 
				rotXSep,\x0,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(xzTranslator, SoTranslate2Dragger, TRUE, 
				xzTranslatorSwitch,\x0,TRUE);

    SO_KIT_ADD_CATALOG_ENTRY(rotYSep, SoSeparator, FALSE,
				topSeparator, geomSeparator,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(rotY, SoRotation, TRUE, 
				rotYSep,\x0,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(zTranslatorSwitch, SoSwitch, FALSE, 
				rotYSep,\x0,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(zTranslator, SoTranslate1Dragger, TRUE, 
				zTranslatorSwitch,\x0,TRUE);
    SO_KIT_ADD_CATALOG_ENTRY(yzTranslatorSwitch, SoSwitch, FALSE, 
				rotYSep,\x0,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(yzTranslator, SoTranslate2Dragger, TRUE, 
				yzTranslatorSwitch,\x0,TRUE);

    SO_KIT_ADD_CATALOG_ENTRY(rotZSep, SoSeparator, FALSE,
				topSeparator, geomSeparator,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(rotZ, SoRotation, TRUE, 
				rotZSep,\x0,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(yTranslatorSwitch, SoSwitch, FALSE, 
				rotZSep,\x0,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(yTranslator, SoTranslate1Dragger, TRUE, 
				yTranslatorSwitch,\x0,TRUE);

    SO_KIT_ADD_CATALOG_ENTRY(xFeedbackSwitch, SoSwitch, FALSE, 
				topSeparator, geomSeparator,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(xFeedbackSep, SoSeparator, FALSE,
				xFeedbackSwitch,\x0,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(xFeedbackTranslation, SoTranslation, FALSE,
				xFeedbackSep,\x0,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(xFeedback, SoSeparator, TRUE,
				xFeedbackSep,\x0,TRUE);

    SO_KIT_ADD_CATALOG_ENTRY(yFeedbackSwitch, SoSwitch, FALSE, 
				topSeparator, geomSeparator,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(yFeedbackSep, SoSeparator, FALSE,
				yFeedbackSwitch,\x0,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(yFeedbackTranslation, SoTranslation, FALSE,
				yFeedbackSep,\x0,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(yFeedback, SoSeparator, TRUE,
				yFeedbackSep,\x0,TRUE);

    SO_KIT_ADD_CATALOG_ENTRY(zFeedbackSwitch, SoSwitch, FALSE, 
				topSeparator, geomSeparator,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(zFeedbackSep, SoSeparator, FALSE,
				zFeedbackSwitch,\x0,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(zFeedbackTranslation, SoTranslation, FALSE,
				zFeedbackSep,\x0,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(zFeedback, SoSeparator, TRUE,
				zFeedbackSep,\x0,TRUE);

    SO_KIT_ADD_CATALOG_ENTRY(planeFeedbackSep, SoSeparator, FALSE,
				topSeparator, geomSeparator,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(planeFeedbackTranslation, SoTranslation, FALSE,
				planeFeedbackSep,\x0,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(planeFeedbackSwitch, SoSwitch, FALSE, 
				planeFeedbackSep,\x0,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(yzFeedback, SoSeparator, TRUE,
				planeFeedbackSwitch,\x0,TRUE);
    SO_KIT_ADD_CATALOG_ENTRY(xzFeedback, SoSeparator, TRUE,
				planeFeedbackSwitch,\x0,TRUE);
    SO_KIT_ADD_CATALOG_ENTRY(xyFeedback, SoSeparator, TRUE,
				planeFeedbackSwitch,\x0,TRUE);

    // read geometry for shared parts
    if (SO_KIT_IS_FIRST_INSTANCE())
	readDefaultParts("dragPointDragger.iv",geomBuffer,sizeof(geomBuffer) );

    // The field that reflects where the dragger has been translated to
    SO_KIT_ADD_FIELD(translation, (0.0, 0.0, 0.0));

    SO_KIT_INIT_INSTANCE();

    // Cached values to make updating the feedback geometry more efficient
    oldXAxisNode = NULL;
    oldYAxisNode = NULL;
    oldZAxisNode = NULL;

    //******************
    // Set up the parts.
    //******************

    // Set up the rotations to orient the draggers correctly.
    SoRotation *myRotX = new SoRotation;
    SoRotation *myRotY = new SoRotation;
    SoRotation *myRotZ = new SoRotation;
    myRotX->rotation = SbRotation( SbVec3f(1,0,0), 1.57079 );
    myRotY->rotation = SbRotation( SbVec3f(0,1,0), 1.57079 );
    myRotZ->rotation = SbRotation( SbVec3f(0,0,1), 1.57079 );
    setAnyPartAsDefault("rotX", myRotX );
    setAnyPartAsDefault("rotY", myRotY );
    setAnyPartAsDefault("rotZ", myRotZ );

    // CREATE THE CHILD DRAGGERS.
    // Create the translate1Draggers...
    SoTranslate1Dragger *myXTrans, *myYTrans, *myZTrans;
    myXTrans = SO_GET_ANY_PART(this,"xTranslator",SoTranslate1Dragger);
    myYTrans = SO_GET_ANY_PART(this,"yTranslator",SoTranslate1Dragger);
    myZTrans = SO_GET_ANY_PART(this,"zTranslator",SoTranslate1Dragger);

    // Create the translate2Draggers...
    SoTranslate2Dragger *myYZTrans, *myXZTrans, *myXYTrans;
    myYZTrans = SO_GET_ANY_PART(this,"yzTranslator",SoTranslate2Dragger);
    myXZTrans = SO_GET_ANY_PART(this,"xzTranslator",SoTranslate2Dragger);
    myXYTrans = SO_GET_ANY_PART(this,"xyTranslator",SoTranslate2Dragger);

    //******************
    // The feedback parts jump around as the limit box changes. That is, they
    // stay fixed in space while the dragger moves around.
    // However, they jump to a new location when the dragger nears the edge.
    // These parts a separate translation node, since they move differently
    // than the dragger itself.
    //******************

    //******************
    // The feedback parts jump around as the limit box changes. That is, they
    // stay fixed in space while the dragger moves around.
    // However, they jump to a new location when the dragger nears the edge.
    // These parts a separate translation node, since they move differently
    // than the dragger itself.
    //
    // Only one plane or one axis is shown at a time, depending on which
    // translator has initiated the dragging.
    //******************

   setPartAsDefault("xFeedback",      "dragPointXFeedback");
   setPartAsDefault("yFeedback",      "dragPointYFeedback");
   setPartAsDefault("zFeedback",      "dragPointZFeedback");

   setPartAsDefault("yzFeedback", "dragPointYZFeedback");
   setPartAsDefault("xzFeedback", "dragPointXZFeedback");
   setPartAsDefault("xyFeedback", "dragPointXYFeedback");

    //********************
    // initialize state, limitbox, gesture variables
    //********************

    // To begin with, only the yTranslator and xzTranslators are turned on.
    // You can switch between pairs of line/plane draggers by hitting the 
    // CONTROL key
    setSwitchValue(xTranslatorSwitch.getValue(),   SO_SWITCH_NONE );
    setSwitchValue(yTranslatorSwitch.getValue(),   0 );
    setSwitchValue(zTranslatorSwitch.getValue(),   SO_SWITCH_NONE );
    setSwitchValue(yzTranslatorSwitch.getValue(),   SO_SWITCH_NONE );
    setSwitchValue(xzTranslatorSwitch.getValue(),   0 );
    setSwitchValue(xyTranslatorSwitch.getValue(),  SO_SWITCH_NONE );

    // ??? Would be cool to be able to choose a free
    // axis, rotate it around to whatever direction, maybe even
    // have it snap to things in the scene, then constrain
    // dragging to that line.

    // Start off inactive
    currentDragger = NULL;

    // The state of the modifier keys
    shftDown = FALSE;

    // Need to initialize since checkBoxLimits will look at it...
    startLocalHitPt.setValue(0,0,0);

    // The jump axes will jump when the edit point gets within
    // 10% of their ends
    jumpLimit = .1;

    // makes the offsetWorkLimit box
    limitBox.makeEmpty();

    updateLimitBoxAndFeedback();

    // These will be called by the child draggers after they call
    // their own callbacks...
    addStartCallback( &SoDragPointDragger::startCB );
    addMotionCallback( &SoDragPointDragger::motionCB );
    addFinishCallback( &SoDragPointDragger::finishCB );

    // When modify keys are released, we need to turn off any constraints.
    addOtherEventCallback( &SoDragPointDragger::metaKeyChangeCB );

    // Updates the translation field when the motionMatrix is set.
    addValueChangedCallback( &SoDragPointDragger::valueChangedCB );

    // Updates the motionMatrix when the translation field is set.
    fieldSensor = new SoFieldSensor( &SoDragPointDragger::fieldSensorCB, this);
    fieldSensor->setPriority( 0 );

    setUpConnections( TRUE, TRUE );
}
////////////////////////////////////////////////////////////////////////
//
// Description:
//    Constructor
//
SoRotateDiscDragger::SoRotateDiscDragger()
//
////////////////////////////////////////////////////////////////////////
{
    SO_KIT_CONSTRUCTOR(SoRotateDiscDragger);

    isBuiltIn = TRUE;

    // Put this stuff under the geomSeparator so it will draw more
    // efficiently.
    SO_KIT_ADD_CATALOG_ENTRY(rotatorSwitch, SoSwitch, TRUE,
				geomSeparator,\x0,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(rotator, SoSeparator, TRUE,
				rotatorSwitch,\x0,TRUE);
    SO_KIT_ADD_CATALOG_ENTRY(rotatorActive, SoSeparator, TRUE,
				rotatorSwitch,\x0,TRUE);
    SO_KIT_ADD_CATALOG_ENTRY(feedbackSwitch, SoSwitch, TRUE,
				geomSeparator,\x0,FALSE);
    SO_KIT_ADD_CATALOG_ENTRY(feedback, SoSeparator, TRUE,
				feedbackSwitch,\x0,TRUE);
    SO_KIT_ADD_CATALOG_ENTRY(feedbackActive, SoSeparator, TRUE,
				feedbackSwitch,\x0,TRUE);

    // read geometry for shared parts
    if (SO_KIT_IS_FIRST_INSTANCE())
	readDefaultParts("rotateDiscDragger.iv", geomBuffer, sizeof(geomBuffer) );

    SO_KIT_ADD_FIELD(rotation, (0.0, 0.0, 0.0, 1.0));

    SO_KIT_INIT_INSTANCE();

    // create the parts...
   setPartAsDefault("rotator",       "rotateDiscRotator");
   setPartAsDefault("rotatorActive", 
			 "rotateDiscRotatorActive"); 
   setPartAsDefault("feedback",      "rotateDiscFeedback");
   setPartAsDefault("feedbackActive",
			 "rotateDiscFeedbackActive");

    // Set the switches to 0...
    setSwitchValue( rotatorSwitch.getValue(), 0 );
    setSwitchValue( feedbackSwitch.getValue(), 0 );

    // our humble projector
    planeProj = new SbPlaneProjector();

    // add the callbacks to perform the dragging
    addStartCallback(  &SoRotateDiscDragger::startCB );
    addMotionCallback( &SoRotateDiscDragger::motionCB );
    addFinishCallback( &SoRotateDiscDragger::doneCB );

    // Updates the scaleFactor field when the motionMatrix is set.
    addValueChangedCallback( &SoRotateDiscDragger::valueChangedCB );

    // Updates the motionMatrix when the scaleFactor field is set.
    fieldSensor 
	= new SoFieldSensor(&SoRotateDiscDragger::fieldSensorCB, this);
    fieldSensor->setPriority( 0 );

    setUpConnections( TRUE, TRUE );
}
Esempio n. 18
0
TranslateRadialDragger::
TranslateRadialDragger()
{
  SO_KIT_CONSTRUCTOR(TranslateRadialDragger);

  SO_KIT_ADD_CATALOG_ENTRY(validitySwitch, SoBlinker, TRUE,
                           geomSeparator, , FALSE);

  SO_KIT_ADD_CATALOG_ENTRY(materialSwitch, SoSwitch, TRUE,
                           validitySwitch, , FALSE);

  // Put this under geomSeparator so it draws efficiently.
  SO_KIT_ADD_CATALOG_ENTRY(translatorSwitch, SoSwitch, TRUE,
                           geomSeparator, , FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(translator, SoSeparator, TRUE,
                           translatorSwitch, , TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(translatorActive, SoSeparator, TRUE,
                           translatorSwitch, , TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(feedbackRotate, SoRotation, TRUE,
                           geomSeparator, , TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(feedbackSwitch, SoSwitch, TRUE,
                           geomSeparator, , FALSE);
  SO_KIT_ADD_CATALOG_ENTRY(feedback, SoSeparator, TRUE,
                           feedbackSwitch, , TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(feedbackActive, SoSeparator, TRUE,
                           feedbackSwitch, , TRUE);


  SO_KIT_ADD_CATALOG_ENTRY(materialPlaced, SoMaterial, TRUE,
                           materialSwitch, , TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(materialNormal, SoMaterial, TRUE,
                           materialSwitch, , TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(materialActive, SoMaterial, TRUE,
                           materialSwitch, , TRUE);
  SO_KIT_ADD_CATALOG_ENTRY(materialInvalid, SoMaterial, TRUE,
                           validitySwitch, , TRUE);

  // Read geometry resources. Only do this the first time we
  // construct one.  'geomBuffer' contains our compiled in
  // defaults. The user can override these by specifying new
  // scene graphs in the file:
  // $(SO_DRAGGER_DIR)/translateRadialDragger.iv
  if(SO_KIT_IS_FIRST_INSTANCE())
    readDefaultParts("translateRadialDragger.iv", geomBuffer,
                     sizeof(geomBuffer) - 1);

  // Field that always shows current position of the dragger.
  SO_KIT_ADD_FIELD(translation, (0.0, 0.0, 0.0));

  // Creates the parts list for this nodekit
  SO_KIT_INIT_INSTANCE();

  // Create the parts of the dragger. This dragger has five
  // parts that we need to create: "translator",
  // "translatorActive", "feedback," and "feedbackActive" will
  // be created using the resource mechanism. They are looked
  // up in the global dictionary.
  // "rotator," used to position the feedback so it points in
  // the direction selected by the user, will just be a plain
  // old SoRotation node.
  // We call 'setPartAsDefault' because we are installing
  // default geometries from the resource files. By calling
  // 'setPartAsDefault' instead of 'setPart', we insure that
  // these parts will not write to file unless they are
  // changed later.
  setPartAsDefault("translator",
                   "translateRadialTranslator");
  setPartAsDefault("translatorActive",
                   "translateRadialTranslatorActive");
  setPartAsDefault("feedback",
                   "translateRadialFeedback");
  setPartAsDefault("feedbackActive",
                   "translateRadialFeedbackActive");
  setPartAsDefault("materialNormal",
                   "translateNormalMaterial");
  setPartAsDefault("materialActive",
                   "translateActiveMaterial");
  setPartAsDefault("materialPlaced",
                   "translatePlacedMaterial");
  setPartAsDefault("materialInvalid",
                   "translateInvalidMaterial");

  // Set the switch parts to 0 to display the inactive parts.
  // The parts "translatorSwitch" and "feedbackSwitch"
  // are not public parts. (i.e., when making the catalog, the
  // isPublic flag was set FALSE, so users cannot access them)
  // To retrieve the parts we must use the SO_GET_ANY_PART
  // macro which calls the protected method getAnyPart().
  SoSwitch *sw;
  sw = SO_GET_ANY_PART(this, "translatorSwitch", SoSwitch);
  setSwitchValue(sw, 0);
  sw = SO_GET_ANY_PART(this, "feedbackSwitch", SoSwitch);
  setSwitchValue(sw, 0);
  sw = SO_GET_ANY_PART(this, "materialSwitch", SoSwitch);
  setSwitchValue(sw, 0);
  sw = SO_GET_ANY_PART(this, "validitySwitch", SoBlinker);
  setSwitchValue(sw, 0);

  // This dragger does motion along a line,
  // so we create a line projector.
  lineProj = new SbLineProjector();

  // Add the callback functions that will be called when
  // the user clicks, drags, and releases.
  addStartCallback(&TranslateRadialDragger::startCB);
  addMotionCallback(&TranslateRadialDragger::motionCB);
  addFinishCallback(&TranslateRadialDragger::finishCB);

  // Updates the translation field when the dragger moves.
  addValueChangedCallback(&TranslateRadialDragger::valueChangedCB);

  // Updates the motionMatrix (and thus moves the dragger
  // through space) to a new location whenever the translation
  // field is changed from the outside.
  fieldSensor = new SoFieldSensor(
      &TranslateRadialDragger::fieldSensorCB, this);
  fieldSensor->setPriority(0);
  setUpConnections(TRUE, TRUE);
}