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

#include <G4OpenInventorWinViewer.hh>

+ Inheritance diagram for G4OpenInventorWinViewer:

Public Member Functions

virtual void FinishView ()
 
virtual void SetView ()
 
 G4OpenInventorWinViewer (G4OpenInventorSceneHandler &scene, const G4String &name="")
 
virtual ~G4OpenInventorWinViewer ()
 
void Initialise ()
 
- 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 &)
 

Additional Inherited Members

- Static Protected Member Functions inherited from G4OpenInventorViewer
static void SelectionCB (void *, SoPath *)
 
- 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
 

Detailed Description

Definition at line 42 of file G4OpenInventorWinViewer.hh.

Constructor & Destructor Documentation

◆ G4OpenInventorWinViewer()

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

Definition at line 87 of file G4OpenInventorWinViewer.cc.

90:G4OpenInventorViewer (sceneHandler, name)
91,fShell(0)
92,fViewer(0)
93{
95 G4cout << "Window name: " << fName << G4endl;
96}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4String fName
Definition: G4VViewer.hh:218
static Verbosity GetVerbosity()

◆ ~G4OpenInventorWinViewer()

G4OpenInventorWinViewer::~G4OpenInventorWinViewer ( )
virtual

Definition at line 207 of file G4OpenInventorWinViewer.cc.

207 {
208 if(fShell) fInteractorManager->RemoveShell(fShell);
209 if(fViewer) {
210 fViewer->setSceneGraph(0);
211 delete fViewer;
212 }
213 if(fShell) {
214 ::SetWindowLongPtr((HWND)fShell,GWLP_USERDATA,LONG(0));
215 ::DestroyWindow((HWND)fShell);
216 }
217}
G4VInteractorManager * fInteractorManager
void RemoveShell(G4Interactor)

Member Function Documentation

◆ FinishView()

void G4OpenInventorWinViewer::FinishView ( void  )
virtual

Reimplemented from G4VViewer.

Definition at line 219 of file G4OpenInventorWinViewer.cc.

219 {
220 if(!fViewer) return;
221 fViewer->viewAll();
222 fViewer->saveHomePosition();
223}

◆ GetCamera()

SoCamera * G4OpenInventorWinViewer::GetCamera ( )
protectedvirtual

Implements G4OpenInventorViewer.

Definition at line 238 of file G4OpenInventorWinViewer.cc.

238 {
239 if(!fViewer) return 0;
240 return fViewer->getCamera();
241}

◆ Initialise()

void G4OpenInventorWinViewer::Initialise ( )
virtual

Reimplemented from G4VViewer.

Definition at line 99 of file G4OpenInventorWinViewer.cc.

