Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4HepRepFileSceneHandler.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// Joseph Perl 27th January 2002
30// A base class for a scene handler to export geometry and trajectories
31// to the HepRep xml file format.
32
33#ifndef G4HepRepFileSCENEHANDLER_HH
34#define G4HepRepFileSCENEHANDLER_HH
35
36//#define G4HEPREPFILEDEBUG // Comment this out to suppress debug code.
37
38#include "G4VSceneHandler.hh"
39#include "G4Box.hh"
40#include "G4Cons.hh"
41#include "G4Tubs.hh"
42#include "G4Trd.hh"
43#include "G4Trap.hh"
44#include "G4Sphere.hh"
45#include "G4Para.hh"
46#include "G4Torus.hh"
47#include "G4Polycone.hh"
48#include "G4Polyhedra.hh"
49
50// HepRep
52
54class G4LogicalVolume;
57
59{
60 public:
63
64 ////////////////////////////////////////////////////////////////
65 // No need to implement these, but if you do...
66 void AddSolid(const G4Box&);
67 void AddSolid(const G4Cons&);
68 void AddSolid(const G4Tubs&);
69 void AddSolid(const G4Trd&);
70 void AddSolid(const G4Trap&);
71 void AddSolid(const G4Sphere&);
72 void AddSolid(const G4Para&);
73 void AddSolid(const G4Torus&);
74 void AddSolid(const G4Polycone&);
75 void AddSolid(const G4Polyhedra&);
76 void AddSolid(const G4Orb&);
77 void AddSolid(const G4Ellipsoid&);
78 void AddSolid(const G4TessellatedSolid&);
79 void AddSolid(const G4VSolid&);
80
82 void AddCompound(const G4VTrajectory&);
83 void InitTrajectory();
84 void AddCompound(const G4VHit&);
85 void InitHit();
86
87 // void PreAddSolid(const G4Transform3D& objectTransformation,
88 // const G4VisAttributes&);
89 // void PostAddSolid();
90
91 ////////////////////////////////////////////////////////////////
92 // Required implementation of pure virtual functions...
93
95 void AddPrimitive(const G4Polyline&);
96 void AddPrimitive(const G4Text&);
97 void AddPrimitive(const G4Circle&);
98 void AddPrimitive(const G4Square&);
99 void AddPrimitive(const G4Polyhedron&);
100
101 ////////////////////////////////////////////////////////////////
102 ////////////////////////////////////////////////////////////////
103 // Further optional AddPrimtive methods. Explicitly invoke base
104 // class methods if not otherwise defined to avoid warnings about
105 // hiding of base class methods.
106 void AddPrimitive(const G4Polymarker&);
107
108 ////////////////////////////////////////////////////////////////
109 // Further optional virtual functions...
110
111 // void BeginPrimitives(const G4Transform3D& objectTransformation);
112 // void EndPrimitives();
113
114 void BeginModeling();
115 void EndModeling();
116
117 void BeginPrimitives2D(const G4Transform3D& objectTransformation);
118 void EndPrimitives2D();
119
120 //////////////////////////////////////////////////////////////
121 // Administration functions.
122
123 // void ClearStore ();
124 void ClearTransientStore();
125
126 ////////////////////////////////////////////////////////////////
127 // Required...
128
130
131 protected:
132 static G4int fSceneIdCount; // Counter for HepRep scene handlers.
133
134 private:
135 G4HepRepFileXMLWriter* hepRepXMLWriter;
136 void AddHepRepInstance(const char* primName, const G4Visible visible);
137 void CheckFileOpen();
138 int fileCounter;
139 G4bool haveVisible;
140 G4bool inPrimitives2D;
141 G4bool warnedAbout3DText;
142 G4bool warnedAbout2DMarkers;
143 G4bool drawingTraj;
144 G4bool doneInitTraj;
145 G4bool drawingHit;
146 G4bool doneInitHit;
147
148 const G4VisTrajContext* trajContext;
149
150 std::vector<G4AttValue>* trajAttValues;
151 std::map<G4String, G4AttDef>* trajAttDefs;
152 std::vector<G4AttValue>* hitAttValues;
153 std::map<G4String, G4AttDef>* hitAttDefs;
154
155#ifdef G4HEPREPFILEDEBUG
156 void PrintThings();
157#endif
158};
159
160#endif
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
Definition: G4Box.hh:56
Definition: G4Cons.hh:78
G4HepRepFileXMLWriter * GetHepRepXMLWriter()
void AddPrimitive(const G4Polyline &)
void BeginPrimitives2D(const G4Transform3D &objectTransformation)
void AddCompound(const G4VTrajectory &)
Definition: G4Orb.hh:56
Definition: G4Para.hh:79
Definition: G4Text.hh:72
Definition: G4Trd.hh:63
Definition: G4Tubs.hh:75
Definition: G4VHit.hh:48
virtual void AddCompound(const G4VTrajectory &)
virtual void AddPrimitive(const G4Polyline &)=0