Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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//
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
39#include <iostream>
40
41namespace 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
69public:
71 const G4String& name);
72 virtual ~G4XXXSGSceneHandler();
73
74 ////////////////////////////////////////////////////////////////
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)
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)
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
115 ////////////////////////////////////////////////////////////////
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);}
128 void AddPrimitive(const G4Scale& scale)
130 // Further related optional virtual functions...
131 void BeginPrimitives(const G4Transform3D& objectTransformation);
132 void EndPrimitives();
133
134 ////////////////////////////////////////////////////////////////
135 // Further optional virtual functions...
136
137 // void BeginModeling();
138 // void EndModeling();
139
140 //////////////////////////////////////////////////////////////
141 // Administration functions.
142
143 void ClearStore ();
144 void ClearTransientStore ();
145
146protected:
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.)
155
156private:
157
158#ifdef G4XXXFileDEBUG
159 void PrintThings();
160#endif
161
162};
163
164#endif
int G4int
Definition: G4Types.hh:85
JA::Node SceneGraph
Definition: G4Box.hh:56
Definition: G4Cons.hh:78
Definition: G4Orb.hh:56
Definition: G4Para.hh:79
Definition: G4Text.hh:72
Definition: G4Trd.hh:63
Definition: G4Tubs.hh:75
virtual void AddSolid(const G4Box &)
virtual void AddPrimitive(const G4Polyline &)=0
void AddSolid(const G4Sphere &sphere)
void CreateCurrentItem(const G4String &)
void AddSolid(const G4Tubs &tubs)
void AddSolid(const G4Para &para)
void AddSolid(const G4Ellipsoid &ellipsoid)
void AddPrimitive(const G4Polyline &)
void PreAddSolid(const G4Transform3D &objectTransformation, const G4VisAttributes &)
void AddSolid(const G4Cons &cons)
void AddSolid(const G4TessellatedSolid &tess)
void AddSolid(const G4VSolid &solid)
void AddSolid(const G4Trd &trd)
void AddSolid(const G4Trap &trap)
void AddSolid(const G4Polycone &polycone)
void AddPrimitive(const G4Polymarker &polymarker)
void BeginPrimitives(const G4Transform3D &objectTransformation)
void AddSolid(const G4Orb &orb)
void AddPrimitive(const G4Scale &scale)
void AddSolid(const G4Polyhedra &polyhedra)
void AddSolid(const G4Box &)
void AddSolid(const G4Torus &torus)
void PrintTree(std::ostream &, Node *)
G4PhysicalVolumeModel::G4PhysicalVolumeNodeID PVNodeID
void Insert(const PVNodeID *pvPath, size_t pathLength, G4int index, Node *node)
std::vector< PVNodeID > PVPath
void Clear(Node *)
PVNodeID fPVNodeID
std::vector< Node * > fDaughters
Node(PVNodeID pvNodeID=PVNodeID(), G4int index=-1)