Geant4  10.00.p02
G4XXXSGSceneHandler.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4XXXSGSceneHandler.hh 66870 2013-01-14 23:38:59Z adotti $
28 //
29 //
30 // John Allison 10th March 2006
31 // A template for a sophisticated graphics driver with a scene graph.
32 //?? Lines beginning like this require specialisation for your driver.
33 
34 #ifndef G4XXXSGSCENEHANDLER_HH
35 #define G4XXXSGSCENEHANDLER_HH
36 
37 #include "G4VSceneHandler.hh"
38 
39 #include "G4PhysicalVolumeModel.hh"
40 #include <iostream>
41 
42 namespace JA {
43  // Ad hoc tree class and utilities.
44 
46  typedef std::vector<PVNodeID> PVPath;
47 
48  struct Node {
49  Node(PVNodeID pvNodeID = PVNodeID(), G4int index = -1):
50  fPVNodeID(pvNodeID), fIndex(index) {}
51  PVNodeID fPVNodeID;
53  std::vector<Node*> fDaughters;
54  };
55 
56  void Insert(const PVNodeID* pvPath, size_t pathLength,
57  G4int index, Node* node);
58 
59  void PrintTree(std::ostream&, Node*);
60 
61  void Clear(Node*);
62 }
63 
65 
67 
68  friend class G4XXXSGViewer;
69 
70 public:
72  const G4String& name);
73  virtual ~G4XXXSGSceneHandler();
74 
76  // Optional virtual functions...
77  void AddSolid(const G4Box&);
78  // Further optional AddSolid functions. Explicitly invoke base
79  // class methods if not otherwise defined to avoid warnings about
80  // hiding of base class methods.
81  void AddSolid(const G4Cons& cons)
83  void AddSolid(const G4Tubs& tubs)
85  void AddSolid(const G4Trd& trd)
87  void AddSolid(const G4Trap& trap)
89  void AddSolid(const G4Sphere& sphere)
90  {G4VSceneHandler::AddSolid(sphere);}
91  void AddSolid(const G4Para& para)
93  void AddSolid(const G4Torus& torus)
95  void AddSolid(const G4Polycone& polycone)
96  {G4VSceneHandler::AddSolid(polycone);}
97  void AddSolid(const G4Polyhedra& polyhedra)
98  {G4VSceneHandler::AddSolid(polyhedra);}
99  void AddSolid(const G4VSolid& solid)
100  {G4VSceneHandler::AddSolid(solid);}
101  // More optional functions...
102  // void AddCompound(const G4VTrajectory&);
103  // void AddCompound(const G4VHit&);
104  // void AddCompound(const G4THitsMap<G4double>&);
105  void PreAddSolid(const G4Transform3D& objectTransformation,
106  const G4VisAttributes&);
107  void PostAddSolid();
108 
110  // Required implementation of pure virtual functions...
111 
112  void AddPrimitive(const G4Polyline&);
113  void AddPrimitive(const G4Text&);
114  void AddPrimitive(const G4Circle&);
115  void AddPrimitive(const G4Square&);
116  void AddPrimitive(const G4Polyhedron&);
117  // Further optional AddPrimitive methods. Explicitly invoke base
118  // class methods if not otherwise defined to avoid warnings about
119  // hiding of base class methods.
120  void AddPrimitive(const G4Polymarker& polymarker)
121  {G4VSceneHandler::AddPrimitive (polymarker);}
122  void AddPrimitive(const G4Scale& scale)
124  // Further related optional virtual functions...
125  void BeginPrimitives(const G4Transform3D& objectTransformation);
126  void EndPrimitives();
127 
129  // Further optional virtual functions...
130 
131  // void BeginModeling();
132  // void EndModeling();
133 
135  // Administration functions.
136 
137  void ClearStore ();
138  void ClearTransientStore ();
139 
140 protected:
141 
142  static G4int fSceneIdCount; // Counter for XXXSG scene handlers.
143 
144  // Utility for PreAddSolid and BeginPrimitives.
145  void CreateCurrentItem(const G4String&);
146 
147  //?? Define the scene graph. (For emulation, use an ad hoc tree class.)
148  SceneGraph fSceneGraph;
149 
150 private:
151 
152 #ifdef G4XXXFileDEBUG
153  void PrintThings();
154 #endif
155 
156 };
157 
158 #endif
void AddPrimitive(const G4Polyline &)
void AddSolid(const G4Trap &trap)
void AddSolid(const G4Tubs &tubs)
Definition: G4Para.hh:77
virtual void AddSolid(const G4Box &)
void BeginPrimitives(const G4Transform3D &objectTransformation)
Definition: G4Text.hh:73
void PrintTree(std::ostream &, Node *)
Definition: G4Box.hh:64
G4String name
Definition: TRTMaterials.hh:40
void AddSolid(const G4VSolid &solid)
void Clear(Node *)
Definition: G4Tubs.hh:85
void AddPrimitive(const G4Polymarker &polymarker)
Definition: G4Trd.hh:72
int G4int
Definition: G4Types.hh:78
virtual void AddPrimitive(const G4Polyline &)=0
PVNodeID fPVNodeID
void AddPrimitive(const G4Scale &scale)
G4XXXSGSceneHandler(G4VGraphicsSystem &system, const G4String &name)
G4PhysicalVolumeModel::G4PhysicalVolumeNodeID PVNodeID
void Insert(const PVNodeID *pvPath, size_t pathLength, G4int index, Node *node)
void AddSolid(const G4Torus &torus)
Definition: G4Cons.hh:83
void AddSolid(const G4Para &para)
HepGeom::Transform3D G4Transform3D
JA::Node SceneGraph
void CreateCurrentItem(const G4String &)
std::vector< PVNodeID > PVPath
void AddSolid(const G4Polyhedra &polyhedra)
void AddSolid(const G4Polycone &polycone)
void AddSolid(const G4Trd &trd)
void AddSolid(const G4Sphere &sphere)
std::vector< Node * > fDaughters
void AddSolid(const G4Box &)
Node(PVNodeID pvNodeID=PVNodeID(), G4int index=-1)
void PreAddSolid(const G4Transform3D &objectTransformation, const G4VisAttributes &)
void AddSolid(const G4Cons &cons)