Geant4 Cross Reference

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


  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 // $Id: G4VisCommandsCompound.cc,v 1.40 2010/05/20 07:54:01 allison Exp $
                                                   >>  28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
 27                                                    29 
 28 // Compound /vis/ commands - John Allison  15t     30 // Compound /vis/ commands - John Allison  15th May 2000
 29                                                    31 
 30 #include "G4VisCommandsCompound.hh"                32 #include "G4VisCommandsCompound.hh"
 31                                                    33 
 32 #include "G4VisManager.hh"                         34 #include "G4VisManager.hh"
 33 #include "G4UImanager.hh"                          35 #include "G4UImanager.hh"
 34 #include "G4UIcommandTree.hh"                  << 
 35 #include "G4UIcmdWithAString.hh"                   36 #include "G4UIcmdWithAString.hh"
 36                                                    37 
 37 #include <sstream>                                 38 #include <sstream>
 38 #include <set>                                 << 
 39                                                << 
 40 #define G4warn G4cout                          << 
 41                                                    39 
 42 ////////////// /vis/drawTree /////////////////     40 ////////////// /vis/drawTree ///////////////////////////////////////
 43                                                    41 
 44 G4VisCommandDrawTree::G4VisCommandDrawTree() {     42 G4VisCommandDrawTree::G4VisCommandDrawTree() {
 45   G4bool omitable;                                 43   G4bool omitable;
 46   fpCommand = new G4UIcommand("/vis/drawTree",     44   fpCommand = new G4UIcommand("/vis/drawTree", this);
 47   fpCommand->SetGuidance                           45   fpCommand->SetGuidance
 48     ("Produces a representation of the geometr <<  46     ("(DTREE) Creates a scene consisting of this physical volume and"
 49      "\nguidance is given on running the comma <<  47      "\n  produces a representation of the geometry hieracrhy.");
 50      "\nfor \"/vis/ASCIITree/verbose\".");     <<  48   fpCommand->SetGuidance("The scene becomes current.");
 51   fpCommand->SetGuidance("The pre-existing sce << 
 52   G4UIparameter* parameter;                        49   G4UIparameter* parameter;
 53   parameter = new G4UIparameter("physical-volu     50   parameter = new G4UIparameter("physical-volume-name", 's', omitable = true);
 54   parameter -> SetDefaultValue("world");           51   parameter -> SetDefaultValue("world");
 55   fpCommand -> SetParameter (parameter);           52   fpCommand -> SetParameter (parameter);
 56   parameter = new G4UIparameter("system", 's',     53   parameter = new G4UIparameter("system", 's', omitable = true);
 57   parameter -> SetDefaultValue("ATree");           54   parameter -> SetDefaultValue("ATree");
 58   fpCommand -> SetParameter (parameter);           55   fpCommand -> SetParameter (parameter);
 59 }                                                  56 }
 60                                                    57 
 61 G4VisCommandDrawTree::~G4VisCommandDrawTree()      58 G4VisCommandDrawTree::~G4VisCommandDrawTree() {
 62   delete fpCommand;                                59   delete fpCommand;
 63 }                                                  60 }
 64                                                    61 
 65 void G4VisCommandDrawTree::SetNewValue(G4UIcom     62 void G4VisCommandDrawTree::SetNewValue(G4UIcommand*, G4String newValue) {
 66                                                    63 
 67   G4String pvname, system;                         64   G4String pvname, system;
 68   std::istringstream is(newValue);                 65   std::istringstream is(newValue);
 69   is >> pvname >> system;                          66   is >> pvname >> system;
 70                                                    67 
 71   // Note: The second parameter, "system", is  << 
 72   // a choice of dedicated tree printing/displ << 
 73   // the only such dedicated system is ASCIITr << 
 74   // specify OGLSX, for example.  So to avoid  << 
 75   // feature to systems that have "Tree" in th << 
 76                                                << 
 77   // Of course, some other systems, such as OG << 
 78   // built-in.  The HepRApp offline browser al << 
 79   // built in.                                 << 
 80                                                << 
 81   if (!G4StrUtil::contains(system, "Tree")) {  << 
 82     system = "ATree";                          << 
 83   }                                            << 
 84                                                << 
 85   G4VGraphicsSystem* keepSystem = fpVisManager     68   G4VGraphicsSystem* keepSystem = fpVisManager->GetCurrentGraphicsSystem();
 86   G4Scene* keepScene = fpVisManager->GetCurren     69   G4Scene* keepScene = fpVisManager->GetCurrentScene();
 87   G4VSceneHandler* keepSceneHandler = fpVisMan     70   G4VSceneHandler* keepSceneHandler = fpVisManager->GetCurrentSceneHandler();
 88   G4VViewer* keepViewer = fpVisManager->GetCur     71   G4VViewer* keepViewer = fpVisManager->GetCurrentViewer();
 89   G4VisManager::Verbosity keepVisVerbosity = f << 
 90   G4bool keepAbleness = fpVisManager->GetConcr << 
 91                                                    72 
 92   G4UImanager* UImanager = G4UImanager::GetUIp     73   G4UImanager* UImanager = G4UImanager::GetUIpointer();
 93   G4int keepUIVerbose = UImanager->GetVerboseL <<  74   G4int keepVerbose = UImanager->GetVerboseLevel();
 94   G4int newVerbose(0);                             75   G4int newVerbose(0);
 95   if (keepUIVerbose >= 2 ||                    <<  76   if (keepVerbose >= 2 ||
 96       fpVisManager->GetVerbosity() >= G4VisMan     77       fpVisManager->GetVerbosity() >= G4VisManager::confirmations)
 97     newVerbose = 2;                                78     newVerbose = 2;
 98   UImanager->SetVerboseLevel(newVerbose);          79   UImanager->SetVerboseLevel(newVerbose);
 99                                                <<  80   UImanager->ApplyCommand(G4String("/vis/open " + system));
100   auto errorCode = UImanager->ApplyCommand(G4S <<  81   UImanager->ApplyCommand(G4String("/vis/drawVolume " + pvname));
101   if (errorCode == 0) {                        <<  82   UImanager->ApplyCommand("/vis/viewer/flush");
102     if (!keepAbleness) {  // Enable temporaril <<  83   UImanager->SetVerboseLevel(keepVerbose);
103       fpVisManager->SetVerboseLevel("Quiet");  <<  84 
104       UImanager->ApplyCommand("/vis/enable");  <<  85   if (keepViewer) {
105       fpVisManager->SetVerboseLevel(keepVisVer <<  86     if (fpVisManager->GetVerbosity() >= G4VisManager::warnings) {
106     }                                          <<  87       G4cout << "Reverting to " << keepViewer->GetName() << G4endl;
107     UImanager->ApplyCommand("/vis/viewer/reset << 
108     UImanager->ApplyCommand(G4String("/vis/dra << 
109     UImanager->ApplyCommand("/vis/viewer/flush << 
110     if (!keepAbleness) {  // Disable again     << 
111       fpVisManager->SetVerboseLevel("Quiet");  << 
112       UImanager->ApplyCommand("/vis/disable"); << 
113       fpVisManager->SetVerboseLevel(keepVisVer << 
114     }                                          << 
115     if (keepViewer) {                          << 
116       if (fpVisManager->GetVerbosity() >= G4Vi << 
117         G4warn << "Reverting to " << keepViewe << 
118       }                                        << 
119       fpVisManager->SetCurrentGraphicsSystem(k << 
120       fpVisManager->SetCurrentScene(keepScene) << 
121       fpVisManager->SetCurrentSceneHandler(kee << 
122       fpVisManager->SetCurrentViewer(keepViewe << 
123     }                                              88     }
                                                   >>  89     fpVisManager->SetCurrentGraphicsSystem(keepSystem);
                                                   >>  90     fpVisManager->SetCurrentScene(keepScene);
                                                   >>  91     fpVisManager->SetCurrentSceneHandler(keepSceneHandler);
                                                   >>  92     fpVisManager->SetCurrentViewer(keepViewer);
124   }                                                93   }
125   UImanager->SetVerboseLevel(keepUIVerbose);   << 
126 }                                                  94 }
127                                                    95 
128 ////////////// /vis/drawView /////////////////     96 ////////////// /vis/drawView ///////////////////////////////////////
129                                                    97 
130 G4VisCommandDrawView::G4VisCommandDrawView() {     98 G4VisCommandDrawView::G4VisCommandDrawView() {
131   G4bool omitable;                                 99   G4bool omitable;
132   fpCommand = new G4UIcommand("/vis/drawView",    100   fpCommand = new G4UIcommand("/vis/drawView", this);
133   fpCommand->SetGuidance                          101   fpCommand->SetGuidance
134     ("Draw view from this angle, etc.");          102     ("Draw view from this angle, etc.");
135   G4UIparameter* parameter;                       103   G4UIparameter* parameter;
136   parameter = new G4UIparameter("theta-degrees    104   parameter = new G4UIparameter("theta-degrees", 'd', omitable = true);
137   parameter -> SetDefaultValue(0.);               105   parameter -> SetDefaultValue(0.);
138   fpCommand -> SetParameter (parameter);          106   fpCommand -> SetParameter (parameter);
139   parameter = new G4UIparameter("phi-degrees",    107   parameter = new G4UIparameter("phi-degrees", 'd', omitable = true);
140   parameter -> SetDefaultValue(0.);               108   parameter -> SetDefaultValue(0.);
141   fpCommand -> SetParameter (parameter);          109   fpCommand -> SetParameter (parameter);
142   parameter = new G4UIparameter("pan-right", '    110   parameter = new G4UIparameter("pan-right", 'd', omitable = true);
143   parameter -> SetDefaultValue(0.);               111   parameter -> SetDefaultValue(0.);
144   fpCommand -> SetParameter (parameter);          112   fpCommand -> SetParameter (parameter);
145   parameter = new G4UIparameter("pan-up", 'd',    113   parameter = new G4UIparameter("pan-up", 'd', omitable = true);
146   parameter -> SetDefaultValue(0.);               114   parameter -> SetDefaultValue(0.);
147   fpCommand -> SetParameter (parameter);          115   fpCommand -> SetParameter (parameter);
148   parameter = new G4UIparameter("pan-unit", 's    116   parameter = new G4UIparameter("pan-unit", 's', omitable = true);
149   parameter -> SetDefaultValue("cm");             117   parameter -> SetDefaultValue("cm");
150   fpCommand -> SetParameter (parameter);          118   fpCommand -> SetParameter (parameter);
151   parameter = new G4UIparameter("zoom-factor",    119   parameter = new G4UIparameter("zoom-factor", 'd', omitable = true);
152   parameter -> SetDefaultValue(1.);               120   parameter -> SetDefaultValue(1.);
153   fpCommand -> SetParameter (parameter);          121   fpCommand -> SetParameter (parameter);
154   parameter = new G4UIparameter("dolly", 'd',     122   parameter = new G4UIparameter("dolly", 'd', omitable = true);
155   parameter -> SetDefaultValue(0.);               123   parameter -> SetDefaultValue(0.);
156   fpCommand -> SetParameter (parameter);          124   fpCommand -> SetParameter (parameter);
157   parameter = new G4UIparameter("dolly-unit",     125   parameter = new G4UIparameter("dolly-unit", 's', omitable = true);
158   parameter -> SetDefaultValue("cm");             126   parameter -> SetDefaultValue("cm");
159   fpCommand -> SetParameter (parameter);          127   fpCommand -> SetParameter (parameter);
160 }                                                 128 }
161                                                   129 
162 G4VisCommandDrawView::~G4VisCommandDrawView()     130 G4VisCommandDrawView::~G4VisCommandDrawView() {
163   delete fpCommand;                               131   delete fpCommand;
164 }                                                 132 }
165                                                   133 
166 void G4VisCommandDrawView::SetNewValue(G4UIcom    134 void G4VisCommandDrawView::SetNewValue(G4UIcommand*, G4String newValue) {
167                                                   135 
168   G4VisManager::Verbosity verbosity = fpVisMan    136   G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
169                                                   137 
170   G4VViewer* currentViewer = fpVisManager->Get    138   G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
171   if (!currentViewer) {                           139   if (!currentViewer) {
172     if (verbosity >= G4VisManager::warnings) {    140     if (verbosity >= G4VisManager::warnings) {
173       G4warn <<                                << 141       G4cout <<
174   "WARNING: G4VisCommandsDrawView::SetNewValue    142   "WARNING: G4VisCommandsDrawView::SetNewValue: no current viewer."
175        << G4endl;                                 143        << G4endl;
176     }                                             144     }
177     return;                                       145     return;
178   }                                               146   }
179                                                   147 
180   G4String thetaDeg;                              148   G4String thetaDeg;
181   G4String phiDeg;                                149   G4String phiDeg;
182   G4String panRight;                              150   G4String panRight;
183   G4String panUp;                                 151   G4String panUp;
184   G4String panUnit;                               152   G4String panUnit;
185   G4String zoomFactor;                            153   G4String zoomFactor;
186   G4String dolly;                                 154   G4String dolly;
187   G4String dollyUnit;                             155   G4String dollyUnit;
188   std::istringstream is(newValue);                156   std::istringstream is(newValue);
189   is >> thetaDeg >> phiDeg >> panRight >> panU    157   is >> thetaDeg >> phiDeg >> panRight >> panUp >> panUnit
190      >> zoomFactor >> dolly >> dollyUnit;         158      >> zoomFactor >> dolly >> dollyUnit;
191                                                   159   
192   G4UImanager* UImanager = G4UImanager::GetUIp    160   G4UImanager* UImanager = G4UImanager::GetUIpointer();
                                                   >> 161   G4int keepVerbose = UImanager->GetVerboseLevel();
                                                   >> 162   G4int newVerbose(0);
                                                   >> 163   if (keepVerbose >= 2 ||
                                                   >> 164       fpVisManager->GetVerbosity() >= G4VisManager::confirmations)
                                                   >> 165     newVerbose = 2;
                                                   >> 166   UImanager->SetVerboseLevel(newVerbose);
193   G4ViewParameters vp = currentViewer->GetView    167   G4ViewParameters vp = currentViewer->GetViewParameters();
194   G4bool keepAutoRefresh = vp.IsAutoRefresh();    168   G4bool keepAutoRefresh = vp.IsAutoRefresh();
195   vp.SetAutoRefresh(false);                       169   vp.SetAutoRefresh(false);
196   currentViewer->SetViewParameters(vp);           170   currentViewer->SetViewParameters(vp);
197   UImanager->ApplyCommand(                        171   UImanager->ApplyCommand(
198     G4String("/vis/viewer/set/viewpointThetaPh    172     G4String("/vis/viewer/set/viewpointThetaPhi " + thetaDeg + " " + phiDeg + " deg"));
199   UImanager->ApplyCommand(                        173   UImanager->ApplyCommand(
200     G4String("/vis/viewer/panTo " + panRight +    174     G4String("/vis/viewer/panTo " + panRight + " " + panUp + " " + panUnit));
201   UImanager->ApplyCommand(                        175   UImanager->ApplyCommand(
202     G4String("/vis/viewer/zoomTo " + zoomFacto    176     G4String("/vis/viewer/zoomTo " + zoomFactor));
203   vp = currentViewer->GetViewParameters();        177   vp = currentViewer->GetViewParameters();
204   vp.SetAutoRefresh(keepAutoRefresh);             178   vp.SetAutoRefresh(keepAutoRefresh);
205   currentViewer->SetViewParameters(vp);           179   currentViewer->SetViewParameters(vp);
206   UImanager->ApplyCommand(                        180   UImanager->ApplyCommand(
207     G4String("/vis/viewer/dollyTo " + dolly +     181     G4String("/vis/viewer/dollyTo " + dolly + " " + dollyUnit));
208 }                                              << 182   UImanager->SetVerboseLevel(keepVerbose);
209                                                << 
210 ////////////// /vis/drawLogicalVolume //////// << 
211                                                << 
212 G4VisCommandDrawLogicalVolume::G4VisCommandDra << 
213   fpCommand = new G4UIcommand("/vis/drawLogica << 
214   fpCommand->SetGuidance                       << 
215   ("Draws logical volume with additional compo << 
216   fpCommand->SetGuidance                       << 
217   ("Synonymous with \"/vis/specify\".");       << 
218   fpCommand->SetGuidance                       << 
219   ("Creates a scene consisting of this logical << 
220    "\n  current viewer to draw it. The scene b << 
221   const G4UIcommandTree* tree = G4UImanager::G << 
222   const G4UIcommand* addLogVolCmd = tree->Find << 
223   // Pick up guidance from /vis/scene/add/logi << 
224   CopyGuidanceFrom(addLogVolCmd,fpCommand);    << 
225   // Pick up parameters from /vis/scene/add/lo << 
226   CopyParametersFrom(addLogVolCmd,fpCommand);  << 
227 }                                              << 
228                                                << 
229 G4VisCommandDrawLogicalVolume::~G4VisCommandDr << 
230   delete fpCommand;                            << 
231 }                                              << 
232                                                << 
233 void G4VisCommandDrawLogicalVolume::SetNewValu << 
234   G4VisManager::Verbosity verbosity = fpVisMan << 
235   G4UImanager* UImanager = G4UImanager::GetUIp << 
236   G4VViewer* currentViewer = fpVisManager->Get << 
237   const G4ViewParameters& currentViewParams =  << 
238   G4bool keepAutoRefresh = currentViewParams.I << 
239   if (keepAutoRefresh) UImanager->ApplyCommand << 
240   UImanager->ApplyCommand("/vis/scene/create") << 
241   UImanager->ApplyCommand(G4String("/vis/scene << 
242   UImanager->ApplyCommand("/vis/sceneHandler/a << 
243   G4ViewParameters::DrawingStyle keepDrawingSt << 
244   if(keepDrawingStyle != G4ViewParameters::wir << 
245     UImanager->ApplyCommand("/vis/viewer/set/s << 
246   G4bool keepMarkerNotHidden = currentViewPara << 
247   if (!keepMarkerNotHidden) UImanager->ApplyCo << 
248   if (keepAutoRefresh) UImanager->ApplyCommand << 
249   if (verbosity >= G4VisManager::warnings) {   << 
250     if (keepDrawingStyle != currentViewParams. << 
251       G4warn                                   << 
252       << "Drawing style changed to wireframe.  << 
253       G4String style, edge;                    << 
254       switch (keepDrawingStyle) {              << 
255         case G4ViewParameters::wireframe:      << 
256           style = "wireframe"; edge = "false"; << 
257         case G4ViewParameters::hlr:            << 
258           style = "wireframe"; edge = "true";  << 
259         case G4ViewParameters::hsr:            << 
260           style = "surface"; edge = "false"; b << 
261         case G4ViewParameters::hlhsr:          << 
262           style = "surface"; edge = "true"; br << 
263         case G4ViewParameters::cloud:          << 
264           style = "cloud"; edge = ""; break;   << 
265       }                                        << 
266       G4warn << "\n  /vis/viewer/set/style " + << 
267       if (!edge.empty()) G4warn << "\n  /vis/v << 
268       G4warn << G4endl;                        << 
269     }                                          << 
270     if (keepMarkerNotHidden != currentViewPara << 
271       G4warn                                   << 
272       << "Markers changed to \"not hidden\". T << 
273       << "\n  /vis/viewer/set/hiddenmarker tru << 
274       << G4endl;                               << 
275     }                                          << 
276   }                                            << 
277   static G4bool warned = false;                << 
278   if (verbosity >= G4VisManager::confirmations << 
279     G4cout <<                                  << 
280     "NOTE: For systems which are not \"auto-re << 
281     "\n  issue \"/vis/viewer/refresh\" or \"/v << 
282     << G4endl;                                 << 
283     warned = true;                             << 
284   }                                            << 
285 }                                                 183 }
286                                                   184 
287 ////////////// /vis/drawVolume ///////////////    185 ////////////// /vis/drawVolume ///////////////////////////////////////
288                                                   186 
289 G4VisCommandDrawVolume::G4VisCommandDrawVolume    187 G4VisCommandDrawVolume::G4VisCommandDrawVolume() {
290   fpCommand = new G4UIcommand("/vis/drawVolume << 188   G4bool omitable;
                                                   >> 189   fpCommand = new G4UIcmdWithAString("/vis/drawVolume", this);
291   fpCommand->SetGuidance                          190   fpCommand->SetGuidance
292   ("Creates a scene containing this physical v << 191     ("Creates a scene containing this physical volume and asks the"
293    "\ncurrent viewer to draw it.  The scene be << 192      "\ncurrent viewer to draw it.  The scene becomes current.");
294   const G4UIcommandTree* tree = G4UImanager::G << 193   fpCommand -> SetGuidance 
295   const G4UIcommand* addVolCmd = tree->FindPat << 194     ("If physical-volume-name is \"world\" (the default), the main geometry"
296   // Pick up guidance from /vis/scene/add/volu << 195      "\ntree (material world) is drawn.  If \"worlds\", all worlds - material"
297   CopyGuidanceFrom(addVolCmd,fpCommand);       << 196      "\nworld and parallel worlds, if any - are drawn.  Otherwise a search of"
298   // Pick up parameters from /vis/scene/add/vo << 197      "\nall worlds is made, taking the first matching occurence only.  To see"
299   CopyParametersFrom(addVolCmd,fpCommand);     << 198      "\na representation of the geometry hierarchy of the worlds, try"
                                                   >> 199      "\n\"/vis/drawTree [worlds]\" or one of the driver/browser combinations"
                                                   >> 200      "\nthat have the required functionality, e.g., HepRep");
                                                   >> 201   fpCommand->SetParameterName("physical-volume-name", omitable = true);
                                                   >> 202   fpCommand->SetDefaultValue("world");
300 }                                                 203 }
301                                                   204 
302 G4VisCommandDrawVolume::~G4VisCommandDrawVolum    205 G4VisCommandDrawVolume::~G4VisCommandDrawVolume() {
303   delete fpCommand;                               206   delete fpCommand;
304 }                                                 207 }
305                                                   208 
306 void G4VisCommandDrawVolume::SetNewValue(G4UIc    209 void G4VisCommandDrawVolume::SetNewValue(G4UIcommand*, G4String newValue) {
307   G4VisManager::Verbosity verbosity = fpVisMan    210   G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
308   G4UImanager* UImanager = G4UImanager::GetUIp    211   G4UImanager* UImanager = G4UImanager::GetUIpointer();
                                                   >> 212   G4int keepVerbose = UImanager->GetVerboseLevel();
                                                   >> 213   G4int newVerbose(0);
                                                   >> 214   if (keepVerbose >= 2 || verbosity >= G4VisManager::confirmations)
                                                   >> 215     newVerbose = 2;
                                                   >> 216   UImanager->SetVerboseLevel(newVerbose);
309   UImanager->ApplyCommand("/vis/scene/create")    217   UImanager->ApplyCommand("/vis/scene/create");
310   UImanager->ApplyCommand(G4String("/vis/scene    218   UImanager->ApplyCommand(G4String("/vis/scene/add/volume " + newValue));
311   UImanager->ApplyCommand("/vis/sceneHandler/a    219   UImanager->ApplyCommand("/vis/sceneHandler/attach");
                                                   >> 220   UImanager->SetVerboseLevel(keepVerbose);
312   static G4bool warned = false;                   221   static G4bool warned = false;
313   if (verbosity >= G4VisManager::confirmations    222   if (verbosity >= G4VisManager::confirmations && !warned) {
314     G4cout <<                                     223     G4cout <<
315       "NOTE: For systems which are not \"auto-    224       "NOTE: For systems which are not \"auto-refresh\" you will need to"
316       "\n  issue \"/vis/viewer/refresh\" or \"    225       "\n  issue \"/vis/viewer/refresh\" or \"/vis/viewer/flush\"."
317      << G4endl;                                   226      << G4endl;
318     warned = true;                                227     warned = true;
319   }                                               228   }
320 }                                                 229 }
321                                                   230 
322 ////////////// /vis/open /////////////////////    231 ////////////// /vis/open ///////////////////////////////////////
323                                                   232 
324 G4VisCommandOpen::G4VisCommandOpen() {            233 G4VisCommandOpen::G4VisCommandOpen() {
325   G4bool omitable;                                234   G4bool omitable;
326   fpCommand = new G4UIcommand("/vis/open", thi    235   fpCommand = new G4UIcommand("/vis/open", this);
327   fpCommand->SetGuidance                          236   fpCommand->SetGuidance
328     ("Creates a scene handler and viewer ready << 237     ("Creates a scene handler ready for drawing.");
329   fpCommand->SetGuidance                          238   fpCommand->SetGuidance
330     ("The scene handler and viewer names are a << 239     ("The scene handler becomes current (the name is auto-generated).");
331   // Pick up guidance from /vis/viewer/create  << 
332   const G4UIcommandTree* tree = G4UImanager::G << 
333   const G4UIcommand* viewerCreateCmd = tree->F << 
334   CopyGuidanceFrom(viewerCreateCmd,fpCommand,2 << 
335   G4UIparameter* parameter;                       240   G4UIparameter* parameter;
336   parameter = new G4UIparameter("graphics-syst << 241   parameter = new G4UIparameter("graphics-system-name", 's', omitable = false);
337   parameter->SetCurrentAsDefault(true);        << 242    const G4GraphicsSystemList& gslist =
                                                   >> 243     fpVisManager->GetAvailableGraphicsSystems();
                                                   >> 244   G4String candidates;
                                                   >> 245   for (size_t igslist = 0; igslist < gslist.size(); igslist++) {
                                                   >> 246     const G4String& name = gslist[igslist]->GetName();
                                                   >> 247     const G4String& nickname = gslist[igslist]->GetNickname();
                                                   >> 248     if (nickname.isNull()) {
                                                   >> 249       candidates += name;
                                                   >> 250     }
                                                   >> 251     else {
                                                   >> 252       candidates += nickname;
                                                   >> 253     }
                                                   >> 254     candidates += " ";
                                                   >> 255   }
                                                   >> 256   candidates = candidates.strip();
                                                   >> 257   parameter->SetParameterCandidates(candidates);
338   fpCommand->SetParameter(parameter);             258   fpCommand->SetParameter(parameter);
339   parameter = new G4UIparameter("window-size-h    259   parameter = new G4UIparameter("window-size-hint", 's', omitable = true);
340   parameter->SetGuidance                          260   parameter->SetGuidance
341     ("integer (pixels) for square window place    261     ("integer (pixels) for square window placed by window manager or"
342      " X-Windows-type geometry string, e.g. 60    262      " X-Windows-type geometry string, e.g. 600x600-100+100");
343   parameter->SetCurrentAsDefault(true);        << 263   parameter->SetDefaultValue("600");
344   fpCommand->SetParameter(parameter);             264   fpCommand->SetParameter(parameter);
345 }                                                 265 }
346                                                   266 
347 G4VisCommandOpen::~G4VisCommandOpen() {           267 G4VisCommandOpen::~G4VisCommandOpen() {
348   delete fpCommand;                               268   delete fpCommand;
349 }                                                 269 }
350                                                   270 
351 G4String G4VisCommandOpen::GetCurrentValue(G4U << 271 void G4VisCommandOpen::SetNewValue (G4UIcommand*, G4String newValue) {
352 {                                              << 
353   G4String graphicsSystemName, windowSizeHint; << 
354   auto graphicsSystem = fpVisManager->GetCurre << 
355   if (graphicsSystem) {                        << 
356     // Take name and hint from latest graphics << 
357     graphicsSystemName = graphicsSystem->GetNa << 
358     auto viewer = fpVisManager->GetCurrentView << 
359     if (viewer) {                              << 
360       windowSizeHint = viewer->GetViewParamete << 
361     }                                          << 
362     else {  // Viewer not yet created?         << 
363       windowSizeHint = fpVisManager->GetDefaul << 
364     }                                          << 
365   }                                            << 
366   else {  // No graphics system yet - must be  << 
367     graphicsSystemName = fpVisManager->GetDefa << 
368     windowSizeHint = fpVisManager->GetDefaultX << 
369   }                                            << 
370   return graphicsSystemName + ' ' + windowSize << 
371 }                                              << 
372                                                << 
373 void G4VisCommandOpen::SetNewValue (G4UIcomman << 
374 {                                              << 
375   G4String systemName, windowSizeHint;            272   G4String systemName, windowSizeHint;
376   std::istringstream is(newValue);                273   std::istringstream is(newValue);
377   is >> systemName >> windowSizeHint;             274   is >> systemName >> windowSizeHint;
378   G4UImanager* UImanager = G4UImanager::GetUIp    275   G4UImanager* UImanager = G4UImanager::GetUIpointer();
379                                                << 276   G4int keepVerbose = UImanager->GetVerboseLevel();
380   auto errorCode = UImanager->ApplyCommand(G4S << 277   G4int newVerbose(0);
381   if (errorCode) {                             << 278   if (keepVerbose >= 2 ||
382     G4warn << "sub-command \"/vis/sceneHandler << 279       fpVisManager->GetVerbosity() >= G4VisManager::confirmations)
383     goto finish;                               << 280     newVerbose = 2;
384   }                                            << 281   UImanager->SetVerboseLevel(newVerbose);
385                                                << 282   UImanager->ApplyCommand(G4String("/vis/sceneHandler/create " + systemName));
386   errorCode = UImanager->ApplyCommand(G4String << 283   UImanager->ApplyCommand(G4String("/vis/viewer/create ! ! " + windowSizeHint));
387   if (errorCode) {                             << 284   UImanager->SetVerboseLevel(keepVerbose);
388     G4warn << "sub-command \"/vis/viewer/creat << 
389     goto finish;                               << 
390   }                                            << 
391                                                << 
392 finish:                                        << 
393   if (errorCode) {                             << 
394     fpVisManager->PrintAvailableGraphicsSystem << 
395     if (errorCode != JustWarning) {            << 
396       G4ExceptionDescription ed;               << 
397       ed << "Invoked command has failed - see  << 
398       command->CommandFailed(errorCode,ed);    << 
399     }                                          << 
400   }                                            << 
401 }                                              << 
402                                                << 
403 ////////////// /vis/plot ///////////////////// << 
404                                                << 
405 G4VisCommandPlot::G4VisCommandPlot ()          << 
406 {                                              << 
407   G4bool omitable;                             << 
408   G4UIparameter* parameter;                    << 
409                                                << 
410   fpCommand = new G4UIcommand("/vis/plot", thi << 
411   fpCommand -> SetGuidance("Draws plots.");    << 
412   parameter = new G4UIparameter ("type", 's',  << 
413   parameter -> SetParameterCandidates("h1 h2") << 
414   fpCommand -> SetParameter (parameter);       << 
415   parameter = new G4UIparameter ("id", 'i', om << 
416   fpCommand -> SetParameter (parameter);       << 
417 #ifdef TOOLS_USE_FREETYPE                      << 
418   parameter = new G4UIparameter ("style", 's', << 
419   parameter -> SetParameterCandidates("none RO << 
420   parameter -> SetDefaultValue("ROOT_default") << 
421   fpCommand -> SetParameter (parameter);       << 
422 #endif                                         << 
423 }                                              << 
424                                                << 
425 G4VisCommandPlot::~G4VisCommandPlot ()         << 
426 {                                              << 
427   delete fpCommand;                            << 
428 }                                              << 
429                                                << 
430 G4String G4VisCommandPlot::GetCurrentValue (G4 << 
431 {                                              << 
432   return "";                                   << 
433 }                                              << 
434                                                << 
435 void G4VisCommandPlot::SetNewValue (G4UIcomman << 
436 {                                              << 
437   auto currentViewer = fpVisManager->GetCurren << 
438   if (currentViewer->GetName().find("TOOLSSG") << 
439     G4warn <<                                  << 
440     "WARNING: Current viewer not able to draw  << 
441     "\n  Try \"/vis/open TSG\", then \"/vis/pl << 
442     << G4endl;                                 << 
443     return;                                    << 
444   }                                            << 
445                                                << 
446   std::istringstream is (newValue);            << 
447   G4String type, id;                           << 
448   is >> type >> id;                            << 
449 #ifdef TOOLS_USE_FREETYPE                      << 
450   G4String style;                              << 
451   is >> style;                                 << 
452 #endif                                         << 
453                                                << 
454   auto keepEnable = fpVisManager->IsEnabled(); << 
455                                                << 
456   auto ui = G4UImanager::GetUIpointer();       << 
457   ui->ApplyCommand("/vis/enable");             << 
458   ui->ApplyCommand("/vis/viewer/resetCameraPar << 
459   ui->ApplyCommand("/vis/scene/create");       << 
460   ui->ApplyCommand("/vis/scene/endOfEventActio << 
461   static G4int plotterID = 0;                  << 
462   std::ostringstream ossPlotter;               << 
463   ossPlotter << "plotter-" << plotterID++;     << 
464   const G4String& plotterName = ossPlotter.str << 
465   ui->ApplyCommand("/vis/plotter/create " + pl << 
466   ui->ApplyCommand("/vis/scene/add/plotter " + << 
467   ui->ApplyCommand("/vis/plotter/add/" + type  << 
468 #ifdef TOOLS_USE_FREETYPE                      << 
469   if (style != "none") {                       << 
470     ui->ApplyCommand("/vis/plotter/addStyle "  << 
471   }                                            << 
472 #endif                                         << 
473   ui->ApplyCommand("/vis/sceneHandler/attach") << 
474                                                << 
475   if (!keepEnable) {                           << 
476     fpVisManager->Disable();                   << 
477     G4warn <<                                  << 
478     "WARNING: drawing was enabled for plotting << 
479     << G4endl;                                 << 
480   }                                            << 
481 }                                                 285 }
482                                                   286 
483 ////////////// /vis/specify //////////////////    287 ////////////// /vis/specify ///////////////////////////////////////
484                                                   288 
485 G4VisCommandSpecify::G4VisCommandSpecify() {      289 G4VisCommandSpecify::G4VisCommandSpecify() {
486   G4bool omitable;                                290   G4bool omitable;
487   fpCommand = new G4UIcommand("/vis/specify",     291   fpCommand = new G4UIcommand("/vis/specify", this);
488   fpCommand->SetGuidance                          292   fpCommand->SetGuidance
489     ("Draws logical volume with Boolean compon    293     ("Draws logical volume with Boolean components, voxels and readout geometry.");
490   fpCommand->SetGuidance                          294   fpCommand->SetGuidance
491     ("Synonymous with \"/vis/drawLogicalVolume << 
492   fpCommand->SetGuidance                       << 
493     ("Creates a scene consisting of this logic    295     ("Creates a scene consisting of this logical volume and asks the"
494      "\n  current viewer to draw it to the spe    296      "\n  current viewer to draw it to the specified depth of descent"
495      "\n  showing boolean components (if any), << 297      "\n  showing boolean components (if any), voxels (if any)"
496      "\n  readout geometry (if any), local axe << 298      "\n  and readout geometry (if any), under control of the appropriate flag.");
497      "\n  under control of the appropriate fla << 
498   fpCommand->SetGuidance                          299   fpCommand->SetGuidance
499   ("Note: voxels are not constructed until sta << 300     ("Note: voxels are not constructed until start of run - /run/beamOn.");
500    "\n  (For voxels without a run, \"/run/beam << 
501   fpCommand->SetGuidance("The scene becomes cu    301   fpCommand->SetGuidance("The scene becomes current.");
502   G4UIparameter* parameter;                       302   G4UIparameter* parameter;
503   parameter = new G4UIparameter("logical-volum    303   parameter = new G4UIparameter("logical-volume-name", 's', omitable = false);
504   fpCommand->SetParameter(parameter);             304   fpCommand->SetParameter(parameter);
505   parameter = new G4UIparameter("depth-of-desc    305   parameter = new G4UIparameter("depth-of-descent", 'i', omitable = true);
506   parameter->SetDefaultValue(1);                  306   parameter->SetDefaultValue(1);
507   fpCommand->SetParameter(parameter);             307   fpCommand->SetParameter(parameter);
508   parameter = new G4UIparameter("booleans-flag    308   parameter = new G4UIparameter("booleans-flag", 'b', omitable = true);
509   parameter->SetDefaultValue(true);               309   parameter->SetDefaultValue(true);
510   fpCommand->SetParameter(parameter);             310   fpCommand->SetParameter(parameter);
511   parameter = new G4UIparameter("voxels-flag",    311   parameter = new G4UIparameter("voxels-flag", 'b', omitable = true);
512   parameter->SetDefaultValue(true);               312   parameter->SetDefaultValue(true);
513   fpCommand->SetParameter(parameter);             313   fpCommand->SetParameter(parameter);
514   parameter = new G4UIparameter("readout-flag"    314   parameter = new G4UIparameter("readout-flag", 'b', omitable = true);
515   parameter->SetDefaultValue(true);               315   parameter->SetDefaultValue(true);
516   fpCommand->SetParameter(parameter);             316   fpCommand->SetParameter(parameter);
517   parameter = new G4UIparameter("axes-flag", ' << 
518   parameter->SetDefaultValue(true);            << 
519   parameter -> SetGuidance ("Set \"false\" to  << 
520   fpCommand->SetParameter(parameter);          << 
521   parameter = new G4UIparameter("check-overlap << 
522   parameter->SetDefaultValue(true);            << 
523   parameter -> SetGuidance ("Set \"false\" to  << 
524   fpCommand->SetParameter(parameter);          << 
525 }                                                 317 }
526                                                   318 
527 G4VisCommandSpecify::~G4VisCommandSpecify() {     319 G4VisCommandSpecify::~G4VisCommandSpecify() {
528   delete fpCommand;                               320   delete fpCommand;
529 }                                                 321 }
530                                                   322 
531 void G4VisCommandSpecify::SetNewValue(G4UIcomm    323 void G4VisCommandSpecify::SetNewValue(G4UIcommand*, G4String newValue) {
532   G4VisManager::Verbosity verbosity = fpVisMan    324   G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
533   G4UImanager* UImanager = G4UImanager::GetUIp    325   G4UImanager* UImanager = G4UImanager::GetUIpointer();
                                                   >> 326   G4int keepVerbose = UImanager->GetVerboseLevel();
                                                   >> 327   G4int newVerbose(0);
                                                   >> 328   if (keepVerbose >= 2 || verbosity >= G4VisManager::confirmations)
                                                   >> 329     newVerbose = 2;
                                                   >> 330   UImanager->SetVerboseLevel(newVerbose);
534   // UImanager->ApplyCommand(G4String("/geomet    331   // UImanager->ApplyCommand(G4String("/geometry/print " + newValue));
535   UImanager->ApplyCommand("/vis/scene/create")    332   UImanager->ApplyCommand("/vis/scene/create");
536   UImanager->ApplyCommand(G4String("/vis/scene    333   UImanager->ApplyCommand(G4String("/vis/scene/add/logicalVolume " + newValue));
537   UImanager->ApplyCommand("/vis/sceneHandler/a    334   UImanager->ApplyCommand("/vis/sceneHandler/attach");
                                                   >> 335   UImanager->SetVerboseLevel(keepVerbose);
538   static G4bool warned = false;                   336   static G4bool warned = false;
539   if (verbosity >= G4VisManager::confirmations    337   if (verbosity >= G4VisManager::confirmations && !warned) {
540     G4cout <<                                     338     G4cout <<
541       "NOTE: For systems which are not \"auto-    339       "NOTE: For systems which are not \"auto-refresh\" you will need to"
542       "\n  issue \"/vis/viewer/refresh\" or \"    340       "\n  issue \"/vis/viewer/refresh\" or \"/vis/viewer/flush\"."
543      << G4endl;                                   341      << G4endl;
544     warned = true;                                342     warned = true;
545   }                                               343   }
546 }                                                 344 }
547                                                   345