Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // 27 // John Allison 19th July 1996 27 // John Allison 19th July 1996 28 // 28 // 29 // Class Description: 29 // Class Description: 30 // Abstract interface class for a graphics sce 30 // Abstract interface class for a graphics scene handler. 31 // It is a minimal scene handler for the GEANT 31 // It is a minimal scene handler for the GEANT4 kernel. 32 // See G4VSceneHandler for a fuller descriptio 32 // See G4VSceneHandler for a fuller description. G4VSceneHandler is 33 // the full abstract interface to graphics sys 33 // the full abstract interface to graphics systems. 34 34 35 #ifndef G4VGRAPHICSSCENE_HH 35 #ifndef G4VGRAPHICSSCENE_HH 36 #define G4VGRAPHICSSCENE_HH 36 #define G4VGRAPHICSSCENE_HH 37 37 38 #include "globals.hh" 38 #include "globals.hh" 39 #include "G4Transform3D.hh" 39 #include "G4Transform3D.hh" 40 40 41 class G4VisAttributes; 41 class G4VisAttributes; 42 class G4VSolid; 42 class G4VSolid; 43 class G4Box; 43 class G4Box; 44 class G4Cons; 44 class G4Cons; 45 class G4Orb; 45 class G4Orb; 46 class G4Para; 46 class G4Para; 47 class G4Torus; 47 class G4Torus; 48 class G4Trap; 48 class G4Trap; 49 class G4Trd; 49 class G4Trd; 50 class G4Tubs; 50 class G4Tubs; 51 class G4Sphere; 51 class G4Sphere; 52 52 53 class G4Ellipsoid; 53 class G4Ellipsoid; 54 class G4Polycone; 54 class G4Polycone; 55 class G4Polyhedra; 55 class G4Polyhedra; 56 class G4TessellatedSolid; 56 class G4TessellatedSolid; 57 57 58 class G4PhysicalVolumeModel; 58 class G4PhysicalVolumeModel; 59 class G4VTrajectory; 59 class G4VTrajectory; 60 class G4VHit; 60 class G4VHit; 61 class G4VDigi; 61 class G4VDigi; 62 template <typename T> class G4THitsMap; 62 template <typename T> class G4THitsMap; 63 class G4Polyline; 63 class G4Polyline; 64 class G4Text; 64 class G4Text; 65 class G4Circle; 65 class G4Circle; 66 class G4Square; 66 class G4Square; 67 class G4Polymarker; 67 class G4Polymarker; 68 class G4Polyhedron; 68 class G4Polyhedron; 69 class G4VisExtent; 69 class G4VisExtent; 70 class G4StatDouble; 70 class G4StatDouble; 71 class G4Mesh; 71 class G4Mesh; 72 class G4Plotter; 72 class G4Plotter; 73 73 74 class G4VGraphicsScene { 74 class G4VGraphicsScene { 75 75 76 public: // With description 76 public: // With description 77 77 78 G4VGraphicsScene(); 78 G4VGraphicsScene(); 79 virtual ~G4VGraphicsScene(); 79 virtual ~G4VGraphicsScene(); 80 80 81 //////////////////////////////////////////// 81 /////////////////////////////////////////////////////////////////// 82 // Methods for adding solids to the scene ha 82 // Methods for adding solids to the scene handler. They 83 // must always be called in the triplet PreA 83 // must always be called in the triplet PreAddSolid, AddSolid and 84 // PostAddSolid. The transformation and vis 84 // PostAddSolid. The transformation and visualization attributes 85 // must be set by the call to PreAddSolid. 85 // must be set by the call to PreAddSolid. A possible default 86 // implementation is to request the solid to 86 // implementation is to request the solid to provide a G4Polyhedron 87 // or similar primitive - see, for example, 87 // or similar primitive - see, for example, G4VSceneHandler in the 88 // Visualization Category. 88 // Visualization Category. 89 89 90 virtual void PreAddSolid (const G4Transform3 90 virtual void PreAddSolid (const G4Transform3D& objectTransformation, 91 const G4VisAttribu 91 const G4VisAttributes& visAttribs) = 0; 92 // objectTransformation is the transformatio 92 // objectTransformation is the transformation in the world 93 // coordinate system of the object about to 93 // coordinate system of the object about to be added, and 94 // visAttribs is its visualization attribute 94 // visAttribs is its visualization attributes. 95 95 96 virtual void PostAddSolid () = 0; 96 virtual void PostAddSolid () = 0; 97 97 98 // From geometry/solids/CSG 98 // From geometry/solids/CSG 99 virtual void AddSolid (const G4Box&) = 99 virtual void AddSolid (const G4Box&) = 0; 100 virtual void AddSolid (const G4Cons&) = 100 virtual void AddSolid (const G4Cons&) = 0; 101 virtual void AddSolid (const G4Orb&) = 101 virtual void AddSolid (const G4Orb&) = 0; 102 virtual void AddSolid (const G4Para&) = 102 virtual void AddSolid (const G4Para&) = 0; 103 virtual void AddSolid (const G4Sphere&) = 103 virtual void AddSolid (const G4Sphere&) = 0; 104 virtual void AddSolid (const G4Torus&) = 104 virtual void AddSolid (const G4Torus&) = 0; 105 virtual void AddSolid (const G4Trap&) = 105 virtual void AddSolid (const G4Trap&) = 0; 106 virtual void AddSolid (const G4Trd&) = 106 virtual void AddSolid (const G4Trd&) = 0; 107 virtual void AddSolid (const G4Tubs&) = 107 virtual void AddSolid (const G4Tubs&) = 0; 108 108 109 // From geometry/solids/specific 109 // From geometry/solids/specific 110 virtual void AddSolid (const G4Ellipsoid&) 110 virtual void AddSolid (const G4Ellipsoid&) = 0; 111 virtual void AddSolid (const G4Polycone&) 111 virtual void AddSolid (const G4Polycone&) = 0; 112 virtual void AddSolid (const G4Polyhedra&) 112 virtual void AddSolid (const G4Polyhedra&) = 0; 113 virtual void AddSolid (const G4TessellatedSo 113 virtual void AddSolid (const G4TessellatedSolid&) = 0; 114 114 115 // For solids not above 115 // For solids not above 116 virtual void AddSolid (const G4VSolid&) = 0; 116 virtual void AddSolid (const G4VSolid&) = 0; 117 117 118 //////////////////////////////////////////// 118 /////////////////////////////////////////////////////////////////// 119 // Methods for adding "compound" GEANT4 obje 119 // Methods for adding "compound" GEANT4 objects to the scene 120 // handler. These methods may either (a) in 120 // handler. These methods may either (a) invoke "user code" that 121 // uses the "user interface", G4VVisManager 121 // uses the "user interface", G4VVisManager (see, for example, 122 // G4VSceneHandler in the Visualization Cate 122 // G4VSceneHandler in the Visualization Category, which for 123 // trajectories uses G4VTrajectory::DrawTraj 123 // trajectories uses G4VTrajectory::DrawTrajectory, via 124 // G4TrajectoriesModel in the Modeling Categ 124 // G4TrajectoriesModel in the Modeling Category) or (b) invoke 125 // AddPrimitives below (between calls to Beg 125 // AddPrimitives below (between calls to Begin/EndPrimitives) or (c) 126 // use graphics-system-specific code or (d) 126 // use graphics-system-specific code or (d) any combination of the 127 // above. 127 // above. 128 128 129 virtual void AddCompound (const G4VTrajector 129 virtual void AddCompound (const G4VTrajectory&) = 0; 130 virtual void AddCompound (const G4VHit&) 130 virtual void AddCompound (const G4VHit&) = 0; 131 virtual void AddCompound (const G4VDigi&) 131 virtual void AddCompound (const G4VDigi&) = 0; 132 virtual void AddCompound (const G4THitsMap<G 132 virtual void AddCompound (const G4THitsMap<G4double>&) = 0; 133 virtual void AddCompound (const G4THitsMap<G 133 virtual void AddCompound (const G4THitsMap<G4StatDouble>&) = 0; 134 virtual void AddCompound (const G4Mesh&) 134 virtual void AddCompound (const G4Mesh&) = 0; 135 135 136 //////////////////////////////////////////// 136 /////////////////////////////////////////////////////////////////// 137 // Methods for adding graphics primitives to 137 // Methods for adding graphics primitives to the scene handler. A 138 // sequence of calls to AddPrimitive must be 138 // sequence of calls to AddPrimitive must be sandwiched between 139 // calls to BeginPrimitives and EndPrimitive 139 // calls to BeginPrimitives and EndPrimitives. A sequence is any 140 // number of calls that have the same transf 140 // number of calls that have the same transformation. 141 141 142 virtual void BeginPrimitives 142 virtual void BeginPrimitives 143 (const G4Transform3D& objectTransformation = 143 (const G4Transform3D& objectTransformation = G4Transform3D()) = 0; 144 // objectTransformation is the transformatio 144 // objectTransformation is the transformation in the world 145 // coordinate system of the object about to 145 // coordinate system of the object about to be added. 146 146 147 virtual void EndPrimitives () = 0; 147 virtual void EndPrimitives () = 0; 148 148 149 virtual void BeginPrimitives2D 149 virtual void BeginPrimitives2D 150 (const G4Transform3D& objectTransformation = 150 (const G4Transform3D& objectTransformation = G4Transform3D()) = 0; 151 151 152 virtual void EndPrimitives2D () = 0; 152 virtual void EndPrimitives2D () = 0; 153 // The x,y coordinates of the primitives pas 153 // The x,y coordinates of the primitives passed to AddPrimitive are 154 // intrepreted as screen coordinates, -1 < x 154 // intrepreted as screen coordinates, -1 < x,y < 1. The 155 // z-coordinate is ignored. 155 // z-coordinate is ignored. 156 156 157 virtual void AddPrimitive (const G4Polyline& 157 virtual void AddPrimitive (const G4Polyline&) = 0; 158 virtual void AddPrimitive (const G4Text&) 158 virtual void AddPrimitive (const G4Text&) = 0; 159 virtual void AddPrimitive (const G4Circle&) 159 virtual void AddPrimitive (const G4Circle&) = 0; 160 virtual void AddPrimitive (const G4Square&) 160 virtual void AddPrimitive (const G4Square&) = 0; 161 virtual void AddPrimitive (const G4Polymarke 161 virtual void AddPrimitive (const G4Polymarker&) = 0; 162 virtual void AddPrimitive (const G4Polyhedro 162 virtual void AddPrimitive (const G4Polyhedron&) = 0; 163 virtual void AddPrimitive (const G4Plotter&) 163 virtual void AddPrimitive (const G4Plotter&) = 0; 164 164 165 virtual const G4VisExtent& GetExtent() const 165 virtual const G4VisExtent& GetExtent() const; 166 // The concrete class should overload this o 166 // The concrete class should overload this or a null extent will be returned. 167 // See G4VScenHandler for example. 167 // See G4VScenHandler for example. 168 168 169 }; 169 }; 170 170 171 #endif 171 #endif 172 172