[834] | 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: G4XXXStoredSceneHandler.hh,v 1.3 2006/06/29 21:27:06 gunter Exp $ |
---|
[850] | 28 | // GEANT4 tag $Name: HEAD $ |
---|
[834] | 29 | // |
---|
| 30 | // |
---|
| 31 | // John Allison 7th March 2006 |
---|
| 32 | // A template for a graphics driver with a store/database. |
---|
| 33 | //?? Lines beginning like this require specialisation for your driver. |
---|
| 34 | |
---|
| 35 | #ifndef G4XXXStoredSCENEHANDLER_HH |
---|
| 36 | #define G4XXXStoredSCENEHANDLER_HH |
---|
| 37 | |
---|
| 38 | #include "G4VSceneHandler.hh" |
---|
| 39 | |
---|
| 40 | #include <list> |
---|
| 41 | |
---|
| 42 | class G4XXXStoredSceneHandler: public G4VSceneHandler { |
---|
| 43 | |
---|
| 44 | friend class G4XXXStoredViewer; |
---|
| 45 | |
---|
| 46 | public: |
---|
| 47 | G4XXXStoredSceneHandler(G4VGraphicsSystem& system, |
---|
| 48 | const G4String& name); |
---|
| 49 | virtual ~G4XXXStoredSceneHandler(); |
---|
| 50 | |
---|
| 51 | //////////////////////////////////////////////////////////////// |
---|
| 52 | // Optional virtual functions... |
---|
| 53 | void AddSolid(const G4Box&); |
---|
| 54 | // Further optional AddSolid functions. Explicitly invoke base |
---|
| 55 | // class methods if not otherwise defined to avoid warnings about |
---|
| 56 | // hiding of base class methods. |
---|
| 57 | void AddSolid(const G4Cons& cons) |
---|
| 58 | {G4VSceneHandler::AddSolid(cons);} |
---|
| 59 | void AddSolid(const G4Tubs& tubs) |
---|
| 60 | {G4VSceneHandler::AddSolid(tubs);} |
---|
| 61 | void AddSolid(const G4Trd& trd) |
---|
| 62 | {G4VSceneHandler::AddSolid(trd);} |
---|
| 63 | void AddSolid(const G4Trap& trap) |
---|
| 64 | {G4VSceneHandler::AddSolid(trap);} |
---|
| 65 | void AddSolid(const G4Sphere& sphere) |
---|
| 66 | {G4VSceneHandler::AddSolid(sphere);} |
---|
| 67 | void AddSolid(const G4Para& para) |
---|
| 68 | {G4VSceneHandler::AddSolid(para);} |
---|
| 69 | void AddSolid(const G4Torus& torus) |
---|
| 70 | {G4VSceneHandler::AddSolid(torus);} |
---|
| 71 | void AddSolid(const G4Polycone& polycone) |
---|
| 72 | {G4VSceneHandler::AddSolid(polycone);} |
---|
| 73 | void AddSolid(const G4Polyhedra& polyhedra) |
---|
| 74 | {G4VSceneHandler::AddSolid(polyhedra);} |
---|
| 75 | void AddSolid(const G4VSolid& solid) |
---|
| 76 | {G4VSceneHandler::AddSolid(solid);} |
---|
| 77 | // More optional functions... |
---|
| 78 | // void AddCompound(const G4VTrajectory&); |
---|
| 79 | // void AddCompound(const G4VHit&); |
---|
| 80 | void PreAddSolid(const G4Transform3D& objectTransformation, |
---|
| 81 | const G4VisAttributes&); |
---|
| 82 | void PostAddSolid(); |
---|
| 83 | |
---|
| 84 | //////////////////////////////////////////////////////////////// |
---|
| 85 | // Required implementation of pure virtual functions... |
---|
| 86 | |
---|
| 87 | void AddPrimitive(const G4Polyline&); |
---|
| 88 | void AddPrimitive(const G4Text&); |
---|
| 89 | void AddPrimitive(const G4Circle&); |
---|
| 90 | void AddPrimitive(const G4Square&); |
---|
| 91 | void AddPrimitive(const G4Polyhedron&); |
---|
| 92 | void AddPrimitive(const G4NURBS&); |
---|
| 93 | // Further optional AddPrimitive methods. Explicitly invoke base |
---|
| 94 | // class methods if not otherwise defined to avoid warnings about |
---|
| 95 | // hiding of base class methods. |
---|
| 96 | void AddPrimitive(const G4Polymarker& polymarker) |
---|
| 97 | {G4VSceneHandler::AddPrimitive (polymarker);} |
---|
| 98 | void AddPrimitive(const G4Scale& scale) |
---|
| 99 | {G4VSceneHandler::AddPrimitive (scale);} |
---|
| 100 | // Further related optional virtual functions... |
---|
| 101 | void BeginPrimitives(const G4Transform3D& objectTransformation); |
---|
| 102 | void EndPrimitives(); |
---|
| 103 | |
---|
| 104 | //////////////////////////////////////////////////////////////// |
---|
| 105 | // Further optional virtual functions... |
---|
| 106 | |
---|
| 107 | // void BeginModeling(); |
---|
| 108 | // void EndModeling(); |
---|
| 109 | |
---|
| 110 | ////////////////////////////////////////////////////////////// |
---|
| 111 | // Administration functions. |
---|
| 112 | |
---|
| 113 | void ClearStore (); |
---|
| 114 | void ClearTransientStore (); |
---|
| 115 | |
---|
| 116 | protected: |
---|
| 117 | |
---|
| 118 | static G4int fSceneIdCount; // Counter for XXXStored scene handlers. |
---|
| 119 | |
---|
| 120 | //?? Define a store for your graphics system. (For emulation, list |
---|
| 121 | //?? has good properties - removal of items is fast and does not |
---|
| 122 | //?? invalidate iterators to other elements.) |
---|
| 123 | typedef std::list<G4String> Store; |
---|
| 124 | typedef std::list<G4String>::iterator StoreIterator; |
---|
| 125 | Store fStore; |
---|
| 126 | StoreIterator fCurrentItem; |
---|
| 127 | |
---|
| 128 | // Keep track of which items are permanent, which transient... |
---|
| 129 | std::vector<StoreIterator> fPermanents; |
---|
| 130 | std::vector<StoreIterator> fTransients; |
---|
| 131 | |
---|
| 132 | private: |
---|
| 133 | |
---|
| 134 | #ifdef G4XXXFileDEBUG |
---|
| 135 | void PrintThings(); |
---|
| 136 | #endif |
---|
| 137 | |
---|
| 138 | }; |
---|
| 139 | |
---|
| 140 | #endif |
---|