Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ToolsSGQtGLES Class Reference

#include <G4ToolsSGQtGLES.hh>

+ Inheritance diagram for G4ToolsSGQtGLES:

Public Member Functions

 G4ToolsSGQtGLES ()
 
virtual ~G4ToolsSGQtGLES ()
 
G4VSceneHandlerCreateSceneHandler (const G4String &name="")
 
G4VViewerCreateViewer (G4VSceneHandler &, const G4String &name="")
 
G4bool IsUISessionCompatible () const
 
- Public Member Functions inherited from G4VGraphicsSystem
 G4VGraphicsSystem (const G4String &name, Functionality f)
 
 G4VGraphicsSystem (const G4String &name, const G4String &nickname, Functionality f)
 
 G4VGraphicsSystem (const G4String &name, const G4String &nickname, const G4String &description, Functionality f)
 
virtual ~G4VGraphicsSystem ()
 
virtual G4VSceneHandlerCreateSceneHandler (const G4String &name)=0
 
virtual G4VViewerCreateViewer (G4VSceneHandler &, const G4String &name)=0
 
const G4StringGetName () const
 
const G4StringGetNickname () const
 
const std::vector< G4String > & GetNicknames () const
 
const G4StringGetDescription () const
 
Functionality GetFunctionality () const
 
virtual G4bool IsUISessionCompatible () const
 
void AddNickname (const G4String &nickname)
 

Protected Member Functions

 G4ToolsSGQtGLES (const G4ToolsSGQtGLES &a_from)
 
G4ToolsSGQtGLESoperator= (const G4ToolsSGQtGLES &)
 
void Initialise ()
 

Protected Attributes

toolx::Qt::session * fSGSession
 
- Protected Attributes inherited from G4VGraphicsSystem
G4String fName
 
std::vector< G4StringfNicknames
 
G4String fDescription
 
Functionality fFunctionality
 

Additional Inherited Members

- Public Types inherited from G4VGraphicsSystem
enum  Functionality {
  noFunctionality , nonEuclidian , twoD , twoDStore ,
  threeD , threeDInteractive , virtualReality , fileWriter
}
 

Detailed Description

Definition at line 35 of file G4ToolsSGQtGLES.hh.

Constructor & Destructor Documentation

◆ G4ToolsSGQtGLES() [1/2]

G4ToolsSGQtGLES::G4ToolsSGQtGLES ( )

Definition at line 43 of file G4ToolsSGQtGLES.cc.

43 :
44parent
45("TOOLSSG_QT_GLES",
46 "TSG_QT_GLES",
47 "TOOLSSG_QT_GLES is a graphics driver based on the g4tools tools/sg scene graph logic where\n\
48 the rendering is done with GLES and the windowing is done with Qt.",
50,fSGSession(nullptr)
51{}
toolx::Qt::session * fSGSession

◆ ~G4ToolsSGQtGLES()

G4ToolsSGQtGLES::~G4ToolsSGQtGLES ( )
virtual

Definition at line 53 of file G4ToolsSGQtGLES.cc.

53 {
54 delete fSGSession;
55}

◆ G4ToolsSGQtGLES() [2/2]

G4ToolsSGQtGLES::G4ToolsSGQtGLES ( const G4ToolsSGQtGLES a_from)
inlineprotected

Definition at line 41 of file G4ToolsSGQtGLES.hh.

41:parent(a_from){}

Member Function Documentation

◆ CreateSceneHandler()

G4VSceneHandler * G4ToolsSGQtGLES::CreateSceneHandler ( const G4String name = "")
virtual

Implements G4VGraphicsSystem.

Definition at line 72 of file G4ToolsSGQtGLES.cc.

72 {
73 G4VSceneHandler* pScene = new G4ToolsSGSceneHandler(*this, a_name);
74 return pScene;
75}

◆ CreateViewer()

G4VViewer * G4ToolsSGQtGLES::CreateViewer ( G4VSceneHandler a_scene,
const G4String name = "" 
)
virtual

Implements G4VGraphicsSystem.

Definition at line 77 of file G4ToolsSGQtGLES.cc.

77 {
79 if(!fSGSession) return nullptr;
80 G4VViewer* pView =
81#ifdef G4TOOLSSG_QT_VIEWER_IN_TAB
83#else
85#endif
86 if (pView) {
87 if (pView->GetViewId() < 0) {
88 G4cerr << "G4ToolsSGQtGLES::CreateViewer:"
89 << " ERROR flagged by negative view id in G4ToolsSGViewer creation."
90 << "\n Destroying view and returning null pointer." << G4endl;
91 delete pView;
92 pView = nullptr;
93 }
94 }
95 if (!pView) {
96 G4cerr << "G4ToolsSGQtGLES::CreateViewer: ERROR: null pointer on new G4ToolsSGViewer." << G4endl;
97 return nullptr;
98 }
99 return pView;
100}
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
G4int GetViewId() const

◆ Initialise()

void G4ToolsSGQtGLES::Initialise ( )
protected

Definition at line 57 of file G4ToolsSGQtGLES.cc.

57 {
58 if(fSGSession) return; //done.
59 int* argc = new int;
60 char** argv = nullptr;
61 std::vector<std::string> args;args.push_back("");
62 tools::new_argcv(args,*argc,argv);
63 fSGSession = new toolx::Qt::session(G4cout,*argc,argv);
64 if(!fSGSession->is_valid()) {
65 G4cerr << "G4ToolsSGQtGLES::Initialise : session::is_valid() failed." << G4endl;
66 delete fSGSession;
67 fSGSession = nullptr;
68 return;
69 }
70}
G4GLOB_DLL std::ostream G4cout

Referenced by CreateViewer().

◆ IsUISessionCompatible()

G4bool G4ToolsSGQtGLES::IsUISessionCompatible ( ) const
virtual

Reimplemented from G4VGraphicsSystem.

Definition at line 102 of file G4ToolsSGQtGLES.cc.

103{
104 G4bool isCompatible = false;
107
108 // If session is a batch session, it may be:
109 // a) this is a batch job (the user has not instantiated any UI session);
110 // b) we are currently processing a UI command, in which case the UI
111 // manager creates a temporary batch session and to find out if there is
112 // a genuine UI session that the user has instantiated we must drill
113 // down through previous sessions to a possible non-batch session.
114 while (G4UIbatch* batch = dynamic_cast<G4UIbatch*>(session)) {
115 session = batch->GetPreviousSession();
116 }
117
118 // Qt windows are only appropriate in a Qt session.
119 if (session) {
120 // If non-zero, this is the originating non-batch session
121 // The user has instantiated a UI session...
122 if (dynamic_cast<G4UIQt*>(session)) {
123 // ...and it's a G4UIQt session, which is OK.
124 isCompatible = true;
125 }
126 }
127 return isCompatible;
128}
bool G4bool
Definition: G4Types.hh:86
G4UIsession * GetSession() const
Definition: G4UImanager.hh:187
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77

◆ operator=()

G4ToolsSGQtGLES & G4ToolsSGQtGLES::operator= ( const G4ToolsSGQtGLES )
inlineprotected

Definition at line 42 of file G4ToolsSGQtGLES.hh.

42{return *this;}

Member Data Documentation

◆ fSGSession

toolx::Qt::session* G4ToolsSGQtGLES::fSGSession
protected

Definition at line 50 of file G4ToolsSGQtGLES.hh.

Referenced by CreateViewer(), Initialise(), and ~G4ToolsSGQtGLES().


The documentation for this class was generated from the following files: