Geant4 11.2.2
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 ()
 
const G4StringGetName () const
 
const G4StringGetNickname () const
 
const std::vector< G4String > & GetNicknames () const
 
const G4StringGetDescription () const
 
Functionality GetFunctionality () 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 36 of file G4ToolsSGQtGLES.cc.

36 :
37parent
38("TOOLSSG_QT_GLES",
39 "TSG_QT_GLES",
40 "TOOLSSG_QT_GLES is a graphics driver based on the g4tools tools/sg scene graph logic where\n\
41 the rendering is done with GLES and the windowing is done with Qt.",
43,fSGSession(nullptr)
44{}
toolx::Qt::session * fSGSession

◆ ~G4ToolsSGQtGLES()

G4ToolsSGQtGLES::~G4ToolsSGQtGLES ( )
virtual

Definition at line 46 of file G4ToolsSGQtGLES.cc.

46 {
47 delete fSGSession;
48}

◆ 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 67 of file G4ToolsSGQtGLES.cc.

67 {
68 G4VSceneHandler* pScene = new G4ToolsSGSceneHandler(*this, a_name);
69 return pScene;
70}

◆ CreateViewer()

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

Implements G4VGraphicsSystem.

Definition at line 72 of file G4ToolsSGQtGLES.cc.

72 {
74 if(!fSGSession) return nullptr;
76 if (pView) {
77 if (pView->GetViewId() < 0) {
78 G4cerr << "G4ToolsSGQtGLES::CreateViewer:"
79 << " ERROR flagged by negative view id in G4ToolsSGViewer creation."
80 << "\n Destroying view and returning null pointer." << G4endl;
81 delete pView;
82 pView = nullptr;
83 }
84 }
85 if (!pView) {
86 G4cerr << "G4ToolsSGQtGLES::CreateViewer: ERROR: null pointer on new G4ToolsSGViewer." << G4endl;
87 return nullptr;
88 }
89 return pView;
90}
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition G4ios.hh:67
G4int GetViewId() const

◆ Initialise()

void G4ToolsSGQtGLES::Initialise ( )
protected

Definition at line 50 of file G4ToolsSGQtGLES.cc.

50 {
51 if(fSGSession) return; //done.
52 G4Qt* interactorManager = G4Qt::getInstance();
53 auto* _qapp = (QApplication*)interactorManager->GetMainInteractor();
54 if(!_qapp) {
55 G4cerr << "G4ToolsSGQtGLES::Initialise : G4Qt::GetMainInteractor() returns null." << G4endl;
56 return;
57 }
58 fSGSession = new toolx::Qt::session(G4cout,_qapp);
59 if(!fSGSession->is_valid()) {
60 G4cerr << "G4ToolsSGQtGLES::Initialise : session::is_valid() failed." << G4endl;
61 delete fSGSession;
62 fSGSession = nullptr;
63 return;
64 }
65}
G4GLOB_DLL std::ostream G4cout
Definition G4Qt.hh:50
static G4Qt * getInstance()
Definition G4Qt.cc:51

Referenced by CreateViewer().

◆ IsUISessionCompatible()

G4bool G4ToolsSGQtGLES::IsUISessionCompatible ( ) const
virtual

Reimplemented from G4VGraphicsSystem.

Definition at line 92 of file G4ToolsSGQtGLES.cc.

93{
94 // Qt windows require a Qt session.
96 if (dynamic_cast<G4UIQt*>(baseSession) != nullptr) return true;
97 return false;
98}
static G4UImanager * GetUIpointer()
G4UIsession * GetBaseSession() const

◆ 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: