CMS 3D CMS Logo

IgSoSlicer Class Reference

#include <Iguana/Inventor/interface/IgSoSlicer.h>

List of all members.

Public Member Functions

 IgSoSlicer (void)
virtual void write (SoWriteAction *action)

Static Public Member Functions

static void initClass (void)

Public Attributes

SoSFBool manip
SoSFBool on
SoSFPlane plane
SoSFFloat thickness

Protected Member Functions

 ~IgSoSlicer (void)

Private Member Functions

 SO_NODE_HEADER (IgSoSlicer)

Static Private Member Functions

static void mplaneSensorCB (void *me, SoSensor *data)
 This callback is called whenever the `m_plane' field changes value.
static void planeSensorCB (void *me, SoSensor *data)
 This callback is called whenever the `plane' field changes value.

Private Attributes

IgSoClipPlanem_back
IgSoSlicerEnginem_engine
IgSoClipPlanem_front
IgSoPlaneManipm_manipPlane
SoFieldSensor * m_mplaneSensor
SoFieldSensor * m_planeSensor


Detailed Description

Definition at line 30 of file IgSoSlicer.h.


Constructor & Destructor Documentation

IgSoSlicer::IgSoSlicer ( void   ) 

Definition at line 28 of file IgSoSlicer.cc.

References IgSoSlicerEngine::backPlane, f, FALSE, IgSoSlicerEngine::frontPlane, m_back, m_engine, m_front, m_manipPlane, m_mplaneSensor, m_planeSensor, manip, IgSoPlaneManip::manip, mplaneSensorCB(), on, IgSoClipPlane::on, IgSoPlaneManip::plane, IgSoSlicerEngine::plane, IgSoClipPlane::plane, plane, planeSensorCB(), thickness, IgSoSlicerEngine::thickness, and TRUE.

00029     : m_front        (new IgSoClipPlane),
00030       m_back         (new IgSoClipPlane),
00031       m_manipPlane   (new IgSoPlaneManip),
00032       m_engine       (new IgSoSlicerEngine),
00033       m_planeSensor  (0),
00034       m_mplaneSensor (0)
00035 {
00036     // Construct two clip planes, front, back and a Plane manipulator
00037 
00038     SO_NODE_CONSTRUCTOR (IgSoSlicer);
00039     SO_NODE_ADD_FIELD (on, (TRUE));
00040     SO_NODE_ADD_FIELD (manip, (FALSE));
00041     SO_NODE_ADD_FIELD (thickness, (.5f));
00042     SO_NODE_ADD_FIELD (plane, (SbPlane (SbVec3f (0, 0, -1), 0)));
00043 
00044     //add clip planes
00045     m_manipPlane->ref ();
00046     m_front->ref ();
00047     m_back->ref ();
00048     addChild (m_manipPlane);
00049     addChild (m_front);
00050     addChild (m_back);
00051 
00052     //set the manipplane same as the plane
00053     m_manipPlane->plane = plane;
00054     
00055     //connect "on" field to the front and back clip plane's 
00056     m_front->on.connectFrom (&on);
00057     m_back->on.connectFrom (&on);
00058     
00059     //connect engine's outputs to the front and back 
00060     //clip plane's "plane" feild
00061     m_front->plane.connectFrom (&m_engine->frontPlane);
00062     m_back->plane.connectFrom (&m_engine->backPlane);
00063 
00064     //connect the engine's inputs
00065     m_engine->thickness.connectFrom (&thickness);
00066     m_engine->plane.connectFrom (&plane);
00067     m_engine->ref();
00068 
00069     m_manipPlane->manip.connectFrom (&manip);
00070         
00071     m_planeSensor = new SoFieldSensor (&planeSensorCB, this);
00072     m_planeSensor->attach (&plane);
00073     
00074     m_mplaneSensor = new SoFieldSensor (&mplaneSensorCB, this);
00075     m_mplaneSensor->attach (&m_manipPlane->plane);
00076 }

IgSoSlicer::~IgSoSlicer ( void   )  [protected]

Definition at line 78 of file IgSoSlicer.cc.

References m_back, m_engine, m_front, m_manipPlane, m_mplaneSensor, and m_planeSensor.

