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.hh,v 1.10 2010/05/28 16:48:03 allison Exp $ |
---|
28 | // GEANT4 tag $Name: vis-V09-03-08 $ |
---|
29 | // |
---|
30 | // |
---|
31 | // John Allison 2nd February 2005 (based on MyVisManager, 24th January 1998). |
---|
32 | // |
---|
33 | // Class description |
---|
34 | // |
---|
35 | // Concrete Visualization Manager that implements the virtual |
---|
36 | // functions RegisterGraphicsSystems and RegisterModelFactories. This |
---|
37 | // is executed when you Initialise() or Initialize() the vis manager. |
---|
38 | // It exploits C-pre-processor variables G4VIS_USE_DAWN, etc., which |
---|
39 | // are set by the GNUmakefiles if environment variables of the same |
---|
40 | // name are set. |
---|
41 | // |
---|
42 | // Include this file and write code to instantiate G4VisExecutive just |
---|
43 | // once at beginning of operations. Before you compile, set |
---|
44 | // appropriate environment variables (usually using "./Configure"). |
---|
45 | // If you change your environment you must force recompilation (the |
---|
46 | // make files will not detect the need to do this). |
---|
47 | // |
---|
48 | // Typically, your main program file will contain: |
---|
49 | // |
---|
50 | // #ifdef G4VIS_USE |
---|
51 | // #include "G4VisExecutive.hh" |
---|
52 | // #endif |
---|
53 | // ... |
---|
54 | // int main() { |
---|
55 | // ... |
---|
56 | // #ifdef G4VIS_USE |
---|
57 | // // Instantiate and initialise Visualization Manager. |
---|
58 | // G4VisManager* visManager = new G4VisExecutive; // See Note (a). |
---|
59 | // visManager -> SetVerboseLevel (verbosityString); // See Note (b). |
---|
60 | // visManager -> RegisterGraphicsSystem (new myGS); // See Note (c). |
---|
61 | // visManager -> Initialize (); // See Note (d). |
---|
62 | // #endif |
---|
63 | // ... |
---|
64 | // #ifdef G4VIS_USE |
---|
65 | // G4cout << "Deleting vis manager..." << G4endl; |
---|
66 | // delete visManager; |
---|
67 | // G4cout << "Vis manager deleted." << G4endl; |
---|
68 | // #endif |
---|
69 | // |
---|
70 | // Notes: |
---|
71 | // (a) After instantiation, all references to this object should be as |
---|
72 | // a G4VisManager. The functions RegisterGraphicsSystems and |
---|
73 | // RegisterModelFactories defined in G4VisExecutive.icc are |
---|
74 | // virtual functions of G4VisManager. They are invoked by |
---|
75 | // G4VisManager::Initialise. If you need to initialise in a |
---|
76 | // separate file, see advice below. |
---|
77 | // (b) The verbosityString ("quiet", "errors", "warnings", |
---|
78 | // "confirmations", etc. - "help /vis/verbose" to see options) can be |
---|
79 | // set here or with /vis/verbose. Alternatively, you can instantiate |
---|
80 | // with a verbosity string. e.g: |
---|
81 | // G4VisManager* visManager = new G4VisExecutive("quiet"); |
---|
82 | // (c) You can register your own graphics system like this. |
---|
83 | // (d) Your can intialise like this with C++ code or use /vis/initialize. |
---|
84 | // |
---|
85 | // If you need to perform the instantiation and the initialisation in |
---|
86 | // separate files, e.g., to establish the verbosity before |
---|
87 | // initialisation, then the code that initialises must have access, of |
---|
88 | // course, to the G4VisExecutive object, but this should be as a |
---|
89 | // G4VisManager object, i.e., #include "G4VisManager.hh". |
---|
90 | // RegisterGraphicsSystems and RegisterModelFactories are (pure) |
---|
91 | // virtual methods of G4VisManager called from G4VisManager::Initialize. |
---|
92 | // First file: |
---|
93 | // #include "G4VisExecutive.hh" |
---|
94 | // ... |
---|
95 | // fpVisManager = new G4VisExecutive; |
---|
96 | // where fpVisManager is a G4VisManager*. |
---|
97 | // Second file: |
---|
98 | // #include "G4VisManager.hh" |
---|
99 | // ... |
---|
100 | // fpVisManager -> Initialize (); |
---|
101 | // where there is some mechanism for getting access to the pointer |
---|
102 | // fpVisManager. |
---|
103 | // |
---|
104 | // The implementation is included as an .icc file because - for those |
---|
105 | // graphics systems that need external libraries - only those systems |
---|
106 | // that have been selected by the flags may be instantiated without |
---|
107 | // causing unresolved references (only the user knows which libraries |
---|
108 | // are available on his/her computer). It also ensures that libraries |
---|
109 | // can be linked in the right order, without circular dependencies. |
---|
110 | // (Note that some graphics systems, notable those that write files |
---|
111 | // for off-line viewing, do not suffer these restrictions and are |
---|
112 | // always registered.) |
---|
113 | // |
---|
114 | // See class description of G4VisManager for more details. |
---|
115 | |
---|
116 | #ifndef G4VISEXECUTIVE_HH |
---|
117 | #define G4VISEXECUTIVE_HH |
---|
118 | |
---|
119 | #include "G4VisManager.hh" |
---|
120 | |
---|
121 | class G4VisExecutive: public G4VisManager { |
---|
122 | |
---|
123 | public: // With description |
---|
124 | |
---|
125 | G4VisExecutive (const G4String& verbosityString = "warnings"); |
---|
126 | |
---|
127 | private: |
---|
128 | |
---|
129 | void RegisterGraphicsSystems(); |
---|
130 | void RegisterModelFactories(); |
---|
131 | |
---|
132 | }; |
---|
133 | |
---|
134 | #include "G4VisExecutive.icc" |
---|
135 | |
---|
136 | #endif |
---|