00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id$ 00028 // 00029 // 00030 // John Allison 2nd February 2005 (based on MyVisManager, 24th January 1998). 00031 // 00032 // Class description 00033 // 00034 // Concrete Visualization Manager that implements the virtual 00035 // functions RegisterGraphicsSystems and RegisterModelFactories. This 00036 // is executed when you Initialise() or Initialize() the vis manager. 00037 // It exploits C-pre-processor variables G4VIS_USE_DAWN, etc., which 00038 // are set by the GNUmakefiles if environment variables of the same 00039 // name are set. 00040 // 00041 // Include this file and write code to instantiate G4VisExecutive just 00042 // once at beginning of operations. Before you compile, set 00043 // appropriate environment variables (usually using "./Configure"). 00044 // If you change your environment you must force recompilation (the 00045 // make files will not detect the need to do this). 00046 // 00047 // Typically, your main program file will contain: 00048 // 00049 // #ifdef G4VIS_USE 00050 // #include "G4VisExecutive.hh" 00051 // #endif 00052 // ... 00053 // int main() { 00054 // ... 00055 // #ifdef G4VIS_USE 00056 // // Instantiate and initialise Visualization Manager. 00057 // G4VisManager* visManager = new G4VisExecutive; // See Note (a). 00058 // visManager -> SetVerboseLevel (verbosityString); // See Note (b). 00059 // visManager -> RegisterGraphicsSystem (new myGS); // See Note (c). 00060 // visManager -> Initialize (); // See Note (d). 00061 // #endif 00062 // ... 00063 // #ifdef G4VIS_USE 00064 // G4cout << "Deleting vis manager..." << G4endl; 00065 // delete visManager; 00066 // G4cout << "Vis manager deleted." << G4endl; 00067 // #endif 00068 // 00069 // Notes: 00070 // (a) After instantiation, all references to this object should be as 00071 // a G4VisManager. The functions RegisterGraphicsSystems and 00072 // RegisterModelFactories defined in G4VisExecutive.icc are 00073 // virtual functions of G4VisManager. They are invoked by 00074 // G4VisManager::Initialise. If you need to initialise in a 00075 // separate file, see advice below. 00076 // (b) The verbosityString ("quiet", "errors", "warnings", 00077 // "confirmations", etc. - "help /vis/verbose" to see options) can be 00078 // set here or with /vis/verbose. Alternatively, you can instantiate 00079 // with a verbosity string. e.g: 00080 // G4VisManager* visManager = new G4VisExecutive("quiet"); 00081 // (c) You can register your own graphics system like this. 00082 // (d) Your can intialise like this with C++ code or use /vis/initialize. 00083 // 00084 // If you need to perform the instantiation and the initialisation in 00085 // separate files, e.g., to establish the verbosity before 00086 // initialisation, then the code that initialises must have access, of 00087 // course, to the G4VisExecutive object, but this should be as a 00088 // G4VisManager object, i.e., #include "G4VisManager.hh". 00089 // RegisterGraphicsSystems and RegisterModelFactories are (pure) 00090 // virtual methods of G4VisManager called from G4VisManager::Initialize. 00091 // First file: 00092 // #include "G4VisExecutive.hh" 00093 // ... 00094 // fpVisManager = new G4VisExecutive; 00095 // where fpVisManager is a G4VisManager*. 00096 // Second file: 00097 // #include "G4VisManager.hh" 00098 // ... 00099 // fpVisManager -> Initialize (); 00100 // where there is some mechanism for getting access to the pointer 00101 // fpVisManager. 00102 // 00103 // The implementation is included as an .icc file because - for those 00104 // graphics systems that need external libraries - only those systems 00105 // that have been selected by the flags may be instantiated without 00106 // causing unresolved references (only the user knows which libraries 00107 // are available on his/her computer). It also ensures that libraries 00108 // can be linked in the right order, without circular dependencies. 00109 // (Note that some graphics systems, notable those that write files 00110 // for off-line viewing, do not suffer these restrictions and are 00111 // always registered.) 00112 // 00113 // See class description of G4VisManager for more details. 00114 00115 #ifndef G4VISEXECUTIVE_HH 00116 #define G4VISEXECUTIVE_HH 00117 00118 #include "G4VisManager.hh" 00119 00120 class G4VisExecutive: public G4VisManager { 00121 00122 public: // With description 00123 00124 G4VisExecutive (const G4String& verbosityString = "warnings"); 00125 00126 private: 00127 00128 void RegisterGraphicsSystems(); 00129 void RegisterModelFactories(); 00130 00131 }; 00132 00133 #include "G4VisExecutive.icc" 00134 00135 #endif