Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/visualization/OpenGL/src/G4OpenGLViewerMessenger.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /visualization/OpenGL/src/G4OpenGLViewerMessenger.cc (Version 11.3.0) and /visualization/OpenGL/src/G4OpenGLViewerMessenger.cc (Version 11.1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 //                                                 26 //
 27                                                    27 
 28 #include "G4OpenGLViewerMessenger.hh"              28 #include "G4OpenGLViewerMessenger.hh"
 29                                                    29 
 30 #include "G4OpenGLViewer.hh"                       30 #include "G4OpenGLViewer.hh"
 31 #include "G4OpenGLStoredViewer.hh"                 31 #include "G4OpenGLStoredViewer.hh"
 32 #include "G4OpenGLStoredSceneHandler.hh"           32 #include "G4OpenGLStoredSceneHandler.hh"
 33 #include "G4UImanager.hh"                          33 #include "G4UImanager.hh"
 34 #include "G4UIcommand.hh"                          34 #include "G4UIcommand.hh"
 35 #include "G4UIdirectory.hh"                        35 #include "G4UIdirectory.hh"
 36 #include "G4UIcmdWithoutParameter.hh"              36 #include "G4UIcmdWithoutParameter.hh"
 37 #include "G4UIcmdWithADouble.hh"                   37 #include "G4UIcmdWithADouble.hh"
 38 #include "G4UIcmdWithABool.hh"                     38 #include "G4UIcmdWithABool.hh"
 39 #include "G4UIcmdWithAString.hh"                   39 #include "G4UIcmdWithAString.hh"
 40 #include "G4UIcmdWithAnInteger.hh"                 40 #include "G4UIcmdWithAnInteger.hh"
 41 #include "G4VisManager.hh"                         41 #include "G4VisManager.hh"
 42 #include <sstream>                                 42 #include <sstream>
 43                                                    43 
 44 G4OpenGLViewerMessenger*                           44 G4OpenGLViewerMessenger*
 45 G4OpenGLViewerMessenger::fpInstance = 0;           45 G4OpenGLViewerMessenger::fpInstance = 0;
 46                                                    46 
 47 G4OpenGLViewerMessenger*                           47 G4OpenGLViewerMessenger*
 48 G4OpenGLViewerMessenger::GetInstance()             48 G4OpenGLViewerMessenger::GetInstance()
 49 {                                                  49 {
 50   if (!fpInstance) fpInstance = new G4OpenGLVi     50   if (!fpInstance) fpInstance = new G4OpenGLViewerMessenger;
 51   return fpInstance;                               51   return fpInstance;
 52 }                                                  52 }
 53                                                    53 
 54 G4OpenGLViewerMessenger::G4OpenGLViewerMesseng     54 G4OpenGLViewerMessenger::G4OpenGLViewerMessenger()
 55 {                                                  55 {
 56   G4bool omitable;                                 56   G4bool omitable;
 57                                                    57 
 58   fpDirectory = new G4UIdirectory("/vis/ogl/")     58   fpDirectory = new G4UIdirectory("/vis/ogl/");
 59   fpDirectory->SetGuidance("G4OpenGLViewer com     59   fpDirectory->SetGuidance("G4OpenGLViewer commands.");
 60                                                    60 
 61   fpCommandExport =                                61   fpCommandExport =
 62   new G4UIcommand("/vis/ogl/export", this);        62   new G4UIcommand("/vis/ogl/export", this);
 63   fpCommandExport->SetGuidance ("Export a scre     63   fpCommandExport->SetGuidance ("Export a screenshot of current OpenGL viewer");
 64   fpCommandExport->SetGuidance                     64   fpCommandExport->SetGuidance
 65   ("If name is \"\", filename and extension wi     65   ("If name is \"\", filename and extension will have the current value");
 66   fpCommandExport->SetGuidance                     66   fpCommandExport->SetGuidance
 67   ("If name is \"toto.png\", set the name to \     67   ("If name is \"toto.png\", set the name to \"toto\" and the format to \"png\".");
 68   fpCommandExport->SetGuidance                     68   fpCommandExport->SetGuidance
 69   ("If name is \"toto\", set the name to \"tot     69   ("If name is \"toto\", set the name to \"toto\" and the format to current format.");
 70   fpCommandExport->SetGuidance                     70   fpCommandExport->SetGuidance
 71   ("Will also add an incremented suffix at the     71   ("Will also add an incremented suffix at the end of the name, except if name is"
 72    "\nthe same as previous it will not reset t     72    "\nthe same as previous it will not reset the incremented suffix.");
 73   fpCommandExport->SetGuidance                     73   fpCommandExport->SetGuidance
 74   ("Setting size is available only on eps/pdf/     74   ("Setting size is available only on eps/pdf/svg/ps formats.");
 75   G4UIparameter* parameterExport;                  75   G4UIparameter* parameterExport;
 76   parameterExport = new G4UIparameter ("name",     76   parameterExport = new G4UIparameter ("name", 's', omitable = true);
 77   parameterExport->SetDefaultValue("!");           77   parameterExport->SetDefaultValue("!");
 78   parameterExport->SetGuidance                     78   parameterExport->SetGuidance
 79   ("By default, will take a default value or t     79   ("By default, will take a default value or the last \"/vis/ogl/set/printFilename\""
 80    " value if set.");                              80    " value if set.");
 81   fpCommandExport->SetParameter(parameterExpor     81   fpCommandExport->SetParameter(parameterExport);
 82   parameterExport = new G4UIparameter ("width"     82   parameterExport = new G4UIparameter ("width", 'd', omitable = true);
 83   parameterExport->SetGuidance                     83   parameterExport->SetGuidance
 84   ("By default, will take the current width of     84   ("By default, will take the current width of the viewer or \"/vis/ogl/set/printSize\""
 85    "\nif set. This parameter is only useful fo     85    "\nif set. This parameter is only useful for eps/pdf/svg/ps formats !");
 86   parameterExport->SetDefaultValue(-1);            86   parameterExport->SetDefaultValue(-1);
 87   fpCommandExport->SetParameter(parameterExpor     87   fpCommandExport->SetParameter(parameterExport);
 88   parameterExport = new G4UIparameter ("height     88   parameterExport = new G4UIparameter ("height", 'd', omitable = true);
 89   parameterExport->SetGuidance                     89   parameterExport->SetGuidance
 90   ("By default, will take the current height o     90   ("By default, will take the current height of the viewer or \"/vis/ogl/set/printSize\""
 91    "\nif set. This parameter is only useful fo     91    "\nif set. This parameter is only useful for eps/pdf/svg/ps formats !");
 92   parameterExport->SetDefaultValue(-1);            92   parameterExport->SetDefaultValue(-1);
 93   fpCommandExport->SetParameter(parameterExpor     93   fpCommandExport->SetParameter(parameterExport);
 94                                                    94 
 95   fpCommandFlushAt = new G4UIcommand("/vis/ogl     95   fpCommandFlushAt = new G4UIcommand("/vis/ogl/flushAt", this);
 96   fpCommandFlushAt->SetGuidance                    96   fpCommandFlushAt->SetGuidance
 97   ("Controls the rate at which graphics primit     97   ("Controls the rate at which graphics primitives are flushed to screen.");
 98   fpCommandFlushAt->SetGuidance                    98   fpCommandFlushAt->SetGuidance
 99   ("Flushing to screen is an expensive operati     99   ("Flushing to screen is an expensive operation so to speed drawing choose"
100    "\nan action suitable for your application.    100    "\nan action suitable for your application.  Note that detectors are flushed"
101    "\nto screen anyway at end of drawing, and     101    "\nto screen anyway at end of drawing, and events are flushed to screen"
102    "\nanyway depending on /vis/scene/endOfEven    102    "\nanyway depending on /vis/scene/endOfEventAction and endOfRunAction.");
103   fpCommandFlushAt->SetGuidance                   103   fpCommandFlushAt->SetGuidance
104   ("For NthPrimitive and NthEvent the second p    104   ("For NthPrimitive and NthEvent the second parameter N is operative.");
105   fpCommandFlushAt->SetGuidance                   105   fpCommandFlushAt->SetGuidance
106   ("For \"never\", detectors and events are st    106   ("For \"never\", detectors and events are still flushed as described above.");
107   G4UIparameter* parameterFlushAt;                107   G4UIparameter* parameterFlushAt;
108   parameterFlushAt = new G4UIparameter ("actio    108   parameterFlushAt = new G4UIparameter ("action", 's', omitable = true);
109   parameterFlushAt->SetParameterCandidates        109   parameterFlushAt->SetParameterCandidates
110   ("endOfEvent endOfRun eachPrimitive NthPrimi    110   ("endOfEvent endOfRun eachPrimitive NthPrimitive NthEvent never");
111   parameterFlushAt->SetDefaultValue("NthEvent"    111   parameterFlushAt->SetDefaultValue("NthEvent");
112   fpCommandFlushAt->SetParameter(parameterFlus    112   fpCommandFlushAt->SetParameter(parameterFlushAt);
113   parameterFlushAt = new G4UIparameter ("N", '    113   parameterFlushAt = new G4UIparameter ("N", 'i', omitable = true);
114   parameterFlushAt->SetDefaultValue(100);         114   parameterFlushAt->SetDefaultValue(100);
115   fpCommandFlushAt->SetParameter(parameterFlus    115   fpCommandFlushAt->SetParameter(parameterFlushAt);
116                                                   116 
117   fpDirectorySet = new G4UIdirectory ("/vis/og    117   fpDirectorySet = new G4UIdirectory ("/vis/ogl/set/");
118   fpDirectorySet->SetGuidance("G4OpenGLViewer     118   fpDirectorySet->SetGuidance("G4OpenGLViewer set commands.");
119                                                   119 
120   fpCommandDisplayListLimit =                     120   fpCommandDisplayListLimit =
121     new G4UIcmdWithoutParameter("/vis/ogl/set/    121     new G4UIcmdWithoutParameter("/vis/ogl/set/displayListLimit", this);
122   fpCommandDisplayListLimit->SetGuidance          122   fpCommandDisplayListLimit->SetGuidance
123   ("This command is no longer relevant. There     123   ("This command is no longer relevant. There is no longer any limit on the"
124    "\nnumber of display lists - except, of cou    124    "\nnumber of display lists - except, of course, the available memory in"
125    "\nyour computer. Keep an eye on that. Good    125    "\nyour computer. Keep an eye on that. Good luck!");
126                                                   126 
127   fpCommandExportFormat =                         127   fpCommandExportFormat =
128   new G4UIcommand("/vis/ogl/set/exportFormat",    128   new G4UIcommand("/vis/ogl/set/exportFormat", this);
129   fpCommandExportFormat->SetGuidance ("Set exp    129   fpCommandExportFormat->SetGuidance ("Set export format");
130   fpCommandExportFormat->SetGuidance ("By defa    130   fpCommandExportFormat->SetGuidance ("By default, pdf/eps/svg/ps are available. Depending of viewers several other format are available.");
131   fpCommandExportFormat->SetGuidance ("Try /vi    131   fpCommandExportFormat->SetGuidance ("Try /vis/ogl/set/exportFormat without parameters to see them.");
132   fpCommandExportFormat->SetGuidance ("Changin    132   fpCommandExportFormat->SetGuidance ("Changing format will reset the incremental suffix to 0.");
133   G4UIparameter* parameterExportFormat;           133   G4UIparameter* parameterExportFormat;
134   parameterExportFormat = new G4UIparameter ("    134   parameterExportFormat = new G4UIparameter ("format", 's', omitable = true);
135   parameterExportFormat->SetDefaultValue("");     135   parameterExportFormat->SetDefaultValue("");
136   fpCommandExportFormat->SetParameter(paramete    136   fpCommandExportFormat->SetParameter(parameterExportFormat);
137                                                   137 
138   fpCommandPrintFilename =                        138   fpCommandPrintFilename =
139     new G4UIcommand("/vis/ogl/set/printFilenam    139     new G4UIcommand("/vis/ogl/set/printFilename", this);
140   fpCommandPrintFilename->SetGuidance ("Set pr    140   fpCommandPrintFilename->SetGuidance ("Set print filename");
141   fpCommandPrintFilename->SetGuidance ("Settin    141   fpCommandPrintFilename->SetGuidance ("Setting 'incremental' will increment filename by one at each new print, starting at 0");
142   G4UIparameter* parameterPrintFilename;          142   G4UIparameter* parameterPrintFilename;
143   parameterPrintFilename = new G4UIparameter (    143   parameterPrintFilename = new G4UIparameter ("name", 's', omitable = true);
144   parameterPrintFilename->SetDefaultValue("G4O    144   parameterPrintFilename->SetDefaultValue("G4OpenGL");
145   fpCommandPrintFilename->SetParameter(paramet    145   fpCommandPrintFilename->SetParameter(parameterPrintFilename);
146   parameterPrintFilename = new G4UIparameter (    146   parameterPrintFilename = new G4UIparameter ("incremental", 'b', omitable = true);
147   parameterPrintFilename->SetDefaultValue(1);     147   parameterPrintFilename->SetDefaultValue(1);
148   fpCommandPrintFilename->SetParameter(paramet    148   fpCommandPrintFilename->SetParameter(parameterPrintFilename);
149                                                   149   
150   fpCommandPrintMode = new G4UIcmdWithAString(    150   fpCommandPrintMode = new G4UIcmdWithAString("/vis/ogl/set/printMode",this);
151   fpCommandPrintMode->SetGuidance("Set print m    151   fpCommandPrintMode->SetGuidance("Set print mode, only available for \"ps\" format");
152   fpCommandPrintMode->SetParameterName("print_    152   fpCommandPrintMode->SetParameterName("print_mode",omitable = true);
153   fpCommandPrintMode->SetCandidates("vectored     153   fpCommandPrintMode->SetCandidates("vectored pixmap");
154   fpCommandPrintMode->SetDefaultValue("vectore    154   fpCommandPrintMode->SetDefaultValue("vectored");
155                                                   155 
156   fpCommandPrintSize =                            156   fpCommandPrintSize =
157     new G4UIcommand("/vis/ogl/set/printSize",     157     new G4UIcommand("/vis/ogl/set/printSize", this);
158   fpCommandPrintSize->SetGuidance ("Set print     158   fpCommandPrintSize->SetGuidance ("Set print size");
159   fpCommandPrintSize->SetGuidance ("Tip : -1 w    159   fpCommandPrintSize->SetGuidance ("Tip : -1 will mean 'print size' = 'window size'");
160   fpCommandPrintSize->SetGuidance ("       Set    160   fpCommandPrintSize->SetGuidance ("       Setting size greater than your maximum graphic card capacity , will set the size to maximum  size.");
161   G4UIparameter* parameterPrintSize;              161   G4UIparameter* parameterPrintSize;
162   parameterPrintSize = new G4UIparameter ("wid    162   parameterPrintSize = new G4UIparameter ("width", 'd', omitable = false);
163   parameterPrintSize->SetDefaultValue(-1);        163   parameterPrintSize->SetDefaultValue(-1);
164   fpCommandPrintSize->SetParameter(parameterPr    164   fpCommandPrintSize->SetParameter(parameterPrintSize);
165   parameterPrintSize = new G4UIparameter ("hei    165   parameterPrintSize = new G4UIparameter ("height", 'd', omitable = false);
166   parameterPrintSize->SetDefaultValue(-1);        166   parameterPrintSize->SetDefaultValue(-1);
167   fpCommandPrintSize->SetParameter(parameterPr    167   fpCommandPrintSize->SetParameter(parameterPrintSize);
168                                                   168 
169   fpCommandTransparency =                         169   fpCommandTransparency =
170     new G4UIcmdWithABool("/vis/ogl/set/transpa    170     new G4UIcmdWithABool("/vis/ogl/set/transparency", this);
171   fpCommandTransparency->SetGuidance              171   fpCommandTransparency->SetGuidance
172     ("True/false to enable/disable rendering o    172     ("True/false to enable/disable rendering of transparent objects.");
173   fpCommandTransparency->SetParameterName         173   fpCommandTransparency->SetParameterName
174     ("transparency-enabled", omitable = true);    174     ("transparency-enabled", omitable = true);
175   fpCommandTransparency->SetDefaultValue(true)    175   fpCommandTransparency->SetDefaultValue(true);
176 }                                                 176 }
177                                                   177 
178 G4OpenGLViewerMessenger::~G4OpenGLViewerMessen    178 G4OpenGLViewerMessenger::~G4OpenGLViewerMessenger ()
179 {                                                 179 {
180   delete fpCommandTransparency;                   180   delete fpCommandTransparency;
181   delete fpCommandPrintSize;                      181   delete fpCommandPrintSize;
182   delete fpCommandPrintMode;                      182   delete fpCommandPrintMode;
183   delete fpCommandPrintFilename;                  183   delete fpCommandPrintFilename;
184   delete fpCommandExportFormat;                   184   delete fpCommandExportFormat;
185   delete fpCommandDisplayListLimit;               185   delete fpCommandDisplayListLimit;
186   delete fpDirectorySet;                          186   delete fpDirectorySet;
187   delete fpCommandFlushAt;                        187   delete fpCommandFlushAt;
188   delete fpCommandExport;                         188   delete fpCommandExport;
189   delete fpDirectory;                             189   delete fpDirectory;
190                                                   190 
191   delete fpInstance;                              191   delete fpInstance;
192 }                                                 192 }
193                                                   193 
194 void G4OpenGLViewerMessenger::SetNewValue         194 void G4OpenGLViewerMessenger::SetNewValue
195 (G4UIcommand* command, G4String newValue)         195 (G4UIcommand* command, G4String newValue)
196 {                                                 196 {
197   G4VisManager* pVisManager = G4VisManager::Ge    197   G4VisManager* pVisManager = G4VisManager::GetInstance();
198                                                   198 
199   G4VViewer* pViewer = pVisManager->GetCurrent    199   G4VViewer* pViewer = pVisManager->GetCurrentViewer();
200   if (!pViewer) {                                 200   if (!pViewer) {
201     G4cout <<                                     201     G4cout <<
202       "G4OpenGLViewerMessenger::SetNewValue: N    202       "G4OpenGLViewerMessenger::SetNewValue: No current viewer."
203       "\n  \"/vis/open\", or similar, to get o    203       "\n  \"/vis/open\", or similar, to get one."
204            << G4endl;                             204            << G4endl;
205     return;                                       205     return;
206   }                                               206   }
207                                                   207 
208   G4VSceneHandler* pSceneHandler = pViewer->Ge    208   G4VSceneHandler* pSceneHandler = pViewer->GetSceneHandler();
209   if (!pSceneHandler) {                           209   if (!pSceneHandler) {
210     G4cout <<                                     210     G4cout <<
211     "G4OpenGLViewerMessenger::SetNewValue: Thi    211     "G4OpenGLViewerMessenger::SetNewValue: This viewer has no scene handler."
212     "\n  Shouldn't happen - please report circ    212     "\n  Shouldn't happen - please report circumstances."
213     "\n  (Viewer is \"" << pViewer->GetName()     213     "\n  (Viewer is \"" << pViewer->GetName() << "\".)"
214     "\n  Try \"/vis/open\", or similar, to get    214     "\n  Try \"/vis/open\", or similar, to get one."
215     << G4endl;                                    215     << G4endl;
216     return;                                       216     return;
217   }                                               217   }
218                                                   218   
219   G4OpenGLViewer* pOGLViewer = dynamic_cast<G4    219   G4OpenGLViewer* pOGLViewer = dynamic_cast<G4OpenGLViewer*>(pViewer);
220   if (!pOGLViewer) {                              220   if (!pOGLViewer) {
221     G4cout <<                                     221     G4cout <<
222       "G4OpenGLViewerMessenger::SetNewValue: C    222       "G4OpenGLViewerMessenger::SetNewValue: Current viewer is not of type"
223       "\n  OGL.  (It is \""                       223       "\n  OGL.  (It is \""
224      << pViewer->GetName() <<                     224      << pViewer->GetName() <<
225       "\".)\n  Use \"/vis/viewer/select\" or \    225       "\".)\n  Use \"/vis/viewer/select\" or \"/vis/open\"."
226            << G4endl;                             226            << G4endl;
227     return;                                       227     return;
228   }                                               228   }
229                                                   229 
230   G4OpenGLSceneHandler* pOGLSceneHandler =        230   G4OpenGLSceneHandler* pOGLSceneHandler =
231   dynamic_cast<G4OpenGLSceneHandler*>(pSceneHa    231   dynamic_cast<G4OpenGLSceneHandler*>(pSceneHandler);
232   if (!pOGLSceneHandler) {                        232   if (!pOGLSceneHandler) {
233     G4cout <<                                     233     G4cout <<
234     "G4OpenGLViewerMessenger::SetNewValue: Cur    234     "G4OpenGLViewerMessenger::SetNewValue: Current scene handler is not of type"
235     "\n  OGL.  (Viewer is \"" << pViewer->GetN    235     "\n  OGL.  (Viewer is \"" << pViewer->GetName() << "\".)"
236     "\n  (Scene handler is \"" << pSceneHandle    236     "\n  (Scene handler is \"" << pSceneHandler->GetName() << "\".)"
237     "\n  Use \"/vis/sceneHandler/list\" and \"    237     "\n  Use \"/vis/sceneHandler/list\" and \"/vis/sceneHandler/select\""
238     "\n  or \"/vis/open\"."                       238     "\n  or \"/vis/open\"."
239     << G4endl;                                    239     << G4endl;
240     return;                                       240     return;
241   }                                               241   }
242                                                   242 
243   if (command == fpCommandExport)                 243   if (command == fpCommandExport)
244   {                                               244   {
245     G4String name;                                245     G4String name;
246     G4int width,height;                           246     G4int width,height;
247     std::istringstream iss(newValue);             247     std::istringstream iss(newValue);
248     iss >> name >> width >> height;               248     iss >> name >> width >> height;
249     pOGLViewer->exportImage(name, width, heigh    249     pOGLViewer->exportImage(name, width, height);
250                                                   250     
251     if (pOGLViewer->fVP.IsAutoRefresh())          251     if (pOGLViewer->fVP.IsAutoRefresh())
252       G4UImanager::GetUIpointer()->ApplyComman    252       G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
253     return;                                       253     return;
254   }                                               254   }
255                                                   255   
256   if (command == fpCommandExportFormat)           256   if (command == fpCommandExportFormat)
257   {                                               257   {
258     G4String name;                                258     G4String name;
259     std::istringstream iss(newValue);             259     std::istringstream iss(newValue);
260     iss >> name;                                  260     iss >> name;
261     pOGLViewer->setExportImageFormat(name);       261     pOGLViewer->setExportImageFormat(name);
262                                                   262 
263     return;                                       263     return;
264   }                                               264   }
265                                                   265 
266   if (command == fpCommandFlushAt)                266   if (command == fpCommandFlushAt)
267   {                                               267   {
268     static G4bool firstTime = true;               268     static G4bool firstTime = true;
269     static std::map<G4String,G4OpenGLSceneHand    269     static std::map<G4String,G4OpenGLSceneHandler::FlushAction> actionMap;
270     if (firstTime) {                              270     if (firstTime) {
271       actionMap["endOfEvent"]    = G4OpenGLSce    271       actionMap["endOfEvent"]    = G4OpenGLSceneHandler::endOfEvent;
272       actionMap["endOfRun"]      = G4OpenGLSce    272       actionMap["endOfRun"]      = G4OpenGLSceneHandler::endOfRun;
273       actionMap["eachPrimitive"] = G4OpenGLSce    273       actionMap["eachPrimitive"] = G4OpenGLSceneHandler::eachPrimitive;
274       actionMap["NthPrimitive"]  = G4OpenGLSce    274       actionMap["NthPrimitive"]  = G4OpenGLSceneHandler::NthPrimitive;
275       actionMap["NthEvent"]      = G4OpenGLSce    275       actionMap["NthEvent"]      = G4OpenGLSceneHandler::NthEvent;
276       actionMap["never"]         = G4OpenGLSce    276       actionMap["never"]         = G4OpenGLSceneHandler::never;
277       firstTime = false;                          277       firstTime = false;
278     }                                             278     }
279     G4String action;                              279     G4String action;
280     G4int entitiesFlushInterval;                  280     G4int entitiesFlushInterval;
281     std::istringstream iss(newValue);             281     std::istringstream iss(newValue);
282     iss >> action >> entitiesFlushInterval;       282     iss >> action >> entitiesFlushInterval;
283     pOGLSceneHandler->SetFlushAction(actionMap    283     pOGLSceneHandler->SetFlushAction(actionMap[action]);
284     pOGLSceneHandler->SetEntitiesFlushInterval    284     pOGLSceneHandler->SetEntitiesFlushInterval(entitiesFlushInterval);
285     return;                                       285     return;
286   }                                               286   }
287                                                   287 
288   if (command == fpCommandPrintFilename)          288   if (command == fpCommandPrintFilename)
289     {                                             289     {
290       G4String name;                              290       G4String name;
291       G4bool inc;                                 291       G4bool inc;
292       std::istringstream iss(newValue);           292       std::istringstream iss(newValue);
293       iss >> name                                 293       iss >> name
294     >> inc;                                       294     >> inc;
295       pOGLViewer->setExportFilename(name,inc);    295       pOGLViewer->setExportFilename(name,inc);
296       return;                                     296       return;
297     }                                             297     }
298                                                   298 
299   if (command == fpCommandPrintMode)              299   if (command == fpCommandPrintMode)
300     {                                             300     {
301       if (newValue == "vectored") pOGLViewer->    301       if (newValue == "vectored") pOGLViewer->fVectoredPs = true;
302                                                   302 
303       if (newValue == "pixmap") pOGLViewer->fV    303       if (newValue == "pixmap") pOGLViewer->fVectoredPs = false;
304       return;                                     304       return;
305     }                                             305     }
306                                                   306 
307   if (command == fpCommandPrintSize)              307   if (command == fpCommandPrintSize)
308     {                                             308     {
309       G4int width,height;                         309       G4int width,height;
310       std::istringstream iss(newValue);           310       std::istringstream iss(newValue);
311       iss >> width                                311       iss >> width
312     >> height;                                    312     >> height;
313       pOGLViewer->setExportSize(width,height);    313       pOGLViewer->setExportSize(width,height);
314       return;                                     314       return;
315     }                                             315     }
316                                                   316 
317   if (command == fpCommandTransparency)           317   if (command == fpCommandTransparency)
318     {                                             318     {
319       pOGLViewer->transparency_enabled = comma    319       pOGLViewer->transparency_enabled = command->ConvertToBool(newValue);
320       if (pOGLViewer->fVP.IsAutoRefresh())        320       if (pOGLViewer->fVP.IsAutoRefresh())
321   G4UImanager::GetUIpointer()->ApplyCommand("/    321   G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
322       return;                                     322       return;
323     }                                             323     }
324                                                   324 
325   // Stored viewer commands                       325   // Stored viewer commands
326   G4OpenGLStoredViewer* pOGLSViewer =             326   G4OpenGLStoredViewer* pOGLSViewer =
327     dynamic_cast<G4OpenGLStoredViewer*>(pViewe    327     dynamic_cast<G4OpenGLStoredViewer*>(pViewer);
328                                                   328 
329   if (!pOGLSViewer)                               329   if (!pOGLSViewer)
330     {                                             330     {
331       G4cout <<                                   331       G4cout <<
332   "G4OpenGLViewerMessenger::SetNewValue: Curre    332   "G4OpenGLViewerMessenger::SetNewValue: Current viewer is not of type OGLS."
333   "\n  (It is \"" << pViewer->GetName() << "\"    333   "\n  (It is \"" << pViewer->GetName() << "\".)"
334   "\n  This feature is only implemented for OG    334   "\n  This feature is only implemented for OGL Stored viewers."
335   "\n  Use \"/vis/viewer/select\" or \"/vis/op    335   "\n  Use \"/vis/viewer/select\" or \"/vis/open OGLS...\"."
336        << G4endl;                                 336        << G4endl;
337       return;                                     337       return;
338     }                                             338     }
339                                                   339 
340   // Scene handler commands                       340   // Scene handler commands
341   G4OpenGLStoredSceneHandler* pOGLSSceneHandle    341   G4OpenGLStoredSceneHandler* pOGLSSceneHandler =
342     dynamic_cast<G4OpenGLStoredSceneHandler*>(    342     dynamic_cast<G4OpenGLStoredSceneHandler*>(pViewer->GetSceneHandler());
343                                                   343 
344   if (!pOGLSSceneHandler) {                       344   if (!pOGLSSceneHandler) {
345     G4cout <<                                     345     G4cout <<
346   "G4OpenGLViewerMessenger::SetNewValue: Curre    346   "G4OpenGLViewerMessenger::SetNewValue: Current scene handler is not of type"
347   "\n  OGLS (Stored).  (Viewer is \"" << pView    347   "\n  OGLS (Stored).  (Viewer is \"" << pViewer->GetName() << "\".)"
348   "\n  (Scene handler is \"" << pSceneHandler-    348   "\n  (Scene handler is \"" << pSceneHandler->GetName() << "\".)"
349   "\n  This feature is only implemented for OG    349   "\n  This feature is only implemented for OGL Stored"
350   "\n  scene handlers.  Use \"/vis/viewer/sele    350   "\n  scene handlers.  Use \"/vis/viewer/select\" or \"/vis/open OGLS...\"."
351            << G4endl;                             351            << G4endl;
352     return;                                       352     return;
353   }                                               353   }
354                                                   354 
355   if (command == fpCommandDisplayListLimit)       355   if (command == fpCommandDisplayListLimit)
356     {                                             356     {
357       G4cerr << command->GetGuidanceLine(0) <<    357       G4cerr << command->GetGuidanceLine(0) << G4endl;
358       return;                                     358       return;
359     }                                             359     }
360 }                                                 360 }
361                                                   361