source: snovis/trunk/source/G4Lab/cxx/TrajectoryContainerAccessor.cxx@ 276

Last change on this file since 276 was 233, checked in by barrand, 19 years ago
  • Property svn:eol-style set to native
File size: 4.2 KB
Line 
1// this :
2#include <G4Lab/TrajectoryContainerAccessor.h>
3
4// Inventor :
5#include <Inventor/nodes/SoSeparator.h>
6#include <Inventor/nodes/SoLightModel.h>
7#include <Inventor/nodes/SoDrawStyle.h>
8
9// HEPVis :
10#include <HEPVis/nodes/SoHighlightMaterial.h>
11
12#ifdef WIN32
13#undef pascal // Clash between windef.h and Geant4/SystemOfUnits.hh
14#endif
15
16// Lib :
17#include <Slash/Core/ISession.h>
18#include <Slash/Data/IIterator.h>
19#include <Lib/Out.h>
20#include <Lib/Variable.h>
21#include <Lib/smanip.h>
22
23// G4Lab :
24#include <G4Lab/SoG4RunManager.h>
25
26//////////////////////////////////////////////////////////////////////////////
27G4Lab::TrajectoryContainerAccessor::TrajectoryContainerAccessor(
28 Slash::Core::ISession& aSession
29)
30:OnX::InventorAccessor(aSession)
31,fType("TrajectoryContainer")
32//////////////////////////////////////////////////////////////////////////////
33//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
34{
35}
36//////////////////////////////////////////////////////////////////////////////
37G4Lab::TrajectoryContainerAccessor::~TrajectoryContainerAccessor(
38)
39//////////////////////////////////////////////////////////////////////////////
40//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
41{
42}
43//////////////////////////////////////////////////////////////////////////////
44std::string G4Lab::TrajectoryContainerAccessor::name(
45) const
46//////////////////////////////////////////////////////////////////////////////
47//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
48{
49 return fType;
50}
51namespace G4Lab {
52 class TrajectoryContainerIterator : public virtual Slash::Data::IIterator {
53 public: //Slash::Data::IIterator
54 virtual Slash::Data::IAccessor::Data object() { return fValue; }
55 virtual void next() { fValue = 0; }
56 virtual void* tag() { return 0;}
57 public:
58 TrajectoryContainerIterator(void* aValue):fValue(aValue) {}
59 virtual ~TrajectoryContainerIterator(){}
60 private:
61 void* fValue;
62 };
63}
64//////////////////////////////////////////////////////////////////////////////
65Slash::Data::IIterator* G4Lab::TrajectoryContainerAccessor::iterator(
66)
67//////////////////////////////////////////////////////////////////////////////
68//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
69{
70 return new TrajectoryContainerIterator(this);
71}
72//////////////////////////////////////////////////////////////////////////////
73void G4Lab::TrajectoryContainerAccessor::beginVisualize(
74)
75//////////////////////////////////////////////////////////////////////////////
76//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
77{
78 OnX::InventorAccessor::beginVisualize();
79 std::string value;
80 int number = 1;
81 if(fSession.parameterValue("modeling.events",value)) {
82 if(!Lib::smanip::toint(value,number)) number = 1;
83 }
84
85 // Search if an SoG4RunManager had been introduced already :
86 SoG4RunManager* node =
87 (SoG4RunManager*)fSoRegion->findNode("type","SoG4RunManager");
88 if(node) {
89 //debug fSession.out().println("debug : find soG4RunManager.");
90 node->numberOfEvents.setValue(number);
91 node->touch();
92
93 } else {
94
95 //debug fSession.out().println("debug : create soG4RunManager.");
96
97 SoSeparator* separator = new SoSeparator;
98 separator->setName("sceneGraph");
99
100 separator->addChild(fSoGC.getHighlightMaterial());
101 separator->addChild(fSoGC.getDrawStyle());
102 separator->addChild(fSoGC.getLightModel());
103
104 SoG4RunManager* soG4RunManager = new SoG4RunManager();
105 soG4RunManager->numberOfEvents.setValue(number);
106 separator->addChild(soG4RunManager);
107
108 fSoRegion->doIt(SbAddNode(separator,"dynamicScene"));
109 }
110}
111//////////////////////////////////////////////////////////////////////////////
112void G4Lab::TrajectoryContainerAccessor::visualize(
113 Slash::Data::IAccessor::Data,void*
114)
115//////////////////////////////////////////////////////////////////////////////
116//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
117{
118}
119//////////////////////////////////////////////////////////////////////////////
120void G4Lab::TrajectoryContainerAccessor::endVisualize(
121)
122//////////////////////////////////////////////////////////////////////////////
123//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
124{
125}
Note: See TracBrowser for help on using the repository browser.