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

#include <G4OpenInventorQtViewer.hh>

+ Inheritance diagram for G4OpenInventorQtViewer:

Public Member Functions

 G4OpenInventorQtViewer (G4OpenInventorSceneHandler &scene, const G4String &name="")
 
virtual ~G4OpenInventorQtViewer ()
 
void Initialise ()
 
virtual void FinishView ()
 
virtual void SetView ()
 
- Public Member Functions inherited from G4OpenInventorViewer
virtual void DrawView ()
 
virtual void ShowView ()
 
virtual void ClearView ()
 
virtual void SetView ()
 
virtual void KernelVisitDecision ()
 
 G4OpenInventorViewer (G4OpenInventorSceneHandler &scene, const G4String &name="")
 
virtual ~G4OpenInventorViewer ()
 
- Public Member Functions inherited from G4VViewer
 G4VViewer (G4VSceneHandler &, G4int id, const G4String &name="")
 
virtual ~G4VViewer ()
 
virtual void Initialise ()
 
virtual void ResetView ()
 
virtual void SetView ()=0
 
virtual void ClearView ()=0
 
virtual void DrawView ()=0
 
void RefreshView ()
 
virtual void ShowView ()
 
virtual void FinishView ()
 
std::vector< G4ThreeVectorComputeFlyThrough (G4Vector3D *)
 
const G4StringGetName () const
 
const G4StringGetShortName () const
 
void SetName (const G4String &)
 
G4int GetViewId () const
 
G4VSceneHandlerGetSceneHandler () const
 
const G4ViewParametersGetViewParameters () const
 
const G4ViewParametersGetDefaultViewParameters () const
 
G4double GetKernelVisitElapsedTimeSeconds () const
 
virtual const std::vector< G4ModelingParameters::VisAttributesModifier > * GetPrivateVisAttributesModifiers () const
 
void SetViewParameters (const G4ViewParameters &vp)
 
void SetDefaultViewParameters (const G4ViewParameters &vp)
 
const G4VisAttributesGetApplicableVisAttributes (const G4VisAttributes *) const
 
void SetNeedKernelVisit (G4bool need)
 
void NeedKernelVisit ()
 
void ProcessView ()
 

Protected Member Functions

virtual void ViewerRender ()
 
virtual SoCamera * GetCamera ()
 
- Protected Member Functions inherited from G4OpenInventorViewer
virtual void ViewerRender ()=0
 
virtual SoCamera * GetCamera ()=0
 
void Escape ()
 Menu items callbacks /////////////////////////////////////////////////////.
 
void WritePostScript (const G4String &file="g4out.ps")
 
void WritePDF (const G4String &file="g4out.pdf")
 
void WritePixmapPostScript (const G4String &file="g4out.ps")
 
void WriteInventor (const G4String &file="g4out.iv")
 
void SceneGraphStatistics ()
 
void EraseDetector ()
 
void EraseEvent ()
 
void SetPreviewAndFull ()
 
void SetPreview ()
 
void SetSolid ()
 
void SetWireFrame ()
 
void SetReducedWireFrame (bool)
 
void UpdateScene ()
 
G4String Help (const G4String &topic="controls")
 
- Protected Member Functions inherited from G4VViewer
void SetTouchable (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath)
 
void TouchableSetVisibility (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath, G4bool visibility)
 
void TouchableSetColour (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath, const G4Colour &)
 

Protected Attributes

G4OpenInventorQtExaminerViewerfViewer
 
- Protected Attributes inherited from G4OpenInventorViewer
G4OpenInventorSceneHandlerfG4OpenInventorSceneHandler
 
G4VInteractorManagerfInteractorManager
 
SoSelection * fSoSelection
 
Geant4_SoImageWriter * fSoImageWriter
 
Geant4_SoGL2PSAction * fGL2PSAction
 
SoNodeSensor * fGroupCameraSensor
 
- Protected Attributes inherited from G4VViewer
G4VSceneHandlerfSceneHandler
 
G4int fViewId
 
G4String fName
 
G4String fShortName
 
G4ViewParameters fVP
 
G4ViewParameters fDefaultVP
 