00079 {
00080     removeChild (m_manipPlane);
00081     removeChild (m_front);
00082     removeChild (m_back);
00083     m_manipPlane->unref ();
00084     m_front->unref ();
00085     m_back->unref ();
00086     m_engine->unref();
00087     delete m_planeSensor;
00088     delete m_mplaneSensor;
00089 }


Member Function Documentation

void IgSoSlicer::initClass ( void   )  [static]

Definition at line 23 of file IgSoSlicer.cc.

Referenced by initNodes(), and initShapes().

00024 {
00025     SO_NODE_INIT_CLASS (IgSoSlicer, SoNode, "Node");
00026 }

void IgSoSlicer::mplaneSensorCB ( void me,
SoSensor *  data 
) [static, private]

This callback is called whenever the `m_plane' field changes value.

Definition at line 94 of file IgSoSlicer.cc.

Referenced by IgSoSlicer().

00095 {
00096     IgSoSlicer *self = static_cast<IgSoSlicer *> (me);
00097     self->m_planeSensor->detach ();
00098     self->plane = self->m_manipPlane->plane;
00099     self->m_planeSensor->attach (&self->plane);
00100 }

void IgSoSlicer::planeSensorCB ( void me,
SoSensor *  data 
) [static, private]

This callback is called whenever the `plane' field changes value.

Definition at line 105 of file IgSoSlicer.cc.

Referenced by IgSoSlicer().

00106 {
00107     IgSoSlicer *self = static_cast<IgSoSlicer *> (me);
00108     self->m_mplaneSensor->detach ();
00109     self->m_manipPlane->plane = self->plane;
00110     self->m_mplaneSensor->attach (&self->m_manipPlane->plane);
00111 }

IgSoSlicer::SO_NODE_HEADER ( IgSoSlicer   )  [private]

void IgSoSlicer::write ( SoWriteAction *  action  )  [virtual]

Definition at line 114 of file IgSoSlicer.cc.

00115 { SoNode::write (action); }


Member Data Documentation

IgSoClipPlane* IgSoSlicer::m_back [private]

Definition at line 52 of file IgSoSlicer.h.

Referenced by IgSoSlicer(), and ~IgSoSlicer().

IgSoSlicerEngine* IgSoSlicer::m_engine [private]

Definition at line 54 of file IgSoSlicer.h.

Referenced by IgSoSlicer(), and ~IgSoSlicer().

IgSoClipPlane* IgSoSlicer::m_front [private]

Definition at line 51 of file IgSoSlicer.h.

Referenced by IgSoSlicer(), and ~IgSoSlicer().

IgSoPlaneManip* IgSoSlicer::m_manipPlane [private]

Definition at line 53 of file IgSoSlicer.h.

Referenced by IgSoSlicer(), and ~IgSoSlicer().

SoFieldSensor* IgSoSlicer::m_mplaneSensor [private]

Definition at line 56 of file IgSoSlicer.h.

Referenced by IgSoSlicer(), and ~IgSoSlicer().

SoFieldSensor* IgSoSlicer::m_planeSensor [private]

Definition at line 55 of file IgSoSlicer.h.

Referenced by IgSoSlicer(), and ~IgSoSlicer().

SoSFBool IgSoSlicer::manip

Definition at line 35 of file IgSoSlicer.h.

Referenced by Ig3DSlicersCategory::attach(), IgSoSlicer(), and Ig3DSlicersCategory::makeSlicer().

SoSFBool IgSoSlicer::on

Definition at line 34 of file IgSoSlicer.h.

Referenced by Ig3DSlicersCategory::attach(), IgSoSlicer(), and Ig3DSlicersCategory::makeSlicer().

SoSFPlane IgSoSlicer::plane

Definition at line 37 of file IgSoSlicer.h.

Referenced by Ig3DSlicersCategory::attach(), IgSoSlicer(), and Ig3DSlicersCategory::makeSlicer().

SoSFFloat IgSoSlicer::thickness

Definition at line 36 of file IgSoSlicer.h.

Referenced by Ig3DSlicersCategory::attach(), and IgSoSlicer().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:25:44 2009 for CMSSW by  doxygen 1.5.4