48G4VtkMessenger::G4VtkMessenger() {
55 fpCommandExport =
new G4UIcommand(
"/vis/vtk/export",
this);
56 fpCommandExport->
SetGuidance (
"Export a screenshot or OBJ file of current Vtk viewer");
59 auto parameterExport =
new G4UIparameter (
"name",
's', omitable =
true);
60 fpCommandExport->
SetGuidance (
"File type (jpg,tiff,eps,ps,obj,vrml)");
64 parameterExport =
new G4UIparameter (
"name",
's', omitable =
true);
70 fpCommandExport->
SetGuidance (
"Enable (True) or disable (False) VTK warnings");
76 delete fpCommandExport;
77 delete fpCommandWarnings;
90 G4cout <<
"G4VtkMessenger::SetNewValue: No current viewer.\n"
91 <<
"\"/vis/open\", or similar, to get one."
96 auto* pVtkViewer =
dynamic_cast<G4VtkViewer*
>(pViewer);
98 G4cout <<
"G4VtkMessenger::SetNewValue: Current viewer is not of type VTK. \n"
102 <<
"Use \"/vis/viewer/select\" or \"/vis/open\"."
107 if (command == fpCommandExport)
111 std::istringstream iss(newValue);
112 iss >> format >> name;
114 if(format ==
"jpg" || format ==
"tiff" ||
115 format ==
"png" || format ==
"bmp" ||
116 format ==
"pnm" || format ==
"ps")
117 pVtkViewer->ExportScreenShot(name, format);
118 else if(format ==
"obj")
119 pVtkViewer->ExportOBJScene(name);
120 else if(format ==
"vrml")
121 pVtkViewer->ExportVRMLScene(name);
122 else if(format ==
"vtp")
123 pVtkViewer->ExportVTPScene(name);
125 G4cout <<
"Unknown /vis/vtk/export file format" <<
G4endl;
127 else if (command == fpCommandWarnings)
129 vtkObject::GlobalWarningDisplayOff();
G4GLOB_DLL std::ostream G4cout
void SetParameter(G4UIparameter *const newParameter)
void SetGuidance(const char *aGuidance)
const G4String & GetName() const
G4VViewer * GetCurrentViewer() const
static G4VisManager * GetInstance()
virtual void SetNewValue(G4UIcommand *command, G4String newValue)
virtual G4String GetCurrentValue(G4UIcommand *command)
static G4VtkMessenger * GetInstance()
virtual ~G4VtkMessenger()