G4double fKernelVisitElapsedTimeSeconds = 999.
 
G4bool fNeedKernelVisit
 

Additional Inherited Members

- Static Protected Member Functions inherited from G4OpenInventorViewer
static void SelectionCB (void *, SoPath *)
 

Detailed Description

Definition at line 48 of file G4OpenInventorQtViewer.hh.

Constructor & Destructor Documentation

◆ G4OpenInventorQtViewer()

G4OpenInventorQtViewer::G4OpenInventorQtViewer ( G4OpenInventorSceneHandler scene,
const G4String name = "" 
)

Definition at line 61 of file G4OpenInventorQtViewer.cc.

63 : G4OpenInventorViewer(sceneHandler, name), fViewer(0)
64{
65 // FWJ fName is in G4VViewer parent of G4OpenInventorViewer
67 G4cout << "Window name: " << fName << G4endl;
68}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4OpenInventorQtExaminerViewer * fViewer
G4String fName
Definition: G4VViewer.hh:218
static Verbosity GetVerbosity()

◆ ~G4OpenInventorQtViewer()

G4OpenInventorQtViewer::~G4OpenInventorQtViewer ( )
virtual

Definition at line 260 of file G4OpenInventorQtViewer.cc.

261{
262 // if(fShell) fInteractorManager->RemoveShell(fShell);
263 if(fViewer) {
264 fViewer->setSceneGraph(0);
265 //FIXME : SGI : the below "delete" block things.
266 //FIXME : CoinXt : the below "delete" crashe in ~SoXtRenderArea.
267 //FIXME : delete fViewer;
268 }
269 // if(fShell) XtDestroyWidget(fShell);
270}

Member Function Documentation

◆ FinishView()

void G4OpenInventorQtViewer::FinishView ( void  )
virtual

Reimplemented from G4VViewer.

Definition at line 272 of file G4OpenInventorQtViewer.cc.

273{
274 if(!fViewer) return;
275 fViewer->viewAll();
276 fViewer->saveHomePosition();
277}

◆ GetCamera()

SoCamera * G4OpenInventorQtViewer::GetCamera ( )
protectedvirtual

Implements G4OpenInventorViewer.

Definition at line 295 of file G4OpenInventorQtViewer.cc.

295 {
296 if(!fViewer) return 0;
297 return fViewer->getCamera();
298}

◆ Initialise()

void G4OpenInventorQtViewer::Initialise ( )
virtual

Reimplemented from G4VViewer.

Definition at line 71 of file G4OpenInventorQtViewer.cc.

