Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/visualization/management/src/G4VisCommandsScene.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/management/src/G4VisCommandsScene.cc (Version 11.3.0) and /visualization/management/src/G4VisCommandsScene.cc (Version 11.1.3)


  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 // /vis/scene commands - John Allison  9th Aug     28 // /vis/scene commands - John Allison  9th August 1998
 29                                                    29 
 30 #include "G4VisCommandsScene.hh"                   30 #include "G4VisCommandsScene.hh"
 31                                                    31 
 32 #include "G4VisManager.hh"                         32 #include "G4VisManager.hh"
 33 #include "G4TransportationManager.hh"              33 #include "G4TransportationManager.hh"
 34 #include "G4RunManager.hh"                         34 #include "G4RunManager.hh"
 35 #include "G4RunManagerFactory.hh"                  35 #include "G4RunManagerFactory.hh"
 36 #include "G4Run.hh"                                36 #include "G4Run.hh"
 37 #include "G4PhysicalVolumeModel.hh"                37 #include "G4PhysicalVolumeModel.hh"
 38 #include "G4ApplicationState.hh"                   38 #include "G4ApplicationState.hh"
 39 #include "G4UImanager.hh"                          39 #include "G4UImanager.hh"
 40 #include "G4UIcommand.hh"                          40 #include "G4UIcommand.hh"
 41 #include "G4UIcmdWithAString.hh"                   41 #include "G4UIcmdWithAString.hh"
 42 #include "G4UIcmdWithoutParameter.hh"              42 #include "G4UIcmdWithoutParameter.hh"
 43 #include "G4ios.hh"                                43 #include "G4ios.hh"
 44 #include <sstream>                                 44 #include <sstream>
 45                                                    45 
 46 #define G4warn G4cout                              46 #define G4warn G4cout
 47                                                    47 
 48 G4VVisCommandScene::G4VVisCommandScene () {}       48 G4VVisCommandScene::G4VVisCommandScene () {}
 49                                                    49 
 50 G4VVisCommandScene::~G4VVisCommandScene () {}      50 G4VVisCommandScene::~G4VVisCommandScene () {}
 51                                                    51 
 52 G4String G4VVisCommandScene::CurrentSceneName      52 G4String G4VVisCommandScene::CurrentSceneName () {
 53   const G4Scene* pScene = fpVisManager -> GetC     53   const G4Scene* pScene = fpVisManager -> GetCurrentScene ();
 54   G4String currentSceneName = "none";              54   G4String currentSceneName = "none";
 55   if (pScene) currentSceneName = pScene -> Get     55   if (pScene) currentSceneName = pScene -> GetName ();
 56   return currentSceneName;                         56   return currentSceneName;
 57 }                                                  57 }
 58                                                    58 
 59 ////////////// /vis/scene/activateModel //////     59 ////////////// /vis/scene/activateModel ////////////////////////////
 60                                                    60 
 61 G4VisCommandSceneActivateModel::G4VisCommandSc     61 G4VisCommandSceneActivateModel::G4VisCommandSceneActivateModel () {
 62   G4bool omitable;                                 62   G4bool omitable;
 63   fpCommand = new G4UIcommand ("/vis/scene/act     63   fpCommand = new G4UIcommand ("/vis/scene/activateModel", this);
 64   fpCommand -> SetGuidance                         64   fpCommand -> SetGuidance
 65     ("Activate or de-activate model.");            65     ("Activate or de-activate model.");
 66   fpCommand -> SetGuidance                         66   fpCommand -> SetGuidance
 67     ("Attempts to match search string to name      67     ("Attempts to match search string to name of model - use unique sub-string.");
 68   fpCommand -> SetGuidance                         68   fpCommand -> SetGuidance
 69     ("Use \"/vis/scene/list\" to see model nam     69     ("Use \"/vis/scene/list\" to see model names.");
 70   fpCommand -> SetGuidance                         70   fpCommand -> SetGuidance
 71     ("If name == \"all\" (default), all models     71     ("If name == \"all\" (default), all models are activated.");
 72   G4UIparameter* parameter;                        72   G4UIparameter* parameter;
 73   parameter = new G4UIparameter ("search-strin     73   parameter = new G4UIparameter ("search-string", 's', omitable = true);
 74   parameter -> SetDefaultValue ("all");            74   parameter -> SetDefaultValue ("all");
 75   fpCommand -> SetParameter (parameter);           75   fpCommand -> SetParameter (parameter);
 76   parameter = new G4UIparameter ("activate", '     76   parameter = new G4UIparameter ("activate", 'b', omitable = true);
 77   parameter -> SetDefaultValue (true);             77   parameter -> SetDefaultValue (true);
 78   fpCommand -> SetParameter (parameter);           78   fpCommand -> SetParameter (parameter);
 79 }                                                  79 }
 80                                                    80 
 81 G4VisCommandSceneActivateModel::~G4VisCommandS     81 G4VisCommandSceneActivateModel::~G4VisCommandSceneActivateModel () {
 82   delete fpCommand;                                82   delete fpCommand;
 83 }                                                  83 }
 84                                                    84 
 85 G4String G4VisCommandSceneActivateModel::GetCu     85 G4String G4VisCommandSceneActivateModel::GetCurrentValue(G4UIcommand*) {
 86   return "";                                       86   return "";
 87 }                                                  87 }
 88                                                    88 
 89 void G4VisCommandSceneActivateModel::SetNewVal     89 void G4VisCommandSceneActivateModel::SetNewValue (G4UIcommand*,
 90                  G4String newValue) {              90                  G4String newValue) {
 91                                                    91 
 92   G4VisManager::Verbosity verbosity = fpVisMan     92   G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
 93                                                    93 
 94   G4String searchString, activateString;           94   G4String searchString, activateString;
 95   std::istringstream is (newValue);                95   std::istringstream is (newValue);
 96   // Need to handle the possibility that the s <<  96   is >> searchString >> activateString;
 97   // contains embedded blanks within quotation << 
 98   // (This arises if the search string is auto << 
 99   // global description, as in G4UIQt, clickin << 
100   auto lastQuotationMark = newValue.find_last_ << 
101   if (lastQuotationMark != std::string::npos)  << 
102     auto firstQuotationMark = newValue.find_fi << 
103     if (lastQuotationMark != firstQuotationMar << 
104       // Note: there must not be more quotatio << 
105       searchString = newValue.substr           << 
106       (firstQuotationMark + 1, lastQuotationMa << 
107       activateString = newValue.substr(lastQuo << 
108       // Perhaps we ought to check number of q << 
109       G4int nQuotes = 0;                       << 
110       for (auto c : newValue) {                << 
111         if (c == '"') nQuotes++;               << 
112       }                                        << 
113       if (nQuotes > 2) {                       << 
114         G4ExceptionDescription ed;             << 
115         ed << "More than 2 quotation marks in  << 
116         G4Exception("G4VisCommandSceneActivate << 
117       }                                        << 
118     }                                          << 
119   }                                            << 
120   else {                                       << 
121     // None or one quotation marks - just inpu << 
122     is >> searchString >> activateString;      << 
123   }                                            << 
124   G4bool activate = G4UIcommand::ConvertToBool     97   G4bool activate = G4UIcommand::ConvertToBool(activateString);
125                                                    98 
126   G4Scene* pScene = fpVisManager->GetCurrentSc     99   G4Scene* pScene = fpVisManager->GetCurrentScene();
127   if (!pScene) {                                  100   if (!pScene) {
128     if (verbosity >= G4VisManager::errors) {      101     if (verbosity >= G4VisManager::errors) {
129       G4warn << "ERROR: No current scene.  Ple    102       G4warn << "ERROR: No current scene.  Please create one." << G4endl;
130     }                                             103     }
131     return;                                       104     return;
132   }                                               105   }
133                                                   106 
134   G4VSceneHandler* pSceneHandler = fpVisManage    107   G4VSceneHandler* pSceneHandler = fpVisManager->GetCurrentSceneHandler();
135   if (!pSceneHandler) {                           108   if (!pSceneHandler) {
136     if (verbosity >= G4VisManager::errors) {      109     if (verbosity >= G4VisManager::errors) {
137       G4warn << "ERROR: No current sceneHandle    110       G4warn << "ERROR: No current sceneHandler.  Please create one." << G4endl;
138     }                                             111     }
139     return;                                       112     return;
140   }                                               113   }
141                                                   114 
142   if (searchString == "all" && !activate) {       115   if (searchString == "all" && !activate) {
143     if (verbosity >= G4VisManager::warnings) {    116     if (verbosity >= G4VisManager::warnings) {
144       G4warn <<                                   117       G4warn <<
145   "WARNING: You are not allowed to de-activate    118   "WARNING: You are not allowed to de-activate all models."
146   "\n  Command ignored."                          119   "\n  Command ignored."
147        << G4endl;                                 120        << G4endl;
148     }                                             121     }
149     return;                                       122     return;
150   }                                               123   }
151                                                   124 
152   G4bool any = false;                             125   G4bool any = false;
153                                                   126 
154   std::vector<G4Scene::Model>& runDurationMode    127   std::vector<G4Scene::Model>& runDurationModelList =
155     pScene->SetRunDurationModelList();            128     pScene->SetRunDurationModelList();
156   for (size_t i = 0; i < runDurationModelList.    129   for (size_t i = 0; i < runDurationModelList.size(); i++) {
157     const G4String& modelName = runDurationMod << 130     const G4String& modelName =
158     if (searchString == "all" || modelName.fin << 131       runDurationModelList[i].fpModel->GetGlobalDescription();
                                                   >> 132     if (searchString == "all" || modelName.find(searchString)
                                                   >> 133   != std::string::npos) {
159       any = true;                                 134       any = true;
160       runDurationModelList[i].fActive = activa    135       runDurationModelList[i].fActive = activate;
161       if (verbosity >= G4VisManager::warnings)    136       if (verbosity >= G4VisManager::warnings) {
162   G4warn << "Model \"" << modelName;              137   G4warn << "Model \"" << modelName;
163   if (activate) G4warn << "\" activated.";        138   if (activate) G4warn << "\" activated.";
164   else  G4warn << "\" de-activated.";             139   else  G4warn << "\" de-activated.";
165   G4warn << G4endl;                               140   G4warn << G4endl;
166       }                                           141       }
167     }                                             142     }
168   }                                               143   }
169                                                   144 
170   std::vector<G4Scene::Model>& endOfEventModel    145   std::vector<G4Scene::Model>& endOfEventModelList =
171     pScene->SetEndOfEventModelList();             146     pScene->SetEndOfEventModelList();
172   for (size_t i = 0; i < endOfEventModelList.s    147   for (size_t i = 0; i < endOfEventModelList.size(); i++) {
173     const G4String& modelName = endOfEventMode << 148     const G4String& modelName =
174     if (searchString == "all" || modelName.fin << 149       endOfEventModelList[i].fpModel->GetGlobalDescription();
                                                   >> 150     if (searchString == "all" || modelName.find(searchString)
                                                   >> 151   != std::string::npos) {
175       any = true;                                 152       any = true;
176       endOfEventModelList[i].fActive = activat    153       endOfEventModelList[i].fActive = activate;
177       if (verbosity >= G4VisManager::warnings)    154       if (verbosity >= G4VisManager::warnings) {
178   G4warn << "Model \"" << modelName;              155   G4warn << "Model \"" << modelName;
179   if (activate) G4warn << "\" activated.";        156   if (activate) G4warn << "\" activated.";
180   else  G4warn << "\" de-activated.";             157   else  G4warn << "\" de-activated.";
181   G4warn << G4endl;                               158   G4warn << G4endl;
182       }                                           159       }
183     }                                             160     }
184   }                                               161   }
185                                                   162 
186   std::vector<G4Scene::Model>& endOfRunModelLi    163   std::vector<G4Scene::Model>& endOfRunModelList =
187     pScene->SetEndOfRunModelList();               164     pScene->SetEndOfRunModelList();
188   for (size_t i = 0; i < endOfRunModelList.siz    165   for (size_t i = 0; i < endOfRunModelList.size(); i++) {
189     const G4String& modelName = endOfRunModelL << 166     const G4String& modelName =
190     if (searchString == "all" || modelName.fin << 167       endOfRunModelList[i].fpModel->GetGlobalDescription();
                                                   >> 168     if (searchString == "all" || modelName.find(searchString)
                                                   >> 169   != std::string::npos) {
191       any = true;                                 170       any = true;
192       endOfRunModelList[i].fActive = activate;    171       endOfRunModelList[i].fActive = activate;
193       if (verbosity >= G4VisManager::warnings)    172       if (verbosity >= G4VisManager::warnings) {
194   G4warn << "Model \"" << modelName;              173   G4warn << "Model \"" << modelName;
195   if (activate) G4warn << "\" activated.";        174   if (activate) G4warn << "\" activated.";
196   else  G4warn << "\" de-activated.";             175   else  G4warn << "\" de-activated.";
197   G4warn << G4endl;                               176   G4warn << G4endl;
198       }                                           177       }
199     }                                             178     }
200   }                                               179   }
201                                                   180 
202   if (!any) {                                     181   if (!any) {
203     if (verbosity >= G4VisManager::warnings) {    182     if (verbosity >= G4VisManager::warnings) {
204       G4warn << "WARNING: No match found." <<     183       G4warn << "WARNING: No match found." << G4endl;
205     }                                             184     }
206     return;                                       185     return;
207   }                                               186   }
208                                                   187 
209   CheckSceneAndNotifyHandlers (pScene);           188   CheckSceneAndNotifyHandlers (pScene);
210 }                                                 189 }
211                                                   190 
212 ////////////// /vis/scene/create /////////////    191 ////////////// /vis/scene/create ///////////////////////////////////////
213                                                   192 
214 G4VisCommandSceneCreate::G4VisCommandSceneCrea    193 G4VisCommandSceneCreate::G4VisCommandSceneCreate (): fId (0) {
215   G4bool omitable;                                194   G4bool omitable;
216   fpCommand = new G4UIcmdWithAString ("/vis/sc    195   fpCommand = new G4UIcmdWithAString ("/vis/scene/create", this);
217   fpCommand -> SetGuidance                        196   fpCommand -> SetGuidance
218     ("Creates an empty scene.");                  197     ("Creates an empty scene.");
219   fpCommand -> SetGuidance                        198   fpCommand -> SetGuidance
220     ("Invents a name if not supplied.  This sc    199     ("Invents a name if not supplied.  This scene becomes current.");
221   fpCommand -> SetParameterName ("scene-name",    200   fpCommand -> SetParameterName ("scene-name", omitable = true);
222 }                                                 201 }
223                                                   202 
224 G4VisCommandSceneCreate::~G4VisCommandSceneCre    203 G4VisCommandSceneCreate::~G4VisCommandSceneCreate () {
225   delete fpCommand;                               204   delete fpCommand;
226 }                                                 205 }
227                                                   206 
228 G4String G4VisCommandSceneCreate::NextName ()     207 G4String G4VisCommandSceneCreate::NextName () {
229   std::ostringstream oss;                         208   std::ostringstream oss;
230   oss << "scene-" << fId;                         209   oss << "scene-" << fId;
231   return oss.str();                               210   return oss.str();
232 }                                                 211 }
233                                                   212 
234 G4String G4VisCommandSceneCreate::GetCurrentVa    213 G4String G4VisCommandSceneCreate::GetCurrentValue (G4UIcommand*) {
235   return "";                                      214   return "";
236 }                                                 215 }
237                                                   216 
238 void G4VisCommandSceneCreate::SetNewValue (G4U    217 void G4VisCommandSceneCreate::SetNewValue (G4UIcommand*, G4String newValue) {
239                                                   218 
240   G4VisManager::Verbosity verbosity = fpVisMan    219   G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
241                                                   220 
242   G4String& newName = newValue;                   221   G4String& newName = newValue;
243   G4String nextName = NextName ();                222   G4String nextName = NextName ();
244                                                   223 
245   if (newName == "") {                            224   if (newName == "") {
246     newName = nextName;                           225     newName = nextName;
247   }                                               226   }
248   if (newName == nextName) fId++;                 227   if (newName == nextName) fId++;
249                                                   228 
250   G4SceneList& sceneList = fpVisManager -> Set    229   G4SceneList& sceneList = fpVisManager -> SetSceneList ();
251   std::size_t iScene, nScenes = sceneList.size    230   std::size_t iScene, nScenes = sceneList.size ();
252   for (iScene = 0; iScene < nScenes; ++iScene)    231   for (iScene = 0; iScene < nScenes; ++iScene) {
253     if (sceneList [iScene] -> GetName () == ne    232     if (sceneList [iScene] -> GetName () == newName) break;
254   }                                               233   }
255   if (iScene < nScenes) {                         234   if (iScene < nScenes) {
256     if (verbosity >= G4VisManager::warnings) {    235     if (verbosity >= G4VisManager::warnings) {
257       G4warn << "WARNING: Scene \"" << newName    236       G4warn << "WARNING: Scene \"" << newName << "\" already exists."
258        << "\n  New scene not created."            237        << "\n  New scene not created."
259        << G4endl;                                 238        << G4endl;
260     }                                             239     }
261   } else {                                        240   } else {
262                                                   241 
263     // Add empty scene data object to list...     242     // Add empty scene data object to list...
264     G4Scene* pScene = new G4Scene (newName);      243     G4Scene* pScene = new G4Scene (newName);
265     sceneList.push_back (pScene);                 244     sceneList.push_back (pScene);
266     fpVisManager -> SetCurrentScene (pScene);     245     fpVisManager -> SetCurrentScene (pScene);
267                                                   246 
268     if (verbosity >= G4VisManager::confirmatio    247     if (verbosity >= G4VisManager::confirmations) {
269       G4cout << "New empty scene \"" << newNam    248       G4cout << "New empty scene \"" << newName << "\" created." << G4endl;
270     }                                             249     }
271   }                                               250   }
272 }                                                 251 }
273                                                   252 
274 ////////////// /vis/scene/endOfEventAction ///    253 ////////////// /vis/scene/endOfEventAction ////////////////////////////
275                                                   254 
276 G4VisCommandSceneEndOfEventAction::G4VisComman    255 G4VisCommandSceneEndOfEventAction::G4VisCommandSceneEndOfEventAction () {
277   G4bool omitable;                                256   G4bool omitable;
278   fpCommand = new G4UIcommand ("/vis/scene/end    257   fpCommand = new G4UIcommand ("/vis/scene/endOfEventAction", this);
279   fpCommand -> SetGuidance                        258   fpCommand -> SetGuidance
280     ("Accumulate or refresh the viewer for eac    259     ("Accumulate or refresh the viewer for each new event.");
281   fpCommand -> SetGuidance                        260   fpCommand -> SetGuidance
282     ("\"accumulate\": viewer accumulates hits,    261     ("\"accumulate\": viewer accumulates hits, etc., event by event, or");
283   fpCommand -> SetGuidance                        262   fpCommand -> SetGuidance
284     ("\"refresh\": viewer shows them at end of    263     ("\"refresh\": viewer shows them at end of event or, for direct-screen"
285      "\n  viewers, refreshes the screen just b    264      "\n  viewers, refreshes the screen just before drawing the next event.");
286   G4UIparameter* parameter;                       265   G4UIparameter* parameter;
287   parameter = new G4UIparameter ("action", 's'    266   parameter = new G4UIparameter ("action", 's', omitable = true);
288   parameter -> SetParameterCandidates ("accumu    267   parameter -> SetParameterCandidates ("accumulate refresh");
289   parameter -> SetDefaultValue ("refresh");       268   parameter -> SetDefaultValue ("refresh");
290   fpCommand -> SetParameter (parameter);          269   fpCommand -> SetParameter (parameter);
291   parameter = new G4UIparameter ("maxNumber",     270   parameter = new G4UIparameter ("maxNumber", 'i', omitable = true);
292   parameter -> SetDefaultValue (100);             271   parameter -> SetDefaultValue (100);
293   parameter -> SetGuidance                        272   parameter -> SetGuidance
294   ("Maximum number of events kept.  Unlimited     273   ("Maximum number of events kept.  Unlimited if negative.");
295   fpCommand -> SetParameter (parameter);          274   fpCommand -> SetParameter (parameter);
296 }                                                 275 }
297                                                   276 
298 G4VisCommandSceneEndOfEventAction::~G4VisComma    277 G4VisCommandSceneEndOfEventAction::~G4VisCommandSceneEndOfEventAction () {
299   delete fpCommand;                               278   delete fpCommand;
300 }                                                 279 }
301                                                   280 
302 G4String G4VisCommandSceneEndOfEventAction::Ge    281 G4String G4VisCommandSceneEndOfEventAction::GetCurrentValue(G4UIcommand*) {
303   return "";                                      282   return "";
304 }                                                 283 }
305                                                   284 
306 void G4VisCommandSceneEndOfEventAction::SetNew    285 void G4VisCommandSceneEndOfEventAction::SetNewValue (G4UIcommand*,
307                  G4String newValue) {             286                  G4String newValue) {
308                                                   287 
309   G4VisManager::Verbosity verbosity = fpVisMan    288   G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
310                                                   289 
311   G4String action;                                290   G4String action;
312   G4int maxNumberOfKeptEvents;                    291   G4int maxNumberOfKeptEvents;
313   std::istringstream is (newValue);               292   std::istringstream is (newValue);
314   is >> action >> maxNumberOfKeptEvents;          293   is >> action >> maxNumberOfKeptEvents;
315                                                   294 
316   G4Scene* pScene = fpVisManager->GetCurrentSc    295   G4Scene* pScene = fpVisManager->GetCurrentScene();
317   if (!pScene) {                                  296   if (!pScene) {
318     if (verbosity >= G4VisManager::errors) {      297     if (verbosity >= G4VisManager::errors) {
319       G4warn << "ERROR: No current scene.  Ple    298       G4warn << "ERROR: No current scene.  Please create one." << G4endl;
320     }                                             299     }
321     return;                                       300     return;
322   }                                               301   }
323                                                   302 
324   G4VSceneHandler* pSceneHandler = fpVisManage    303   G4VSceneHandler* pSceneHandler = fpVisManager->GetCurrentSceneHandler();
325   if (!pSceneHandler) {                           304   if (!pSceneHandler) {
326     if (verbosity >= G4VisManager::errors) {      305     if (verbosity >= G4VisManager::errors) {
327       G4warn << "ERROR: No current sceneHandle    306       G4warn << "ERROR: No current sceneHandler.  Please create one." << G4endl;
328     }                                             307     }
329     return;                                       308     return;
330   }                                               309   }
331                                                   310 
332   if (action == "accumulate") {                   311   if (action == "accumulate") {
333     pScene->SetRefreshAtEndOfEvent(false);        312     pScene->SetRefreshAtEndOfEvent(false);
334     pScene->SetMaxNumberOfKeptEvents(maxNumber    313     pScene->SetMaxNumberOfKeptEvents(maxNumberOfKeptEvents);
335   }                                               314   }
336   else if (action == "refresh") {                 315   else if (action == "refresh") {
337     if (!pScene->GetRefreshAtEndOfRun()) {        316     if (!pScene->GetRefreshAtEndOfRun()) {
338       if (verbosity >= G4VisManager::errors) {    317       if (verbosity >= G4VisManager::errors) {
339   G4warn <<                                       318   G4warn <<
340     "ERROR: Cannot refresh events unless runs     319     "ERROR: Cannot refresh events unless runs refresh too."
341     "\n  Use \"/vis/scene/endOfRun refresh\"."    320     "\n  Use \"/vis/scene/endOfRun refresh\"."
342          << G4endl;                               321          << G4endl;
343       }                                           322       }
344     } else {                                      323     } else {
345       pScene->SetRefreshAtEndOfEvent(true);       324       pScene->SetRefreshAtEndOfEvent(true);
346       pScene->SetMaxNumberOfKeptEvents(maxNumb    325       pScene->SetMaxNumberOfKeptEvents(maxNumberOfKeptEvents);
347       pSceneHandler->SetMarkForClearingTransie    326       pSceneHandler->SetMarkForClearingTransientStore(true);
348     }                                             327     }
349   }                                               328   }
350   else {                                          329   else {
351     if (verbosity >= G4VisManager::errors) {      330     if (verbosity >= G4VisManager::errors) {
352       G4warn <<                                   331       G4warn <<
353   "ERROR: unrecognised parameter \"" << action    332   "ERROR: unrecognised parameter \"" << action << "\"."
354              << G4endl;                           333              << G4endl;
355     }                                             334     }
356     return;                                       335     return;
357   }                                               336   }
358                                                   337 
359   // Change of transients behaviour, so...        338   // Change of transients behaviour, so...
360   fpVisManager->ResetTransientsDrawnFlags();      339   fpVisManager->ResetTransientsDrawnFlags();
361                                                   340 
362   // Are there any events currently kept...       341   // Are there any events currently kept...
363   size_t nCurrentlyKept    = 0;                   342   size_t nCurrentlyKept    = 0;
364   G4RunManager* runManager = G4RunManagerFacto    343   G4RunManager* runManager = G4RunManagerFactory::GetMasterRunManager();
365   if(runManager)                                  344   if(runManager)
366   {                                               345   {
367     const G4Run* currentRun = runManager->GetC    346     const G4Run* currentRun = runManager->GetCurrentRun();
368     if(currentRun)                                347     if(currentRun)
369     {                                             348     {
370       const std::vector<const G4Event*>* event    349       const std::vector<const G4Event*>* events = currentRun->GetEventVector();
371       if(events)                                  350       if(events)
372         nCurrentlyKept = events->size();          351         nCurrentlyKept = events->size();
373     }                                             352     }
374   }                                               353   }
375                                                   354 
376   if (verbosity >= G4VisManager::confirmations    355   if (verbosity >= G4VisManager::confirmations) {
377     G4cout << "End of event action set to ";      356     G4cout << "End of event action set to ";
378     if (pScene->GetRefreshAtEndOfEvent()) G4co    357     if (pScene->GetRefreshAtEndOfEvent()) G4cout << "\"refresh\".";
379     else {                                        358     else {
380       G4cout << "\"accumulate\"."                 359       G4cout << "\"accumulate\"."
381   "\n  Maximum number of events to be kept: "     360   "\n  Maximum number of events to be kept: "
382        << maxNumberOfKeptEvents                   361        << maxNumberOfKeptEvents
383        << " (unlimited if negative)."             362        << " (unlimited if negative)."
384   "\n  This may be changed with, e.g., "          363   "\n  This may be changed with, e.g., "
385   "\"/vis/scene/endOfEventAction accumulate 10    364   "\"/vis/scene/endOfEventAction accumulate 1000\".";
386     }                                             365     }
387     G4cout << G4endl;                             366     G4cout << G4endl;
388   }                                               367   }
389                                                   368 
390   if (!pScene->GetRefreshAtEndOfEvent() &&        369   if (!pScene->GetRefreshAtEndOfEvent() &&
391       maxNumberOfKeptEvents != 0 &&               370       maxNumberOfKeptEvents != 0 &&
392       verbosity >= G4VisManager::warnings) {      371       verbosity >= G4VisManager::warnings) {
393     G4warn << "WARNING: ";                        372     G4warn << "WARNING: ";
394     if (nCurrentlyKept) {                         373     if (nCurrentlyKept) {
395       G4warn <<                                   374       G4warn <<
396   "\n  There are currently " << nCurrentlyKept    375   "\n  There are currently " << nCurrentlyKept
397        << " events kept for refreshing and/or     376        << " events kept for refreshing and/or reviewing.";
398     } else {                                      377     } else {
399       G4warn << "The vis manager will keep ";     378       G4warn << "The vis manager will keep ";
400       if (maxNumberOfKeptEvents < 0) G4warn <<    379       if (maxNumberOfKeptEvents < 0) G4warn << "an unlimited number of";
401       else G4warn << "up to " << maxNumberOfKe    380       else G4warn << "up to " << maxNumberOfKeptEvents;
402       G4warn << " events.";                       381       G4warn << " events.";
403       if (maxNumberOfKeptEvents > 1 || maxNumb    382       if (maxNumberOfKeptEvents > 1 || maxNumberOfKeptEvents < 0)
404   G4warn <<                                       383   G4warn <<
405     "\n  This may use a lot of memory."           384     "\n  This may use a lot of memory."
406     "\n  It may be changed with, e.g., "          385     "\n  It may be changed with, e.g., "
407     "\"/vis/scene/endOfEventAction accumulate     386     "\"/vis/scene/endOfEventAction accumulate 10\".";
408     }                                             387     }
409     G4warn << G4endl;                             388     G4warn << G4endl;
410   }                                               389   }
411 }                                                 390 }
412                                                   391 
413 ////////////// /vis/scene/endOfRunAction /////    392 ////////////// /vis/scene/endOfRunAction ////////////////////////////
414                                                   393 
415 G4VisCommandSceneEndOfRunAction::G4VisCommandS    394 G4VisCommandSceneEndOfRunAction::G4VisCommandSceneEndOfRunAction () {
416   G4bool omitable;                                395   G4bool omitable;
417   fpCommand = new G4UIcmdWithAString ("/vis/sc    396   fpCommand = new G4UIcmdWithAString ("/vis/scene/endOfRunAction", this);
418   fpCommand -> SetGuidance                        397   fpCommand -> SetGuidance
419     ("Accumulate or refresh the viewer for eac    398     ("Accumulate or refresh the viewer for each new run.");
420   fpCommand -> SetGuidance                        399   fpCommand -> SetGuidance
421     ("\"accumulate\": viewer accumulates hits,    400     ("\"accumulate\": viewer accumulates hits, etc., run by run, or");
422   fpCommand -> SetGuidance                        401   fpCommand -> SetGuidance
423     ("\"refresh\": viewer shows them at end of    402     ("\"refresh\": viewer shows them at end of run or, for direct-screen"
424      "\n  viewers, refreshes the screen just b    403      "\n  viewers, refreshes the screen just before drawing the first"
425      "\n  event of the next run.");               404      "\n  event of the next run.");
426   fpCommand -> SetGuidance ("The detector rema    405   fpCommand -> SetGuidance ("The detector remains or is redrawn.");
427   fpCommand -> SetParameterName ("action", omi    406   fpCommand -> SetParameterName ("action", omitable = true);
428   fpCommand -> SetCandidates ("accumulate refr    407   fpCommand -> SetCandidates ("accumulate refresh");
429   fpCommand -> SetDefaultValue ("refresh");       408   fpCommand -> SetDefaultValue ("refresh");
430 }                                                 409 }
431                                                   410 
432 G4VisCommandSceneEndOfRunAction::~G4VisCommand    411 G4VisCommandSceneEndOfRunAction::~G4VisCommandSceneEndOfRunAction () {
433   delete fpCommand;                               412   delete fpCommand;
434 }                                                 413 }
435                                                   414 
436 G4String G4VisCommandSceneEndOfRunAction::GetC    415 G4String G4VisCommandSceneEndOfRunAction::GetCurrentValue(G4UIcommand*) {
437   return "";                                      416   return "";
438 }                                                 417 }
439                                                   418 
440 void G4VisCommandSceneEndOfRunAction::SetNewVa    419 void G4VisCommandSceneEndOfRunAction::SetNewValue (G4UIcommand*,
441                  G4String newValue) {             420                  G4String newValue) {
442                                                   421 
443   G4VisManager::Verbosity verbosity = fpVisMan    422   G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
444                                                   423 
445   G4String action;                                424   G4String action;
446   std::istringstream is (newValue);               425   std::istringstream is (newValue);
447   is >> action;                                   426   is >> action;
448                                                   427 
449   G4Scene* pScene = fpVisManager->GetCurrentSc    428   G4Scene* pScene = fpVisManager->GetCurrentScene();
450   if (!pScene) {                                  429   if (!pScene) {
451     if (verbosity >= G4VisManager::errors) {      430     if (verbosity >= G4VisManager::errors) {
452       G4warn << "ERROR: No current scene.  Ple    431       G4warn << "ERROR: No current scene.  Please create one." << G4endl;
453     }                                             432     }
454     return;                                       433     return;
455   }                                               434   }
456                                                   435 
457   G4VSceneHandler* pSceneHandler = fpVisManage    436   G4VSceneHandler* pSceneHandler = fpVisManager->GetCurrentSceneHandler();
458   if (!pSceneHandler) {                           437   if (!pSceneHandler) {
459     if (verbosity >= G4VisManager::errors) {      438     if (verbosity >= G4VisManager::errors) {
460       G4warn << "ERROR: No current sceneHandle    439       G4warn << "ERROR: No current sceneHandler.  Please create one." << G4endl;
461     }                                             440     }
462     return;                                       441     return;
463   }                                               442   }
464                                                   443 
465   if (action == "accumulate") {                   444   if (action == "accumulate") {
466     if (pScene->GetRefreshAtEndOfEvent()) {       445     if (pScene->GetRefreshAtEndOfEvent()) {
467       if (verbosity >= G4VisManager::errors) {    446       if (verbosity >= G4VisManager::errors) {
468   G4warn <<                                       447   G4warn <<
469     "ERROR: Cannot accumulate runs unless even    448     "ERROR: Cannot accumulate runs unless events accumulate too."
470     "\n  Use \"/vis/scene/endOfEventAction acc    449     "\n  Use \"/vis/scene/endOfEventAction accumulate\"."
471          << G4endl;                               450          << G4endl;
472       }                                           451       }
473     }                                             452     }
474     else {                                        453     else {
475       pScene->SetRefreshAtEndOfRun(false);        454       pScene->SetRefreshAtEndOfRun(false);
476     }                                             455     }
477   }                                               456   }
478   else if (action == "refresh") {                 457   else if (action == "refresh") {
479     pScene->SetRefreshAtEndOfRun(true);           458     pScene->SetRefreshAtEndOfRun(true);
480     pSceneHandler->SetMarkForClearingTransient    459     pSceneHandler->SetMarkForClearingTransientStore(true);
481   }                                               460   }
482   else {                                          461   else {
483     if (verbosity >= G4VisManager::errors) {      462     if (verbosity >= G4VisManager::errors) {
484       G4warn <<                                   463       G4warn <<
485   "ERROR: unrecognised parameter \"" << action    464   "ERROR: unrecognised parameter \"" << action << "\"."
486              << G4endl;                           465              << G4endl;
487     }                                             466     }
488     return;                                       467     return;
489   }                                               468   }
490                                                   469 
491   // Change of transients behaviour, so...        470   // Change of transients behaviour, so...
492   fpVisManager->ResetTransientsDrawnFlags();      471   fpVisManager->ResetTransientsDrawnFlags();
493                                                   472 
494   if (verbosity >= G4VisManager::confirmations    473   if (verbosity >= G4VisManager::confirmations) {
495     G4cout << "End of run action set to \"";      474     G4cout << "End of run action set to \"";
496     if (pScene->GetRefreshAtEndOfRun()) G4cout    475     if (pScene->GetRefreshAtEndOfRun()) G4cout << "refresh";
497     else G4cout << "accumulate";                  476     else G4cout << "accumulate";
498     G4cout << "\"" << G4endl;                     477     G4cout << "\"" << G4endl;
499   }                                               478   }
500 }                                                 479 }
501                                                   480 
502 ////////////// /vis/scene/list ///////////////    481 ////////////// /vis/scene/list ///////////////////////////////////////
503                                                   482 
504 G4VisCommandSceneList::G4VisCommandSceneList (    483 G4VisCommandSceneList::G4VisCommandSceneList () {
505   G4bool omitable;                                484   G4bool omitable;
506   fpCommand = new G4UIcommand ("/vis/scene/lis    485   fpCommand = new G4UIcommand ("/vis/scene/list", this);
507   fpCommand -> SetGuidance ("Lists scene(s).")    486   fpCommand -> SetGuidance ("Lists scene(s).");
508   fpCommand -> SetGuidance                        487   fpCommand -> SetGuidance
509     ("\"help /vis/verbose\" for definition of     488     ("\"help /vis/verbose\" for definition of verbosity.");
510   G4UIparameter* parameter;                       489   G4UIparameter* parameter;
511   parameter = new G4UIparameter ("scene-name",    490   parameter = new G4UIparameter ("scene-name", 's', omitable = true);
512   parameter -> SetDefaultValue ("all");           491   parameter -> SetDefaultValue ("all");
513   fpCommand -> SetParameter (parameter);          492   fpCommand -> SetParameter (parameter);
514   parameter = new G4UIparameter ("verbosity",     493   parameter = new G4UIparameter ("verbosity", 's', omitable = true);
515   parameter -> SetDefaultValue ("warnings");      494   parameter -> SetDefaultValue ("warnings");
516   fpCommand -> SetParameter (parameter);          495   fpCommand -> SetParameter (parameter);
517 }                                                 496 }
518                                                   497 
519 G4VisCommandSceneList::~G4VisCommandSceneList     498 G4VisCommandSceneList::~G4VisCommandSceneList () {
520   delete fpCommand;                               499   delete fpCommand;
521 }                                                 500 }
522                                                   501 
523 G4String G4VisCommandSceneList::GetCurrentValu    502 G4String G4VisCommandSceneList::GetCurrentValue (G4UIcommand*) {
524   return "";                                      503   return "";
525 }                                                 504 }
526                                                   505 
527 void G4VisCommandSceneList::SetNewValue (G4UIc    506 void G4VisCommandSceneList::SetNewValue (G4UIcommand*, G4String newValue) {
528   G4String name, verbosityString;                 507   G4String name, verbosityString;
529   std::istringstream is (newValue);               508   std::istringstream is (newValue);
530   is >> name >> verbosityString;                  509   is >> name >> verbosityString;
531   G4VisManager::Verbosity verbosity =             510   G4VisManager::Verbosity verbosity =
532     fpVisManager->GetVerbosityValue(verbosityS    511     fpVisManager->GetVerbosityValue(verbosityString);
533   const G4Scene* currentScene = fpVisManager -    512   const G4Scene* currentScene = fpVisManager -> GetCurrentScene ();
534   G4String currentName;                           513   G4String currentName;
535   if (currentScene) currentName = currentScene    514   if (currentScene) currentName = currentScene->GetName();
536                                                   515 
537   G4SceneList& sceneList = fpVisManager -> Set    516   G4SceneList& sceneList = fpVisManager -> SetSceneList ();
538   std::size_t iScene, nScenes = sceneList.size    517   std::size_t iScene, nScenes = sceneList.size ();
539   G4bool found = false;                           518   G4bool found = false;
540   for (iScene = 0; iScene < nScenes; ++iScene)    519   for (iScene = 0; iScene < nScenes; ++iScene) {
541     G4Scene* pScene = sceneList [iScene];         520     G4Scene* pScene = sceneList [iScene];
542     const G4String& iName = pScene -> GetName     521     const G4String& iName = pScene -> GetName ();
543     if (name != "all") {                          522     if (name != "all") {
544       if (name != iName) continue;                523       if (name != iName) continue;
545     }                                             524     }
546     found = true;                                 525     found = true;
547     if (iName == currentName) {                   526     if (iName == currentName) {
548       G4cout << "  (current)";                    527       G4cout << "  (current)";
549     }                                             528     }
550     else {                                        529     else {
551       G4cout << "           ";                    530       G4cout << "           ";
552     }                                             531     }
553     G4cout << " scene \"" << iName << "\"";       532     G4cout << " scene \"" << iName << "\"";
554     if (verbosity >= G4VisManager::warnings) {    533     if (verbosity >= G4VisManager::warnings) {
555       std::size_t i;                              534       std::size_t i;
556       G4cout << "\n  Run-duration models:";       535       G4cout << "\n  Run-duration models:";
557       std::size_t nRunModels = pScene -> GetRu    536       std::size_t nRunModels = pScene -> GetRunDurationModelList ().size ();
558       if (nRunModels == 0) {                      537       if (nRunModels == 0) {
559   G4cout << " none.";                             538   G4cout << " none.";
560       }                                           539       }
561       for (i = 0; i < nRunModels; ++i) {          540       for (i = 0; i < nRunModels; ++i) {
562   if (pScene -> GetRunDurationModelList()[i].f    541   if (pScene -> GetRunDurationModelList()[i].fActive)
563     G4cout << "\n   Active:   ";                  542     G4cout << "\n   Active:   ";
564   else G4cout << "\n   Inactive: ";               543   else G4cout << "\n   Inactive: ";
565   G4VModel* pModel = pScene -> GetRunDurationM    544   G4VModel* pModel = pScene -> GetRunDurationModelList()[i].fpModel;
566   G4cout << pModel -> GetGlobalDescription ();    545   G4cout << pModel -> GetGlobalDescription ();
567       }                                           546       }
568       G4cout << "\n  End-of-event models:";       547       G4cout << "\n  End-of-event models:";
569       std::size_t nEOEModels = pScene -> GetEn    548       std::size_t nEOEModels = pScene -> GetEndOfEventModelList ().size ();
570       if (nEOEModels == 0) {                      549       if (nEOEModels == 0) {
571   G4cout << " none.";                             550   G4cout << " none.";
572       }                                           551       }
573       for (i = 0; i < nEOEModels; ++i) {          552       for (i = 0; i < nEOEModels; ++i) {
574   if (pScene -> GetEndOfEventModelList()[i].fA    553   if (pScene -> GetEndOfEventModelList()[i].fActive)
575     G4cout << "\n   Active:   ";                  554     G4cout << "\n   Active:   ";
576   else G4cout << "\n   Inactive: ";               555   else G4cout << "\n   Inactive: ";
577   G4VModel* pModel = pScene -> GetEndOfEventMo    556   G4VModel* pModel = pScene -> GetEndOfEventModelList()[i].fpModel;
578   G4cout << pModel -> GetGlobalDescription ();    557   G4cout << pModel -> GetGlobalDescription ();
579       }                                           558       }
580       G4cout << "\n  End-of-run models:";         559       G4cout << "\n  End-of-run models:";
581       std::size_t nEORModels = pScene -> GetEn    560       std::size_t nEORModels = pScene -> GetEndOfRunModelList ().size ();
582       if (nEORModels == 0) {                      561       if (nEORModels == 0) {
583   G4cout << " none.";                             562   G4cout << " none.";
584       }                                           563       }
585       for (i = 0; i < nEORModels; ++i) {          564       for (i = 0; i < nEORModels; ++i) {
586   if (pScene -> GetEndOfRunModelList()[i].fAct    565   if (pScene -> GetEndOfRunModelList()[i].fActive)
587     G4cout << "\n   Active:   ";                  566     G4cout << "\n   Active:   ";
588   else G4cout << "\n   Inactive: ";               567   else G4cout << "\n   Inactive: ";
589   G4VModel* pModel = pScene -> GetEndOfRunMode    568   G4VModel* pModel = pScene -> GetEndOfRunModelList()[i].fpModel;
590   G4cout << pModel -> GetGlobalDescription ();    569   G4cout << pModel -> GetGlobalDescription ();
591       }                                           570       }
592     }                                             571     }
593     if (verbosity >= G4VisManager::parameters)    572     if (verbosity >= G4VisManager::parameters) {
594       G4cout << "\n  " << *sceneList [iScene];    573       G4cout << "\n  " << *sceneList [iScene];
595     }                                             574     }
596     G4cout << G4endl;                             575     G4cout << G4endl;
597   }                                               576   }
598   if (!found) {                                   577   if (!found) {
599     G4warn << "No scenes found";                  578     G4warn << "No scenes found";
600     if (name != "all") {                          579     if (name != "all") {
601       G4warn << " of name \"" << name << "\"";    580       G4warn << " of name \"" << name << "\"";
602     }                                             581     }
603     G4warn << "." << G4endl;                      582     G4warn << "." << G4endl;
604   }                                               583   }
605 }                                                 584 }
606                                                   585 
607 ////////////// /vis/scene/notifyHandlers /////    586 ////////////// /vis/scene/notifyHandlers /////////////////////////
608                                                   587 
609 G4VisCommandSceneNotifyHandlers::G4VisCommandS    588 G4VisCommandSceneNotifyHandlers::G4VisCommandSceneNotifyHandlers () {
610   G4bool omitable;                                589   G4bool omitable;
611   fpCommand = new G4UIcommand ("/vis/scene/not    590   fpCommand = new G4UIcommand ("/vis/scene/notifyHandlers", this);
612   fpCommand -> SetGuidance                        591   fpCommand -> SetGuidance
613     ("Notifies scene handlers and forces re-re    592     ("Notifies scene handlers and forces re-rendering.");
614   fpCommand -> SetGuidance                        593   fpCommand -> SetGuidance
615     ("Notifies the handler(s) of the specified    594     ("Notifies the handler(s) of the specified scene and forces a"
616      "\nreconstruction of any graphical databa    595      "\nreconstruction of any graphical databases."
617      "\nClears and refreshes all viewers of cu    596      "\nClears and refreshes all viewers of current scene."
618      "\n  The default action \"refresh\" does     597      "\n  The default action \"refresh\" does not issue \"update\" (see"
619      "\n    /vis/viewer/update)."                 598      "\n    /vis/viewer/update)."
620      "\nIf \"flush\" is specified, it issues a    599      "\nIf \"flush\" is specified, it issues an \"update\" as well as"
621      "\n  \"refresh\" - \"update\" and initiat    600      "\n  \"refresh\" - \"update\" and initiates post-processing"
622      "\n  for graphics systems which need it."    601      "\n  for graphics systems which need it.");
623   fpCommand -> SetGuidance                        602   fpCommand -> SetGuidance 
624     ("The default for <scene-name> is the curr    603     ("The default for <scene-name> is the current scene name.");
625   fpCommand -> SetGuidance                        604   fpCommand -> SetGuidance
626     ("This command does not change current sce    605     ("This command does not change current scene, scene handler or viewer.");
627   G4UIparameter* parameter;                       606   G4UIparameter* parameter;
628   parameter = new G4UIparameter ("scene-name",    607   parameter = new G4UIparameter ("scene-name", 's',
629          omitable = true);                        608          omitable = true);
630   parameter -> SetCurrentAsDefault(true);         609   parameter -> SetCurrentAsDefault(true);
631   fpCommand -> SetParameter (parameter);          610   fpCommand -> SetParameter (parameter);
632   parameter = new G4UIparameter ("refresh-flus    611   parameter = new G4UIparameter ("refresh-flush", 's',
633          omitable = true);                        612          omitable = true);
634   parameter -> SetDefaultValue("refresh");        613   parameter -> SetDefaultValue("refresh");
635   parameter -> SetParameterCandidates("r refre    614   parameter -> SetParameterCandidates("r refresh f flush");
636   fpCommand -> SetParameter (parameter);          615   fpCommand -> SetParameter (parameter);
637 }                                                 616 }
638                                                   617 
639 G4VisCommandSceneNotifyHandlers::~G4VisCommand    618 G4VisCommandSceneNotifyHandlers::~G4VisCommandSceneNotifyHandlers () {
640   delete fpCommand;                               619   delete fpCommand;
641 }                                                 620 }
642                                                   621 
643 G4String G4VisCommandSceneNotifyHandlers::GetC    622 G4String G4VisCommandSceneNotifyHandlers::GetCurrentValue(G4UIcommand*) {
644   return CurrentSceneName ();                     623   return CurrentSceneName ();
645 }                                                 624 }
646                                                   625 
647 void G4VisCommandSceneNotifyHandlers::SetNewVa    626 void G4VisCommandSceneNotifyHandlers::SetNewValue (G4UIcommand*,
648                G4String newValue) {               627                G4String newValue) {
649                                                   628 
650   G4VisManager::Verbosity verbosity = fpVisMan    629   G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
651                                                   630 
652   G4String sceneName, refresh_flush;              631   G4String sceneName, refresh_flush;
653   std::istringstream is (newValue);               632   std::istringstream is (newValue);
654   is >> sceneName >> refresh_flush;               633   is >> sceneName >> refresh_flush;
655   G4bool flush = false;                           634   G4bool flush = false;
656   if (refresh_flush[0] == 'f') flush = true;      635   if (refresh_flush[0] == 'f') flush = true;
657                                                   636 
658   const G4SceneList& sceneList = fpVisManager     637   const G4SceneList& sceneList = fpVisManager -> GetSceneList ();
659   G4SceneHandlerList& sceneHandlerList =          638   G4SceneHandlerList& sceneHandlerList =
660     fpVisManager -> SetAvailableSceneHandlers     639     fpVisManager -> SetAvailableSceneHandlers ();
661                                                   640 
662   // Check scene name.                            641   // Check scene name.
663   const std::size_t nScenes = sceneList.size (    642   const std::size_t nScenes = sceneList.size ();
664   std::size_t iScene;                             643   std::size_t iScene;
665   for (iScene = 0; iScene < nScenes; ++iScene)    644   for (iScene = 0; iScene < nScenes; ++iScene) {
666     G4Scene* scene = sceneList [iScene];          645     G4Scene* scene = sceneList [iScene];
667     if (sceneName == scene -> GetName ()) brea    646     if (sceneName == scene -> GetName ()) break;
668   }                                               647   }
669   if (iScene >= nScenes ) {                       648   if (iScene >= nScenes ) {
670     if (verbosity >= G4VisManager::warnings) {    649     if (verbosity >= G4VisManager::warnings) {
671       G4warn << "WARNING: Scene \"" << sceneNa    650       G4warn << "WARNING: Scene \"" << sceneName << "\" not found."
672   "\n  /vis/scene/list to see scenes."            651   "\n  /vis/scene/list to see scenes."
673        << G4endl;                                 652        << G4endl;
674     }                                             653     }
675     return;                                       654     return;
676   }                                               655   }
677                                                   656 
678   // Store current context...                     657   // Store current context...
679   G4VSceneHandler* pCurrentSceneHandler =         658   G4VSceneHandler* pCurrentSceneHandler =
680     fpVisManager -> GetCurrentSceneHandler();     659     fpVisManager -> GetCurrentSceneHandler();
681   if (!pCurrentSceneHandler) {                    660   if (!pCurrentSceneHandler) {
682     if (verbosity >= G4VisManager::warnings) {    661     if (verbosity >= G4VisManager::warnings) {
683       G4warn << "WARNING: No current scene han    662       G4warn << "WARNING: No current scene handler."
684        << G4endl;                                 663        << G4endl;
685     }                                             664     }
686     return;                                       665     return;
687   }                                               666   }
688   G4VViewer* pCurrentViewer = fpVisManager ->     667   G4VViewer* pCurrentViewer = fpVisManager -> GetCurrentViewer();
689   if (!pCurrentViewer) {                          668   if (!pCurrentViewer) {
690     if (verbosity >= G4VisManager::warnings) {    669     if (verbosity >= G4VisManager::warnings) {
691       G4warn << "WARNING: No current viewer."     670       G4warn << "WARNING: No current viewer."
692        << G4endl;                                 671        << G4endl;
693     }                                             672     }
694     return;                                       673     return;
695   }                                               674   }
696   G4Scene* pCurrentScene = fpVisManager -> Get    675   G4Scene* pCurrentScene = fpVisManager -> GetCurrentScene();
697   if (!pCurrentScene) {                           676   if (!pCurrentScene) {
698     if (verbosity >= G4VisManager::warnings) {    677     if (verbosity >= G4VisManager::warnings) {
699       G4warn << "WARNING: No current scene."      678       G4warn << "WARNING: No current scene."
700        << G4endl;                                 679        << G4endl;
701     }                                             680     }
702     return;                                       681     return;
703   }                                               682   }
704                                                   683 
705   G4VisManager::Verbosity currentVerbosity = f    684   G4VisManager::Verbosity currentVerbosity = fpVisManager -> GetVerbosity();
706                                                   685 
707   // Suppress messages during this process (on    686   // Suppress messages during this process (only print errors)...
708   //fpVisManager -> SetVerboseLevel(G4VisManag    687   //fpVisManager -> SetVerboseLevel(G4VisManager::errors);
709                                                   688 
710   // For each scene handler, if it contains th    689   // For each scene handler, if it contains the scene, clear and
711   // rebuild the graphical database, then for     690   // rebuild the graphical database, then for each viewer set (make
712   // current), clear, (re)draw, and show.         691   // current), clear, (re)draw, and show.
713   const std::size_t nSceneHandlers = sceneHand    692   const std::size_t nSceneHandlers = sceneHandlerList.size ();
714   for (std::size_t iSH = 0; iSH < nSceneHandle    693   for (std::size_t iSH = 0; iSH < nSceneHandlers; ++iSH) {
715     G4VSceneHandler* aSceneHandler = sceneHand    694     G4VSceneHandler* aSceneHandler = sceneHandlerList [iSH];
716     G4Scene* aScene = aSceneHandler -> GetScen    695     G4Scene* aScene = aSceneHandler -> GetScene ();
717     if (aScene) {                                 696     if (aScene) {
718       const G4String& aSceneName = aScene -> G    697       const G4String& aSceneName = aScene -> GetName ();
719       if (sceneName == aSceneName) {              698       if (sceneName == aSceneName) {
720   aScene->CalculateExtent();  // Check and rec    699   aScene->CalculateExtent();  // Check and recalculate extent
721   G4ViewerList& viewerList = aSceneHandler ->     700   G4ViewerList& viewerList = aSceneHandler -> SetViewerList ();
722   const std::size_t nViewers = viewerList.size    701   const std::size_t nViewers = viewerList.size ();
723   for (std::size_t iV = 0; iV < nViewers; ++iV    702   for (std::size_t iV = 0; iV < nViewers; ++iV) {
724     G4VViewer* aViewer = viewerList [iV];         703     G4VViewer* aViewer = viewerList [iV];
725     // Force rebuild of graphical database, if    704     // Force rebuild of graphical database, if any.
726     aViewer -> NeedKernelVisit();                 705     aViewer -> NeedKernelVisit();
727     if (aViewer->GetViewParameters().IsAutoRef    706     if (aViewer->GetViewParameters().IsAutoRefresh()) {
728       aSceneHandler -> SetCurrentViewer (aView    707       aSceneHandler -> SetCurrentViewer (aViewer);
729       // Ensure consistency of vis manager...     708       // Ensure consistency of vis manager...
730       fpVisManager -> SetCurrentViewer(aViewer    709       fpVisManager -> SetCurrentViewer(aViewer);
731       fpVisManager -> SetCurrentSceneHandler(a    710       fpVisManager -> SetCurrentSceneHandler(aSceneHandler);
732       fpVisManager -> SetCurrentScene(aScene);    711       fpVisManager -> SetCurrentScene(aScene);
733       aViewer -> SetView ();                      712       aViewer -> SetView ();
734       aViewer -> ClearView ();                    713       aViewer -> ClearView ();
735       aViewer -> DrawView ();                     714       aViewer -> DrawView ();
736       if (flush) aViewer -> ShowView ();          715       if (flush) aViewer -> ShowView ();
737       if (verbosity >= G4VisManager::confirmat    716       if (verbosity >= G4VisManager::confirmations) {
738         G4cout << "Viewer \"" << aViewer -> Ge    717         G4cout << "Viewer \"" << aViewer -> GetName ()
739          << "\" of scene handler \"" << aScene    718          << "\" of scene handler \"" << aSceneHandler -> GetName ()
740          << "\"\n  ";                             719          << "\"\n  ";
741         if (flush) G4cout << "flushed";           720         if (flush) G4cout << "flushed";
742         else G4cout << "refreshed";               721         else G4cout << "refreshed";
743         G4cout << " at request of scene \"" <<    722         G4cout << " at request of scene \"" << sceneName
744          << "\"." << G4endl;                      723          << "\"." << G4endl;
745       }                                           724       }
746     } else {                                      725     } else {
747       if (verbosity >= G4VisManager::confirmat    726       if (verbosity >= G4VisManager::confirmations) {
748         G4cout << "NOTE: The scene, \""           727         G4cout << "NOTE: The scene, \""
749          << sceneName                             728          << sceneName
750          << "\", of viewer \""                    729          << "\", of viewer \""
751          << aViewer -> GetName ()                 730          << aViewer -> GetName ()
752          << "\"\n  of scene handler \""           731          << "\"\n  of scene handler \""
753          << aSceneHandler -> GetName ()           732          << aSceneHandler -> GetName ()
754          << "\"  has changed.  To see effect,"    733          << "\"  has changed.  To see effect,"
755          << "\n  \"/vis/viewer/select "           734          << "\n  \"/vis/viewer/select "
756          << aViewer -> GetShortName ()            735          << aViewer -> GetShortName ()
757          << "\" and \"/vis/viewer/rebuild\"."     736          << "\" and \"/vis/viewer/rebuild\"."
758          << G4endl;                               737          << G4endl;
759       }                                           738       }
760     }                                             739     }
761   }                                               740   }
762       }                                           741       }
763     }                                             742     }
764     else {                                        743     else {
765       if (verbosity >= G4VisManager::warnings)    744       if (verbosity >= G4VisManager::warnings) {
766   G4warn << "WARNING: G4VisCommandSceneNotifyH    745   G4warn << "WARNING: G4VisCommandSceneNotifyHandlers: scene handler \""
767          << aSceneHandler->GetName()              746          << aSceneHandler->GetName()
768          << "\" has a null scene."                747          << "\" has a null scene."
769          << G4endl;                               748          << G4endl;
770       }                                           749       }
771     }                                             750     }
772   }                                               751   }
773                                                   752 
774   // Reclaim original context - but set viewer    753   // Reclaim original context - but set viewer first, then scene
775   // handler, because the latter might have be    754   // handler, because the latter might have been created very recently
776   // and, not yet having a viewer, the current    755   // and, not yet having a viewer, the current viewer will,
777   // temporarily, refer to another scene handl    756   // temporarily, refer to another scene handler.  SetCurrentViewer
778   // actually resets the scene handler, which     757   // actually resets the scene handler, which is what we don't want,
779   // so we set it again on the next line...       758   // so we set it again on the next line...
780   fpVisManager -> SetCurrentViewer(pCurrentVie    759   fpVisManager -> SetCurrentViewer(pCurrentViewer);
781   fpVisManager -> SetCurrentSceneHandler(pCurr    760   fpVisManager -> SetCurrentSceneHandler(pCurrentSceneHandler);
782   fpVisManager -> SetCurrentScene(pCurrentScen    761   fpVisManager -> SetCurrentScene(pCurrentScene);
783   fpVisManager -> SetVerboseLevel(currentVerbo    762   fpVisManager -> SetVerboseLevel(currentVerbosity);
784   // Take care of special case of scene handle    763   // Take care of special case of scene handler with no viewer yet.  
785   if (pCurrentSceneHandler) {                     764   if (pCurrentSceneHandler) {
786     G4ViewerList& viewerList = pCurrentSceneHa    765     G4ViewerList& viewerList = pCurrentSceneHandler -> SetViewerList ();
787     const std::size_t nViewers = viewerList.si    766     const std::size_t nViewers = viewerList.size ();
788     if (nViewers) {                               767     if (nViewers) {
789       pCurrentSceneHandler -> SetCurrentViewer    768       pCurrentSceneHandler -> SetCurrentViewer (pCurrentViewer);
790       // JA: I don't think we need this. SetVi    769       // JA: I don't think we need this. SetView will be called when needed.
791       // if (pCurrentViewer && pCurrentSceneHa    770       // if (pCurrentViewer && pCurrentSceneHandler->GetScene()) {
792       //   pCurrentViewer -> SetView ();          771       //   pCurrentViewer -> SetView ();
793       // }                                        772       // }
794     }                                             773     }
795   }                                               774   }
796 }                                                 775 }
797                                                   776 
798 ////////////// /vis/scene/removeModel ////////    777 ////////////// /vis/scene/removeModel ////////////////////////////
799                                                   778 
800 G4VisCommandSceneRemoveModel::G4VisCommandScen    779 G4VisCommandSceneRemoveModel::G4VisCommandSceneRemoveModel () {
801   G4bool omitable;                                780   G4bool omitable;
802   fpCommand = new G4UIcommand ("/vis/scene/rem    781   fpCommand = new G4UIcommand ("/vis/scene/removeModel", this);
803   fpCommand -> SetGuidance("Remove model.");      782   fpCommand -> SetGuidance("Remove model.");
804   fpCommand -> SetGuidance                        783   fpCommand -> SetGuidance
805   ("Attempts to match search string to name of    784   ("Attempts to match search string to name of model - use unique sub-string.");
806   fpCommand -> SetGuidance                        785   fpCommand -> SetGuidance
807   ("Use \"/vis/scene/list\" to see model names    786   ("Use \"/vis/scene/list\" to see model names.");
808   G4UIparameter* parameter;                       787   G4UIparameter* parameter;
809   parameter = new G4UIparameter ("search-strin    788   parameter = new G4UIparameter ("search-string", 's', omitable = false);
810   fpCommand -> SetParameter (parameter);          789   fpCommand -> SetParameter (parameter);
811 }                                                 790 }
812                                                   791 
813 G4VisCommandSceneRemoveModel::~G4VisCommandSce    792 G4VisCommandSceneRemoveModel::~G4VisCommandSceneRemoveModel () {
814   delete fpCommand;                               793   delete fpCommand;
815 }                                                 794 }
816                                                   795 
817 G4String G4VisCommandSceneRemoveModel::GetCurr    796 G4String G4VisCommandSceneRemoveModel::GetCurrentValue(G4UIcommand*) {
818   return "";                                      797   return "";
819 }                                                 798 }
820                                                   799 
821 void G4VisCommandSceneRemoveModel::SetNewValue    800 void G4VisCommandSceneRemoveModel::SetNewValue (G4UIcommand*,
822               G4String newValue) {                801               G4String newValue) {
823                                                   802 
824   G4VisManager::Verbosity verbosity = fpVisMan    803   G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
825                                                   804 
826   G4String searchString;                          805   G4String searchString;
827   std::istringstream is (newValue);               806   std::istringstream is (newValue);
828   is >> searchString;                             807   is >> searchString;
829                                                   808 
830   G4Scene* pScene = fpVisManager->GetCurrentSc    809   G4Scene* pScene = fpVisManager->GetCurrentScene();
831   if (!pScene) {                                  810   if (!pScene) {
832     if (verbosity >= G4VisManager::errors) {      811     if (verbosity >= G4VisManager::errors) {
833       G4warn << "ERROR: No current scene.  Ple    812       G4warn << "ERROR: No current scene.  Please create one." << G4endl;
834     }                                             813     }
835     return;                                       814     return;
836   }                                               815   }
837                                                   816 
838   G4VSceneHandler* pSceneHandler = fpVisManage    817   G4VSceneHandler* pSceneHandler = fpVisManager->GetCurrentSceneHandler();
839   if (!pSceneHandler) {                           818   if (!pSceneHandler) {
840     if (verbosity >= G4VisManager::errors) {      819     if (verbosity >= G4VisManager::errors) {
841       G4warn << "ERROR: No current sceneHandle    820       G4warn << "ERROR: No current sceneHandler.  Please create one." << G4endl;
842     }                                             821     }
843     return;                                       822     return;
844   }                                               823   }
845                                                   824 
846   G4bool any = false;                             825   G4bool any = false;
847                                                   826 
848   std::vector<G4Scene::Model>& runDurationMode    827   std::vector<G4Scene::Model>& runDurationModelList =
849   pScene->SetRunDurationModelList();              828   pScene->SetRunDurationModelList();
850   for (size_t i = 0; i < runDurationModelList.    829   for (size_t i = 0; i < runDurationModelList.size(); i++) {
851     const G4String& modelName =                   830     const G4String& modelName =
852     runDurationModelList[i].fpModel->GetGlobal    831     runDurationModelList[i].fpModel->GetGlobalDescription();
853     if (modelName.find(searchString) != std::s    832     if (modelName.find(searchString) != std::string::npos) {
854       runDurationModelList.erase(runDurationMo    833       runDurationModelList.erase(runDurationModelList.begin()+i);
855       any = true;                                 834       any = true;
856       if (verbosity >= G4VisManager::warnings)    835       if (verbosity >= G4VisManager::warnings) {
857   G4warn << "Model \"" << modelName << "\" rem    836   G4warn << "Model \"" << modelName << "\" removed." << G4endl;
858       }                                           837       }
859       break;  // Allow only one model at a tim    838       break;  // Allow only one model at a time to be removed.
860     }                                             839     }
861   }                                               840   }
862                                                   841 
863   std::vector<G4Scene::Model>& endOfEventModel    842   std::vector<G4Scene::Model>& endOfEventModelList =
864   pScene->SetEndOfEventModelList();               843   pScene->SetEndOfEventModelList();
865   for (size_t i = 0; i < endOfEventModelList.s    844   for (size_t i = 0; i < endOfEventModelList.size(); i++) {
866     const G4String& modelName =                   845     const G4String& modelName =
867     endOfEventModelList[i].fpModel->GetGlobalD    846     endOfEventModelList[i].fpModel->GetGlobalDescription();
868     if (modelName.find(searchString) != std::s    847     if (modelName.find(searchString) != std::string::npos) {
869       endOfEventModelList.erase(endOfEventMode    848       endOfEventModelList.erase(endOfEventModelList.begin()+i);
870       any = true;                                 849       any = true;
871       if (verbosity >= G4VisManager::warnings)    850       if (verbosity >= G4VisManager::warnings) {
872   G4warn << "Model \"" << modelName << "\" rem    851   G4warn << "Model \"" << modelName << "\" removed." << G4endl;
873       }                                           852       }
874       break;  // Allow only one model at a tim    853       break;  // Allow only one model at a time to be removed.
875     }                                             854     }
876   }                                               855   }
877                                                   856 
878   std::vector<G4Scene::Model>& endOfRunModelLi    857   std::vector<G4Scene::Model>& endOfRunModelList =
879   pScene->SetEndOfRunModelList();                 858   pScene->SetEndOfRunModelList();
880   for (size_t i = 0; i < endOfRunModelList.siz    859   for (size_t i = 0; i < endOfRunModelList.size(); i++) {
881     const G4String& modelName =                   860     const G4String& modelName =
882     endOfRunModelList[i].fpModel->GetGlobalDes    861     endOfRunModelList[i].fpModel->GetGlobalDescription();
883     if (modelName.find(searchString) != std::s    862     if (modelName.find(searchString) != std::string::npos) {
884       endOfRunModelList.erase(endOfRunModelLis    863       endOfRunModelList.erase(endOfRunModelList.begin()+i);
885       any = true;                                 864       any = true;
886       if (verbosity >= G4VisManager::warnings)    865       if (verbosity >= G4VisManager::warnings) {
887   G4warn << "Model \"" << modelName << "\" rem    866   G4warn << "Model \"" << modelName << "\" removed." << G4endl;
888       }                                           867       }
889       break;  // Allow only one model at a tim    868       break;  // Allow only one model at a time to be removed.
890     }                                             869     }
891   }                                               870   }
892                                                   871 
893   if (!any) {                                     872   if (!any) {
894     if (verbosity >= G4VisManager::warnings) {    873     if (verbosity >= G4VisManager::warnings) {
895       G4warn << "WARNING: No match found." <<     874       G4warn << "WARNING: No match found." << G4endl;
896     }                                             875     }
897     return;                                       876     return;
898   }                                               877   }
899                                                   878 
900   CheckSceneAndNotifyHandlers (pScene);           879   CheckSceneAndNotifyHandlers (pScene);
901 }                                                 880 }
902                                                   881 
903 ////////////// /vis/scene/select /////////////    882 ////////////// /vis/scene/select ///////////////////////////////////////
904                                                   883 
905 G4VisCommandSceneSelect::G4VisCommandSceneSele    884 G4VisCommandSceneSelect::G4VisCommandSceneSelect () {
906   G4bool omitable;                                885   G4bool omitable;
907   fpCommand = new G4UIcmdWithAString ("/vis/sc    886   fpCommand = new G4UIcmdWithAString ("/vis/scene/select", this);
908   fpCommand -> SetGuidance ("Selects a scene")    887   fpCommand -> SetGuidance ("Selects a scene");
909   fpCommand -> SetGuidance                        888   fpCommand -> SetGuidance
910   ("Makes the scene current.  \"/vis/scene/lis    889   ("Makes the scene current.  \"/vis/scene/list\" to see"
911    "\n possible scene names.");                   890    "\n possible scene names.");
912   fpCommand -> SetParameterName ("scene-name",    891   fpCommand -> SetParameterName ("scene-name", omitable = false);
913 }                                                 892 }
914                                                   893 
915 G4VisCommandSceneSelect::~G4VisCommandSceneSel    894 G4VisCommandSceneSelect::~G4VisCommandSceneSelect () {
916   delete fpCommand;                               895   delete fpCommand;
917 }                                                 896 }
918                                                   897 
919 G4String G4VisCommandSceneSelect::GetCurrentVa    898 G4String G4VisCommandSceneSelect::GetCurrentValue (G4UIcommand*) {
920   return "";                                      899   return "";
921 }                                                 900 }
922                                                   901 
923 void G4VisCommandSceneSelect::SetNewValue (G4U    902 void G4VisCommandSceneSelect::SetNewValue (G4UIcommand*, G4String newValue) {
924                                                   903 
925   G4VisManager::Verbosity verbosity = fpVisMan    904   G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
926                                                   905 
927   G4String& selectName = newValue;                906   G4String& selectName = newValue;
928   G4SceneList& sceneList = fpVisManager -> Set    907   G4SceneList& sceneList = fpVisManager -> SetSceneList ();
929   std::size_t iScene, nScenes = sceneList.size    908   std::size_t iScene, nScenes = sceneList.size ();
930   for (iScene = 0; iScene < nScenes; ++iScene)    909   for (iScene = 0; iScene < nScenes; ++iScene) {
931     if (sceneList [iScene] -> GetName () == se    910     if (sceneList [iScene] -> GetName () == selectName) break;
932   }                                               911   }
933   if (iScene >= nScenes) {                        912   if (iScene >= nScenes) {
934     if (verbosity >= G4VisManager::warnings) {    913     if (verbosity >= G4VisManager::warnings) {
935       G4warn << "WARNING: Scene \"" << selectN    914       G4warn << "WARNING: Scene \"" << selectName
936       << "\" not found - \"/vis/scene/list\" t    915       << "\" not found - \"/vis/scene/list\" to see possibilities."
937       << G4endl;                                  916       << G4endl;
938     }                                             917     }
939     return;                                       918     return;
940   }                                               919   }
941                                                   920 
942   if (verbosity >= G4VisManager::confirmations    921   if (verbosity >= G4VisManager::confirmations) {
943     G4cout << "Scene \"" << selectName            922     G4cout << "Scene \"" << selectName
944     << "\" selected." << G4endl;                  923     << "\" selected." << G4endl;
945   }                                               924   }
946                                                   925 
947   CheckSceneAndNotifyHandlers (sceneList [iSce    926   CheckSceneAndNotifyHandlers (sceneList [iScene]);
948 }                                                 927 }
949                                                   928 
950 ////////////// /vis/scene/showExtents ////////    929 ////////////// /vis/scene/showExtents ///////////////////////////////////////
951                                                   930 
952 G4VisCommandSceneShowExtents::G4VisCommandScen    931 G4VisCommandSceneShowExtents::G4VisCommandSceneShowExtents () {
953   fpCommand = new G4UIcmdWithoutParameter ("/v    932   fpCommand = new G4UIcmdWithoutParameter ("/vis/scene/showExtents", this);
954   fpCommand -> SetGuidance ("Prints and draws     933   fpCommand -> SetGuidance ("Prints and draws extents of models in a scene");
955 }                                                 934 }
956                                                   935 
957 G4VisCommandSceneShowExtents::~G4VisCommandSce    936 G4VisCommandSceneShowExtents::~G4VisCommandSceneShowExtents () {
958   delete fpCommand;                               937   delete fpCommand;
959 }                                                 938 }
960                                                   939 
961 G4String G4VisCommandSceneShowExtents::GetCurr    940 G4String G4VisCommandSceneShowExtents::GetCurrentValue (G4UIcommand*) {
962   return "";                                      941   return "";
963 }                                                 942 }
964                                                   943 
965 void G4VisCommandSceneShowExtents::SetNewValue    944 void G4VisCommandSceneShowExtents::SetNewValue (G4UIcommand*, G4String) {
966                                                   945 
967   G4VisManager::Verbosity verbosity = fpVisMan    946   G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
968                                                   947 
969   G4VSceneHandler* pCurrentSceneHandler =         948   G4VSceneHandler* pCurrentSceneHandler =
970   fpVisManager -> GetCurrentSceneHandler();       949   fpVisManager -> GetCurrentSceneHandler();
971   if (!pCurrentSceneHandler) {                    950   if (!pCurrentSceneHandler) {
972     if (verbosity >= G4VisManager::warnings) {    951     if (verbosity >= G4VisManager::warnings) {
973       G4warn << "WARNING: No current scene han    952       G4warn << "WARNING: No current scene handler."
974       << G4endl;                                  953       << G4endl;
975     }                                             954     }
976     return;                                       955     return;
977   }                                               956   }
978   G4VViewer* pCurrentViewer = fpVisManager ->     957   G4VViewer* pCurrentViewer = fpVisManager -> GetCurrentViewer();
979   if (!pCurrentViewer) {                          958   if (!pCurrentViewer) {
980     if (verbosity >= G4VisManager::warnings) {    959     if (verbosity >= G4VisManager::warnings) {
981       G4warn << "WARNING: No current viewer."     960       G4warn << "WARNING: No current viewer."
982       << G4endl;                                  961       << G4endl;
983     }                                             962     }
984     return;                                       963     return;
985   }                                               964   }
986   G4Scene* pCurrentScene = fpVisManager -> Get    965   G4Scene* pCurrentScene = fpVisManager -> GetCurrentScene();
987   if (!pCurrentScene) {                           966   if (!pCurrentScene) {
988     if (verbosity >= G4VisManager::warnings) {    967     if (verbosity >= G4VisManager::warnings) {
989       G4warn << "WARNING: No current scene."      968       G4warn << "WARNING: No current scene."
990       << G4endl;                                  969       << G4endl;
991     }                                             970     }
992     return;                                       971     return;
993   }                                               972   }
994                                                   973 
995   G4cout << "\n  Run-duration models:";           974   G4cout << "\n  Run-duration models:";
996   std::size_t nRunModels = pCurrentScene -> Ge    975   std::size_t nRunModels = pCurrentScene -> GetRunDurationModelList ().size ();
997   if (nRunModels == 0) {                          976   if (nRunModels == 0) {
998     G4cout << " none.";                           977     G4cout << " none.";
999   }                                               978   }
1000   for (std::size_t i = 0; i < nRunModels; ++i    979   for (std::size_t i = 0; i < nRunModels; ++i) {
1001     if (pCurrentScene -> GetRunDurationModelL    980     if (pCurrentScene -> GetRunDurationModelList()[i].fActive)
1002       G4cout << "\n   Active:   ";               981       G4cout << "\n   Active:   ";
1003     else G4cout << "\n   Inactive: ";            982     else G4cout << "\n   Inactive: ";
1004     G4VModel* pModel = pCurrentScene -> GetRu    983     G4VModel* pModel = pCurrentScene -> GetRunDurationModelList()[i].fpModel;
1005     const G4VisExtent& transformedExtent = pM    984     const G4VisExtent& transformedExtent = pModel -> GetExtent();
1006     G4cout << pModel -> GetGlobalDescription     985     G4cout << pModel -> GetGlobalDescription ()
1007     << "\n" << transformedExtent;                986     << "\n" << transformedExtent;
1008     DrawExtent(transformedExtent);               987     DrawExtent(transformedExtent);
1009   }                                              988   }
1010   G4cout << "\n  End-of-event models:";          989   G4cout << "\n  End-of-event models:";
1011   std::size_t nEOEModels = pCurrentScene -> G    990   std::size_t nEOEModels = pCurrentScene -> GetEndOfEventModelList ().size ();
1012   if (nEOEModels == 0) {                         991   if (nEOEModels == 0) {
1013     G4cout << " none.";                          992     G4cout << " none.";
1014   }                                              993   }
1015   for (std::size_t i = 0; i < nEOEModels; ++i    994   for (std::size_t i = 0; i < nEOEModels; ++i) {
1016     if (pCurrentScene -> GetEndOfEventModelLi    995     if (pCurrentScene -> GetEndOfEventModelList()[i].fActive)
1017       G4cout << "\n   Active:   ";               996       G4cout << "\n   Active:   ";
1018     else G4cout << "\n   Inactive: ";            997     else G4cout << "\n   Inactive: ";
1019     G4VModel* pModel = pCurrentScene -> GetEn    998     G4VModel* pModel = pCurrentScene -> GetEndOfEventModelList()[i].fpModel;
1020     const G4VisExtent& transformedExtent = pM    999     const G4VisExtent& transformedExtent = pModel -> GetExtent();
1021     G4cout << pModel -> GetGlobalDescription     1000     G4cout << pModel -> GetGlobalDescription ()
1022     << "\n" << transformedExtent;                1001     << "\n" << transformedExtent;
1023     DrawExtent(transformedExtent);               1002     DrawExtent(transformedExtent);
1024   }                                              1003   }
1025   G4cout << "\n  End-of-run models:";            1004   G4cout << "\n  End-of-run models:";
1026   std::size_t nEORModels = pCurrentScene -> G    1005   std::size_t nEORModels = pCurrentScene -> GetEndOfRunModelList ().size ();
1027   if (nEORModels == 0) {                         1006   if (nEORModels == 0) {
1028     G4cout << " none.";                          1007     G4cout << " none.";
1029   }                                              1008   }
1030   for (std::size_t i = 0; i < nEORModels; ++i    1009   for (std::size_t i = 0; i < nEORModels; ++i) {
1031     if (pCurrentScene -> GetEndOfRunModelList    1010     if (pCurrentScene -> GetEndOfRunModelList()[i].fActive)
1032       G4cout << "\n   Active:   ";               1011       G4cout << "\n   Active:   ";
1033     else G4cout << "\n   Inactive: ";            1012     else G4cout << "\n   Inactive: ";
1034     G4VModel* pModel = pCurrentScene -> GetEn    1013     G4VModel* pModel = pCurrentScene -> GetEndOfRunModelList()[i].fpModel;
1035     const G4VisExtent& transformedExtent = pM    1014     const G4VisExtent& transformedExtent = pModel -> GetExtent();
1036     G4cout << pModel -> GetGlobalDescription     1015     G4cout << pModel -> GetGlobalDescription ()
1037     << "\n" << transformedExtent;                1016     << "\n" << transformedExtent;
1038     DrawExtent(transformedExtent);               1017     DrawExtent(transformedExtent);
1039   }                                              1018   }
1040   G4cout << "\n  Overall extent:\n";             1019   G4cout << "\n  Overall extent:\n";
1041   DrawExtent(pCurrentScene->GetExtent());        1020   DrawExtent(pCurrentScene->GetExtent());
1042   G4cout << G4endl;                              1021   G4cout << G4endl;
1043 }                                                1022 }
1044                                                  1023