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

#include <G4ToolsSGQtZB.hh>

+ Inheritance diagram for G4ToolsSGQtZB:

Public Member Functions

 G4ToolsSGQtZB ()
 
virtual ~G4ToolsSGQtZB ()
 
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

 G4ToolsSGQtZB (const G4ToolsSGQtZB &a_from)
 
G4ToolsSGQtZBoperator= (const G4ToolsSGQtZB &)
 
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 G4ToolsSGQtZB.hh.

Constructor & Destructor Documentation

◆ G4ToolsSGQtZB() [1/2]

G4ToolsSGQtZB::G4ToolsSGQtZB ( )

Definition at line 36 of file G4ToolsSGQtZB.cc.

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

◆ ~G4ToolsSGQtZB()

G4ToolsSGQtZB::~G4ToolsSGQtZB ( )
virtual

Definition at line 46 of file G4ToolsSGQtZB.cc.

46 {
47 delete fSGSession;
48}

◆ G4ToolsSGQtZB() [2/2]

G4ToolsSGQtZB::G4ToolsSGQtZB ( const G4ToolsSGQtZB & a_from)
inlineprotected

Definition at line 41 of file G4ToolsSGQtZB.hh.

41:parent(a_from){}

Member Function Documentation

◆ CreateSceneHandler()

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

Implements G4VGraphicsSystem.

Definition at line 67 of file G4ToolsSGQtZB.cc.

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

◆ CreateViewer()

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

Implements G4VGraphicsSystem.

Definition at line 72 of file G4ToolsSGQtZB.cc.

72 {
74 if(!fSGSession) return nullptr;
75 G4VViewer* pView = new G4ToolsSGQtZBViewer(*fSGSession,(G4ToolsSGSceneHandler&)a_scene,a_name);
76 if (pView) {
77 if (pView->GetViewId() < 0) {
78 G4cerr << "G4ToolsSGQtZB::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 << "G4ToolsSGQtZB::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 G4ToolsSGQtZB::Initialise ( )
protected

Definition at line 50 of file G4ToolsSGQtZB.cc.

50 {
51 if(fSGSession) return; //done.
52 G4Qt* interactorManager = G4Qt::getInstance();
53 QApplication* _qapp = (QApplication*)interactorManager->GetMainInteractor();
54 if(!_qapp) {
55 G4cerr << "G4ToolsSGQtZB::Initialise : G4Qt::GetMainInteractor() returns null." << G4endl;
56 return;
57 }
58 fSGSession = new toolx::Qt::session(G4cout,_qapp);
59 if(!fSGSession->is_valid()) {
60 G4cerr << "G4ToolsSGQtZB::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 G4ToolsSGQtZB::IsUISessionCompatible ( ) const
virtual

Reimplemented from G4VGraphicsSystem.

Definition at line 92 of file G4ToolsSGQtZB.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=()

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

Definition at line 42 of file G4ToolsSGQtZB.hh.

42{return *this;}

Member Data Documentation

◆ fSGSession

toolx::Qt::session* G4ToolsSGQtZB::fSGSession
protected

Definition at line 50 of file G4ToolsSGQtZB.hh.

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


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