ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4XXXSGSceneHandler.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4XXXSGSceneHandler.hh
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 //
28 //
29 // John Allison 10th March 2006
30 // A template for a sophisticated graphics driver with a scene graph.
31 //?? Lines beginning like this require specialisation for your driver.
32 
33 #ifndef G4XXXSGSCENEHANDLER_HH
34 #define G4XXXSGSCENEHANDLER_HH
35 
36 #include "G4VSceneHandler.hh"
37 
38 #include "G4PhysicalVolumeModel.hh"
39 #include <iostream>
40 
41 namespace JA {
42  // Ad hoc tree class and utilities.
43 
45  typedef std::vector<PVNodeID> PVPath;
46 
47  struct Node {
48  Node(PVNodeID pvNodeID = PVNodeID(), G4int index = -1):
49  fPVNodeID(pvNodeID), fIndex(index) {}
52  std::vector<Node*> fDaughters;
53  };
54 
55  void Insert(const PVNodeID* pvPath, size_t pathLength,
56  G4int index, Node* node);
57 
58  void PrintTree(std::ostream&, Node*);
59 
60  void Clear(Node*);
61 }
62 
64 
66 
67  friend class G4XXXSGViewer;
68 
69 public:
71  const G4String& name);
72  virtual ~G4XXXSGSceneHandler();
73 
75  // Optional virtual functions...
76  void AddSolid(const G4Box&);
77  // Further optional AddSolid functions. Explicitly invoke base
78  // class methods if not otherwise defined to avoid warnings about
79  // hiding of base class methods.
80  void AddSolid(const G4Cons& cons)
82  void AddSolid(const G4Tubs& tubs)
84  void AddSolid(const G4Trd& trd)
86  void AddSolid(const G4Trap& trap)
88  void AddSolid(const G4Sphere& sphere)
89  {G4VSceneHandler::AddSolid(sphere);}
90  void AddSolid(const G4Para& para)
92  void AddSolid(const G4Torus& torus)
94  void AddSolid(const G4Polycone& polycone)
95  {G4VSceneHandler::AddSolid(polycone);}
96  void AddSolid(const G4Polyhedra& polyhedra)
97  {G4VSceneHandler::AddSolid(polyhedra);}
98  void AddSolid(const G4Orb& orb)
100  void AddSolid(const G4Ellipsoid& ellipsoid)
101  {G4VSceneHandler::AddSolid(ellipsoid);}
102  void AddSolid(const G4TessellatedSolid& tess)
104  void AddSolid(const G4VSolid& solid)
105  {G4VSceneHandler::AddSolid(solid);}
106  // More optional functions...
107  // void AddCompound(const G4VTrajectory&);
108  // void AddCompound(const G4VHit&);
109  // void AddCompound(const G4THitsMap<G4double>&);
110  // void AddCompound(const G4THitsMap<G4StatDouble>&);
111  void PreAddSolid(const G4Transform3D& objectTransformation,
112  const G4VisAttributes&);
113  void PostAddSolid();
114 
116  // Required implementation of pure virtual functions...
117 
118  void AddPrimitive(const G4Polyline&);
119  void AddPrimitive(const G4Text&);
120  void AddPrimitive(const G4Circle&);
121  void AddPrimitive(const G4Square&);
122  void AddPrimitive(const G4Polyhedron&);
123  // Further optional AddPrimitive methods. Explicitly invoke base
124  // class methods if not otherwise defined to avoid warnings about
125  // hiding of base class methods.
126  void AddPrimitive(const G4Polymarker& polymarker)
127  {G4VSceneHandler::AddPrimitive (polymarker);}
130  // Further related optional virtual functions...
131  void BeginPrimitives(const G4Transform3D& objectTransformation);
132  void EndPrimitives();
133 
135  // Further optional virtual functions...
136 
137  // void BeginModeling();
138  // void EndModeling();
139 
141  // Administration functions.
142 
143  void ClearStore ();
144  void ClearTransientStore ();
145 
146 protected:
147 
148  static G4int fSceneIdCount; // Counter for XXXSG scene handlers.
149 
150  // Utility for PreAddSolid and BeginPrimitives.
151  void CreateCurrentItem(const G4String&);
152 
153  //?? Define the scene graph. (For emulation, use an ad hoc tree class.)
154  SceneGraph fSceneGraph;
155 
156 private:
157 
158 #ifdef G4XXXFileDEBUG
159  void PrintThings();
160 #endif
161 
162 };
163 
164 #endif