source: trunk/source/visualization/XXX/include/G4XXXSGSceneHandler.hh@ 1347

Last change on this file since 1347 was 1347, checked in by garnier, 15 years ago

geant4 tag 9.4

File size: 5.6 KB
Line 
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.4 2009/10/21 15:28:53 allison Exp $
28// GEANT4 tag $Name: geant4-09-04-ref-00 $
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
44class G4XXXSGSceneHandler: public G4VSceneHandler {
45
46 friend class G4XXXSGViewer;
47
48public:
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 AddCompound(const G4THitsMap<G4double>&);
83 void PreAddSolid(const G4Transform3D& objectTransformation,
84 const G4VisAttributes&);
85 void PostAddSolid();
86
87 ////////////////////////////////////////////////////////////////
88 // Required implementation of pure virtual functions...
89
90 void AddPrimitive(const G4Polyline&);
91 void AddPrimitive(const G4Text&);
92 void AddPrimitive(const G4Circle&);
93 void AddPrimitive(const G4Square&);
94 void AddPrimitive(const G4Polyhedron&);
95 void AddPrimitive(const G4NURBS&);
96 // Further optional AddPrimitive methods. Explicitly invoke base
97 // class methods if not otherwise defined to avoid warnings about
98 // hiding of base class methods.
99 void AddPrimitive(const G4Polymarker& polymarker)
100 {G4VSceneHandler::AddPrimitive (polymarker);}
101 void AddPrimitive(const G4Scale& scale)
102 {G4VSceneHandler::AddPrimitive (scale);}
103 // Further related optional virtual functions...
104 void BeginPrimitives(const G4Transform3D& objectTransformation);
105 void EndPrimitives();
106
107 ////////////////////////////////////////////////////////////////
108 // Further optional virtual functions...
109
110 // void BeginModeling();
111 // void EndModeling();
112
113 //////////////////////////////////////////////////////////////
114 // Administration functions.
115
116 void ClearStore ();
117 void ClearTransientStore ();
118
119protected:
120
121 static G4int fSceneIdCount; // Counter for XXXSG scene handlers.
122
123 // Utility for PreAddSolid and BeginPrimitives.
124 void CreateCurrentItem(const G4String&);
125
126 //?? Define the scene graph. (For emulation, a tree class by Troy
127 //?? A. Johnson, tajohnson@ieee.orglist. Unfortunately, it does
128 //?? not compile with SUN CC, hence #ifdef G4VIS_BUILD_XXXSG_DRIVER.)
129 typedef taj::tree<G4String> SceneGraph;
130 typedef taj::tree<G4String>::iterator SceneGraphIterator;
131 SceneGraph fSceneGraph;
132 SceneGraphIterator fRoot, fPermanentsRoot, fTransientsRoot, fCurrentItem;
133
134 // Keep track of mothers...
135 std::map<const G4LogicalVolume*,SceneGraphIterator> fLVMap;
136 typedef std::map<const G4LogicalVolume*,SceneGraphIterator>::iterator
137 LVMapIterator;
138
139private:
140
141#ifdef G4XXXFileDEBUG
142 void PrintThings();
143#endif
144
145};
146
147#endif
148
149#endif
Note: See TracBrowser for help on using the repository browser.