26 #ifdef G4VIS_BUILD_OI_DRIVER
30 #include <HEPVis/actions/SoAlternateRepAction.h>
33 #include <Inventor/nodes/SoNode.h>
34 #include <Inventor/elements/SoSwitchElement.h>
35 #include <Inventor/elements/SoCoordinateElement.h>
37 SO_ACTION_SOURCE(SoAlternateRepAction)
39 void SoAlternateRepAction::initClass(
45 SO_ACTION_INIT_CLASS(SoAlternateRepAction,SoAction);
47 SO_ENABLE(SoAlternateRepAction,SoSwitchElement);
48 SO_ENABLE(SoAlternateRepAction,SoCoordinateElement);
50 SO_ACTION_ADD_METHOD(SoNode,nodeAction);
53 SoAlternateRepAction::SoAlternateRepAction(
59 SO_ACTION_CONSTRUCTOR(SoAlternateRepAction);
62 SoAlternateRepAction::~SoAlternateRepAction(
69 void SoAlternateRepAction::setGenerate(
75 fGenerate = aGenerate;
78 SbBool SoAlternateRepAction::getGenerate(
87 #include <Inventor/nodes/SoNode.h>
88 #include <Inventor/nodes/SoGroup.h>
89 #include <Inventor/nodes/SoCoordinate3.h>
95 #define IF_CLASS(aClass) \
96 if(aNode->isOfType(aClass::getClassTypeId())) {\
98 aClass* node = (aClass*)aNode;\
99 if(This->fGenerate==TRUE) {\
100 if(node->alternateRep.getValue()==NULL) {\
101 node->generateAlternateRep();\
103 SoNode* altRep = node->alternateRep.getValue();\
104 if((altRep!=NULL) && altRep->isOfType(SoGroup::getClassTypeId()))\
105 altRep->doAction(This);\
109 SoNode* altRep = node->alternateRep.getValue();\
110 if((altRep!=NULL) && altRep->isOfType(SoGroup::getClassTypeId()))\
111 altRep->doAction(This);\
113 node->clearAlternateRep();\
118 void SoAlternateRepAction::nodeAction(
136 else if(aNode->isOfType(SoGroup::getClassTypeId())) {
137 aNode->doAction(aThis);
139 else if(aNode->isOfType(SoCoordinate3::getClassTypeId())) {
140 aNode->doAction(aThis);
143 else if(aNode->getField(
"alternateRep")!=NULL) {
144 aNode->doAction(aThis);