| 1 | #ifndef G4Lab_SoG4Trajectories_h
|
|---|
| 2 | #define G4Lab_SoG4Trajectories_h
|
|---|
| 3 |
|
|---|
| 4 | // Inheritance :
|
|---|
| 5 | #include <Inventor/nodes/SoShape.h>
|
|---|
| 6 |
|
|---|
| 7 | #include <Inventor/fields/SoSFEnum.h>
|
|---|
| 8 | #include <Inventor/fields/SoSFFloat.h>
|
|---|
| 9 | #include <Inventor/fields/SoSFInt32.h>
|
|---|
| 10 | #include <Inventor/fields/SoSFBool.h>
|
|---|
| 11 | #include <Inventor/fields/SoSFNode.h>
|
|---|
| 12 |
|
|---|
| 13 | #include <vector>
|
|---|
| 14 |
|
|---|
| 15 | class G4TrajectoryContainer;
|
|---|
| 16 | class SoSensor;
|
|---|
| 17 | class SoFieldSensor;
|
|---|
| 18 |
|
|---|
| 19 | class PointIdentifier {
|
|---|
| 20 | public:
|
|---|
| 21 | PointIdentifier(int aTrajectory,int aPoint)
|
|---|
| 22 | :fTrajectory(aTrajectory),fPoint(aPoint){}
|
|---|
| 23 | public:
|
|---|
| 24 | int fTrajectory;
|
|---|
| 25 | int fPoint;
|
|---|
| 26 | };
|
|---|
| 27 |
|
|---|
| 28 | class SoG4Trajectories : public SoShape {
|
|---|
| 29 | SO_NODE_HEADER(SoG4Trajectories);
|
|---|
| 30 | public:
|
|---|
| 31 | enum Model {
|
|---|
| 32 | ALL,
|
|---|
| 33 | TIMED
|
|---|
| 34 | };
|
|---|
| 35 | SoSFEnum model;
|
|---|
| 36 |
|
|---|
| 37 | SoSFFloat timeStart;
|
|---|
| 38 | SoSFFloat timeInterval;
|
|---|
| 39 | SoSFInt32 timeSteps;
|
|---|
| 40 | SoSFInt32 timeIndex;
|
|---|
| 41 |
|
|---|
| 42 | // Info nodes :
|
|---|
| 43 | SoSFFloat timeMin;
|
|---|
| 44 | SoSFFloat timeMax;
|
|---|
| 45 | SoSFBool verbose;
|
|---|
| 46 |
|
|---|
| 47 | SoSFNode alternateRep;
|
|---|
| 48 | public:
|
|---|
| 49 | SoG4Trajectories();
|
|---|
| 50 | virtual void generateAlternateRep();
|
|---|
| 51 | virtual void clearAlternateRep();
|
|---|
| 52 | public:
|
|---|
| 53 | static void initClass();
|
|---|
| 54 | protected:
|
|---|
| 55 | virtual void GLRender(SoGLRenderAction*);
|
|---|
| 56 | virtual void rayPick(SoRayPickAction*);
|
|---|
| 57 | virtual void computeBBox(SoAction*,SbBox3f&,SbVec3f&);
|
|---|
| 58 | virtual void generatePrimitives(SoAction*);
|
|---|
| 59 | virtual void doAction(SoAction*);
|
|---|
| 60 | protected:
|
|---|
| 61 | virtual ~SoG4Trajectories();
|
|---|
| 62 | private:
|
|---|
| 63 | void flush();
|
|---|
| 64 | static void sensorCB(void*,SoSensor*);
|
|---|
| 65 | bool isG4LabTrajectories(G4TrajectoryContainer*);
|
|---|
| 66 | void timeOrder(G4TrajectoryContainer*);
|
|---|
| 67 | private:
|
|---|
| 68 | G4TrajectoryContainer* fContainer;
|
|---|
| 69 | std::vector< std::vector<PointIdentifier> > fTimeOrderedPoints;
|
|---|
| 70 | SoFieldSensor* fSensor;
|
|---|
| 71 | };
|
|---|
| 72 |
|
|---|
| 73 | #endif
|
|---|