Geant4 11.1.1
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 SetView ()
 
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 &a_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 Initialise ()
 
virtual void SetView ()
 
virtual void ClearView ()
 
virtual void DrawView ()
 
virtual void ShowView ()
 
virtual void FinishView ()
 
- 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

 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)
 
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)
 
- 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 &)
 

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 fKeyPressed
 
G4bool fKeyShift
 
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.
 
G4bool fNeedKernelVisit
 

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

Definition at line 45 of file G4ToolsSGOffscreenViewer.hh.

46 :parent(a_session,a_scene_handler,a_name)
47 ,fFileName("auto")
48 ,fFilePrefix("auto")
49 ,fFileIndex(0)
50 ,fResetFileIndex(false)
51 {
53 }

◆ ~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 114 of file G4ToolsSGOffscreenViewer.hh.

114 {
115 //::printf("debug : G4ToolsSGOffscreenViewer::ClearView %s\n",fName.c_str());
116 }

◆ DrawView()

virtual void G4ToolsSGOffscreenViewer::DrawView ( )
inlinevirtual

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

Definition at line 84 of file G4ToolsSGOffscreenViewer.hh.

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

◆ FinishView()

virtual void G4ToolsSGOffscreenViewer::FinishView ( void  )
inlinevirtual

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

Definition at line 120 of file G4ToolsSGOffscreenViewer.hh.

120 {
121 //::printf("debug : G4ToolsSGOffscreenViewer::FinishView %s\n",fName.c_str());
122 if(fSGViewer) {
124 }
125 }

◆ GetFileIndex()

unsigned int G4ToolsSGOffscreenViewer::GetFileIndex ( )
inlineprotected

Definition at line 364 of file G4ToolsSGOffscreenViewer.hh.

364 {
366 fFileIndex++;
367 return fFileIndex;
368 }

Referenced by DrawView().

◆ GetFormatExtension()

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

Definition at line 383 of file G4ToolsSGOffscreenViewer.hh.

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

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);
65 fSGViewer = new tools::offscreen::sg_viewer(fSGSession
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:218
G4ViewParameters fDefaultVP
Definition: G4VViewer.hh:221
void SetAutoRefresh(G4bool)
G4int GetWindowAbsoluteLocationHintY(G4int) const
unsigned int GetWindowSizeHintX() const
G4int GetWindowAbsoluteLocationHintX(G4int) const
unsigned int GetWindowSizeHintY() const

◆ IsKnownFormat()

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

Definition at line 370 of file G4ToolsSGOffscreenViewer.hh.

370 {
371 if(a_format=="gl2ps_eps") return true;
372 if(a_format=="gl2ps_ps") return true;
373 if(a_format=="gl2ps_pdf") return true;
374 if(a_format=="gl2ps_svg") return true;
375 if(a_format=="gl2ps_tex") return true;
376 if(a_format=="gl2ps_pgf") return true;
377 if(a_format=="zb_ps") return true;
378 if(a_format=="zb_png") return true;
379 if(a_format=="zb_jpeg") return true;
380 return false;
381 }

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 142 of file G4ToolsSGOffscreenViewer.hh.

142 {
143 if(!fSGViewer) return;
144 fSGViewer->set_do_transparency(a_value);
145 }

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

◆ SetFileFormat()

void G4ToolsSGOffscreenViewer::SetFileFormat ( const G4String a_format)
inlineprotected

Definition at line 137 of file G4ToolsSGOffscreenViewer.hh.

137 {
138 if(!fSGViewer) return;
139 fSGViewer->set_file_format(a_format);
140 }

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 147 of file G4ToolsSGOffscreenViewer.hh.

147 {
148 fFileName = a_file;
149 fFilePrefix = a_prefix;
150 fResetFileIndex = a_reset_index;
151 }

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

◆ SetGL2PSOptions()

void G4ToolsSGOffscreenViewer::SetGL2PSOptions ( const G4String a_opts)
inlineprotected

Definition at line 158 of file G4ToolsSGOffscreenViewer.hh.

158 {
159 if(!fSGViewer) return;
160 fSGViewer->set_opts_2(a_opts);
161 }

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

◆ SetGL2PSSort()

void G4ToolsSGOffscreenViewer::SetGL2PSSort ( const G4String a_sort)
inlineprotected

Definition at line 153 of file G4ToolsSGOffscreenViewer.hh.

153 {
154 if(!fSGViewer) return;
155 fSGViewer->set_opts_1(a_sort);
156 }

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

◆ SetSize()

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

Definition at line 128 of file G4ToolsSGOffscreenViewer.hh.

128 {
129 if(!fSGViewer) return;
130 if(!a_w || !a_h) {
132 } else {
133 fSGViewer->set_size(a_w,a_h);
134 }
135 }

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

◆ SetView()

virtual void G4ToolsSGOffscreenViewer::SetView ( )
inlinevirtual

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

Definition at line 78 of file G4ToolsSGOffscreenViewer.hh.

78 {
79 //::printf("debug : G4ToolsSGOffscreenViewer::SetView\n");
80 fVP.SetGlobalMarkerScale(1); //WARNING: for __APPLE__, the G4ToolsSGQtViewer set it to 2.
82 }
void SetGlobalMarkerScale(G4double globalMarkerScale)

◆ ShowView()

virtual void G4ToolsSGOffscreenViewer::ShowView ( void  )
inlinevirtual

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

Definition at line 117 of file G4ToolsSGOffscreenViewer.hh.

117 {
118 //::printf("debug : G4ToolsSGOffscreenViewer::ShowView %s\n",fName.c_str());
119 }

Member Data Documentation

◆ fFileIndex

unsigned int G4ToolsSGOffscreenViewer::fFileIndex
protected

Definition at line 400 of file G4ToolsSGOffscreenViewer.hh.

Referenced by GetFileIndex().

◆ fFileName

std::string G4ToolsSGOffscreenViewer::fFileName
protected

Definition at line 398 of file G4ToolsSGOffscreenViewer.hh.

Referenced by DrawView(), and SetFileName().

◆ fFilePrefix

std::string G4ToolsSGOffscreenViewer::fFilePrefix
protected

Definition at line 399 of file G4ToolsSGOffscreenViewer.hh.

Referenced by DrawView(), and SetFileName().

◆ fResetFileIndex

bool G4ToolsSGOffscreenViewer::fResetFileIndex
protected

Definition at line 401 of file G4ToolsSGOffscreenViewer.hh.

Referenced by GetFileIndex(), and SetFileName().


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