Geant4-11
Public Member Functions | Static Public Member Functions | Data Fields | Protected Member Functions | Private Member Functions | Static Private Member Functions
SoDetectorTreeKit Class Reference

#include <SoDetectorTreeKit.h>

Inheritance diagram for SoDetectorTreeKit:

Public Member Functions

virtual SbBool affectsState () const
 
virtual void clearAlternateRep ()
 
virtual void generateAlternateRep ()
 
virtual SoSeparator * getFullSeparator () const
 
virtual SbBool getPreview () const
 
virtual SoSeparator * getPreviewSeparator () const
 
virtual void setPreview (SbBool Flag)
 
void setPreviewAndFull ()
 
 SoDetectorTreeKit ()
 

Static Public Member Functions

static void initClass ()
 

Data Fields

SoSFNode alternateRep
 

Protected Member Functions

virtual void doAction (SoAction *)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// More...
 
virtual ~SoDetectorTreeKit ()
 

Private Member Functions

void createInitialTree ()
 
 SO_KIT_CATALOG_ENTRY_HEADER (appearance)
 
 SO_KIT_CATALOG_ENTRY_HEADER (callbackList)
 
 SO_KIT_CATALOG_ENTRY_HEADER (childList)
 
 SO_KIT_CATALOG_ENTRY_HEADER (fullSeparator)
 
 SO_KIT_CATALOG_ENTRY_HEADER (pickStyle)
 
 SO_KIT_CATALOG_ENTRY_HEADER (previewSeparator)
 
 SO_KIT_CATALOG_ENTRY_HEADER (texture2Transform)
 
 SO_KIT_CATALOG_ENTRY_HEADER (topSeparator)
 
 SO_KIT_CATALOG_ENTRY_HEADER (transform)
 
 SO_KIT_CATALOG_ENTRY_HEADER (units)
 
 SO_KIT_HEADER (SoDetectorTreeKit)
 

Static Private Member Functions

static void contract (void *userData, SoEventCallback *eventCB)
 
static void expand (void *userData, SoEventCallback *eventCB)
 

Detailed Description

Definition at line 47 of file SoDetectorTreeKit.h.

Constructor & Destructor Documentation

◆ SoDetectorTreeKit()

SoDetectorTreeKit::SoDetectorTreeKit ( )

Definition at line 75 of file SoDetectorTreeKit.cc.

75 {
76 SO_KIT_CONSTRUCTOR(SoDetectorTreeKit);
77
78 SO_NODE_ADD_FIELD(alternateRep, (NULL));
79
80 SO_KIT_ADD_CATALOG_ENTRY ( topSeparator, SoSeparator, FALSE, this,\0, FALSE);
81 SO_KIT_ADD_CATALOG_ENTRY ( pickStyle, SoSeparator, TRUE , topSeparator,\0, TRUE);
82 SO_KIT_ADD_CATALOG_ENTRY ( appearance, SoAppearanceKit, TRUE, topSeparator ,\0, TRUE);
83 SO_KIT_ADD_CATALOG_ENTRY ( units, SoUnits, TRUE, topSeparator ,\0, TRUE);
84 SO_KIT_ADD_CATALOG_ENTRY ( transform, SoTransform, TRUE , topSeparator,\0, TRUE);
85 SO_KIT_ADD_CATALOG_ENTRY (texture2Transform, SoTexture2Transform, TRUE, topSeparator ,\0, TRUE);
86 SO_KIT_ADD_CATALOG_ENTRY ( childList, SoSwitch, FALSE, topSeparator,\0, FALSE);
87 SO_KIT_ADD_CATALOG_ENTRY ( previewSeparator, SoSeparator, FALSE, childList,\0, TRUE);
88 SO_KIT_ADD_CATALOG_ENTRY ( fullSeparator, SoSeparator, FALSE, childList,\0, TRUE);
89
90 SO_KIT_INIT_INSTANCE();
92}
#define TRUE
Definition: Globals.hh:27
#define FALSE
Definition: Globals.hh:23
G4bool transform(G4String &input, const G4String &type)

References alternateRep, createInitialTree(), FALSE, G4coutFormatters::anonymous_namespace{G4coutFormatters.cc}::transform(), and TRUE.

◆ ~SoDetectorTreeKit()

SoDetectorTreeKit::~SoDetectorTreeKit ( )
protectedvirtual

Definition at line 95 of file SoDetectorTreeKit.cc.

95 {
96}

Member Function Documentation

◆ affectsState()

SbBool SoDetectorTreeKit::affectsState ( ) const
virtual

Definition at line 99 of file SoDetectorTreeKit.cc.

99 {
100 return FALSE;
101}

References FALSE.

◆ clearAlternateRep()

void SoDetectorTreeKit::clearAlternateRep ( )
virtual

Definition at line 229 of file SoDetectorTreeKit.cc.

229 {
230 alternateRep.setValue(NULL);
231}

References alternateRep.

◆ contract()

