Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
G4XXXSceneHandler.cc
Go to the documentation of this file.
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$
28//
29//
30// John Allison 5th April 2001
31// A template for a simplest possible graphics driver.
32//?? Lines or sections marked like this require specialisation for your driver.
33
34#include "G4XXXSceneHandler.hh"
35
38#include "G4VPhysicalVolume.hh"
39#include "G4LogicalVolume.hh"
40#include "G4Polyline.hh"
41#include "G4Text.hh"
42#include "G4Circle.hh"
43#include "G4Square.hh"
44#include "G4Polyhedron.hh"
45#include "G4UnitsTable.hh"
46
48// Counter for XXX scene handlers.
49
51 const G4String& name):
52 G4VSceneHandler(system, fSceneIdCount++, name)
53{}
54
56
57#ifdef G4XXXDEBUG
58void G4XXXSceneHandler::PrintThings() {
59 G4cout <<
60 " with transformation "
61 << (void*)fpObjectTransformation;
62 if (fpModel) {
63 G4cout << " from " << fpModel->GetCurrentDescription()
64 << " (tag " << fpModel->GetCurrentTag()
65 << ')';
66 } else {
67 G4cout << "(not from a model)";
68 }
69 G4PhysicalVolumeModel* pPVModel =
70 dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
71 if (pPVModel) {
72 G4cout <<
73 "\n current physical volume: "
74 << pPVModel->GetCurrentPV()->GetName() <<
75 "\n current logical volume: "
76// There might be a problem with the LV pointer if this is a G4LogicalVolumeModel
77 << pPVModel->GetCurrentLV()->GetName() <<
78 "\n current depth of geometry tree: "
79 << pPVModel->GetCurrentDepth();
80 }
81 G4cout << G4endl;
82}
83#endif
84
86#ifdef G4XXXDEBUG
87 polyline
88#endif
89) {
90#ifdef G4XXXDEBUG
91 G4cout <<
92 "G4XXXSceneHandler::AddPrimitive(const G4Polyline& polyline) called.\n"
93 << polyline
94 << G4endl;
95 PrintThings();
96#endif
97 // Get vis attributes - pick up defaults if none.
98 //const G4VisAttributes* pVA =
99 // fpViewer -> GetApplicableVisAttributes (polyline.GetVisAttributes ());
100 //?? Process polyline.
101}
102
104#ifdef G4XXXDEBUG
105 text
106#endif
107) {
108#ifdef G4XXXDEBUG
109 G4cout <<
110 "G4XXXSceneHandler::AddPrimitive(const G4Text& text) called.\n"
111 << text
112 << G4endl;
113 PrintThings();
114#endif
115 // Get text colour - special method since default text colour is
116 // determined by the default text vis attributes, which may be
117 // specified independent of default vis attributes of other types of
118 // visible objects.
119 //const G4Colour& c = GetTextColour (text); // Picks up default if none.
120 //?? Process text.
121}
122
124#ifdef G4XXXDEBUG
125 circle
126#endif
127) {
128#ifdef G4XXXDEBUG
129 G4cout <<
130 "G4XXXSceneHandler::AddPrimitive(const G4Circle& circle) called.\n"
131 << circle
132 << G4endl;
133 MarkerSizeType sizeType;
134 G4double size = GetMarkerSize (circle, sizeType);
135 switch (sizeType) {
136 default:
137 case screen:
138 // Draw in screen coordinates.
139 G4cout << "screen";
140 break;
141 case world:
142 // Draw in world coordinates.
143 G4cout << "world";
144 break;
145 }
146 G4cout << " size: " << size << G4endl;
147 PrintThings();
148#endif
149 // Get vis attributes - pick up defaults if none.
150 //const G4VisAttributes* pVA =
151 // fpViewer -> GetApplicableVisAttributes (circle.GetVisAttributes ());
152 //?? Process circle.
153}
154
156#ifdef G4XXXDEBUG
157 square
158#endif
159) {
160#ifdef G4XXXDEBUG
161 G4cout <<
162 "G4XXXSceneHandler::AddPrimitive(const G4Square& square) called.\n"
163 << square
164 << G4endl;
165 MarkerSizeType sizeType;
166 G4double size = GetMarkerSize (square, sizeType);
167 switch (sizeType) {
168 default:
169 case screen:
170 // Draw in screen coordinates.
171 G4cout << "screen";
172 break;
173 case world:
174 // Draw in world coordinates.
175 G4cout << "world";
176 break;
177 }
178 G4cout << " size: " << size << G4endl;
179 PrintThings();
180#endif
181 // Get vis attributes - pick up defaults if none.
182 //const G4VisAttributes* pVA =
183 // fpViewer -> GetApplicableVisAttributes (square.GetVisAttributes ());
184 //?? Process square.
185}
186
188#ifdef G4XXXDEBUG
189 G4cout <<
190 "G4XXXSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron) called.\n"
191 << polyhedron
192 << G4endl;
193 PrintThings();
194#endif
195 //?? Process polyhedron. Here are some ideas...
196 //Assume all facets are convex quadrilaterals.
197 //Draw each G4Facet individually
198
199 //Get colour, etc..
200 if (polyhedron.GetNoFacets() == 0) return;
201
202 // Get vis attributes - pick up defaults if none.
203 const G4VisAttributes* pVA =
204 fpViewer -> GetApplicableVisAttributes (polyhedron.GetVisAttributes ());
205
206 // Get view parameters that the user can force through the vis
207 // attributes, thereby over-riding the current view parameter.
209 //G4bool isAuxEdgeVisible = GetAuxEdgeVisible (pVA);
210
211 //Get colour, etc..
212 //const G4Colour& c = pVA -> GetColour ();
213
214 // Initial action depending on drawing style.
215 switch (drawing_style) {
217 {
218 break;
219 }
221 {
222 break;
223 }
225 {
226 break;
227 }
228 default:
229 {
230 break;
231 }
232 }
233
234 // Loop through all the facets...
235
236 // Look at G4OpenGLSceneHandler::AddPrimitive(const G4Polyhedron&)
237 // for an example of how to get facets out of a G4Polyhedron,
238 // including how to cope with triangles if that's a problem.
239}
240
242#ifdef G4XXXDEBUG
243 G4cout <<
244 "G4XXXSceneHandler::AddPrimitive(const G4NURBS& nurbs) called."
245 << G4endl;
246 PrintThings();
247#endif
248 //?? Don't bother implementing this. NURBS are not functional.
249}
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
G4String GetName() const
G4VPhysicalVolume * GetCurrentPV() const
G4LogicalVolume * GetCurrentLV() const
Definition: G4Text.hh:73
virtual G4String GetCurrentDescription() const
Definition: G4VModel.cc:54
virtual G4String GetCurrentTag() const
Definition: G4VModel.cc:49
const G4String & GetName() const
G4double GetMarkerSize(const G4VMarker &, MarkerSizeType &)
G4VViewer * fpViewer
G4ViewParameters::DrawingStyle GetDrawingStyle(const G4VisAttributes *)
const G4VisAttributes * GetVisAttributes() const
static G4int fSceneIdCount
G4XXXSceneHandler(G4VGraphicsSystem &system, const G4String &name)
void AddPrimitive(const G4Polyline &)
virtual ~G4XXXSceneHandler()
G4int GetNoFacets() const