Geant4  10.00.p03
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 // $Id: G4VVisManager.hh 79152 2014-02-19 15:22:08Z gcosmo $
28 // John Allison 19/Oct/1996.
29 //
30 // Class Description:
31 //
32 // G4VVisManager is an abstract interface for the GEANT4 Visualization Manager.
33 // The inheritance hierarchy is:
34 // G4VVisManager <- G4VisManager <- G4VisExecutive
35 //
36 // You may also write your own vis manager in place of G4VisExecutive.
37 //
38 // See example/novice/N02 to see how and when to instantiate
39 // G4VisExecutive (or your own vis manager). You should *not* access
40 // it directly; instead you should obtain a pointer as follows:
41 //
42 // G4VVisManager* pVVMan = G4VVisManager::GetConcreteInstance ();
43 //
44 // This ensures your code will link even if G4VisExecutive is not
45 // instantiated or even if not provided in a library. Please protect
46 // your code by testing the pointer, for example, by:
47 //
48 // if (pVVMan) pVVMan -> Draw (polyline);
49 //
50 // The Draw functions draw only "transient" objects. This is useful
51 // for debugging, e.g., drawing the step in your UserSteppingAction,
52 // since G4Steps are not kept.
53 //
54 // Note: "permanent" objects, i.e., objects which are always
55 // available, such as detector geometry components, or available in an
56 // event after tracking has finished, such as hits, digitisations and
57 // trajectories, can be drawn in a transient way if you wish but it is
58 // usually possible to draw them in a permanent way with /vis/
59 // commands. The advantage is that permanent objects can be redrawn,
60 // e.g., when you change view or viewer; transient objects get
61 // forgotten. Also, it is possible to write a G4VUserVisAction class
62 // and register it to "promote" your Draw messages to "permanent" -
63 // see documentation.
64 //
65 // Note that the G4Transform3D argument refers to the transformation
66 // of the *object*, not the transformation of the coordinate syste.
67 //
68 // Note also that where a G4VisAttributes argument is specified, it
69 // overrides any attributes belonging to the object itself.
70 
71 #ifndef G4VVISMANAGER_HH
72 #define G4VVISMANAGER_HH
73 
74 #include "G4Transform3D.hh"
75 #include "G4ThreeVector.hh" // Just a typedef Hep3Vector.
76 #include "G4RotationMatrix.hh" // Just a typedef HepRotation.
77 
78 class G4Polyline;
79 class G4Text;
80 class G4Circle;
81 class G4Scale;
82 class G4Square;
83 class G4Polymarker;
84 class G4Polyhedron;
85 class G4VSolid;
86 class G4VHit;
87 class G4VDigi;
88 class G4VTrajectory;
89 class G4LogicalVolume;
90 class G4VPhysicalVolume;
91 class G4VisAttributes;
92 
94 
95 public: // With description
96 
98  // Returns pointer to actual visualization manager if a view is
99  // available for drawing, else returns null. Always check value.
100 
101 public:
102 
103  virtual ~G4VVisManager ();
104 
105 public: // With description
106 
108  // Draw methods for Geant4 Visualization Primitives, useful
109  // for representing hits, digis, etc.
110 
111  virtual void Draw (const G4Circle&,
112  const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
113 
114  virtual void Draw (const G4Polyhedron&,
115  const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
116 
117  virtual void Draw (const G4Polyline&,
118  const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
119 
120  virtual void Draw (const G4Polymarker&,
121  const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
122 
123  virtual void Draw (const G4Scale&,
124  const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
125 
126  virtual void Draw (const G4Square&,
127  const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
128 
129  virtual void Draw (const G4Text&,
130  const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
131 
133  // For 2D methods, the x,y coordinates are interpreted as screen
134  // coordinates, -1 < x,y < 1. The z-coordinate is ignored.
135 
136  virtual void Draw2D (const G4Circle&,
137  const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
138 
139  virtual void Draw2D (const G4Polyhedron&,
140  const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
141 
142  virtual void Draw2D (const G4Polyline&,
143  const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
144 
145  virtual void Draw2D (const G4Polymarker&,
146  const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
147 
148  virtual void Draw2D (const G4Square&,
149  const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
150 
151  virtual void Draw2D (const G4Text&,
152  const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
153 
155  // Draw methods for Geant4 Objects as if they were Visualization
156  // Primitives. Note that the visualization attributes needed in
157  // some cases override any visualization attributes that are
158  // associated with the object itself - thus you can, for example,
159  // change the colour of a physical volume.
160 
161  virtual void Draw (const G4VTrajectory&) = 0;
162 
163  virtual void Draw (const G4VHit&) = 0;
164 
165  virtual void Draw (const G4VDigi&) = 0;
166 
167  virtual void Draw (const G4LogicalVolume&, const G4VisAttributes&,
168  const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
169 
170  virtual void Draw (const G4VPhysicalVolume&, const G4VisAttributes&,
171  const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
172 
173  virtual void Draw (const G4VSolid&, const G4VisAttributes&,
174  const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
175 
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 
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 
215  virtual G4bool FilterTrajectory(const G4VTrajectory&) = 0;
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 
231 protected:
232 
233  static void SetConcreteInstance (G4VVisManager*);
234 
235  static G4VVisManager* fpConcreteInstance; // Pointer to real G4VisManager.
236 };
237 
238 #endif
virtual void Draw(const G4Circle &, const G4Transform3D &objectTransformation=G4Transform3D())=0
virtual void GeometryHasChanged()=0
virtual G4bool FilterTrajectory(const G4VTrajectory &)=0
Definition: G4Text.hh:73
static G4VVisManager * GetConcreteInstance()
Definition: G4VHit.hh:48
virtual ~G4VVisManager()
virtual void EndDraw2D()=0
virtual G4bool FilterHit(const G4VHit &)=0
virtual void IgnoreStateChanges(G4bool)
bool G4bool
Definition: G4Types.hh:79
virtual void EndDraw()=0
virtual void BeginDraw2D(const G4Transform3D &objectTransformation=G4Transform3D())=0
static G4VVisManager * fpConcreteInstance
virtual void BeginDraw(const G4Transform3D &objectTransformation=G4Transform3D())=0
HepGeom::Transform3D G4Transform3D
virtual void DispatchToModel(const G4VTrajectory &)=0
virtual void NotifyHandlers()
virtual G4bool FilterDigi(const G4VDigi &)=0
virtual void Draw2D(const G4Circle &, const G4Transform3D &objectTransformation=G4Transform3D())=0
static void SetConcreteInstance(G4VVisManager *)