Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4VVisManager.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// John Allison 19/Oct/1996.
28//
29// Class Description:
30//
31// G4VVisManager is an abstract interface for the GEANT4 Visualization Manager.
32// The inheritance hierarchy is:
33// G4VVisManager <- G4VisManager <- G4VisExecutive
34//
35// You may also write your own vis manager in place of G4VisExecutive.
36//
37// See example/novice/N02 to see how and when to instantiate
38// G4VisExecutive (or your own vis manager). You should *not* access
39// it directly; instead you should obtain a pointer as follows:
40//
41// G4VVisManager* pVVMan = G4VVisManager::GetConcreteInstance ();
42//
43// This ensures your code will link even if G4VisExecutive is not
44// instantiated or even if not provided in a library. Please protect
45// your code by testing the pointer, for example, by:
46//
47// if (pVVMan) pVVMan -> Draw (polyline);
48//
49// The Draw functions draw only "transient" objects. This is useful
50// for debugging, e.g., drawing the step in your UserSteppingAction,
51// since G4Steps are not kept.
52//
53// Note: "permanent" objects, i.e., objects which are always
54// available, such as detector geometry components, or available in an
55// event after tracking has finished, such as hits, digitisations and
56// trajectories, can be drawn in a transient way if you wish but it is
57// usually possible to draw them in a permanent way with /vis/
58// commands. The advantage is that permanent objects can be redrawn,
59// e.g., when you change view or viewer; transient objects get
60// forgotten. Also, it is possible to write a G4VUserVisAction class
61// and register it to "promote" your Draw messages to "permanent" -
62// see documentation.
63//
64// Note that the G4Transform3D argument refers to the transformation
65// of the *object*, not the transformation of the coordinate syste.
66//
67// Note also that where a G4VisAttributes argument is specified, it
68// overrides any attributes belonging to the object itself.
69
70#ifndef G4VVISMANAGER_HH
71#define G4VVISMANAGER_HH
72
73#include "G4Transform3D.hh"
74#include "G4ThreeVector.hh" // Just a typedef Hep3Vector.
75#include "G4RotationMatrix.hh" // Just a typedef HepRotation.
76
77class G4Polyline;
78class G4Text;
79class G4Circle;
80class G4Square;
81class G4Polymarker;
82class G4Polyhedron;
83class G4VSolid;
84class G4VHit;
85class G4VDigi;
86class G4VTrajectory;
87class G4LogicalVolume;
89class G4VisAttributes;
90
92
93public: // With description
94
96 // Returns pointer to actual visualization manager if a view is
97 // available for drawing, else returns null. Always check value.
98
99public:
100
102 virtual ~G4VVisManager ();
103
104public: // With description
105
106 ///////////////////////////////////////////////////////////////////////
107 // Draw methods for Geant4 Visualization Primitives, useful
108 // for representing hits, digis, etc.
109
110 virtual void Draw (const G4Circle&,
111 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
112
113 virtual void Draw (const G4Polyhedron&,
114 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
115
116 virtual void Draw (const G4Polyline&,
117 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
118
119 virtual void Draw (const G4Polymarker&,
120 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
121
122 virtual void Draw (const G4Square&,
123 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
124
125 virtual void Draw (const G4Text&,
126 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
127
128 ///////////////////////////////////////////////////////////////////////
129 // For 2D methods, the x,y coordinates are interpreted as screen
130 // coordinates, -1 < x,y < 1. The z-coordinate is ignored.
131
132 virtual void Draw2D (const G4Circle&,
133 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
134
135 virtual void Draw2D (const G4Polyhedron&,
136 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
137
138 virtual void Draw2D (const G4Polyline&,
139 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
140
141 virtual void Draw2D (const G4Polymarker&,
142 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
143
144 virtual void Draw2D (const G4Square&,
145 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
146
147 virtual void Draw2D (const G4Text&,
148 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
149
150 ///////////////////////////////////////////////////////////////////////
151 // Draw methods for Geant4 Objects as if they were Visualization
152 // Primitives. Note that the visualization attributes needed in
153 // some cases override any visualization attributes that are
154 // associated with the object itself - thus you can, for example,
155 // change the colour of a physical volume.
156
157 virtual void Draw (const G4VTrajectory&) = 0;
158
159 virtual void Draw (const G4VHit&) = 0;
160
161 virtual void Draw (const G4VDigi&) = 0;
162
163 virtual void Draw (const G4LogicalVolume&, const G4VisAttributes&,
164 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
165
166 virtual void Draw (const G4VPhysicalVolume&, const G4VisAttributes&,
167 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
168
169 virtual void Draw (const G4VSolid&, const G4VisAttributes&,
170 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
171
172 virtual void DrawGeometry
174 // Draws a geometry tree starting at the specified physical volume.
175
176 //////////////////////////////////////////////////////////////////////
177 // Optional methods that you may use to bracket a series of Draw
178 // messages that have identical objectTransformation to improve
179 // drawing speed. Use Begin/EndDraw for a series of Draw messages,
180 // Begin/EndDraw2D for a series of Draw2D messages. Do not mix Draw
181 // and Draw2D messages.
182
183 virtual void BeginDraw
184 (const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
185
186 virtual void EndDraw () = 0;
187
188 virtual void BeginDraw2D
189 (const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
190
191 virtual void EndDraw2D () = 0;
192
193 //////////////////////////////////////////////////////////////////////
194 // Other methods...
195
196 virtual void GeometryHasChanged () = 0;
197 // This is used by the run manager to notify a change of geometry.
198
199 virtual void IgnoreStateChanges(G4bool);
200 // This method shoud be invoked by a class that has its own event loop,
201 // such as the RayTracer, material scanner, etc. If the argument is true,
202 // the following state changes among Idle, GeomClosed and EventProc are
203 // caused by such a class, and thus not by the ordinary event simulation.
204 // The same method with false should be invoked once such an event loop
205 // is over.
206
207 virtual void NotifyHandlers () {}
208 // Notify scene handlers (G4VGraphicsScene objects) that the scene
209 // has changed so that they may rebuild their graphics database, if
210 // any, and redraw all views.
211
212 virtual void DispatchToModel(const G4VTrajectory&) = 0;
213 // Draw the trajectory.
214
216 // Trajectory filter
217
218 virtual G4bool FilterHit(const G4VHit&) = 0;
219 // Hit filter
220
221 virtual G4bool FilterDigi(const G4VDigi&) = 0;
222 // Digi filter
223
224#ifdef G4MULTITHREADED
225
226 virtual void SetUpForAThread() = 0;
227 // This method is invoked by G4WorkerRunManager
228
229#endif
230
231protected:
232
233 static void SetConcreteInstance (G4VVisManager*);
234
235 static G4VVisManager* fpConcreteInstance; // Pointer to real G4VisManager.
236
237};
238
239#endif
HepGeom::Transform3D G4Transform3D
bool G4bool
Definition: G4Types.hh:86
Definition: G4Text.hh:72
Definition: G4VHit.hh:48
virtual void Draw2D(const G4Polyhedron &, const G4Transform3D &objectTransformation=G4Transform3D())=0
virtual void Draw2D(const G4Polyline &, const G4Transform3D &objectTransformation=G4Transform3D())=0
virtual void Draw(const G4Polyline &, const G4Transform3D &objectTransformation=G4Transform3D())=0
virtual G4bool FilterHit(const G4VHit &)=0
virtual void Draw2D(const G4Square &, const G4Transform3D &objectTransformation=G4Transform3D())=0
virtual G4bool FilterTrajectory(const G4VTrajectory &)=0
virtual void DrawGeometry(G4VPhysicalVolume *, const G4Transform3D &t=G4Transform3D())
virtual void Draw2D(const G4Circle &, const G4Transform3D &objectTransformation=G4Transform3D())=0
virtual void Draw(const G4VTrajectory &)=0
virtual G4bool FilterDigi(const G4VDigi &)=0
virtual void Draw(const G4VDigi &)=0
virtual void EndDraw2D()=0
virtual void Draw2D(const G4Polymarker &, const G4Transform3D &objectTransformation=G4Transform3D())=0
virtual void Draw(const G4VSolid &, const G4VisAttributes &, const G4Transform3D &objectTransformation=G4Transform3D())=0
virtual void Draw(const G4VPhysicalVolume &, const G4VisAttributes &, const G4Transform3D &objectTransformation=G4Transform3D())=0
virtual ~G4VVisManager()
virtual void NotifyHandlers()
virtual void Draw(const G4Polymarker &, const G4Transform3D &objectTransformation=G4Transform3D())=0
virtual void IgnoreStateChanges(G4bool)
virtual void DispatchToModel(const G4VTrajectory &)=0
virtual void Draw(const G4VHit &)=0
virtual void EndDraw()=0
virtual void Draw(const G4LogicalVolume &, const G4VisAttributes &, const G4Transform3D &objectTransformation=G4Transform3D())=0
virtual void Draw(const G4Square &, const G4Transform3D &objectTransformation=G4Transform3D())=0
virtual void Draw2D(const G4Text &, const G4Transform3D &objectTransformation=G4Transform3D())=0
static G4VVisManager * fpConcreteInstance
static G4VVisManager * GetConcreteInstance()
virtual void Draw(const G4Circle &, const G4Transform3D &objectTransformation=G4Transform3D())=0
virtual void BeginDraw(const G4Transform3D &objectTransformation=G4Transform3D())=0
virtual void Draw(const G4Text &, const G4Transform3D &objectTransformation=G4Transform3D())=0
virtual void Draw(const G4Polyhedron &, const G4Transform3D &objectTransformation=G4Transform3D())=0
virtual void BeginDraw2D(const G4Transform3D &objectTransformation=G4Transform3D())=0
virtual void GeometryHasChanged()=0
static void SetConcreteInstance(G4VVisManager *)