72{
73
74 QWidget* parent = SoQt::getTopLevelWidget();
75
76 // FWJ DEBUG
77 // G4cout << "G4OIQtViewer: Creating G4OIQtExaminerViewer with parent " <<
78 // parent << G4endl;
79
81
82 // FWJ tried this to replace sensors, but it misses some camera changes.
83 // fGroupCameraSensor->detach();
84 // fCameraSensor->detach();
85 // fViewer->addFinishCallback(FinishCB);
86
87 auto UI = G4UImanager::GetUIpointer();
88 auto uiQt = dynamic_cast<G4UIQt*>(UI->GetG4UIWindow());
89
90 // Moved this to G4OpenInventorQtExaminerViewer::afterRealizeHook()
91 ///////////////////////////////////////////////////////////
92 //
93 // This explicitly sets the TabWidget as parent before addTab():
94 // if (uiQt) uiQt->AddTabWidget(parent, QString(fName));
95 ///////////////////////////////////////////////////////////
96
97 // Simpler: calls addTab(), but causes viewer parts to show (temporarily)
98 // in the "Useful tips" page !!
99 // if (uiQt) uiQt->AddViewerTab(parent, fName);
100 // Leaves an empty viewer window frame hanging around:
101 // if (uiQt) uiQt->AddTabWidget(fViewer->getWidget(), QString(fName));
102
103 // G4String wName = fName;
104 //
105 // QWidget parent = (QWidget)fInteractorManager->GetParentInteractor();
106
107 int width = fVP.GetWindowSizeHintX();
108 int height = fVP.GetWindowSizeHintY();
109
110 // FWJ not sure what this is for
111 // fInteractorManager->AddShell(fShell);
112
113 // FWJ or this:
114 // } else {
115 // char* str = fInteractorManager->GetCreationString();
116 // if(str!=0) wName = str;
117 // fViewer = new SoQtExaminerViewer(parent,wName.c_str(),TRUE);
118 // }
119
120 fViewer->setSize(SbVec2s(width, height));
121 fViewer->setOrigWindowSize(width, height);
122
123 // Add common menu items...
124
125 // QMenuBar* menubar = fViewer->getMenubar();
126 QMenu* filemenu = fViewer->getFileMenu();
127 QMenu* etcmenu = fViewer->getEtcMenu();
128 QFont* font = fViewer->getFont();
129
130 // File menu
131
132 FileWritePS = new QAction("Write PostScript (gl2ps)", this);
133 FileWritePS->setFont(*font);
134 connect(FileWritePS, SIGNAL(triggered()), this,
135 SLOT(FileWritePSCB()));
136 filemenu->addAction(FileWritePS);
137
138 FileWritePDF = new QAction("Write PDF (gl2ps)", this);
139 FileWritePDF->setFont(*font);
140 connect(FileWritePDF, SIGNAL(triggered()), this,
141 SLOT(FileWritePDFCB()));
142 filemenu->addAction(FileWritePDF);
143
144 FileWriteIV = new QAction("Write IV", this);
145 FileWriteIV->setFont(*font);
146 connect(FileWriteIV, SIGNAL(triggered()), this,
147 SLOT(FileWriteIVCB()));
148 filemenu->addAction(FileWriteIV);
149
150 FileEscape = new QAction("Escape", this);
151 FileEscape->setFont(*font);
152 connect(FileEscape, SIGNAL(triggered()), this,
153 SLOT(FileEscapeCB()));
154 filemenu->addAction(FileEscape);
155
156 // G4cout << "G4OIQtViewer: externalApp = " <<
157 // static_cast<G4SoQt*>(fInteractorManager)->IsExternalApp() << G4endl;
158 if (static_cast<G4SoQt*>(fInteractorManager)->IsExternalApp())
160
161 // Register escape CB with viewer, allowing E key escape
162 // fViewer->addEscapeCallback(FileEscapeCB);
163 // fViewer->addEscapeCallback(FileEscapeCB, (void*)this);
164
165 // Etc menu
166
167 EtcEraseDetector = new QAction("Erase detector", this);
168 EtcEraseDetector->setFont(*font);
169 connect(EtcEraseDetector, SIGNAL(triggered()), this,
170 SLOT(EtcEraseDetectorCB()));
171 etcmenu->addAction(EtcEraseDetector);
172
173 EtcEraseEvent = new QAction("Erase event", this);
174 EtcEraseEvent->setFont(*font);
175 connect(EtcEraseEvent, SIGNAL(triggered()), this,
176 SLOT(EtcEraseEventCB()));
177 etcmenu->addAction(EtcEraseEvent);
178
179 EtcSetSolid = new QAction("Set solid", this);
180 EtcSetSolid->setFont(*font);
181 connect(EtcSetSolid, SIGNAL(triggered()), this, SLOT(EtcSetSolidCB()));
182 etcmenu->addAction(EtcSetSolid);
183
184 EtcSetReducedWireframe = new QAction("Set (G4) reduced wireframe", this);
185 EtcSetReducedWireframe->setFont(*font);
186 connect(EtcSetReducedWireframe, SIGNAL(triggered()), this,
187 SLOT(EtcSetReducedWireframeCB()));
188 etcmenu->addAction(EtcSetReducedWireframe);
189
190 EtcSetFullWireframe = new QAction("Set full wireframe", this);
191 EtcSetFullWireframe->setFont(*font);
192 connect(EtcSetFullWireframe, SIGNAL(triggered()), this,
193 SLOT(EtcSetFullWireframeCB()));
194 etcmenu->addAction(EtcSetFullWireframe);
195
196 EtcVisibMInvisibD = new QAction("Visible mothers + invisible daughters",
197 this);
198 EtcVisibMInvisibD->setFont(*font);
199 connect(EtcVisibMInvisibD, SIGNAL(triggered()), this,
200 SLOT(EtcVisibMInvisibDCB()));
201 etcmenu->addAction(EtcVisibMInvisibD);
202
203 EtcVisibMVisibD = new QAction("Visible mothers + visible daughters", this);
204 EtcVisibMVisibD->setFont(*font);
205 connect(EtcVisibMVisibD, SIGNAL(triggered()), this,
206 SLOT(EtcVisibMVisibDCB()));
207 etcmenu->addAction(EtcVisibMVisibD);
208
209 EtcUpdateScene = new QAction("Update scene", this);
210 EtcUpdateScene->setFont(*font);
211 connect(EtcUpdateScene, SIGNAL(triggered()), this,
212 SLOT(EtcUpdateSceneCB()));
213 etcmenu->addAction(EtcUpdateScene);
214
215 EtcSceneGraphStats = new QAction("Scene graph stats", this);
216 EtcSceneGraphStats->setFont(*font);
217 connect(EtcSceneGraphStats, SIGNAL(triggered()), this,
218 SLOT(EtcSceneGraphStatsCB()));
219 etcmenu->addAction(EtcSceneGraphStats);
220
221
222 // Have a GL2PS render action :
223 const SbViewportRegion& vpRegion = fViewer->getViewportRegion();
224 fGL2PSAction = new SoGL2PSAction(vpRegion);
225 fViewer->setGLRenderAction(fGL2PSAction);
226
227 // Else :
228
229 // FWJ DEBUG
230 // G4cout << "G4OpenInventorQtViewer: setting scene graph " <<
231 // fSoSelection << G4endl;
232 // G4cout << "G4OpenInventorQtViewer: getNumChildren " <<
233 // fSoSelection->getNumChildren() << G4endl;
234
235 fViewer->setSceneGraph(fSoSelection);
236 fViewer->setTransparencyType(SoGLRenderAction::SORTED_OBJECT_ADD);
237 fViewer->viewAll();
238 fViewer->saveHomePosition();
239 // SOMEHOW this also the OIQt main window title
240 if (!uiQt) fViewer->setTitle(fName);
241 fViewer->show();
242
243 // This SHOULD invoke the event loop:
244 // if(fShell) {
245
246 QWidget* mainWin = SoQt::getTopLevelWidget();
247
248 // FWJ DEBUG
249 // G4cout << "G4OIQtViewer: calling SoQt::show on mainWin = " << mainWin
250 // << G4endl;
251
252 SoQt::show(mainWin);
254
255 // }
257}
#define SoGL2PSAction
Definition: SoGL2PSAction.h:40
G4VInteractorManager * fInteractorManager
Geant4_SoGL2PSAction * fGL2PSAction
Definition: G4SoQt.hh:46
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77
void SetCreatedInteractor(G4Interactor)
virtual void FlushAndWaitExecution()=0
G4ViewParameters fVP
Definition: G4VViewer.hh:220
unsigned int GetWindowSizeHintX() const
unsigned int GetWindowSizeHintY() const
#define TRUE
Definition: globals.hh:41

◆ SetView()

void G4OpenInventorQtViewer::SetView ( )
virtual

Reimplemented from G4OpenInventorViewer.

Definition at line 279 of file G4OpenInventorQtViewer.cc.

280{
282 if(!fViewer) return;
283 // Background.
285 fViewer->setBackgroundColor
286 (SbColor((float)b.GetRed(),(float)b.GetGreen(),(float)b.GetBlue()));
287}
G4double GetBlue() const
Definition: G4Colour.hh:154
G4double GetRed() const
Definition: G4Colour.hh:152
G4double GetGreen() const
Definition: G4Colour.hh:153
const G4Colour & GetBackgroundColour() const

◆ ViewerRender()

void G4OpenInventorQtViewer::ViewerRender ( )
protectedvirtual

Implements G4OpenInventorViewer.

Definition at line 289 of file G4OpenInventorQtViewer.cc.

290{
291 if(!fViewer) return;
292 fViewer->render();
293}

Member Data Documentation

◆ fViewer

G4OpenInventorQtExaminerViewer* G4OpenInventorQtViewer::fViewer
protected

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