ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4OpenInventor.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4OpenInventor.cc
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 #ifdef G4VIS_BUILD_OI_DRIVER
29 
30 // this :
31 #include "G4OpenInventor.hh"
32 
33 #include "HEPVis/nodes/SoBox.h"
34 #include "HEPVis/nodes/SoTubs.h"
35 #include "HEPVis/nodes/SoCons.h"
36 #include "HEPVis/nodes/SoTrd.h"
37 #include "HEPVis/nodes/SoTrap.h"
44 
45 #include "Geant4_SoPolyhedron.h"
46 
48 
49 #include "G4UImanager.hh"
50 #include "G4UIbatch.hh"
51 
53  const G4String name
54 ,const G4String nickname
56 )
57 :G4VGraphicsSystem(name,nickname,f)
58 ,interactorManager(0)
59 {
60 }
61 
63 
65  interactorManager = im;
66 }
68  return interactorManager;
69 }
71  Initialize();
72  G4VSceneHandler* p = new G4OpenInventorSceneHandler (*this, name);
73  return p;
74 }
75 
77 {
87 
91 }
92 
94 {
95  G4bool isCompatible = false;
98 
99  // If session is a batch session, it may be:
100  // a) this is a batch job (the user has not instantiated any UI session);
101  // b) we are currently processing a UI command, in which case the UI
102  // manager creates a temporary batch session and to find out if there is
103  // a genuine UI session that the user has instantiated we must drill
104  // down through previous sessions to a possible non-batch session.
105  while (G4UIbatch* batch = dynamic_cast<G4UIbatch*>(session)) {
106  session = batch->GetPreviousSession();
107  }
108 
109  // OI windows are not appropriate in a batch session.
110  if (session) {
111  // If non-zero, this is the originating non-batch session
112  // The user has instantiated a UI session...
113  isCompatible = true;
114  }
115 
116  return isCompatible;
117 }
118 
119 #endif