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

#include <G4ToolsSGOffscreenViewer.hh>

Inheritance diagram for G4ToolsSGOffscreenViewer:

Classes

class  Messenger

Public Member Functions

 G4ToolsSGOffscreenViewer (tools::offscreen::session &a_session, G4ToolsSGSceneHandler &a_scene_handler, const G4String &a_name)
virtual ~G4ToolsSGOffscreenViewer ()=default
virtual void Initialise ()
virtual void DrawView ()
virtual void ClearView ()
virtual void ShowView ()
virtual void FinishView ()
Public Member Functions inherited from G4ToolsSGViewer< tools::offscreen::session, tools::offscreen::sg_viewer >
virtual void key_press (const tools::sg::key_down_event &)
virtual void key_release (const tools::sg::key_up_event &)
virtual void mouse_press (const tools::sg::mouse_down_event &a_event)
virtual void mouse_release (const tools::sg::mouse_up_event &)
virtual void mouse_move (const tools::sg::mouse_move_event &a_event)
virtual void wheel_rotate (const tools::sg::wheel_rotate_event &a_event)
 G4ToolsSGViewer (tools::offscreen::session &a_session, G4ToolsSGSceneHandler &a_scene_handler, const G4String &a_name)
virtual ~G4ToolsSGViewer ()
virtual void SetView ()
G4bool GetWindowSize (unsigned int &a_w, unsigned int &a_h)
G4bool GetRenderAreaSize (unsigned int &a_w, unsigned int &a_h)
virtual void EmitWindowRender ()
Public Member Functions inherited from G4VViewer
 G4VViewer (G4VSceneHandler &, G4int id, const G4String &name="")
virtual ~G4VViewer ()
virtual void ResetView ()
void RefreshView ()
virtual G4bool ReadyToDraw ()
std::vector< G4ThreeVectorComputeFlyThrough (G4Vector3D *)
virtual void DoneWithMasterThread ()
virtual void MovingToVisSubThread ()
virtual void SwitchToVisSubThread ()
virtual void DoneWithVisSubThread ()
virtual void MovingToMasterThread ()
virtual void SwitchToMasterThread ()
void InsertModelInSceneTree (G4VModel *)
const G4SceneTreeItemGetSceneTree ()
G4SceneTreeItemAccessSceneTree ()
void UpdateGUISceneTree ()
void UpdateGUIControlWidgets ()
void UpdateGUIDrawingStyle ()
void UpdateGUIProjectionStyle ()
void UpdateGUITransparencySlider ()
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 ()
void ProcessTransients ()
void ZoomFromMouseWheel (G4double delta, G4bool shift=false, G4double xPos=0, G4double yPos=0)
Public Member Functions inherited from G4ToolsSG_viewer
 G4ToolsSG_viewer ()
virtual ~G4ToolsSG_viewer ()

Protected Member Functions

 G4ToolsSGOffscreenViewer (const G4ToolsSGOffscreenViewer &a_from)
G4ToolsSGOffscreenVieweroperator= (const G4ToolsSGOffscreenViewer &)
void SetSize (unsigned int a_w, unsigned int a_h)
void SetFileFormat (const G4String &a_format)
void SetDoTransparency (bool a_value)
void SetFileName (const G4String &a_file, const G4String &a_prefix, bool a_reset_index)
void SetGL2PSSort (const G4String &a_sort)
void SetGL2PSOptions (const G4String &a_opts)
unsigned int GetFileIndex ()
Protected Member Functions inherited from G4ToolsSGViewer< tools::offscreen::session, tools::offscreen::sg_viewer >
 G4ToolsSGViewer (const G4ToolsSGViewer &a_from)
G4ToolsSGVieweroperator= (const G4ToolsSGViewer &)
void KernelVisitDecision ()
G4bool CompareForKernelVisit (G4ViewParameters &vp)
G4bool CompareForTransientsRedraw (G4ViewParameters &vp)
void CreateSG (tools::sg::base_camera *a_camera, const G4Vector3D &a_light_dir)
void Export (const G4String &a_format, const G4String &a_file, G4bool a_do_transparency)
G4double GetSceneNearWidth ()
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 Member Functions inherited from G4ToolsSG_viewer
 G4ToolsSG_viewer (const G4ToolsSG_viewer &)
G4ToolsSG_vieweroperator= (const G4ToolsSG_viewer &)

