00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id$ 00028 // John Allison 19/Oct/1996. 00029 // 00030 // Class Description: 00031 // 00032 // G4VVisManager is an abstract interface for the GEANT4 Visualization Manager. 00033 // The inheritance hierarchy is: 00034 // G4VVisManager <- G4VisManager <- G4VisExecutive 00035 // 00036 // You may also write your own vis manager in place of G4VisExecutive. 00037 // 00038 // See example/novice/N02 to see how and when to instantiate 00039 // G4VisExecutive (or your own vis manager). You should *not* access 00040 // it directly; instead you should obtain a pointer as follows: 00041 // 00042 // G4VVisManager* pVVMan = G4VVisManager::GetConcreteInstance (); 00043 // 00044 // This ensures your code will link even if G4VisExecutive is not 00045 // instantiated or even if not provided in a library. Please protect 00046 // your code by testing the pointer, for example, by: 00047 // 00048 // if (pVVMan) pVVMan -> Draw (polyline); 00049 // 00050 // The Draw functions draw only "transient" objects. This is useful 00051 // for debugging, e.g., drawing the step in your UserSteppingAction, 00052 // since G4Steps are not kept. 00053 // 00054 // Note: "permanent" objects, i.e., objects which are always 00055 // available, such as detector geometry components, or available in an 00056 // event after tracking has finished, such as hits, digitisations and 00057 // trajectories, can be drawn in a transient way if you wish but it is 00058 // usually possible to draw them in a permanent way with /vis/ 00059 // commands. The advantage is that permanent objects can be redrawn, 00060 // e.g., when you change view or viewer; transient objects get 00061 // forgotten. Also, it is possible to write a G4VUserVisAction class 00062 // and register it to "promote" your Draw messages to "permanent" - 00063 // see documentation. 00064 // 00065 // Note that the G4Transform3D argument refers to the transformation 00066 // of the *object*, not the transformation of the coordinate syste. 00067 // 00068 // Note also that where a G4VisAttributes argument is specified, it 00069 // overrides any attributes belonging to the object itself. 00070 00071 #ifndef G4VVISMANAGER_HH 00072 #define G4VVISMANAGER_HH 00073 00074 #include "G4Transform3D.hh" 00075 #include "G4ThreeVector.hh" // Just a typedef Hep3Vector. 00076 #include "G4RotationMatrix.hh" // Just a typedef HepRotation. 00077 00078 class G4Polyline; 00079 class G4Text; 00080 class G4Circle; 00081 class G4Scale; 00082 class G4Square; 00083 class G4Polymarker; 00084 class G4Polyhedron; 00085 class G4NURBS; 00086 class G4VSolid; 00087 class G4VHit; 00088 class G4VDigi; 00089 class G4VTrajectory; 00090 class G4LogicalVolume; 00091 class G4VPhysicalVolume; 00092 class G4VisAttributes; 00093 00094 class G4VVisManager { 00095 00096 public: // With description 00097 00098 static G4VVisManager* GetConcreteInstance (); 00099 // Returns pointer to actual visualization manager if a view is 00100 // available for drawing, else returns null. Always check value. 00101 00102 public: 00103 00104 virtual ~G4VVisManager (); 00105 00106 public: // With description 00107 00109 // Draw methods for Geant4 Visualization Primitives, useful 00110 // for representing hits, digis, etc. 00111 00112 virtual void Draw (const G4Circle&, 00113 const G4Transform3D& objectTransformation = G4Transform3D()) = 0; 00114 00115 virtual void Draw (const G4NURBS&, 00116 const G4Transform3D& objectTransformation = G4Transform3D()) = 0; 00117 00118 virtual void Draw (const G4Polyhedron&, 00119 const G4Transform3D& objectTransformation = G4Transform3D()) = 0; 00120 00121 virtual void Draw (const G4Polyline&, 00122 const G4Transform3D& objectTransformation = G4Transform3D()) = 0; 00123 00124 virtual void Draw (const G4Polymarker&, 00125 const G4Transform3D& objectTransformation = G4Transform3D()) = 0; 00126 00127 virtual void Draw (const G4Scale&, 00128 const G4Transform3D& objectTransformation = G4Transform3D()) = 0; 00129 00130 virtual void Draw (const G4Square&, 00131 const G4Transform3D& objectTransformation = G4Transform3D()) = 0; 00132 00133 virtual void Draw (const G4Text&, 00134 const G4Transform3D& objectTransformation = G4Transform3D()) = 0; 00135 00137 // For 2D methods, the x,y coordinates are interpreted as screen 00138 // coordinates, -1 < x,y < 1. The z-coordinate is ignored. 00139 00140 virtual void Draw2D (const G4Circle&, 00141 const G4Transform3D& objectTransformation = G4Transform3D()) = 0; 00142 00143 virtual void Draw2D (const G4NURBS&, 00144 const G4Transform3D& objectTransformation = G4Transform3D()) = 0; 00145 00146 virtual void Draw2D (const G4Polyhedron&, 00147 const G4Transform3D& objectTransformation = G4Transform3D()) = 0; 00148 00149 virtual void Draw2D (const G4Polyline&, 00150 const G4Transform3D& objectTransformation = G4Transform3D()) = 0; 00151 00152 virtual void Draw2D (const G4Polymarker&, 00153 const G4Transform3D& objectTransformation = G4Transform3D()) = 0; 00154 00155 virtual void Draw2D (const G4Square&, 00156 const G4Transform3D& objectTransformation = G4Transform3D()) = 0; 00157 00158 virtual void Draw2D (const G4Text&, 00159 const G4Transform3D& objectTransformation = G4Transform3D()) = 0; 00160 00162 // Draw methods for Geant4 Objects as if they were Visualization 00163 // Primitives. Note that the visualization attributes needed in 00164 // some cases override any visualization attributes that are 00165 // associated with the object itself - thus you can, for example, 00166 // change the colour of a physical volume. 00167 00168 virtual void Draw (const G4VHit&) = 0; 00169 00170 virtual void Draw (const G4VDigi&) = 0; 00171 00172 virtual void Draw (const G4VTrajectory&, G4int i_mode = 0) = 0; 00173 // i_mode is a parameter that can be used to control the drawing of 00174 // the trajectory. See, e.g., G4TrajectoryDrawByCharge::Draw in the 00175 // modeling sub-category. Its use is deprecated; use trajectory 00176 // model commands instead. 00177 00178 virtual void Draw (const G4LogicalVolume&, const G4VisAttributes&, 00179 const G4Transform3D& objectTransformation = G4Transform3D()) = 0; 00180 00181 virtual void Draw (const G4VPhysicalVolume&, const G4VisAttributes&, 00182 const G4Transform3D& objectTransformation = G4Transform3D()) = 0; 00183 00184 virtual void Draw (const G4VSolid&, const G4VisAttributes&, 00185 const G4Transform3D& objectTransformation = G4Transform3D()) = 0; 00186 00188 // Optional methods that you may use to bracket a series of Draw 00189 // messages that have identical objectTransformation to improve 00190 // drawing speed. Use Begin/EndDraw for a series of Draw messages, 00191 // Begin/EndDraw2D for a series of Draw2D messages. Do not mix Draw 00192 // and Draw2D messages. 00193 00194 virtual void BeginDraw 00195 (const G4Transform3D& objectTransformation = G4Transform3D()) = 0; 00196 00197 virtual void EndDraw () = 0; 00198 00199 virtual void BeginDraw2D 00200 (const G4Transform3D& objectTransformation = G4Transform3D()) = 0; 00201 00202 virtual void EndDraw2D () = 0; 00203 00205 // Other methods... 00206 00207 virtual void GeometryHasChanged () = 0; 00208 // This is used by the run manager to notify a change of geometry. 00209 00210 virtual void NotifyHandlers () {} 00211 // Notify scene handlers (G4VGraphicsScene objects) that the scene 00212 // has changed so that they may rebuild their graphics database, if 00213 // any, and redraw all views. 00214 00215 virtual void DispatchToModel(const G4VTrajectory&) = 0; 00216 virtual void DispatchToModel(const G4VTrajectory&, G4int i_mode) = 0; 00217 // Draw the trajectory. 00218 00219 virtual G4bool FilterTrajectory(const G4VTrajectory&) = 0; 00220 // Trajectory filter 00221 00222 virtual G4bool FilterHit(const G4VHit&) = 0; 00223 // Hit filter 00224 00225 virtual G4bool FilterDigi(const G4VDigi&) = 0; 00226 // Digi filter 00227 00228 protected: 00229 00230 static void SetConcreteInstance (G4VVisManager*); 00231 00232 static G4VVisManager* fpConcreteInstance; // Pointer to real G4VisManager. 00233 }; 00234 00235 #endif