void SoDetectorTreeKit::contract ( void *  userData,
SoEventCallback *  eventCB 
)
staticprivate

Definition at line 152 of file SoDetectorTreeKit.cc.

152 {
153
154 // Was the event previously handled? Is it the right kind?
155 if (eventCB->isHandled()) return;
156 const SoMouseButtonEvent *event= (SoMouseButtonEvent *) eventCB->getEvent();
157 if (!SoMouseButtonEvent::isButtonPressEvent(event,SoMouseButtonEvent::BUTTON1)) return;
158 if (event->wasCtrlDown()) return;
159 if (!event->wasShiftDown()) return;
160
161 // Which Detector is this being called for?
163
164 // Find out whether that's the one that has been picked
165 SoHandleEventAction *handleEventAction = eventCB->getAction();
166 const SoPickedPoint *pickedPoint = handleEventAction->getPickedPoint();
167 if (!pickedPoint) return;
168
169 // Find out whether that's the one that has been picked.
170 // "This" is the lowest detector tree kit in the hierarchy.
171 SoFullPath* path = (SoFullPath*)pickedPoint->getPath();
172 SoNode *ancestorNode=NULL;
173 SbBool firstTreeFound=FALSE;
174 for (int i=0;i<path->getLength();i++) {
175 ancestorNode = path->getNodeFromTail(i);
176 if (ancestorNode->isOfType(SoDetectorTreeKit::getClassTypeId())) {
177 if (!firstTreeFound) {
178 if (This!=ancestorNode) return;
179 firstTreeFound=TRUE;
180 }
181 SoDetectorTreeKit *That = (SoDetectorTreeKit *) ancestorNode;
182 if (!That->getPreview()) {
183 That->setPreview(TRUE);
184 eventCB->setHandled();
185 return;
186 }
187 }
188 }
189}
virtual void setPreview(SbBool Flag)
virtual SbBool getPreview() const
#define userData
Definition: xmlparse.cc:572

References FALSE, getPreview(), setPreview(), TRUE, and userData.

Referenced by createInitialTree().

◆ createInitialTree()

void SoDetectorTreeKit::createInitialTree ( )
private

Definition at line 103 of file SoDetectorTreeKit.cc.

103 {
104
105 SoEventCallback *myCallback = new SoEventCallback();
106 myCallback->addEventCallback(SoMouseButtonEvent::getClassTypeId(),
108 this);
109 myCallback->addEventCallback(SoMouseButtonEvent::getClassTypeId(),
111 this);
112 if(setPart("callbackList[0]",myCallback)==FALSE) myCallback->unref();
113
114 SoSwitch *theChildList = (SoSwitch *) childList.getValue();
115 theChildList->whichChild.setValue(0);
116}
static void expand(void *userData, SoEventCallback *eventCB)
static void contract(void *userData, SoEventCallback *eventCB)

References contract(), expand(), and FALSE.

Referenced by SoDetectorTreeKit().

◆ doAction()

void SoDetectorTreeKit::doAction ( SoAction *  aAction)
protectedvirtual

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 233 of file SoDetectorTreeKit.cc.

238{
240 SoBaseKit::doAction(aAction);
241}
#define SO_ALTERNATEREP_DO_ACTION(aAction)

References SO_ALTERNATEREP_DO_ACTION.

◆ expand()

void SoDetectorTreeKit::expand ( void *  userData,
SoEventCallback *  eventCB 
)
staticprivate

Definition at line 118 of file SoDetectorTreeKit.cc.

118 {
119
120 // Was the event previously handled? Is it the right kind?
121
122 if (eventCB->isHandled()) return;
123 const SoMouseButtonEvent *event= (SoMouseButtonEvent *) eventCB->getEvent();
124 if (!SoMouseButtonEvent::isButtonPressEvent(event,SoMouseButtonEvent::BUTTON1)) return;
125 if (!event->wasCtrlDown()) return;
126 if (event->wasShiftDown()) return;
127
128 // Which Detector is this being called for?
130
131 // Find out whether that's the one that has been picked.
132 // "This' is the lowest detector tree kit in the hierarchy.
133 SoHandleEventAction *handleEventAction = eventCB->getAction();
134 const SoPickedPoint *pickedPoint = handleEventAction->getPickedPoint();
135 if (!pickedPoint) return;
136
137 SoFullPath* path = (SoFullPath*)pickedPoint->getPath();
138 SoNode *ancestorNode=NULL;
139 for (int i=0;i<path->getLength();i++) {
140 ancestorNode = path->getNodeFromTail(i);
141 if (ancestorNode->isOfType(SoDetectorTreeKit::getClassTypeId())) break;
142 }
143 if (This!=ancestorNode) return;
144 // if (!ancestorNode->isOfType(SoDetectorTreeKit::getClassTypeId())) return;
145
146 // Deactivate the Preview
147 This->setPreview(FALSE);
148 eventCB->setHandled();
149
150}

References FALSE, setPreview(), and userData.

Referenced by createInitialTree().