Static Protected Member Functions

static bool IsKnownFormat (const std::string &a_format)
static bool GetFormatExtension (const std::string &a_format, std::string &a_ext)

Protected Attributes

std::string fFileName
std::string fFilePrefix
unsigned int fFileIndex
bool fResetFileIndex
Protected Attributes inherited from G4ToolsSGViewer< tools::offscreen::session, tools::offscreen::sg_viewer >
tools::offscreen::session & fSGSession
G4ToolsSGSceneHandlerfSGSceneHandler
tools::offscreen::sg_viewer * fSGViewer
G4ViewParameters fLastVP
G4bool fMousePressed
G4double fMousePressedX
G4double fMousePressedY
tools::sg::zb_manager f_zb_mgr
tools::sg::gl2ps_manager f_gl2ps_mgr
Protected Attributes inherited from G4VViewer
G4VSceneHandlerfSceneHandler
G4int fViewId
G4String fName
G4String fShortName
G4ViewParameters fVP
G4ViewParameters fDefaultVP
G4double fKernelVisitElapsedTimeSeconds = 999.
G4SceneTreeItem fSceneTree
G4bool fNeedKernelVisit
G4bool fTransientsNeedRedrawing

Additional Inherited Members

Public Attributes inherited from G4VViewer
const G4int fMaxAllTouchables = 10000
G4bool fCurtailDescent = false

Detailed Description

Definition at line 42 of file G4ToolsSGOffscreenViewer.hh.

Constructor & Destructor Documentation

◆ G4ToolsSGOffscreenViewer() [1/2]

G4ToolsSGOffscreenViewer::G4ToolsSGOffscreenViewer ( tools::offscreen::session & a_session,
G4ToolsSGSceneHandler & a_scene_handler,
const G4String & a_name )
inline

◆ ~G4ToolsSGOffscreenViewer()

virtual G4ToolsSGOffscreenViewer::~G4ToolsSGOffscreenViewer ( )
virtualdefault

◆ G4ToolsSGOffscreenViewer() [2/2]

G4ToolsSGOffscreenViewer::G4ToolsSGOffscreenViewer ( const G4ToolsSGOffscreenViewer & a_from)
inlineprotected

Definition at line 56 of file G4ToolsSGOffscreenViewer.hh.

56:parent(a_from){}

Member Function Documentation

◆ ClearView()

virtual void G4ToolsSGOffscreenViewer::ClearView ( void )
inlinevirtual

Reimplemented from G4ToolsSGViewer< tools::offscreen::session, tools::offscreen::sg_viewer >.

Definition at line 109 of file G4ToolsSGOffscreenViewer.hh.

109 {
110 //::printf("debug : G4ToolsSGOffscreenViewer::ClearView %s\n",fName.c_str());
111 }

◆ DrawView()

virtual void G4ToolsSGOffscreenViewer::DrawView ( )
inlinevirtual

Reimplemented from G4ToolsSGViewer< tools::offscreen::session, tools::offscreen::sg_viewer >.

Definition at line 79 of file G4ToolsSGOffscreenViewer.hh.

79 {
81 fLastVP = fVP;
82 ProcessView(); // Clears store and processes scene only if necessary.
83 //::printf("debug : G4ToolsSGOffscreenViewer::DrawView %s\n",fName.c_str());
84 if(fSGViewer) {
85 fSGSceneHandler.TouchPlotters(fSGViewer->sg());
86 if(fFileName=="auto") {
87 std::string prefix;
88 if(fFilePrefix=="auto") {
89 prefix = "g4tsg_offscreen_"+fSGViewer->file_format()+"_";
90 } else {
91 prefix = fFilePrefix;
92 }
93 std::string suffix;
95 std::string file_name = prefix+tools::tos(GetFileIndex())+"."+suffix;
96 fSGViewer->set_file_name(file_name);
97 }
98 } else {
99 fSGViewer->set_file_name(fFileName);
100 }
101 if(fSGViewer->write_paper()) {
103 G4cout << "File " << fSGViewer->file_name() << " produced." << G4endl;
104 }
105 }
106 }
107 }
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
static bool GetFormatExtension(const std::string &a_format, std::string &a_ext)
G4bool fNeedKernelVisit
Definition G4VViewer.hh:280
void ProcessView()
Definition G4VViewer.cc:112
G4ViewParameters fVP
Definition G4VViewer.hh:272
static Verbosity GetVerbosity()

