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