Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 99152 2016-09-07 08:04:30Z gcosmo $
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) {}
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 G4Orb& orb)
101  void AddSolid(const G4Ellipsoid& ellipsoid)
102  {G4VSceneHandler::AddSolid(ellipsoid);}
103  void AddSolid(const G4VSolid& solid)
104  {G4VSceneHandler::AddSolid(solid);}
105  // More optional functions...
106  // void AddCompound(const G4VTrajectory&);
107  // void AddCompound(const G4VHit&);
108  // void AddCompound(const G4THitsMap<G4double>&);
109  // void AddCompound(const G4THitsMap<G4StatDouble>&);
110  void PreAddSolid(const G4Transform3D& objectTransformation,
111  const G4VisAttributes&);
112  void PostAddSolid();
113 
115  // Required implementation of pure virtual functions...
116 
117  void AddPrimitive(const G4Polyline&);
118  void AddPrimitive(const G4Text&);
119  void AddPrimitive(const G4Circle&);
120  void AddPrimitive(const G4Square&);
121  void AddPrimitive(const G4Polyhedron&);
122  // Further optional AddPrimitive methods. Explicitly invoke base
123  // class methods if not otherwise defined to avoid warnings about
124  // hiding of base class methods.
125  void AddPrimitive(const G4Polymarker& polymarker)
126  {G4VSceneHandler::AddPrimitive (polymarker);}
127  void AddPrimitive(const G4Scale& scale)
129  // Further related optional virtual functions...
130  void BeginPrimitives(const G4Transform3D& objectTransformation);
131  void EndPrimitives();
132 
134  // Further optional virtual functions...
135 
136  // void BeginModeling();
137  // void EndModeling();
138 
140  // Administration functions.
141 
142  void ClearStore ();
143  void ClearTransientStore ();
144 
145 protected:
146 
147  static G4int fSceneIdCount; // Counter for XXXSG scene handlers.
148 
149  // Utility for PreAddSolid and BeginPrimitives.
150  void CreateCurrentItem(const G4String&);
151 
152  //?? Define the scene graph. (For emulation, use an ad hoc tree class.)
153  SceneGraph fSceneGraph;
154 
155 private:
156 
157 #ifdef G4XXXFileDEBUG
158  void PrintThings();
159 #endif
160 
161 };
162 
163 #endif
void AddPrimitive(const G4Polyline &)
void AddSolid(const G4Trap &trap)
const XML_Char * name
Definition: expat.h:151
void AddSolid(const G4Tubs &tubs)
Definition: G4Para.hh:77
virtual void AddSolid(const G4Box &)
void BeginPrimitives(const G4Transform3D &objectTransformation)
Definition: G4Text.hh:73
void AddSolid(const G4Orb &orb)
void PrintTree(std::ostream &, Node *)
Definition: G4Box.hh:64
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)
JA::Node SceneGraph
void CreateCurrentItem(const G4String &)
std::vector< PVNodeID > PVPath
void AddSolid(const G4Polyhedra &polyhedra)
Definition: G4Orb.hh:61
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 AddSolid(const G4Ellipsoid &ellipsoid)
void PreAddSolid(const G4Transform3D &objectTransformation, const G4VisAttributes &)
void AddSolid(const G4Cons &cons)