ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4VVisManager.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4VVisManager.hh
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 
77 class G4Polyline;
78 class G4Text;
79 class G4Circle;
80 class G4Scale;
81 class G4Square;
82 class G4Polymarker;
83 class G4Polyhedron;
84 class G4VSolid;
85 class G4VHit;
86 class G4VDigi;
87 class G4VTrajectory;
88 class G4LogicalVolume;
89 class G4VPhysicalVolume;
90 class G4VisAttributes;
91 
93 
94 public: // With description
95 
97  // Returns pointer to actual visualization manager if a view is
98  // available for drawing, else returns null. Always check value.
99 
100 public:
101 
102  G4VVisManager ();
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 
239 #endif