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 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  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 G4Square;
 81 class G4Polymarker;
 82 class G4Polyhedron;
 83 class G4VSolid;
 84 class G4VHit;
 85 class G4VDigi;
 86 class G4VTrajectory;
 87 class G4LogicalVolume;
 88 class G4VPhysicalVolume;
 89 class G4VisAttributes;
 90 class G4Event;
 91 
 92 class G4VVisManager {
 93 
 94 public: // With description
 95 
 96   static G4VVisManager* GetConcreteInstance ();
 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 
107   ///////////////////////////////////////////////////////////////////////
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 G4Square&,
124     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
125 
126   virtual void Draw (const G4Text&,
127     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
128 
129   ///////////////////////////////////////////////////////////////////////
130   // For 2D methods, the x,y coordinates are interpreted as screen
131   // coordinates, -1 < x,y < 1.  The z-coordinate is ignored.
132 
133   virtual void Draw2D (const G4Circle&,
134     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
135 
136   virtual void Draw2D (const G4Polyhedron&,
137     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
138 
139   virtual void Draw2D (const G4Polyline&,
140     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
141 
142   virtual void Draw2D (const G4Polymarker&,
143     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
144 
145   virtual void Draw2D (const G4Square&,
146     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
147 
148   virtual void Draw2D (const G4Text&,
149     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
150 
151   ///////////////////////////////////////////////////////////////////////
152   // Draw methods for Geant4 Objects as if they were Visualization
153   // Primitives.  Note that the visualization attributes needed in
154   // some cases override any visualization attributes that are
155   // associated with the object itself - thus you can, for example,
156   // change the colour of a physical volume.
157 
158   virtual void Draw (const G4VTrajectory&) = 0;
159 
160   virtual void Draw (const G4VHit&) = 0;
161 
162   virtual void Draw (const G4VDigi&) = 0;
163 
164   virtual void Draw (const G4LogicalVolume&, const G4VisAttributes&,
165     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
166 
167   virtual void Draw (const G4VPhysicalVolume&, const G4VisAttributes&,
168     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
169 
170   virtual void Draw (const G4VSolid&, const G4VisAttributes&,
171     const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
172 
173   virtual void DrawGeometry
174   (G4VPhysicalVolume*, const G4Transform3D& t = G4Transform3D());
175   // Draws a geometry tree starting at the specified physical volume.
176 
177   //////////////////////////////////////////////////////////////////////
178   // Optional methods that you may use to bracket a series of Draw
179   // messages that have identical objectTransformation to improve
180   // drawing speed.  Use Begin/EndDraw for a series of Draw messages,
181   // Begin/EndDraw2D for a series of Draw2D messages.  Do not mix Draw
182   // and Draw2D messages.
183 
184   virtual void BeginDraw
185   (const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
186 
187   virtual void EndDraw () = 0;
188 
189   virtual void BeginDraw2D
190   (const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
191 
192   virtual void EndDraw2D () = 0;
193 
194   //////////////////////////////////////////////////////////////////////
195   // Other methods...
196 
197   virtual void GeometryHasChanged () = 0;
198   // This is used by the run manager to notify a change of geometry.
199 
200   virtual void IgnoreStateChanges(G4bool);
201   // This method shoud be invoked by a class that has its own event loop,
202   // such as the RayTracer, material scanner, etc. If the argument is true,
203   // the following state changes among Idle, GeomClosed and EventProc are
204   // caused by such a class, and thus not by the ordinary event simulation.
205   // The same method with false should be invoked once such an event loop
206   // is over.
207 
208   virtual void NotifyHandlers () {}
209   // Notify scene handlers (G4VGraphicsScene objects) that the scene
210   // has changed so that they may rebuild their graphics database, if
211   // any, and redraw all views.
212 
213   virtual void DispatchToModel(const G4VTrajectory&) = 0;
214   // Draw the trajectory.
215 
216   virtual G4bool FilterTrajectory(const G4VTrajectory&) = 0;
217   // Trajectory filter
218 
219   virtual G4bool FilterHit(const G4VHit&) = 0;
220   // Hit filter
221 
222   virtual G4bool FilterDigi(const G4VDigi&) = 0;
223   // Digi filter
224 
225   virtual void SetUpForAThread() {}
226   // This method is invoked by G4WorkerRunManager
227 
228   virtual void EventReadyForVis(const G4Event*) {}
229   // This is invoked by G4SubEvtRunManager
230 
231 protected:
232 
233   static void SetConcreteInstance (G4VVisManager*);
234 
235   static G4VVisManager* fpConcreteInstance;  // Pointer to real G4VisManager.
236 
237 };
238 
239 #endif
240