99 {
100
101 G4String wName = fName;
102
103 int width = fVP.GetWindowSizeHintX();
104 int height = fVP.GetWindowSizeHintY();;
105
106 HWND parent = (HWND)fInteractorManager->GetParentInteractor ();
107 if(!parent) {
108 //Create a shell window :
109 G4String shellName = wName;
110 shellName += "_shell";
111 static SbBool done = FALSE;
112 if(done==FALSE) {
113 HBRUSH brush = (HBRUSH) GetSysColorBrush(COLOR_BTNFACE);
114 WNDCLASS wc;
115 wc.style = CS_HREDRAW | CS_VREDRAW;
116 wc.lpfnWndProc = (WNDPROC)WindowProc;
117 wc.cbClsExtra = 0;
118 wc.cbWndExtra = 0;
119 wc.hInstance = ::GetModuleHandle(0);
120 wc.hIcon = ::LoadIcon(0, IDI_APPLICATION);
121 wc.hCursor = ::LoadCursor(0, IDC_ARROW);
122 wc.hbrBackground = brush;
123 wc.lpszMenuName = className;
124 wc.lpszClassName = className;
125 ::RegisterClass(&wc);
126 done = TRUE;
127 }
128
129 width = fVP.GetWindowSizeHintX();
130 height = fVP.GetWindowSizeHintX();
131
132 HMENU menuBar = CreateMenu();
133
134 {HMENU casc = CreatePopupMenu();
135 ::AppendMenu(menuBar,MF_POPUP,(UINT)casc,"File");
136 ::AppendMenu(casc,MF_STRING,ID_FILE_POSTSCRIPT,"PS (gl2ps)");
137 ::AppendMenu(casc,MF_STRING,ID_FILE_PIXMAP_POSTSCRIPT,"PS (pixmap)");
138 ::AppendMenu(casc,MF_STRING,ID_FILE_INVENTOR,"IV");
139 ::AppendMenu(casc,MF_STRING,ID_FILE_ESCAPE,"Escape");}
140
141 {HMENU casc = CreatePopupMenu();
142 ::AppendMenu(menuBar,MF_POPUP,(UINT)casc,"Etc");
143 ::AppendMenu(casc,MF_STRING,ID_ETC_ERASE_DETECTOR,"Erase detector");
144 ::AppendMenu(casc,MF_STRING,ID_ETC_ERASE_EVENT,"Erase event");
145 ::AppendMenu(casc,MF_STRING,ID_ETC_SET_SOLID,"Set solid");
146 //::AppendMenu(casc,MF_STRING,ID_ETC_SET_WIRE_FRAME,"Set (G4) wire frame");
147 ::AppendMenu(casc,MF_STRING,ID_ETC_SET_REDUCED_WIRE_FRAME,
148 "Set (G4) reduced wire frame");
149 ::AppendMenu(casc,MF_STRING,ID_ETC_SET_FULL_WIRE_FRAME,
150 "Set (G4) full wire frame");
151 ::AppendMenu(casc,MF_STRING,ID_ETC_SET_PREVIEW,
152 "Visible mothers + invisible daughters");
153 ::AppendMenu(casc,MF_STRING,ID_ETC_SET_PREVIEW_AND_FULL,
154 "Visible mothers + visible daughters");
155 ::AppendMenu(casc,MF_STRING,ID_ETC_UPDATE_SCENE,"Update scene");
156 ::AppendMenu(casc,MF_STRING,ID_ETC_STATS,"Scene graph stats");}
157
158 {HMENU casc = CreatePopupMenu();
159 ::AppendMenu(menuBar,MF_POPUP,(UINT)casc,"Help");
160 ::AppendMenu(casc,MF_STRING,ID_HELP_CONTROLS,"Controls");}
161
162 fShell = ::CreateWindow(className, shellName.c_str(),
163 WS_OVERLAPPEDWINDOW |
164 WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
165 CW_USEDEFAULT, CW_USEDEFAULT,
166 width,height,
167 0,menuBar,::GetModuleHandle(0),0);
168 // Retreive window and client sizez :
169 RECT wrect,crect;
170 GetWindowRect((HWND)fShell,&wrect);
171 GetClientRect((HWND)fShell,&crect);
172 int ww = wrect.right-wrect.left;
173 int wh = wrect.bottom-wrect.top;
174 int cw = crect.right-crect.left;
175 int ch = crect.bottom-crect.top;
176 // Compell client rect to be width height :
177 MoveWindow((HWND)fShell,wrect.left,wrect.top,width+ww-cw,height+wh-ch,TRUE);
178 ::SetWindowLongPtr((HWND)fShell,GWLP_USERDATA,LONG(this));
179 ::SetWindowText((HWND)fShell,shellName.c_str());
180 parent = fShell;
182 } else {
184 if(str!=0) wName = str;
185 }
186 fViewer = new Geant4_SoWinExaminerViewer(parent,wName.c_str(),TRUE);
187
188 // Have a GL2PS render action :
189 const SbViewportRegion& vpRegion = fViewer->getViewportRegion();
190 fGL2PSAction = new SoGL2PSAction(vpRegion);
191 fViewer->setGLRenderAction(fGL2PSAction);
192
193 fViewer->setSize(SbVec2s(width,height));
194 fViewer->setSceneGraph(fSoSelection);
195 fViewer->viewAll();
196 fViewer->saveHomePosition();
197 fViewer->setTitle(fName);
198 fViewer->show();
199 if(fShell) {
200 SoWin::show(fShell);
202 }
203 fInteractorManager->SetCreatedInteractor (fViewer -> getWidget());
204 fViewer->setTransparencyType(SoGLRenderAction::SORTED_OBJECT_ADD);
205}
#define ID_ETC_SET_FULL_WIRE_FRAME
#define ID_ETC_UPDATE_SCENE
#define ID_ETC_SET_PREVIEW_AND_FULL
#define ID_ETC_STATS
#define ID_FILE_PIXMAP_POSTSCRIPT
#define ID_ETC_SET_PREVIEW
#define ID_ETC_ERASE_DETECTOR
#define ID_ETC_SET_REDUCED_WIRE_FRAME
#define ID_HELP_CONTROLS
#define ID_FILE_POSTSCRIPT
#define ID_ETC_ERASE_EVENT
#define ID_ETC_SET_SOLID
#define ID_FILE_ESCAPE
#define ID_FILE_INVENTOR
#define SoGL2PSAction
Definition: SoGL2PSAction.h:40
Geant4_SoGL2PSAction * fGL2PSAction
void SetCreatedInteractor(G4Interactor)
virtual void FlushAndWaitExecution()=0
G4Interactor GetParentInteractor()
void AddShell(G4Interactor)
G4ViewParameters fVP
Definition: G4VViewer.hh:220
unsigned int GetWindowSizeHintX() const
unsigned int GetWindowSizeHintY() const
#define TRUE
Definition: globals.hh:41
#define FALSE
Definition: globals.hh:38

◆ SetView()

void G4OpenInventorWinViewer::SetView ( )
virtual

Reimplemented from G4OpenInventorViewer.

Definition at line 225 of file G4OpenInventorWinViewer.cc.

225 {
227 if(!fViewer) return;
228 // Background.
230 fViewer->setBackgroundColor
231 (SbColor((float)b.GetRed(),(float)b.GetGreen(),(float)b.GetBlue()));
232}
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 G4OpenInventorWinViewer::ViewerRender ( )
protectedvirtual

Implements G4OpenInventorViewer.

Definition at line 233 of file G4OpenInventorWinViewer.cc.

233 {
234 if(!fViewer) return;
235 fViewer->render();
236}

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