Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // >> 26 #ifdef G4VIS_BUILD_OI_DRIVER >> 27 26 28 27 // this : 29 // this : 28 #include <HEPVis/actions/SoAlternateRepAction. 30 #include <HEPVis/actions/SoAlternateRepAction.h> 29 31 30 // Inventor : 32 // Inventor : 31 #include <Inventor/nodes/SoNode.h> 33 #include <Inventor/nodes/SoNode.h> 32 #include <Inventor/elements/SoSwitchElement.h> 34 #include <Inventor/elements/SoSwitchElement.h> 33 #include <Inventor/elements/SoCoordinateElemen 35 #include <Inventor/elements/SoCoordinateElement.h> 34 36 35 SO_ACTION_SOURCE(SoAlternateRepAction) 37 SO_ACTION_SOURCE(SoAlternateRepAction) 36 38 37 ////////////////////////////////////////////// 39 ////////////////////////////////////////////////////////////////////////////// 38 void SoAlternateRepAction::initClass( 40 void SoAlternateRepAction::initClass( 39 ) 41 ) 40 ////////////////////////////////////////////// 42 ////////////////////////////////////////////////////////////////////////////// 41 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 43 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// 42 { 44 { 43 static bool first = true; << 45 SO_ACTION_INIT_CLASS(SoAlternateRepAction,SoAction); 44 if (first) { << 45 first = false; << 46 SO_ACTION_INIT_CLASS(SoAlternateRepAction, << 47 46 48 SO_ENABLE(SoAlternateRepAction,SoSwitchEle << 47 SO_ENABLE(SoAlternateRepAction,SoSwitchElement); //SGI wants that. 49 SO_ENABLE(SoAlternateRepAction,SoCoordinat << 48 SO_ENABLE(SoAlternateRepAction,SoCoordinateElement); //For SoMarkerSet. 50 49 51 SO_ACTION_ADD_METHOD(SoNode,nodeAction); << 50 SO_ACTION_ADD_METHOD(SoNode,nodeAction); 52 } << 53 } 51 } 54 ////////////////////////////////////////////// 52 ////////////////////////////////////////////////////////////////////////////// 55 SoAlternateRepAction::SoAlternateRepAction( 53 SoAlternateRepAction::SoAlternateRepAction( 56 ) 54 ) 57 :fGenerate(FALSE) 55 :fGenerate(FALSE) 58 ////////////////////////////////////////////// 56 ////////////////////////////////////////////////////////////////////////////// 59 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 57 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// 60 { 58 { 61 SO_ACTION_CONSTRUCTOR(SoAlternateRepAction); 59 SO_ACTION_CONSTRUCTOR(SoAlternateRepAction); 62 } 60 } 63 ////////////////////////////////////////////// 61 ////////////////////////////////////////////////////////////////////////////// 64 SoAlternateRepAction::~SoAlternateRepAction( 62 SoAlternateRepAction::~SoAlternateRepAction( 65 ) 63 ) 66 ////////////////////////////////////////////// 64 ////////////////////////////////////////////////////////////////////////////// 67 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 65 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// 68 { 66 { 69 } 67 } 70 ////////////////////////////////////////////// 68 ////////////////////////////////////////////////////////////////////////////// 71 void SoAlternateRepAction::setGenerate( 69 void SoAlternateRepAction::setGenerate( 72 SbBool aGenerate 70 SbBool aGenerate 73 ) 71 ) 74 ////////////////////////////////////////////// 72 ////////////////////////////////////////////////////////////////////////////// 75 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 73 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// 76 { 74 { 77 fGenerate = aGenerate; 75 fGenerate = aGenerate; 78 } 76 } 79 ////////////////////////////////////////////// 77 ////////////////////////////////////////////////////////////////////////////// 80 SbBool SoAlternateRepAction::getGenerate( 78 SbBool SoAlternateRepAction::getGenerate( 81 ) const 79 ) const 82 ////////////////////////////////////////////// 80 ////////////////////////////////////////////////////////////////////////////// 83 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 81 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// 84 { 82 { 85 return fGenerate; 83 return fGenerate; 86 } 84 } 87 85 88 // Inventor : 86 // Inventor : 89 #include <Inventor/nodes/SoNode.h> 87 #include <Inventor/nodes/SoNode.h> 90 #include <Inventor/nodes/SoGroup.h> 88 #include <Inventor/nodes/SoGroup.h> 91 #include <Inventor/nodes/SoCoordinate3.h> 89 #include <Inventor/nodes/SoCoordinate3.h> 92 90 93 // HEPVisUtils : 91 // HEPVisUtils : 94 //#include <HEPVis/nodes/SoHighlightMaterial.h 92 //#include <HEPVis/nodes/SoHighlightMaterial.h> 95 //#include <HEPVis/nodes/SoSplineCurve.h> 93 //#include <HEPVis/nodes/SoSplineCurve.h> 96 94 97 #define IF_CLASS(aClass) \ 95 #define IF_CLASS(aClass) \ 98 if(aNode->isOfType(aClass::getClassTypeId()) 96 if(aNode->isOfType(aClass::getClassTypeId())) {\ 99 /*printf("debug : SoAlternateRepAction::no 97 /*printf("debug : SoAlternateRepAction::nodeAction : %s generate %d\n",#aClass,This->fGenerate);*/\ 100 aClass* node = (aClass*)aNode;\ 98 aClass* node = (aClass*)aNode;\ 101 if(This->fGenerate==TRUE) {\ 99 if(This->fGenerate==TRUE) {\ 102 if(node->alternateRep.getValue()==NULL) 100 if(node->alternateRep.getValue()==NULL) {\ 103 node->generateAlternateRep();\ 101 node->generateAlternateRep();\ 104 /* Then go down if needed : */\ 102 /* Then go down if needed : */\ 105 SoNode* altRep = node->alternateRep.ge 103 SoNode* altRep = node->alternateRep.getValue();\ 106 if((altRep!=NULL) && altRep->isOfType( 104 if((altRep!=NULL) && altRep->isOfType(SoGroup::getClassTypeId()))\ 107 altRep->doAction(This);\ 105 altRep->doAction(This);\ 108 }\ 106 }\ 109 } else {\ 107 } else {\ 110 /* First go down if needed : */\ 108 /* First go down if needed : */\ 111 SoNode* altRep = node->alternateRep.getV 109 SoNode* altRep = node->alternateRep.getValue();\ 112 if((altRep!=NULL) && altRep->isOfType(So 110 if((altRep!=NULL) && altRep->isOfType(SoGroup::getClassTypeId()))\ 113 altRep->doAction(This);\ 111 altRep->doAction(This);\ 114 /* Then clear : */\ 112 /* Then clear : */\ 115 node->clearAlternateRep();\ 113 node->clearAlternateRep();\ 116 }\ 114 }\ 117 } 115 } 118 116 119 ////////////////////////////////////////////// 117 ////////////////////////////////////////////////////////////////////////////// 120 void SoAlternateRepAction::nodeAction( 118 void SoAlternateRepAction::nodeAction( 121 SoAction* aThis 119 SoAction* aThis 122 ,SoNode* aNode 120 ,SoNode* aNode 123 ) 121 ) 124 ////////////////////////////////////////////// 122 ////////////////////////////////////////////////////////////////////////////// 125 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 123 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// 126 { 124 { 127 /*printf("debug : SoAlternateRepAction::node 125 /*printf("debug : SoAlternateRepAction::nodeAction : %s %s\n", 128 aNode->getName().getString(), 126 aNode->getName().getString(), 129 aNode->getTypeId().getName().getString()); 127 aNode->getTypeId().getName().getString());*/ 130 //SoAlternateRepAction* This = (SoAlternateR 128 //SoAlternateRepAction* This = (SoAlternateRepAction*)aThis; 131 129 132 if(false) {} 130 if(false) {} 133 // HEPVisUtils : 131 // HEPVisUtils : 134 //else IF_CLASS(SoHighlightMaterial) 132 //else IF_CLASS(SoHighlightMaterial) 135 //else IF_CLASS(SoSplineCurve) 133 //else IF_CLASS(SoSplineCurve) 136 134 137 // Inventor : 135 // Inventor : 138 else if(aNode->isOfType(SoGroup::getClassTyp 136 else if(aNode->isOfType(SoGroup::getClassTypeId())) { 139 aNode->doAction(aThis); 137 aNode->doAction(aThis); 140 } 138 } 141 else if(aNode->isOfType(SoCoordinate3::getCl 139 else if(aNode->isOfType(SoCoordinate3::getClassTypeId())) { //For SoMakerSet. 142 aNode->doAction(aThis); 140 aNode->doAction(aThis); 143 } 141 } 144 // Else : 142 // Else : 145 else if(aNode->getField("alternateRep")!=NUL 143 else if(aNode->getField("alternateRep")!=NULL) { 146 aNode->doAction(aThis); 144 aNode->doAction(aThis); 147 } 145 } 148 146 149 } 147 } >> 148 >> 149 #endif 150 150