Geant4-11
G4VisExecutive.icc
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//
28//
29// John Allison 24th January 1998.
30
31#ifndef G4VISEXECUTIVE_ICC
32#define G4VISEXECUTIVE_ICC
33
34// Supported drivers...
35
36// Not needing external packages or libraries...
37#include "G4ASCIITree.hh"
38#include "G4DAWNFILE.hh"
39#include "G4HepRepFile.hh"
40#include "G4RayTracer.hh"
41#include "G4HitFilterFactories.hh"
42#include "G4DigiFilterFactories.hh"
43#include "G4TrajectoryFilterFactories.hh"
44#include "G4TrajectoryModelFactories.hh"
45#include "G4VRML2File.hh"
46#include "G4GMocrenFile.hh"
47
48// Needing external packages or libraries...
49#ifdef G4VIS_USE_OPENGLX
50#include "G4OpenGLImmediateX.hh"
51#include "G4OpenGLStoredX.hh"
52#endif
53
54#ifdef G4VIS_USE_OPENGLWIN32
55#include "G4OpenGLImmediateWin32.hh"
56#include "G4OpenGLStoredWin32.hh"
57#endif
58
59#ifdef G4VIS_USE_OPENGLXM
60#include "G4OpenGLImmediateXm.hh"
61#include "G4OpenGLStoredXm.hh"
62#endif
63
64#ifdef G4VIS_USE_OPENGLQT
65#include "G4OpenGLImmediateQt.hh"
66#include "G4OpenGLStoredQt.hh"
67#endif
68
69#ifdef G4VIS_USE_OIX
70#include "G4OpenInventorX.hh"
71#include "G4OpenInventorXtExtended.hh"
72#endif
73
74#ifdef G4VIS_USE_OIQT
75#include "G4OpenInventorQt.hh"
76#endif
77
78#ifdef G4VIS_USE_OIWIN32
79#include "G4OpenInventorWin32.hh"
80#endif
81
82#ifdef G4VIS_USE_RAYTRACERX
83#include "G4RayTracerX.hh"
84#endif
85
86#ifdef G4VIS_USE_QT3D
87#include "G4Qt3D.hh"
88#endif
89
90#ifdef G4VIS_USE_TOOLSSG_X11_GLES
91#include "G4ToolsSGX11GLES.hh"
92#endif
93
94#ifdef G4VIS_USE_TOOLSSG_WINDOWS_GLES
95#include "G4ToolsSGWindowsGLES.hh"
96#endif
97
98#ifdef G4VIS_USE_TOOLSSG_XT_GLES
99#include "G4ToolsSGXtGLES.hh"
100#endif
101
102#ifdef G4VIS_USE_TOOLSSG_QT_GLES
103#include "G4ToolsSGQtGLES.hh"
104#endif
105
106#ifdef G4VIS_USE_VTK
107#include "G4Vtk.hh"
108#endif
109
110#ifdef G4VIS_USE_VTK_QT
111#include "G4VtkQt.hh"
112#endif
113
114// The inline keyword prevents the compiler making an external
115// reference even though they cannot actually be inlined since they
116// are virtual functions. This prevents a "multiple definition" error
117// if it is included in more than one file. However, as explained in
118// the class description in G4VisExecutive.hh, it should never be
119// necessary to #include "G4VisExecutive.hh" in more than one file
120// since after instantiation the object can be treated as a
121// G4VisManager.
122
123inline
124G4VisExecutive::G4VisExecutive (const G4String& verbosityString):
125G4VisManager(verbosityString)
126{}
127
128inline void
129G4VisExecutive::RegisterGraphicsSystems () {
130
131 // Graphics Systems not needing external packages or libraries...
132 RegisterGraphicsSystem (new G4ASCIITree);
133 RegisterGraphicsSystem (new G4DAWNFILE);
134 RegisterGraphicsSystem (new G4HepRepFile);
135 RegisterGraphicsSystem (new G4RayTracer);
136 RegisterGraphicsSystem (new G4VRML2File);
137 RegisterGraphicsSystem (new G4GMocrenFile);
138
139// Graphics systems needing external packages or libraries...
140// Register OGL family of drivers with their normal names,
141// super-abbreviated names and fallback names where approproiate.
142
143#ifdef G4VIS_USE_OPENGLQT
144 G4VGraphicsSystem* ogliqt = new G4OpenGLImmediateQt;
145 G4VGraphicsSystem* oglsqt = new G4OpenGLStoredQt;
146 RegisterGraphicsSystem(ogliqt);
147 RegisterGraphicsSystem(oglsqt);
148 ogliqt->AddNickname("OGLI");
149 oglsqt->AddNickname("OGL");
150 oglsqt->AddNickname("OGLS");
151#endif
152
153#ifdef G4VIS_USE_OPENGLXM
154 G4VGraphicsSystem* oglixm = new G4OpenGLImmediateXm;
155 G4VGraphicsSystem* oglsxm = new G4OpenGLStoredXm;
156 RegisterGraphicsSystem(oglixm);
157 RegisterGraphicsSystem(oglsxm);
158# ifdef G4VIS_USE_OPENGLQT
159 oglixm->AddNickname("OGLIQt_FALLBACK");
160 oglsxm->AddNickname("OGLSQt_FALLBACK");
161# else
162 oglixm->AddNickname("OGLI");
163 oglsxm->AddNickname("OGL");
164 oglsxm->AddNickname("OGLS");
165# endif
166#endif
167
168#ifdef G4VIS_USE_OPENGLX
169 G4VGraphicsSystem* oglix = new G4OpenGLImmediateX;
170 G4VGraphicsSystem* oglsx = new G4OpenGLStoredX;
171 RegisterGraphicsSystem(oglix);
172 RegisterGraphicsSystem(oglsx);
173# ifdef G4VIS_USE_OPENGLQT
174 oglix->AddNickname("OGLIQt_FALLBACK");
175 oglsx->AddNickname("OGLSQt_FALLBACK");
176# endif
177# ifdef G4VIS_USE_OPENGLXM
178 oglix->AddNickname("OGLIXm_FALLBACK");
179 oglsx->AddNickname("OGLSXm_FALLBACK");
180# endif
181# if defined(G4VIS_USE_OPENGLQT) || (G4VIS_USE_OPENGLXM)
182# else
183 oglix->AddNickname("OGLI");
184 oglsx->AddNickname("OGL");
185 oglsx->AddNickname("OGLS");
186# endif
187#endif
188
189#ifdef G4VIS_USE_OPENGLWIN32
190 G4VGraphicsSystem* ogliwin32 = new G4OpenGLImmediateWin32;
191 G4VGraphicsSystem* oglswin32 = new G4OpenGLStoredWin32;
192 RegisterGraphicsSystem(ogliwin32);
193 RegisterGraphicsSystem(oglswin32);
194# ifdef G4VIS_USE_OPENGLQT
195 ogliwin32->AddNickname("OGLIQt_FALLBACK");
196 oglswin32->AddNickname("OGLSQt_FALLBACK");
197# else
198 ogliwin32->AddNickname("OGLI");
199 oglswin32->AddNickname("OGL");
200 oglswin32->AddNickname("OGLS");
201# endif
202#endif
203
204// Register OI graphics system with super-abbreviated nickname
205#ifdef G4VIS_USE_OI
206 G4VGraphicsSystem* oi = 0;
207# ifdef G4VIS_USE_OIX
208 oi = new G4OpenInventorX;
209# elif defined(G4VIS_USE_OIQT)
210 oi = new G4OpenInventorQt;
211# elif defined(G4VIS_USE_OIWIN32)
212 oi = new G4OpenInventorWin32;
213# endif
214 if(oi)
215 {
216 RegisterGraphicsSystem(oi);
217 oi->AddNickname("OI");
218 }
219#endif
220
221// The new, extended OI is registered separately for now.
222#ifdef G4VIS_USE_OIX
223 RegisterGraphicsSystem(new G4OpenInventorXtExtended);
224#endif
225
226#ifdef G4VIS_USE_RAYTRACERX
227 RegisterGraphicsSystem(new G4RayTracerX);
228#endif
229
230#ifdef G4VIS_USE_QT3D
231 RegisterGraphicsSystem(new G4Qt3D);
232#endif
233
234#ifdef G4VIS_USE_TOOLSSG_X11_GLES
235 G4VGraphicsSystem* tsg_x11_gles = new G4ToolsSGX11GLES;
236 RegisterGraphicsSystem(tsg_x11_gles);
237#endif
238
239#ifdef G4VIS_USE_TOOLSSG_WINDOWS_GLES
240 G4VGraphicsSystem* tsg_windows_gles = new G4ToolsSGWindowsGLES;
241 RegisterGraphicsSystem(tsg_windows_gles);
242#endif
243
244#ifdef G4VIS_USE_TOOLSSG_XT_GLES
245 G4VGraphicsSystem* tsg_xt_gles = new G4ToolsSGXtGLES;
246 RegisterGraphicsSystem(tsg_xt_gles);
247#endif
248
249#ifdef G4VIS_USE_TOOLSSG_QT_GLES
250 G4VGraphicsSystem* tsg_qt_gles = new G4ToolsSGQtGLES;
251 RegisterGraphicsSystem(tsg_qt_gles);
252#endif
253
254#ifdef G4VIS_USE_TOOLSSG_QT_GLES
255 tsg_qt_gles->AddNickname("TSG");
256#elif defined(G4VIS_USE_TOOLSSG_XT_GLES)
257 tsg_xt_gles->AddNickname("TSG");
258#elif defined(G4VIS_USE_TOOLSSG_X11_GLES)
259 tsg_x11_gles->AddNickname("TSG");
260#elif defined(G4VIS_USE_TOOLSSG_WINDOWS_GLES)
261 tsg_windows_gles->AddNickname("TSG");
262#endif
263
264#ifdef G4VIS_USE_VTK
265 G4Vtk* vtkN = new G4Vtk();
266 RegisterGraphicsSystem(vtkN);
267 vtkN->AddNickname("VTK_NATIVE");
268# ifdef G4VIS_USE_VTK_QT
269 // Comment out for now until we understand behaviour with a terminal session.
270 // vtkN->AddNickname("VtkQt_FALLBACK");
271# endif
272#endif
273
274#ifdef G4VIS_USE_VTK_QT
275 G4VtkQt* vtkQt = new G4VtkQt();
276 RegisterGraphicsSystem(vtkQt);
277#endif
278
279#ifdef G4VIS_USE_VTK_QT
280 vtkQt->AddNickname("Vtk");
281 vtkQt->AddNickname("VTK");
282#elif defined(G4VIS_USE_VTK)
283 vtkN->AddNickname("Vtk");
284 vtkN->AddNickname("VTK");
285#endif
286}
287
288// See comments about inlining above.
289inline void
290G4VisExecutive::RegisterModelFactories()
291{
292 // Trajectory draw models
293 RegisterModelFactory(new G4TrajectoryGenericDrawerFactory());
294 RegisterModelFactory(new G4TrajectoryDrawByAttributeFactory());
295 RegisterModelFactory(new G4TrajectoryDrawByChargeFactory());
296 RegisterModelFactory(new G4TrajectoryDrawByOriginVolumeFactory());
297 RegisterModelFactory(new G4TrajectoryDrawByParticleIDFactory());
298 RegisterModelFactory(new G4TrajectoryDrawByEncounteredVolumeFactory());
299
300 // Trajectory filter models
301 RegisterModelFactory(new G4TrajectoryAttributeFilterFactory());
302 RegisterModelFactory(new G4TrajectoryChargeFilterFactory());
303 RegisterModelFactory(new G4TrajectoryOriginVolumeFilterFactory());
304 RegisterModelFactory(new G4TrajectoryParticleFilterFactory());
305 RegisterModelFactory(new G4TrajectoryEncounteredVolumeFilterFactory());
306
307 // Hit filter models
308 RegisterModelFactory(new G4HitAttributeFilterFactory());
309
310 // Digi filter models
311 RegisterModelFactory(new G4DigiAttributeFilterFactory());
312}
313
314#endif