◆ generateAlternateRep()

void SoDetectorTreeKit::generateAlternateRep ( )
virtual

Definition at line 225 of file SoDetectorTreeKit.cc.

225 {
226 alternateRep.setValue(topSeparator.getValue());
227}

References alternateRep.

◆ getFullSeparator()

SoSeparator * SoDetectorTreeKit::getFullSeparator ( ) const
virtual

Definition at line 217 of file SoDetectorTreeKit.cc.

217 {
218 return (SoSeparator *) fullSeparator.getValue();
219}

◆ getPreview()

SbBool SoDetectorTreeKit::getPreview ( ) const
virtual

Definition at line 201 of file SoDetectorTreeKit.cc.

201 {
202 SoSwitch *theChildList = (SoSwitch *) childList.getValue();
203 if (theChildList->whichChild.getValue()==0) return TRUE;
204 return FALSE;
205}

References FALSE, and TRUE.

Referenced by contract().

◆ getPreviewSeparator()

SoSeparator * SoDetectorTreeKit::getPreviewSeparator ( ) const
virtual

Definition at line 213 of file SoDetectorTreeKit.cc.

213 {
214 return (SoSeparator *) previewSeparator.getValue();
215}

◆ initClass()

void SoDetectorTreeKit::initClass ( void  )
static

Definition at line 66 of file SoDetectorTreeKit.cc.

66 {
67 static bool first = true;
68 if (first) {
69 first = false;
70 SO_KIT_INIT_CLASS(SoDetectorTreeKit,SoBaseKit,"BaseKit");
71 }
72}

Referenced by G4OpenInventor::InitNodes().

◆ setPreview()

void SoDetectorTreeKit::setPreview ( SbBool  Flag)
virtual

Definition at line 191 of file SoDetectorTreeKit.cc.

191 {
192 SoSwitch *theChildList = (SoSwitch *) childList.getValue();
193 if (Flag) {
194 theChildList->whichChild.setValue(0);
195 }
196 else {
197 theChildList->whichChild.setValue(1);
198 }
199}

Referenced by contract(), expand(), and G4OpenInventorSceneHandler::GeneratePrerequisites().

◆ setPreviewAndFull()

void SoDetectorTreeKit::setPreviewAndFull ( )

Definition at line 208 of file SoDetectorTreeKit.cc.

208 {
209 SoSwitch *theChildList = (SoSwitch *) childList.getValue();
210 theChildList->whichChild.setValue(SO_SWITCH_ALL);
211}

Referenced by G4OpenInventorSceneHandler::GeneratePrerequisites().

◆ SO_KIT_CATALOG_ENTRY_HEADER() [1/10]

SoDetectorTreeKit::SO_KIT_CATALOG_ENTRY_HEADER ( appearance  )
private

◆ SO_KIT_CATALOG_ENTRY_HEADER() [2/10]

SoDetectorTreeKit::SO_KIT_CATALOG_ENTRY_HEADER ( callbackList  )
private

◆ SO_KIT_CATALOG_ENTRY_HEADER() [3/10]

SoDetectorTreeKit::SO_KIT_CATALOG_ENTRY_HEADER ( childList  )
private

◆ SO_KIT_CATALOG_ENTRY_HEADER() [4/10]

SoDetectorTreeKit::SO_KIT_CATALOG_ENTRY_HEADER ( fullSeparator  )
private

◆ SO_KIT_CATALOG_ENTRY_HEADER() [5/10]

SoDetectorTreeKit::SO_KIT_CATALOG_ENTRY_HEADER ( pickStyle  )
private

◆ SO_KIT_CATALOG_ENTRY_HEADER() [6/10]

SoDetectorTreeKit::SO_KIT_CATALOG_ENTRY_HEADER ( previewSeparator  )
private

◆ SO_KIT_CATALOG_ENTRY_HEADER() [7/10]

SoDetectorTreeKit::SO_KIT_CATALOG_ENTRY_HEADER ( texture2Transform  )
private

◆ SO_KIT_CATALOG_ENTRY_HEADER() [8/10]

SoDetectorTreeKit::SO_KIT_CATALOG_ENTRY_HEADER ( topSeparator  )
private

◆ SO_KIT_CATALOG_ENTRY_HEADER() [9/10]

SoDetectorTreeKit::SO_KIT_CATALOG_ENTRY_HEADER ( transform  )
private

◆ SO_KIT_CATALOG_ENTRY_HEADER() [10/10]

SoDetectorTreeKit::SO_KIT_CATALOG_ENTRY_HEADER ( units  )
private

◆ SO_KIT_HEADER()

SoDetectorTreeKit::SO_KIT_HEADER ( SoDetectorTreeKit  )
private

Field Documentation

◆ alternateRep

SoSFNode SoDetectorTreeKit::alternateRep

Definition at line 53 of file SoDetectorTreeKit.h.

Referenced by clearAlternateRep(), generateAlternateRep(), and SoDetectorTreeKit().


The documentation for this class was generated from the following files: