84{
85
87
89 if (!pViewer) {
90 G4cout <<
"G4VtkMessenger::SetNewValue: No current viewer.\n"
91 << "\"/vis/open\", or similar, to get one."
93 return;
94 }
95
96 auto* pVtkViewer =
dynamic_cast<G4VtkViewer*
>(pViewer);
97 if (!pVtkViewer) {
98 G4cout <<
"G4VtkMessenger::SetNewValue: Current viewer is not of type VTK. \n"
99 << "(It is \""
101 << "\".)\n"
102 << "Use \"/vis/viewer/select\" or \"/vis/open\"."
104 return;
105 }
106
107 if (command == fpCommandExport)
108 {
110
111 std::istringstream iss(newValue);
112 iss >> format >>
name;
113
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);
124 else
125 G4cout <<
"Unknown /vis/vtk/export file format" <<
G4endl;
126 }
127 else if (command == fpCommandWarnings)
128 {
129 vtkObject::GlobalWarningDisplayOff();
130 }
131}
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
G4VViewer * GetCurrentViewer() const
static G4VisManager * GetInstance()
const char * name(G4int ptype)