26#ifdef G4VIS_BUILD_OI_DRIVER
38#include <Inventor/nodes/SoNode.h>
39#include <Inventor/nodes/SoGroup.h>
40#include <Inventor/nodes/SoSwitch.h>
41#include <Inventor/nodekits/SoBaseKit.h>
42#include <Inventor/elements/SoSwitchElement.h>
47 static bool first =
true;
54 SO_ACTION_ADD_METHOD(SoNode,SoCounterAction::actionMethod);
58:fCount(0),fLookFor(NODE),fType(),fCheckDerived(
TRUE) {
64 SoAction::beginTraversal(node);
66void SoCounterAction::actionMethod(SoAction* aThis,SoNode* aNode) {
70 if(This->fLookFor==NODE) {
72 }
else if(This->fLookFor==
TYPE) {
73 if(This->fCheckDerived==
TRUE) {
74 if(aNode->getTypeId().isDerivedFrom(This->fType)) This->fCount++;
76 if(aNode->getTypeId()==This->fType) This->fCount++;
78 }
else if(This->fLookFor==
NAME) {
79 if(This->fName==aNode->getName()) This->fCount++;
81 if(aNode->isOfType(SoSwitch::getClassTypeId())) {
82 SoSwitch* sw = (SoSwitch*)aNode;
83 SbBool flag = sw->whichChild.enableNotify(
FALSE);
84 int old = sw->whichChild.getValue();
85 sw->whichChild.setValue(SO_SWITCH_ALL);
86 aNode->doAction(aThis);
87 sw->whichChild.setValue(old);
88 sw->whichChild.enableNotify(flag);
89 }
else if(aNode->isOfType(SoGroup::getClassTypeId())) {
90 aNode->doAction(aThis);
91 }
else if(aNode->isOfType(SoBaseKit::getClassTypeId())) {
92 aNode->doAction(aThis);
100 fCheckDerived = aCheckDerived;
virtual ~SoCounterAction()
virtual void beginTraversal(SoNode *)
static void initClass(void)
void setType(const SoType, SbBool=TRUE)