Geant4  10.03
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 // $Id: G4VisExecutive.icc 98766 2016-08-09 14:17:17Z gcosmo $
28 //
29 //
30 // John Allison 24th January 1998.
31 
32 #ifndef G4VISEXECUTIVE_ICC
33 #define G4VISEXECUTIVE_ICC
34 
35 // Supported drivers...
36 
37 // Not needing external packages or libraries...
38 #include "G4ASCIITree.hh"
39 #include "G4DAWNFILE.hh"
40 #include "G4HepRep.hh"
41 #include "G4HepRepFile.hh"
42 #include "G4RayTracer.hh"
43 #include "G4HitFilterFactories.hh"
44 #include "G4DigiFilterFactories.hh"
45 #include "G4TrajectoryFilterFactories.hh"
46 #include "G4TrajectoryModelFactories.hh"
47 #include "G4VRML1File.hh"
48 #include "G4VRML2File.hh"
49 #include "G4GMocrenFile.hh"
50 
51 // FIXME : avoid mix with QT/WT driver (should be done by cmake??)
52 #if defined(G4VIS_USE_OPENGLWT)
53  // do not want GL2P2 in WT case
54  #undef G4VIS_BUILD_OPENGL_GL2PS
55 #endif
56 
57 // Needing external packages or libraries...
58 
59 #ifdef G4VIS_USE_DAWN
60 #include "G4FukuiRenderer.hh"
61 #endif
62 
63 #ifdef G4VIS_USE_OPENGLX
64 #include "G4OpenGLImmediateX.hh"
65 #include "G4OpenGLStoredX.hh"
66 #endif
67 
68 #ifdef G4VIS_USE_OPENGLWIN32
69 #include "G4OpenGLImmediateWin32.hh"
70 #include "G4OpenGLStoredWin32.hh"
71 #endif
72 
73 #ifdef G4VIS_USE_OPENGLXM
74 #include "G4OpenGLImmediateXm.hh"
75 #include "G4OpenGLStoredXm.hh"
76 #endif
77 
78 #ifdef G4VIS_USE_OPENGLQT
79 #include "G4OpenGLImmediateQt.hh"
80 #include "G4OpenGLStoredQt.hh"
81 #endif
82 
83 #ifdef G4VIS_USE_OPENGLWT
84 #include "G4OpenGLImmediateWt.hh"
85 #endif
86 
87 #ifdef G4VIS_USE_OIX
88 #include "G4OpenInventorX.hh"
89 #include "G4OpenInventorXtExtended.hh"
90 #endif
91 
92 #ifdef G4VIS_USE_OIWIN32
93 #include "G4OpenInventorWin32.hh"
94 #endif
95 
96 #ifdef G4VIS_USE_RAYTRACERX
97 #include "G4RayTracerX.hh"
98 #endif
99 
100 #ifdef G4VIS_USE_VRML
101 #include "G4VRML1.hh"
102 #include "G4VRML2.hh"
103 #endif
104 
105 // The inline keyword prevents the compiler making an external
106 // reference even though they cannot actually be inlined since they
107 // are virtual functions. This prevents a "multiple definition" error
108 // if it is included in more than one file. However, as explained in
109 // the class description in G4VisExecutive.hh, it should never be
110 // necessary to #include "G4VisExecutive.hh" in more than one file
111 // since after instantiation the object can be treated as a
112 // G4VisManager.
113 
114 inline
115 G4VisExecutive::G4VisExecutive (const G4String& verbosityString):
116 G4VisManager(verbosityString)
117 {}
118 
119 inline void
120 G4VisExecutive::RegisterGraphicsSystems () {
121 
122  // Graphics Systems not needing external packages or libraries...
123  RegisterGraphicsSystem (new G4ASCIITree);
124  RegisterGraphicsSystem (new G4DAWNFILE);
125  RegisterGraphicsSystem (new G4HepRep);
126  RegisterGraphicsSystem (new G4HepRepFile);
127  RegisterGraphicsSystem (new G4RayTracer);
128  RegisterGraphicsSystem (new G4VRML1File);
129  RegisterGraphicsSystem (new G4VRML2File);
130  RegisterGraphicsSystem (new G4GMocrenFile);
131 
132 // Graphics systems needing external packages or libraries...
133 
134 #ifdef G4VIS_USE_DAWN
135  RegisterGraphicsSystem (new G4FukuiRenderer);
136 #endif
137 
138 #ifdef G4VIS_USE_VRML
139  RegisterGraphicsSystem (new G4VRML1);
140  RegisterGraphicsSystem (new G4VRML2);
141 #endif
142 
143 // Register OGL family of drivers with their normal names,
144 // super-abbreviated names and fallback names where approproiate.
145 
146 #ifdef G4VIS_USE_OPENGLQT
147  G4VGraphicsSystem* ogliqt = new G4OpenGLImmediateQt;
148  G4VGraphicsSystem* oglsqt = new G4OpenGLStoredQt;
149  RegisterGraphicsSystem (ogliqt);
150  RegisterGraphicsSystem (oglsqt);
151  ogliqt->AddNickname("OGLI");
152  oglsqt->AddNickname("OGL");
153  oglsqt->AddNickname("OGLS");
154 #endif
155 
156 #ifdef G4VIS_USE_OPENGLXM
157  G4VGraphicsSystem* oglixm = new G4OpenGLImmediateXm;
158  G4VGraphicsSystem* oglsxm = new G4OpenGLStoredXm;
159  RegisterGraphicsSystem (oglixm);
160  RegisterGraphicsSystem (oglsxm);
161 #ifdef G4VIS_USE_OPENGLQT
162  oglixm->AddNickname("OGLIQt_FALLBACK");
163  oglsxm->AddNickname("OGLSQt_FALLBACK");
164 #else
165  oglixm->AddNickname("OGLI");
166  oglsxm->AddNickname("OGL");
167  oglsxm->AddNickname("OGLS");
168 #endif
169 #endif
170 
171 #ifdef G4VIS_USE_OPENGLX
172  G4VGraphicsSystem* oglix = new G4OpenGLImmediateX;
173  G4VGraphicsSystem* oglsx = new G4OpenGLStoredX;
174  RegisterGraphicsSystem (oglix);
175  RegisterGraphicsSystem (oglsx);
176 #ifdef G4VIS_USE_OPENGLQT
177  oglix->AddNickname("OGLIQt_FALLBACK");
178  oglsx->AddNickname("OGLSQt_FALLBACK");
179 #endif
180 #ifdef G4VIS_USE_OPENGLXM
181  oglix->AddNickname("OGLIXm_FALLBACK");
182  oglsx->AddNickname("OGLSXm_FALLBACK");
183 #endif
184 #if defined (G4VIS_USE_OPENGLQT) || (G4VIS_USE_OPENGLXM)
185 #else
186  oglix->AddNickname("OGLI");
187  oglsx->AddNickname("OGL");
188  oglsx->AddNickname("OGLS");
189 #endif
190 #endif
191 
192 #ifdef G4VIS_USE_OPENGLWIN32
193  G4VGraphicsSystem* ogliwin32 = new G4OpenGLImmediateWin32;
194  G4VGraphicsSystem* oglswin32 = new G4OpenGLStoredWin32;
195  RegisterGraphicsSystem (ogliwin32);
196  RegisterGraphicsSystem (oglswin32);
197 #ifdef G4VIS_USE_OPENGLQT
198  ogliwin32->AddNickname("OGLIQt_FALLBACK");
199  oglswin32->AddNickname("OGLSQt_FALLBACK");
200 #else
201  ogliwin32->AddNickname("OGLI");
202  oglswin32->AddNickname("OGL");
203  oglswin32->AddNickname("OGLS");
204 #endif
205 #endif
206 
207 #ifdef G4VIS_USE_OPENGLWT
208  RegisterGraphicsSystem (new G4OpenGLImmediateWt);
209 #endif
210 
211 // Register OI graphics system with super-abbreviated nickname
212 #ifdef G4VIS_USE_OI
213  G4VGraphicsSystem* oi = 0;
214 #ifdef G4VIS_USE_OIX
215  oi = new G4OpenInventorX;
216 #elif G4VIS_USE_OIWIN32
217  oi = new G4OpenInventorWin32;
218 #endif
219  if (oi) {
220  RegisterGraphicsSystem (oi);
221  oi->AddNickname("OI");
222  }
223 #endif
224 
225 // The new, extended OI is registered separately for now.
226 #ifdef G4VIS_USE_OIX
227  RegisterGraphicsSystem (new G4OpenInventorXtExtended);
228 #endif
229 
230 #ifdef G4VIS_USE_RAYTRACERX
231  RegisterGraphicsSystem (new G4RayTracerX);
232 #endif
233 
234 }
235 
236 // See comments about inlining above.
237 inline void
238 G4VisExecutive::RegisterModelFactories()
239 {
240  // Trajectory draw models
241  RegisterModelFactory(new G4TrajectoryGenericDrawerFactory());
242  RegisterModelFactory(new G4TrajectoryDrawByAttributeFactory());
243  RegisterModelFactory(new G4TrajectoryDrawByChargeFactory());
244  RegisterModelFactory(new G4TrajectoryDrawByOriginVolumeFactory());
245  RegisterModelFactory(new G4TrajectoryDrawByParticleIDFactory());
246  RegisterModelFactory(new G4TrajectoryDrawByEncounteredVolumeFactory());
247 
248  // Trajectory filter models
249  RegisterModelFactory(new G4TrajectoryAttributeFilterFactory());
250  RegisterModelFactory(new G4TrajectoryChargeFilterFactory());
251  RegisterModelFactory(new G4TrajectoryOriginVolumeFilterFactory());
252  RegisterModelFactory(new G4TrajectoryParticleFilterFactory());
253  RegisterModelFactory(new G4TrajectoryEncounteredVolumeFilterFactory());
254 
255  // Hit filter models
256  RegisterModelFactory(new G4HitAttributeFilterFactory());
257 
258  // Digi filter models
259  RegisterModelFactory(new G4DigiAttributeFilterFactory());
260 }
261 
262 #endif