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: G4XXXSGSceneHandler.hh,v 1.3 2006/06/29 21:26:56 gunter Exp $ |
---|
28 | // GEANT4 tag $Name: HEAD $ |
---|
29 | // |
---|
30 | // |
---|
31 | // John Allison 10th March 2006 |
---|
32 | // A template for a sophisticated graphics driver with a scene graph. |
---|
33 | //?? Lines beginning like this require specialisation for your driver. |
---|
34 | |
---|
35 | #ifdef G4VIS_BUILD_XXXSG_DRIVER |
---|
36 | |
---|
37 | #ifndef G4XXXSGSCENEHANDLER_HH |
---|
38 | #define G4XXXSGSCENEHANDLER_HH |
---|
39 | |
---|
40 | #include "G4VSceneHandler.hh" |
---|
41 | |
---|
42 | #include "tree/tree.h" |
---|
43 | |
---|
44 | class G4XXXSGSceneHandler: public G4VSceneHandler { |
---|
45 | |
---|
46 | friend class G4XXXSGViewer; |
---|
47 | |
---|
48 | public: |
---|
49 | G4XXXSGSceneHandler(G4VGraphicsSystem& system, |
---|
50 | const G4String& name); |
---|
51 | virtual ~G4XXXSGSceneHandler(); |
---|
52 | |
---|
53 | //////////////////////////////////////////////////////////////// |
---|
54 | // Optional virtual functions... |
---|
55 | void AddSolid(const G4Box&); |
---|
56 | // Further optional AddSolid functions. Explicitly invoke base |
---|
57 | // class methods if not otherwise defined to avoid warnings about |
---|
58 | // hiding of base class methods. |
---|
59 | void AddSolid(const G4Cons& cons) |
---|
60 | {G4VSceneHandler::AddSolid(cons);} |
---|
61 | void AddSolid(const G4Tubs& tubs) |
---|
62 | {G4VSceneHandler::AddSolid(tubs);} |
---|
63 | void AddSolid(const G4Trd& trd) |
---|
64 | {G4VSceneHandler::AddSolid(trd);} |
---|
65 | void AddSolid(const G4Trap& trap) |
---|
66 | {G4VSceneHandler::AddSolid(trap);} |
---|
67 | void AddSolid(const G4Sphere& sphere) |
---|
68 | {G4VSceneHandler::AddSolid(sphere);} |
---|
69 | void AddSolid(const G4Para& para) |
---|
70 | {G4VSceneHandler::AddSolid(para);} |
---|
71 | void AddSolid(const G4Torus& torus) |
---|
72 | {G4VSceneHandler::AddSolid(torus);} |
---|
73 | void AddSolid(const G4Polycone& polycone) |
---|
74 | {G4VSceneHandler::AddSolid(polycone);} |
---|
75 | void AddSolid(const G4Polyhedra& polyhedra) |
---|
76 | {G4VSceneHandler::AddSolid(polyhedra);} |
---|
77 | void AddSolid(const G4VSolid& solid) |
---|
78 | {G4VSceneHandler::AddSolid(solid);} |
---|
79 | // More optional functions... |
---|
80 | // void AddCompound(const G4VTrajectory&); |
---|
81 | // void AddCompound(const G4VHit&); |
---|
82 | void PreAddSolid(const G4Transform3D& objectTransformation, |
---|
83 | const G4VisAttributes&); |
---|
84 | void PostAddSolid(); |
---|
85 | |
---|
86 | //////////////////////////////////////////////////////////////// |
---|
87 | // Required implementation of pure virtual functions... |
---|
88 | |
---|
89 | void AddPrimitive(const G4Polyline&); |
---|
90 | void AddPrimitive(const G4Text&); |
---|
91 | void AddPrimitive(const G4Circle&); |
---|
92 | void AddPrimitive(const G4Square&); |
---|
93 | void AddPrimitive(const G4Polyhedron&); |
---|
94 | void AddPrimitive(const G4NURBS&); |
---|
95 | // Further optional AddPrimitive methods. Explicitly invoke base |
---|
96 | // class methods if not otherwise defined to avoid warnings about |
---|
97 | // hiding of base class methods. |
---|
98 | void AddPrimitive(const G4Polymarker& polymarker) |
---|
99 | {G4VSceneHandler::AddPrimitive (polymarker);} |
---|
100 | void AddPrimitive(const G4Scale& scale) |
---|
101 | {G4VSceneHandler::AddPrimitive (scale);} |
---|
102 | // Further related optional virtual functions... |
---|
103 | void BeginPrimitives(const G4Transform3D& objectTransformation); |
---|
104 | void EndPrimitives(); |
---|
105 | |
---|
106 | //////////////////////////////////////////////////////////////// |
---|
107 | // Further optional virtual functions... |
---|
108 | |
---|
109 | // void BeginModeling(); |
---|
110 | // void EndModeling(); |
---|
111 | |
---|
112 | ////////////////////////////////////////////////////////////// |
---|
113 | // Administration functions. |
---|
114 | |
---|
115 | void ClearStore (); |
---|
116 | void ClearTransientStore (); |
---|
117 | |
---|
118 | protected: |
---|
119 | |
---|
120 | static G4int fSceneIdCount; // Counter for XXXSG scene handlers. |
---|
121 | |
---|
122 | // Utility for PreAddSolid and BeginPrimitives. |
---|
123 | void CreateCurrentItem(const G4String&); |
---|
124 | |
---|
125 | //?? Define the scene graph. (For emulation, a tree class by Troy |
---|
126 | //?? A. Johnson, tajohnson@ieee.orglist. Unfortunately, it does |
---|
127 | //?? not compile with SUN CC, hence #ifdef G4VIS_BUILD_XXXSG_DRIVER.) |
---|
128 | typedef taj::tree<G4String> SceneGraph; |
---|
129 | typedef taj::tree<G4String>::iterator SceneGraphIterator; |
---|
130 | SceneGraph fSceneGraph; |
---|
131 | SceneGraphIterator fRoot, fPermanentsRoot, fTransientsRoot, fCurrentItem; |
---|
132 | |
---|
133 | // Keep track of mothers... |
---|
134 | std::map<const G4LogicalVolume*,SceneGraphIterator> fLVMap; |
---|
135 | typedef std::map<const G4LogicalVolume*,SceneGraphIterator>::iterator |
---|
136 | LVMapIterator; |
---|
137 | |
---|
138 | private: |
---|
139 | |
---|
140 | #ifdef G4XXXFileDEBUG |
---|
141 | void PrintThings(); |
---|
142 | #endif |
---|
143 | |
---|
144 | }; |
---|
145 | |
---|
146 | #endif |
---|
147 | |
---|
148 | #endif |
---|