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 // 00029 // 00030 // John Allison 7th March 2006 00031 // A template for a graphics driver with a store/database. 00032 //?? Lines beginning like this require specialisation for your driver. 00033 00034 #ifndef G4XXXStoredSCENEHANDLER_HH 00035 #define G4XXXStoredSCENEHANDLER_HH 00036 00037 #include "G4VSceneHandler.hh" 00038 00039 #include <list> 00040 00041 class G4XXXStoredSceneHandler: public G4VSceneHandler { 00042 00043 friend class G4XXXStoredViewer; 00044 00045 public: 00046 G4XXXStoredSceneHandler(G4VGraphicsSystem& system, 00047 const G4String& name); 00048 virtual ~G4XXXStoredSceneHandler(); 00049 00051 // Optional virtual functions... 00052 void AddSolid(const G4Box&); 00053 // Further optional AddSolid functions. Explicitly invoke base 00054 // class methods if not otherwise defined to avoid warnings about 00055 // hiding of base class methods. 00056 void AddSolid(const G4Cons& cons) 00057 {G4VSceneHandler::AddSolid(cons);} 00058 void AddSolid(const G4Tubs& tubs) 00059 {G4VSceneHandler::AddSolid(tubs);} 00060 void AddSolid(const G4Trd& trd) 00061 {G4VSceneHandler::AddSolid(trd);} 00062 void AddSolid(const G4Trap& trap) 00063 {G4VSceneHandler::AddSolid(trap);} 00064 void AddSolid(const G4Sphere& sphere) 00065 {G4VSceneHandler::AddSolid(sphere);} 00066 void AddSolid(const G4Para& para) 00067 {G4VSceneHandler::AddSolid(para);} 00068 void AddSolid(const G4Torus& torus) 00069 {G4VSceneHandler::AddSolid(torus);} 00070 void AddSolid(const G4Polycone& polycone) 00071 {G4VSceneHandler::AddSolid(polycone);} 00072 void AddSolid(const G4Polyhedra& polyhedra) 00073 {G4VSceneHandler::AddSolid(polyhedra);} 00074 void AddSolid(const G4VSolid& solid) 00075 {G4VSceneHandler::AddSolid(solid);} 00076 // More optional functions... 00077 // void AddCompound(const G4VTrajectory&); 00078 // void AddCompound(const G4VHit&); 00079 // void AddCompound(const G4THitsMap<G4double>&); 00080 void PreAddSolid(const G4Transform3D& objectTransformation, 00081 const G4VisAttributes&); 00082 void PostAddSolid(); 00083 00085 // Required implementation of pure virtual functions... 00086 00087 void AddPrimitive(const G4Polyline&); 00088 void AddPrimitive(const G4Text&); 00089 void AddPrimitive(const G4Circle&); 00090 void AddPrimitive(const G4Square&); 00091 void AddPrimitive(const G4Polyhedron&); 00092 void AddPrimitive(const G4NURBS&); 00093 // Further optional AddPrimitive methods. Explicitly invoke base 00094 // class methods if not otherwise defined to avoid warnings about 00095 // hiding of base class methods. 00096 void AddPrimitive(const G4Polymarker& polymarker) 00097 {G4VSceneHandler::AddPrimitive (polymarker);} 00098 void AddPrimitive(const G4Scale& scale) 00099 {G4VSceneHandler::AddPrimitive (scale);} 00100 // Further related optional virtual functions... 00101 void BeginPrimitives(const G4Transform3D& objectTransformation); 00102 void EndPrimitives(); 00103 00105 // Further optional virtual functions... 00106 00107 // void BeginModeling(); 00108 // void EndModeling(); 00109 00111 // Administration functions. 00112 00113 void ClearStore (); 00114 void ClearTransientStore (); 00115 00116 protected: 00117 00118 static G4int fSceneIdCount; // Counter for XXXStored scene handlers. 00119 00120 //?? Define a store for your graphics system. (For emulation, list 00121 //?? has good properties - removal of items is fast and does not 00122 //?? invalidate iterators to other elements.) 00123 typedef std::list<G4String> Store; 00124 typedef std::list<G4String>::iterator StoreIterator; 00125 Store fStore; 00126 StoreIterator fCurrentItem; 00127 00128 // Keep track of which items are permanent, which transient... 00129 std::vector<StoreIterator> fPermanents; 00130 std::vector<StoreIterator> fTransients; 00131 00132 private: 00133 00134 #ifdef G4XXXFileDEBUG 00135 void PrintThings(); 00136 #endif 00137 00138 }; 00139 00140 #endif