◆ FinishView()

virtual void G4ToolsSGOffscreenViewer::FinishView ( void )
inlinevirtual

Reimplemented from G4ToolsSGViewer< tools::offscreen::session, tools::offscreen::sg_viewer >.

Definition at line 115 of file G4ToolsSGOffscreenViewer.hh.

115 {
116 //::printf("debug : G4ToolsSGOffscreenViewer::FinishView %s\n",fName.c_str());
117 if(fSGViewer) {
118 fSGSceneHandler.TouchPlotters(fSGViewer->sg());
119 }
120 }

◆ GetFileIndex()

unsigned int G4ToolsSGOffscreenViewer::GetFileIndex ( )
inlineprotected

Definition at line 359 of file G4ToolsSGOffscreenViewer.hh.

359 {
361 fFileIndex++;
362 return fFileIndex;
363 }

Referenced by DrawView().

◆ GetFormatExtension()

bool G4ToolsSGOffscreenViewer::GetFormatExtension ( const std::string & a_format,
std::string & a_ext )
inlinestaticprotected

Definition at line 378 of file G4ToolsSGOffscreenViewer.hh.

378 {
379 if(a_format=="gl2ps_eps") {a_ext = "eps";return true;}
380 if(a_format=="gl2ps_ps") {a_ext = "ps";return true;}
381 if(a_format=="gl2ps_pdf") {a_ext = "pdf";return true;}
382 if(a_format=="gl2ps_svg") {a_ext = "svg";return true;}
383 if(a_format=="gl2ps_tex") {a_ext = "tex";return true;}
384 if(a_format=="gl2ps_pgf") {a_ext = "pgf";return true;}
385 if(a_format=="zb_ps") {a_ext = "ps";return true;}
386 if(a_format=="zb_png") {a_ext = "png";return true;}
387 if(a_format=="zb_jpeg") {a_ext = "jpeg";return true;}
388 a_ext.clear();
389 return false;
390 }

Referenced by DrawView().

◆ Initialise()

virtual void G4ToolsSGOffscreenViewer::Initialise ( )
inlinevirtual

Reimplemented from G4ToolsSGViewer< tools::offscreen::session, tools::offscreen::sg_viewer >.

Definition at line 59 of file G4ToolsSGOffscreenViewer.hh.

59 {
60 if(fSGViewer) return; //done.
61 //::printf("debug : G4ToolsSGOffscreenViewer::Initialize\n");
62 // auto refresh true produces too much files.
63 fVP.SetAutoRefresh(false);
64 fDefaultVP.SetAutoRefresh(false);
65 fSGViewer = new tools::offscreen::sg_viewer(fSGSession
66 ,fVP.GetWindowAbsoluteLocationHintX(1440)
67 ,fVP.GetWindowAbsoluteLocationHintY(900)
68 ,fVP.GetWindowSizeHintX()
69 ,fVP.GetWindowSizeHintY()
70 ,fName);
71 fSGViewer->set_file_format("zb_png");
72 fSGViewer->set_file_name("out.png");
73 fSGViewer->set_png_writer(tools::fpng::write);
74 fSGViewer->set_jpeg_writer(tools::toojpeg::write);
75 fSGViewer->set_do_transparency(true);
76 fSGViewer->set_top_to_bottom(false); //if using tools::fpng, tools::toojpeg.
77 }
G4String fName
Definition G4VViewer.hh:270
G4ViewParameters fDefaultVP
Definition G4VViewer.hh:273

◆ IsKnownFormat()

bool G4ToolsSGOffscreenViewer::IsKnownFormat ( const std::string & a_format)
inlinestaticprotected

Definition at line 365 of file G4ToolsSGOffscreenViewer.hh.

365 {
366 if(a_format=="gl2ps_eps") return true;
367 if(a_format=="gl2ps_ps") return true;
368 if(a_format=="gl2ps_pdf") return true;
369 if(a_format=="gl2ps_svg") return true;
370 if(a_format=="gl2ps_tex") return true;
371 if(a_format=="gl2ps_pgf") return true;
372 if(a_format=="zb_ps") return true;
373 if(a_format=="zb_png") return true;
374 if(a_format=="zb_jpeg") return true;
375 return false;
376 }

Referenced by G4ToolsSGOffscreenViewer::Messenger::SetNewValue().

