| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

GiGaVisManager.cpp

Go to the documentation of this file.
00001 // $Id: GiGaVisManager.cpp,v 1.5 2007/01/12 15:48:37 ranjard Exp $
00002 // Include files 
00003 
00004 // from Gaudi
00005 #include "GaudiKernel/DeclareFactoryEntries.h" 
00006 #include "GaudiKernel/ToolFactory.h"
00007 #include "GaudiKernel/MsgStream.h"
00008 // from GiGa 
00009 //#include "GiGa/GiGaMACROs.h"
00010 
00011 // local
00012 #include "GiGaVisManager.h"
00013 
00014 #include "G4VisManager.hh"
00015 #include "G4VisExecutive.hh"
00017 // Not needing external packages or libraries...
00018 #include "G4ASCIITree.hh"
00019 #include "G4DAWNFILE.hh"
00020 #include "G4HepRep.hh"
00021 //#include "G4GAGTree.hh"
00022 #include "G4RayTracer.hh"
00023 #include "G4VRML1File.hh"
00024 #include "G4VRML2File.hh"
00025 //
00026 #ifdef G4VIS_USE_DAWN
00027 #include "G4FukuiRenderer.hh"
00028 #endif
00029 //
00030 #ifdef G4VIS_USE_OPACS
00031 #include "G4Wo.hh"
00032 #include "G4Xo.hh"
00033 #endif
00034 //
00035 #ifdef G4VIS_USE_OPENGLX
00036 #include "G4OpenGLImmediateX.hh"
00037 #include "G4OpenGLStoredX.hh"
00038 #endif
00039 //
00040 #ifdef G4VIS_USE_OPENGLWIN32
00041 #include "G4OpenGLImmediateWin32.hh"
00042 #include "G4OpenGLStoredWin32.hh"
00043 #endif
00044 //
00045 #ifdef G4VIS_USE_OPENGLXM
00046 #include "G4OpenGLImmediateXm.hh"
00047 #include "G4OpenGLStoredXm.hh"
00048 #endif
00049 //
00050 #ifdef G4VIS_USE_OIX
00051 #include "G4OpenInventorX.hh"
00052 #endif
00053 //
00054 #ifdef G4VIS_USE_OIWIN32
00055 #include "G4OpenInventorWin32.hh"
00056 #endif
00057 //
00058 #ifdef G4VIS_USE_VRML
00059 #include "G4VRML1.hh"
00060 #include "G4VRML2.hh"
00061 #endif
00062 //
00063 namespace GiGaVisManagerLocal 
00064 {
00065   class GiGaVisMgr: public G4VisManager
00066   {
00067   public:
00069     GiGaVisMgr() 
00070       : G4VisManager() 
00071     {
00072       // activate the static pointer 
00073       G4VVisManager::SetConcreteInstance( this ); 
00074     };
00075     
00077     virtual ~GiGaVisMgr() {}
00078     // main method 
00079     void RegisterGraphicsSystems ()
00080     {
00081       // Graphics Systems not needing external packages or libraries...
00082       RegisterGraphicsSystem (new G4ASCIITree);
00083       //RegisterGraphicsSystem (new G4GAGTree);
00084       RegisterGraphicsSystem (new G4DAWNFILE);
00085       RegisterGraphicsSystem (new G4RayTracer);
00086       RegisterGraphicsSystem (new G4VRML1File);
00087       RegisterGraphicsSystem (new G4VRML2File);
00088       
00089       // Graphics systems needing external packages or libraries...
00090       
00091 #ifdef G4VIS_USE_DAWN
00092       RegisterGraphicsSystem (new G4FukuiRenderer);
00093 #endif
00094       
00095 #ifdef G4VIS_USE_OPACS
00096       RegisterGraphicsSystem (new G4Wo);
00097       RegisterGraphicsSystem (new G4Xo);
00098 #endif
00099       
00100 #ifdef G4VIS_USE_OPENGLX
00101       RegisterGraphicsSystem (new G4OpenGLImmediateX);
00102       RegisterGraphicsSystem (new G4OpenGLStoredX);
00103 #endif
00104       
00105 #ifdef G4VIS_USE_OPENGLWIN32
00106       RegisterGraphicsSystem (new G4OpenGLImmediateWin32);
00107       RegisterGraphicsSystem (new G4OpenGLStoredWin32);
00108 #endif
00109       
00110 #ifdef G4VIS_USE_OPENGLXM
00111       RegisterGraphicsSystem (new G4OpenGLImmediateXm);
00112       RegisterGraphicsSystem (new G4OpenGLStoredXm);
00113 #endif
00114       
00115 #ifdef G4VIS_USE_OIX
00116       RegisterGraphicsSystem (new G4OpenInventorX);
00117 #endif
00118       
00119 #ifdef G4VIS_USE_OIWIN32
00120       RegisterGraphicsSystem (new G4OpenInventorWin32);
00121 #endif
00122       
00123 #ifdef G4VIS_USE_VRML
00124       RegisterGraphicsSystem (new G4VRML1);
00125       RegisterGraphicsSystem (new G4VRML2);
00126 #endif
00127       
00128       if (fVerbose > 0) 
00129         {
00130           G4cout << "\nYou have successfully chosen to use " 
00131                  << "the following graphics systems."
00132                  << G4endl;
00133           PrintAvailableGraphicsSystems ();
00134         }
00136     };
00137   };
00138 };  
00139 
00140 
00141 
00142 // ============================================================================
00149 // ============================================================================
00150 
00151 // Declaration of the Tool Factory
00152 DECLARE_TOOL_FACTORY( GiGaVisManager );
00153 
00154 
00155 // ============================================================================
00161 // ============================================================================
00162 GiGaVisManager::GiGaVisManager
00163 ( const std::string& type,
00164   const std::string& name,
00165   const IInterface* parent )
00166   : GiGaBase( type, name , parent )
00167   , m_visMgr ( 0 )
00168 { declareInterface <IGiGaVisManager> ( this ); };
00169 // ============================================================================
00170 
00171 // ============================================================================
00173 // ============================================================================
00174 GiGaVisManager::~GiGaVisManager()
00175 { if( 0 != m_visMgr ) { delete m_visMgr ; m_visMgr = 0 ; } };
00176 // ============================================================================
00177 
00178 // ============================================================================
00183 // ============================================================================
00184 G4VVisManager* GiGaVisManager::visMgr () const 
00185 {
00186   if( 0 == m_visMgr ) { Warning("G4VVisManager* points to NULL!"); }
00187   return m_visMgr ;
00188 };
00189 // ============================================================================
00190 
00191 // ============================================================================
00198 // ============================================================================
00199 StatusCode GiGaVisManager::initialize  ()        
00200 {
00201   // initialize the base 
00202   StatusCode sc = GiGaBase::initialize();
00203   if( sc.isFailure() ) { return Error("Error from GiGaBase",sc); }
00204   
00205   Print("Creating VisManager");
00206   //G4VisManager* vm = new GiGaVisManagerLocal::GiGaVisMgr();
00207   G4VisManager* vm = new G4VisExecutive();
00208   vm->SetVerboseLevel(5);
00209   vm->Initialize();
00210   m_visMgr = vm ;
00211   
00212   if( 0 == m_visMgr )
00213     { Warning ( "initialize(): local  G4VVisManager* points to NULL!" ) ; }
00214   if( 0 == G4VVisManager::GetConcreteInstance() ) 
00215     { Warning ( "initialize(): static G4VVisManager* points to NULL!" ) ; }
00216   
00217   return StatusCode::SUCCESS ;
00218 };
00219 // ============================================================================
00220 
00221 // ============================================================================
00228 // ============================================================================
00229 StatusCode GiGaVisManager::finalize    ()
00230 {
00231   // delete the visualization manager itself 
00232   Print("finalize(): Delete the virualization manager");
00233   if( 0 != m_visMgr ) { delete m_visMgr ; m_visMgr = 0 ; }
00234   // finalize the base class 
00235   return GiGaBase::finalize ();
00236 };
00237 // ============================================================================
00238   
00239 
00240 
00241 // ============================================================================
00242 // The END 
00243 // ===========================================================================
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:01:38 2011 for GiGaVisUI by doxygen 1.4.7