source: trunk/source/graphics_reps/include/G4VVisManager.hh@ 1030

Last change on this file since 1030 was 932, checked in by garnier, 17 years ago

John update

File size: 8.2 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: G4VVisManager.hh,v 1.15 2009/02/25 14:13:43 allison Exp $
28// GEANT4 tag $Name: $
29// John Allison 19/Oct/1996.
30//
31// Class Description:
32//
33// G4VVisManager is an abstract interface for the GEANT4 Visualization Manager.
34// The inheritance hierarchy is:
35// G4VVisManager <- G4VisManager <- G4VisExecutive
36//
37// You may also write your own vis manager in place of G4VisExecutive.
38//
39// See example/novice/N02 to see how and when to instantiate
40// G4VisExecutive (or your own vis manager). You should *not* access
41// it directly; instead you should obtain a pointer as follows:
42//
43// G4VVisManager* pVVMan = G4VVisManager::GetConcreteInstance ();
44//
45// This ensures your code will link even if G4VisExecutive is not
46// instantiated or even if not provided in a library. Please protect
47// your code by testing the pointer, for example, by:
48//
49// if (pVVMan) pVVMan -> Draw (polyline);
50//
51// The Draw functions draw only "transient" objects. This is useful
52// for debugging, e.g., drawing the step in your UserSteppingAction,
53// since G4Steps are not kept.
54//
55// Note: "permanent" objects, i.e., objects which are always
56// available, such as detector geometry components, or available in an
57// event after tracking has finished, such as hits, digitisations and
58// trajectories, can be drawn in a transient way if you wish but it is
59// usually possible to draw them in a permanent way with /vis/
60// commands. The advantage is that permanent objects can be redrawn,
61// e.g., when you change view or viewer; transient objects get
62// forgotten. Also, it is possible to write a G4VUserVisAction class
63// and register it to "promote" your Draw messages to "permanent" -
64// see documentation.
65//
66// Note that the G4Transform3D argument refers to the transformation
67// of the *object*, not the transformation of the coordinate syste.
68//
69// Note also that where a G4VisAttributes argument is specified, it
70// overrides any attributes belonging to the object itself.
71
72#ifndef G4VVISMANAGER_HH
73#define G4VVISMANAGER_HH
74
75#include "G4Transform3D.hh"
76#include "G4ThreeVector.hh" // Just a typedef Hep3Vector.
77#include "G4RotationMatrix.hh" // Just a typedef HepRotation.
78
79class G4Polyline;
80class G4Text;
81class G4Circle;
82class G4Scale;
83class G4Square;
84class G4Polymarker;
85class G4Polyhedron;
86class G4NURBS;
87class G4VSolid;
88class G4VHit;
89class G4VTrajectory;
90class G4LogicalVolume;
91class G4VPhysicalVolume;
92class G4VisAttributes;
93
94class G4VVisManager {
95
96public: // With description
97
98 static G4VVisManager* GetConcreteInstance ();
99 // Returns pointer to actual visualization manager if a view is
100 // available for drawing, else returns null. Always check value.
101
102public:
103
104 virtual ~G4VVisManager ();
105
106public: // With description
107
108 ///////////////////////////////////////////////////////////////////////
109 // Draw methods for Geant4 Visualization Primitives, useful
110 // for representing hits, digis, etc.
111
112 virtual void Draw (const G4Circle&,
113 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
114
115 virtual void Draw (const G4NURBS&,
116 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
117
118 virtual void Draw (const G4Polyhedron&,
119 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
120
121 virtual void Draw (const G4Polyline&,
122 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
123
124 virtual void Draw (const G4Polymarker&,
125 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
126
127 virtual void Draw (const G4Scale&,
128 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
129
130 virtual void Draw (const G4Square&,
131 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
132
133 virtual void Draw (const G4Text&,
134 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
135
136 ///////////////////////////////////////////////////////////////////////
137 // For 2D methods, the x,y coordinates are interpreted as screen
138 // coordinates, -1 < x,y < 1. The z-coordinate is ignored.
139
140 virtual void Draw2D (const G4Circle&,
141 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
142
143 virtual void Draw2D (const G4NURBS&,
144 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
145
146 virtual void Draw2D (const G4Polyhedron&,
147 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
148
149 virtual void Draw2D (const G4Polyline&,
150 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
151
152 virtual void Draw2D (const G4Polymarker&,
153 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
154
155 virtual void Draw2D (const G4Square&,
156 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
157
158 virtual void Draw2D (const G4Text&,
159 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
160
161 ///////////////////////////////////////////////////////////////////////
162 // Draw methods for Geant4 Objects as if they were Visualization
163 // Primitives. Note that the visualization attributes needed in
164 // some cases override any visualization attributes that are
165 // associated with the object itself - thus you can, for example,
166 // change the colour of a physical volume.
167
168 virtual void Draw (const G4VHit&) = 0;
169
170 virtual void Draw (const G4VTrajectory&, G4int i_mode = 0) = 0;
171 // i_mode is a parameter that can be used to control the drawing of
172 // the trajectory. See, e.g., G4TrajectoryDrawByCharge::Draw in the
173 // modeling sub-category. Its use is deprecated; use trajectory
174 // model commands instead.
175
176 virtual void Draw (const G4LogicalVolume&, const G4VisAttributes&,
177 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
178
179 virtual void Draw (const G4VPhysicalVolume&, const G4VisAttributes&,
180 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
181
182 virtual void Draw (const G4VSolid&, const G4VisAttributes&,
183 const G4Transform3D& objectTransformation = G4Transform3D()) = 0;
184
185 //////////////////////////////////////////////////////////////////////
186 // Other methods...
187
188 virtual void GeometryHasChanged () = 0;
189 // This is used by the run manager to notify a change of geometry.
190
191 virtual void NotifyHandlers () {}
192 // Notify scene handlers (G4VGraphicsScene objects) that the scene
193 // has changed so that they may rebuild their graphics database, if
194 // any, and redraw all views.
195
196 virtual void DispatchToModel(const G4VTrajectory&, G4int i_mode = 0) = 0;
197 // Draw the trajectory.
198
199 virtual G4bool FilterTrajectory(const G4VTrajectory&) = 0;
200 // Trajectory filter
201
202 virtual G4bool FilterHit(const G4VHit&) = 0;
203 // Hit filter
204
205protected:
206
207 static void SetConcreteInstance (G4VVisManager*);
208
209 static G4VVisManager* fpConcreteInstance; // Pointer to real G4VisManager.
210
211};
212
213#endif
Note: See TracBrowser for help on using the repository browser.