◆ operator=()

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

Definition at line 57 of file G4ToolsSGOffscreenViewer.hh.

57{return *this;}

◆ SetDoTransparency()

void G4ToolsSGOffscreenViewer::SetDoTransparency ( bool a_value)
inlineprotected

Definition at line 137 of file G4ToolsSGOffscreenViewer.hh.

137 {
138 if(!fSGViewer) return;
139 fSGViewer->set_do_transparency(a_value);
140 }

Referenced by G4ToolsSGOffscreenViewer::Messenger::SetNewValue().

◆ SetFileFormat()

void G4ToolsSGOffscreenViewer::SetFileFormat ( const G4String & a_format)
inlineprotected

Definition at line 132 of file G4ToolsSGOffscreenViewer.hh.

132 {
133 if(!fSGViewer) return;
134 fSGViewer->set_file_format(a_format);
135 }

Referenced by G4ToolsSGOffscreenViewer::Messenger::SetNewValue().

◆ SetFileName()

void G4ToolsSGOffscreenViewer::SetFileName ( const G4String & a_file,
const G4String & a_prefix,
bool a_reset_index )
inlineprotected

Definition at line 142 of file G4ToolsSGOffscreenViewer.hh.

142 {
143 fFileName = a_file;
144 fFilePrefix = a_prefix;
145 fResetFileIndex = a_reset_index;
146 }

Referenced by G4ToolsSGOffscreenViewer::Messenger::SetNewValue().

◆ SetGL2PSOptions()

void G4ToolsSGOffscreenViewer::SetGL2PSOptions ( const G4String & a_opts)
inlineprotected

Definition at line 153 of file G4ToolsSGOffscreenViewer.hh.

153 {
154 if(!fSGViewer) return;
155 fSGViewer->set_opts_2(a_opts);
156 }

Referenced by G4ToolsSGOffscreenViewer::Messenger::SetNewValue().

◆ SetGL2PSSort()

void G4ToolsSGOffscreenViewer::SetGL2PSSort ( const G4String & a_sort)
inlineprotected

Definition at line 148 of file G4ToolsSGOffscreenViewer.hh.

148 {
149 if(!fSGViewer) return;
150 fSGViewer->set_opts_1(a_sort);
151 }

Referenced by G4ToolsSGOffscreenViewer::Messenger::SetNewValue().

◆ SetSize()

void G4ToolsSGOffscreenViewer::SetSize ( unsigned int a_w,
unsigned int a_h )
inlineprotected

Definition at line 123 of file G4ToolsSGOffscreenViewer.hh.

123 {
124 if(!fSGViewer) return;
125 if(!a_w || !a_h) {
126 fSGViewer->set_size(fVP.GetWindowSizeHintX(),fVP.GetWindowSizeHintY());
127 } else {
128 fSGViewer->set_size(a_w,a_h);
129 }
130 }

Referenced by G4ToolsSGOffscreenViewer::Messenger::SetNewValue().

◆ ShowView()

virtual void G4ToolsSGOffscreenViewer::ShowView ( void )
inlinevirtual

Reimplemented from G4ToolsSGViewer< tools::offscreen::session, tools::offscreen::sg_viewer >.

Definition at line 112 of file G4ToolsSGOffscreenViewer.hh.

112 {
113 //::printf("debug : G4ToolsSGOffscreenViewer::ShowView %s\n",fName.c_str());
114 }

Member Data Documentation

◆ fFileIndex

unsigned int G4ToolsSGOffscreenViewer::fFileIndex
protected

Definition at line 395 of file G4ToolsSGOffscreenViewer.hh.

Referenced by G4ToolsSGOffscreenViewer(), and GetFileIndex().

◆ fFileName

std::string G4ToolsSGOffscreenViewer::fFileName
protected

Definition at line 393 of file G4ToolsSGOffscreenViewer.hh.

Referenced by DrawView(), G4ToolsSGOffscreenViewer(), and SetFileName().

◆ fFilePrefix

std::string G4ToolsSGOffscreenViewer::fFilePrefix
protected

Definition at line 394 of file G4ToolsSGOffscreenViewer.hh.

Referenced by DrawView(), G4ToolsSGOffscreenViewer(), and SetFileName().

◆ fResetFileIndex

bool G4ToolsSGOffscreenViewer::fResetFileIndex
protected

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