Geant4 9.6.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// $Id$
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
40#include <iostream>
41
42namespace 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
70public:
72 const G4String& name);
73 virtual ~G4XXXSGSceneHandler();
74
75 ////////////////////////////////////////////////////////////////
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)
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)
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
109 ////////////////////////////////////////////////////////////////
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 void AddPrimitive(const G4NURBS&);
118 // Further optional AddPrimitive methods. Explicitly invoke base
119 // class methods if not otherwise defined to avoid warnings about
120 // hiding of base class methods.
121 void AddPrimitive(const G4Polymarker& polymarker)
122 {G4VSceneHandler::AddPrimitive (polymarker);}
123 void AddPrimitive(const G4Scale& scale)
125 // Further related optional virtual functions...
126 void BeginPrimitives(const G4Transform3D& objectTransformation);
127 void EndPrimitives();
128
129 ////////////////////////////////////////////////////////////////
130 // Further optional virtual functions...
131
132 // void BeginModeling();
133 // void EndModeling();
134
135 //////////////////////////////////////////////////////////////
136 // Administration functions.
137
138 void ClearStore ();
139 void ClearTransientStore ();
140
141protected:
142
143 static G4int fSceneIdCount; // Counter for XXXSG scene handlers.
144
145 // Utility for PreAddSolid and BeginPrimitives.
146 void CreateCurrentItem(const G4String&);
147
148 //?? Define the scene graph. (For emulation, use an ad hoc tree class.)
150
151private:
152
153#ifdef G4XXXFileDEBUG
154 void PrintThings();
155#endif
156
157};
158
159#endif
int G4int
Definition: G4Types.hh:66
JA::Node SceneGraph
Definition: G4Box.hh:55
Definition: G4Cons.hh:75
Definition: G4Para.hh:77
Definition: G4Text.hh:73
Definition: G4Trd.hh:63
Definition: G4Tubs.hh:77
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 AddPrimitive(const G4Polyline &)
void PreAddSolid(const G4Transform3D &objectTransformation, const G4VisAttributes &)
void AddSolid(const G4Cons &cons)
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 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)