Geant4 Cross Reference

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


  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 // /vis/plotter commands - Guy Barrand October     27 // /vis/plotter commands - Guy Barrand October 2021.
 28                                                    28 
 29 #include "G4VisCommandsPlotter.hh"                 29 #include "G4VisCommandsPlotter.hh"
 30                                                    30 
 31 #include "G4PlotterManager.hh"                     31 #include "G4PlotterManager.hh"
 32                                                    32 
 33 #include <tools/tokenize>                          33 #include <tools/tokenize>
 34                                                    34 
 35 #include <sstream>                                 35 #include <sstream>
 36                                                    36 
 37 #define G4warn G4cout                          << 
 38                                                << 
 39 //////////////////////////////////////////////     37 /////////////////////////////////////////////////////////////////////////////
 40 ////////////// /vis/plotter/create ///////////     38 ////////////// /vis/plotter/create //////////////////////////////////////////
 41 //////////////////////////////////////////////     39 /////////////////////////////////////////////////////////////////////////////
 42 G4VisCommandPlotterCreate::G4VisCommandPlotter     40 G4VisCommandPlotterCreate::G4VisCommandPlotterCreate () {
 43   fpCommand = new G4UIcommand("/vis/plotter/cr     41   fpCommand = new G4UIcommand("/vis/plotter/create", this);
 44   fpCommand->SetGuidance("Create a named G4Plo     42   fpCommand->SetGuidance("Create a named G4Plotter.");
 45                                                    43 
 46   G4UIparameter* parameter;                        44   G4UIparameter* parameter;
 47   parameter = new G4UIparameter("name",'s',fal     45   parameter = new G4UIparameter("name",'s',false);
 48   fpCommand->SetParameter (parameter);             46   fpCommand->SetParameter (parameter);
 49 }                                                  47 }
 50                                                    48 
 51 G4VisCommandPlotterCreate::~G4VisCommandPlotte     49 G4VisCommandPlotterCreate::~G4VisCommandPlotterCreate () {delete fpCommand;}
 52                                                    50 
 53 void G4VisCommandPlotterCreate::SetNewValue (G     51 void G4VisCommandPlotterCreate::SetNewValue (G4UIcommand*, G4String newValue)
 54 {                                                  52 {
 55   G4Plotter& _plotter = G4PlotterManager::GetI     53   G4Plotter& _plotter = G4PlotterManager::GetInstance().GetPlotter(newValue);
 56   _plotter.Reset();                                54   _plotter.Reset();
 57   G4Scene* pScene = fpVisManager->GetCurrentSc     55   G4Scene* pScene = fpVisManager->GetCurrentScene();
 58   if(pScene) CheckSceneAndNotifyHandlers (pSce     56   if(pScene) CheckSceneAndNotifyHandlers (pScene);
 59 }                                                  57 }
 60                                                    58 
 61 //////////////////////////////////////////////     59 /////////////////////////////////////////////////////////////////////////////
 62 ////////////// /vis/plotter/setLayout ////////     60 ////////////// /vis/plotter/setLayout ///////////////////////////////////////
 63 //////////////////////////////////////////////     61 /////////////////////////////////////////////////////////////////////////////
 64 G4VisCommandPlotterSetLayout::G4VisCommandPlot     62 G4VisCommandPlotterSetLayout::G4VisCommandPlotterSetLayout () {
 65   fpCommand = new G4UIcommand("/vis/plotter/se     63   fpCommand = new G4UIcommand("/vis/plotter/setLayout", this);
 66   fpCommand->SetGuidance("Set plotter grid lay     64   fpCommand->SetGuidance("Set plotter grid layout.");
 67                                                    65 
 68   G4UIparameter* parameter;                        66   G4UIparameter* parameter;
 69   parameter = new G4UIparameter("plotter",'s',     67   parameter = new G4UIparameter("plotter",'s',false);
 70   fpCommand->SetParameter (parameter);             68   fpCommand->SetParameter (parameter);
 71                                                    69   
 72   parameter = new G4UIparameter("columns",'i',     70   parameter = new G4UIparameter("columns",'i',true);
 73   parameter->SetDefaultValue(1);                   71   parameter->SetDefaultValue(1);
 74   fpCommand->SetParameter (parameter);             72   fpCommand->SetParameter (parameter);
 75                                                    73 
 76   parameter = new G4UIparameter("rows",'i',tru     74   parameter = new G4UIparameter("rows",'i',true);
 77   parameter->SetDefaultValue(1);                   75   parameter->SetDefaultValue(1);
 78   fpCommand->SetParameter (parameter);             76   fpCommand->SetParameter (parameter);
 79 }                                                  77 }
 80                                                    78 
 81 G4VisCommandPlotterSetLayout::~G4VisCommandPlo     79 G4VisCommandPlotterSetLayout::~G4VisCommandPlotterSetLayout () {delete fpCommand;}
 82                                                    80 
 83 void G4VisCommandPlotterSetLayout::SetNewValue     81 void G4VisCommandPlotterSetLayout::SetNewValue (G4UIcommand*, G4String newValue)
 84 {                                                  82 {
 85   G4String plotter;                                83   G4String plotter;
 86   G4int cols,rows;                                 84   G4int cols,rows;
 87   std::istringstream is(newValue);                 85   std::istringstream is(newValue);
 88   is >> plotter >> cols >> rows;                   86   is >> plotter >> cols >> rows;
 89                                                    87   
 90   G4Plotter& _plotter = G4PlotterManager::GetI     88   G4Plotter& _plotter = G4PlotterManager::GetInstance().GetPlotter(plotter);
 91   _plotter.SetLayout(cols,rows);                   89   _plotter.SetLayout(cols,rows);
 92                                                    90 
 93   G4Scene* pScene = fpVisManager->GetCurrentSc     91   G4Scene* pScene = fpVisManager->GetCurrentScene();
 94   if(pScene) CheckSceneAndNotifyHandlers (pSce     92   if(pScene) CheckSceneAndNotifyHandlers (pScene);
 95 }                                                  93 }
 96                                                    94 
 97 //////////////////////////////////////////////     95 /////////////////////////////////////////////////////////////////////////////
 98 ////////////// /vis/plotter/addStyle /////////     96 ////////////// /vis/plotter/addStyle ////////////////////////////////////////
 99 //////////////////////////////////////////////     97 /////////////////////////////////////////////////////////////////////////////
100 G4VisCommandPlotterAddStyle::G4VisCommandPlott     98 G4VisCommandPlotterAddStyle::G4VisCommandPlotterAddStyle () {
101   fpCommand = new G4UIcommand("/vis/plotter/ad     99   fpCommand = new G4UIcommand("/vis/plotter/addStyle", this);
102   fpCommand->SetGuidance("Add a style for a pl    100   fpCommand->SetGuidance("Add a style for a plotter.");
103   fpCommand->SetGuidance("It is applied on all    101   fpCommand->SetGuidance("It is applied on all regions/plots of the plotter.");
104   fpCommand->SetGuidance("default, ROOT_defaul    102   fpCommand->SetGuidance("default, ROOT_default, hippodraw are known embedded styles.");
105   fpCommand->SetGuidance("reset is a keyword u    103   fpCommand->SetGuidance("reset is a keyword used to reset regions style.");
106                                                   104 
107   G4UIparameter* parameter;                       105   G4UIparameter* parameter;
108   parameter = new G4UIparameter("plotter",'s',    106   parameter = new G4UIparameter("plotter",'s',false);
109   fpCommand->SetParameter (parameter);            107   fpCommand->SetParameter (parameter);
110                                                   108   
111   parameter = new G4UIparameter("style",'s',tr    109   parameter = new G4UIparameter("style",'s',true);
112   parameter->SetDefaultValue("default");          110   parameter->SetDefaultValue("default");
113   fpCommand->SetParameter (parameter);            111   fpCommand->SetParameter (parameter);
114 }                                                 112 }
115                                                   113 
116 G4VisCommandPlotterAddStyle::~G4VisCommandPlot    114 G4VisCommandPlotterAddStyle::~G4VisCommandPlotterAddStyle () {delete fpCommand;}
117                                                   115 
118 void G4VisCommandPlotterAddStyle::SetNewValue     116 void G4VisCommandPlotterAddStyle::SetNewValue (G4UIcommand*, G4String newValue)
119 {                                                 117 {
120   G4String plotter;                               118   G4String plotter;
121   G4String style;                                 119   G4String style;
122   std::istringstream is(newValue);                120   std::istringstream is(newValue);
123   is >> plotter >> style;                         121   is >> plotter >> style;
124                                                   122   
125   G4Plotter& _plotter = G4PlotterManager::GetI    123   G4Plotter& _plotter = G4PlotterManager::GetInstance().GetPlotter(plotter);
126   _plotter.AddStyle(style);                       124   _plotter.AddStyle(style);
127                                                   125   
128   G4Scene* pScene = fpVisManager->GetCurrentSc    126   G4Scene* pScene = fpVisManager->GetCurrentScene();
129   if(pScene) CheckSceneAndNotifyHandlers (pSce    127   if(pScene) CheckSceneAndNotifyHandlers (pScene);
130 }                                                 128 }
131                                                   129 
132 //////////////////////////////////////////////    130 /////////////////////////////////////////////////////////////////////////////
133 ////////////// /vis/plotter/addRegionStyle ///    131 ////////////// /vis/plotter/addRegionStyle //////////////////////////////////
134 //////////////////////////////////////////////    132 /////////////////////////////////////////////////////////////////////////////
135 G4VisCommandPlotterAddRegionStyle::G4VisComman    133 G4VisCommandPlotterAddRegionStyle::G4VisCommandPlotterAddRegionStyle () {
136   fpCommand = new G4UIcommand("/vis/plotter/ad    134   fpCommand = new G4UIcommand("/vis/plotter/addRegionStyle", this);
137   fpCommand->SetGuidance("Add a style to be ap    135   fpCommand->SetGuidance("Add a style to be applied on a region.");
138   fpCommand->SetGuidance("default, ROOT_defaul    136   fpCommand->SetGuidance("default, ROOT_default, hippodraw are known embedded styles.");
139   fpCommand->SetGuidance("reset is a keyword u    137   fpCommand->SetGuidance("reset is a keyword used to reset a region style.");
140                                                   138 
141   G4UIparameter* parameter;                       139   G4UIparameter* parameter;
142   parameter = new G4UIparameter("plotter",'s',    140   parameter = new G4UIparameter("plotter",'s',false);
143   fpCommand->SetParameter (parameter);            141   fpCommand->SetParameter (parameter);
144                                                   142   
145   parameter = new G4UIparameter("region",'i',f    143   parameter = new G4UIparameter("region",'i',false);
146 //parameter->SetDefaultValue(0);                  144 //parameter->SetDefaultValue(0);
147   fpCommand->SetParameter (parameter);            145   fpCommand->SetParameter (parameter);
148                                                   146   
149   parameter = new G4UIparameter("style",'s',tr    147   parameter = new G4UIparameter("style",'s',true);
150   parameter->SetDefaultValue("default");          148   parameter->SetDefaultValue("default");
151   fpCommand->SetParameter (parameter);            149   fpCommand->SetParameter (parameter);
152 }                                                 150 }
153                                                   151 
154 G4VisCommandPlotterAddRegionStyle::~G4VisComma    152 G4VisCommandPlotterAddRegionStyle::~G4VisCommandPlotterAddRegionStyle () {delete fpCommand;}
155                                                   153 
156 void G4VisCommandPlotterAddRegionStyle::SetNew    154 void G4VisCommandPlotterAddRegionStyle::SetNewValue (G4UIcommand*, G4String newValue)
157 {                                                 155 {
158   G4VisManager::Verbosity verbosity = fpVisMan    156   G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
159                                                   157 
160   G4String plotter;                               158   G4String plotter;
161   int region;                                     159   int region;
162   G4String style;                                 160   G4String style;
163   std::istringstream is(newValue);                161   std::istringstream is(newValue);
164   is >> plotter >> region >> style;               162   is >> plotter >> region >> style;
165   if(region<0) {                                  163   if(region<0) {
166     if (verbosity >= G4VisManager::errors) {      164     if (verbosity >= G4VisManager::errors) {
167       G4warn << "ERROR: bad region index " <<  << 165       G4cerr << "ERROR: bad region index " << region << "." << G4endl;
168     }                                             166     }
169     return;                                       167     return;
170   }                                               168   }
171                                                   169   
172   G4Plotter& _plotter = G4PlotterManager::GetI    170   G4Plotter& _plotter = G4PlotterManager::GetInstance().GetPlotter(plotter);
173   _plotter.AddRegionStyle(region,style);          171   _plotter.AddRegionStyle(region,style);
174                                                   172   
175   G4Scene* pScene = fpVisManager->GetCurrentSc    173   G4Scene* pScene = fpVisManager->GetCurrentScene();
176   if(pScene) CheckSceneAndNotifyHandlers (pSce    174   if(pScene) CheckSceneAndNotifyHandlers (pScene);
177 }                                                 175 }
178                                                   176 
179 //////////////////////////////////////////////    177 /////////////////////////////////////////////////////////////////////////////
180 ////////////// /vis/plotter/addRegionParameter    178 ////////////// /vis/plotter/addRegionParameter //////////////////////////////
181 //////////////////////////////////////////////    179 /////////////////////////////////////////////////////////////////////////////
182 G4VisCommandPlotterAddRegionParameter::G4VisCo    180 G4VisCommandPlotterAddRegionParameter::G4VisCommandPlotterAddRegionParameter () {
183   fpCommand = new G4UIcommand("/vis/plotter/ad    181   fpCommand = new G4UIcommand("/vis/plotter/addRegionParameter", this);
184   fpCommand->SetGuidance("Add a parameter to b    182   fpCommand->SetGuidance("Add a parameter to be set on a region.");
185                                                   183 
186   G4UIparameter* parameter;                       184   G4UIparameter* parameter;
187   parameter = new G4UIparameter("plotter",'s',    185   parameter = new G4UIparameter("plotter",'s',false);
188   fpCommand->SetParameter (parameter);            186   fpCommand->SetParameter (parameter);
189                                                   187   
190   parameter = new G4UIparameter("region",'i',f    188   parameter = new G4UIparameter("region",'i',false);
191   fpCommand->SetParameter (parameter);            189   fpCommand->SetParameter (parameter);
192                                                   190   
193   parameter = new G4UIparameter("parameter",'s    191   parameter = new G4UIparameter("parameter",'s',false);
194   fpCommand->SetParameter (parameter);            192   fpCommand->SetParameter (parameter);
195                                                   193   
196   parameter = new G4UIparameter("value",'s',fa    194   parameter = new G4UIparameter("value",'s',false);
197   fpCommand->SetParameter (parameter);            195   fpCommand->SetParameter (parameter);
198 }                                                 196 }
199                                                   197 
200 G4VisCommandPlotterAddRegionParameter::~G4VisC    198 G4VisCommandPlotterAddRegionParameter::~G4VisCommandPlotterAddRegionParameter () {delete fpCommand;}
201                                                   199 
202 void G4VisCommandPlotterAddRegionParameter::Se    200 void G4VisCommandPlotterAddRegionParameter::SetNewValue (G4UIcommand* command, G4String newValue)
203 {                                                 201 {
204   G4VisManager::Verbosity verbosity = fpVisMan    202   G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
205                                                   203 
206   std::vector<std::string> args;                  204   std::vector<std::string> args;
207   tools::double_quotes_tokenize(newValue, args    205   tools::double_quotes_tokenize(newValue, args);
208   if ( args.size() != command->GetParameterEnt    206   if ( args.size() != command->GetParameterEntries() ) { // check consistency.
209     if (verbosity >= G4VisManager::errors) {      207     if (verbosity >= G4VisManager::errors) {
210       G4warn << "ERROR: tokenize value problem << 208       G4cerr << "ERROR: tokenize value problem." << G4endl;
211     }                                             209     }
212     return;                                       210     return;
213   }                                               211   }
214                                                   212 
215   std::string plotter = args[0];                  213   std::string plotter = args[0];
216   int region = G4UIcommand::ConvertToInt(args[    214   int region = G4UIcommand::ConvertToInt(args[1].c_str());
217   std::string parameter = args[2];                215   std::string parameter = args[2];
218   std::string value = args[3];                    216   std::string value = args[3];
219   if(region<0) {                                  217   if(region<0) {
220     if (verbosity >= G4VisManager::errors) {      218     if (verbosity >= G4VisManager::errors) {
221       G4warn << "ERROR: bad region index " <<  << 219       G4cerr << "ERROR: bad region index " << region << "." << G4endl;
222     }                                             220     }
223     return;                                       221     return;
224   }                                               222   }
225                                                   223   
226   G4Plotter& _plotter = G4PlotterManager::GetI    224   G4Plotter& _plotter = G4PlotterManager::GetInstance().GetPlotter(plotter);
227   _plotter.AddRegionParameter(region,parameter    225   _plotter.AddRegionParameter(region,parameter,value);
228                                                   226   
229   G4Scene* pScene = fpVisManager->GetCurrentSc    227   G4Scene* pScene = fpVisManager->GetCurrentScene();
230   if(pScene) CheckSceneAndNotifyHandlers (pSce    228   if(pScene) CheckSceneAndNotifyHandlers (pScene);
231 }                                                 229 }
232                                                   230 
233 //////////////////////////////////////////////    231 /////////////////////////////////////////////////////////////////////////////
234 ////////////// /vis/plotter/clear ////////////    232 ////////////// /vis/plotter/clear ///////////////////////////////////////////
235 //////////////////////////////////////////////    233 /////////////////////////////////////////////////////////////////////////////
236 G4VisCommandPlotterClear::G4VisCommandPlotterC    234 G4VisCommandPlotterClear::G4VisCommandPlotterClear () {
237   fpCommand = new G4UIcommand("/vis/plotter/cl    235   fpCommand = new G4UIcommand("/vis/plotter/clear", this);
238   fpCommand->SetGuidance("Remove plottables fr    236   fpCommand->SetGuidance("Remove plottables from all regions.");
239                                                   237 
240   G4UIparameter* parameter;                       238   G4UIparameter* parameter;
241   parameter = new G4UIparameter("plotter",'s',    239   parameter = new G4UIparameter("plotter",'s',false);
242   fpCommand->SetParameter (parameter);            240   fpCommand->SetParameter (parameter);
243 }                                                 241 }
244                                                   242 
245 G4VisCommandPlotterClear::~G4VisCommandPlotter    243 G4VisCommandPlotterClear::~G4VisCommandPlotterClear () {delete fpCommand;}
246                                                   244 
247 void G4VisCommandPlotterClear::SetNewValue (G4    245 void G4VisCommandPlotterClear::SetNewValue (G4UIcommand*, G4String newValue)
248 {                                                 246 {
249   G4Plotter& _plotter = G4PlotterManager::GetI    247   G4Plotter& _plotter = G4PlotterManager::GetInstance().GetPlotter(newValue);
250   _plotter.Clear();                               248   _plotter.Clear();
251                                                   249   
252   G4Scene* pScene = fpVisManager->GetCurrentSc    250   G4Scene* pScene = fpVisManager->GetCurrentScene();
253   if(pScene) CheckSceneAndNotifyHandlers (pSce    251   if(pScene) CheckSceneAndNotifyHandlers (pScene);
254 }                                                 252 }
255                                                   253 
256 //////////////////////////////////////////////    254 /////////////////////////////////////////////////////////////////////////////
257 ////////////// /vis/plotter/clearRegion //////    255 ////////////// /vis/plotter/clearRegion /////////////////////////////////////
258 //////////////////////////////////////////////    256 /////////////////////////////////////////////////////////////////////////////
259 G4VisCommandPlotterClearRegion::G4VisCommandPl    257 G4VisCommandPlotterClearRegion::G4VisCommandPlotterClearRegion () {
260   fpCommand = new G4UIcommand("/vis/plotter/cl    258   fpCommand = new G4UIcommand("/vis/plotter/clearRegion", this);
261   fpCommand->SetGuidance("Remove plottables a     259   fpCommand->SetGuidance("Remove plottables a region.");
262                                                   260 
263   G4UIparameter* parameter;                       261   G4UIparameter* parameter;
264   parameter = new G4UIparameter("plotter",'s',    262   parameter = new G4UIparameter("plotter",'s',false);
265   fpCommand->SetParameter (parameter);            263   fpCommand->SetParameter (parameter);
266                                                   264   
267   parameter = new G4UIparameter("region",'i',f    265   parameter = new G4UIparameter("region",'i',false);
268 //parameter->SetDefaultValue(0);                  266 //parameter->SetDefaultValue(0);
269   fpCommand->SetParameter (parameter);            267   fpCommand->SetParameter (parameter);
270 }                                                 268 }
271                                                   269 
272 G4VisCommandPlotterClearRegion::~G4VisCommandP    270 G4VisCommandPlotterClearRegion::~G4VisCommandPlotterClearRegion () {delete fpCommand;}
273                                                   271 
274 void G4VisCommandPlotterClearRegion::SetNewVal    272 void G4VisCommandPlotterClearRegion::SetNewValue (G4UIcommand*, G4String newValue)
275 {                                                 273 {
276   G4VisManager::Verbosity verbosity = fpVisMan    274   G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
277                                                   275 
278   G4String plotter;                               276   G4String plotter;
279   int region;                                     277   int region;
280   std::istringstream is(newValue);                278   std::istringstream is(newValue);
281   is >> plotter >> region;                        279   is >> plotter >> region;
282   if(region<0) {                                  280   if(region<0) {
283     if (verbosity >= G4VisManager::errors) {      281     if (verbosity >= G4VisManager::errors) {
284       G4warn << "ERROR: bad region index " <<  << 282       G4cerr << "ERROR: bad region index " << region << "." << G4endl;
285     }                                             283     }
286     return;                                       284     return;
287   }                                               285   }
288                                                   286   
289   G4Plotter& _plotter = G4PlotterManager::GetI    287   G4Plotter& _plotter = G4PlotterManager::GetInstance().GetPlotter(plotter);
290   _plotter.ClearRegion(region);                   288   _plotter.ClearRegion(region);
291                                                   289   
292   G4Scene* pScene = fpVisManager->GetCurrentSc    290   G4Scene* pScene = fpVisManager->GetCurrentScene();
293   if(pScene) CheckSceneAndNotifyHandlers (pSce    291   if(pScene) CheckSceneAndNotifyHandlers (pScene);
294 }                                                 292 }
295                                                   293 
296 //////////////////////////////////////////////    294 /////////////////////////////////////////////////////////////////////////////
297 ////////////// /vis/plotter/list /////////////    295 ////////////// /vis/plotter/list ////////////////////////////////////////////
298 //////////////////////////////////////////////    296 /////////////////////////////////////////////////////////////////////////////
299 G4VisCommandPlotterList::G4VisCommandPlotterLi    297 G4VisCommandPlotterList::G4VisCommandPlotterList () {
300   fpCommand = new G4UIcommand("/vis/plotter/li    298   fpCommand = new G4UIcommand("/vis/plotter/list", this);
301   fpCommand->SetGuidance("List plotters in the    299   fpCommand->SetGuidance("List plotters in the scene.");
302 }                                                 300 }
303                                                   301 
304 G4VisCommandPlotterList::~G4VisCommandPlotterL    302 G4VisCommandPlotterList::~G4VisCommandPlotterList () {delete fpCommand;}
305                                                   303 
306 void G4VisCommandPlotterList::SetNewValue (G4U    304 void G4VisCommandPlotterList::SetNewValue (G4UIcommand*, G4String)
307 {                                                 305 {
308   G4PlotterManager::GetInstance().List();         306   G4PlotterManager::GetInstance().List();
309 }                                                 307 }
310                                                   308 
311 //////////////////////////////////////////////    309 /////////////////////////////////////////////////////////////////////////////
312 ////////////// /vis/plotter/add/h1 ///////////    310 ////////////// /vis/plotter/add/h1 //////////////////////////////////////////
313 //////////////////////////////////////////////    311 /////////////////////////////////////////////////////////////////////////////
314 G4VisCommandPlotterAddRegionH1::G4VisCommandPl    312 G4VisCommandPlotterAddRegionH1::G4VisCommandPlotterAddRegionH1 () {
315   fpCommand = new G4UIcommand("/vis/plotter/ad    313   fpCommand = new G4UIcommand("/vis/plotter/add/h1", this);
316   fpCommand->SetGuidance("Attach a 1D histogra    314   fpCommand->SetGuidance("Attach a 1D histogram to a plotter region.");
317                                                   315 
318   G4UIparameter* parameter;                       316   G4UIparameter* parameter;
319   parameter = new G4UIparameter("histo",'i',fa    317   parameter = new G4UIparameter("histo",'i',false);
320   fpCommand->SetParameter (parameter);            318   fpCommand->SetParameter (parameter);
321                                                   319   
322   parameter = new G4UIparameter("plotter",'s',    320   parameter = new G4UIparameter("plotter",'s',false);
323   fpCommand->SetParameter (parameter);            321   fpCommand->SetParameter (parameter);
324                                                   322   
325   parameter = new G4UIparameter("region",'i',t    323   parameter = new G4UIparameter("region",'i',true);
326   parameter->SetDefaultValue(0);                  324   parameter->SetDefaultValue(0);
327   fpCommand->SetParameter (parameter);            325   fpCommand->SetParameter (parameter);
328 }                                                 326 }
329                                                   327 
330 G4VisCommandPlotterAddRegionH1::~G4VisCommandP    328 G4VisCommandPlotterAddRegionH1::~G4VisCommandPlotterAddRegionH1 () {delete fpCommand;}
331                                                   329 
332 void G4VisCommandPlotterAddRegionH1::SetNewVal    330 void G4VisCommandPlotterAddRegionH1::SetNewValue (G4UIcommand*, G4String newValue)
333 {                                                 331 {
334   G4VisManager::Verbosity verbosity = fpVisMan    332   G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
335                                                   333 
336   int hid;                                        334   int hid;
337   G4String plotter;                               335   G4String plotter;
338   int region;                                     336   int region;
339   std::istringstream is(newValue);                337   std::istringstream is(newValue);
340   is >> hid >> plotter >> region;                 338   is >> hid >> plotter >> region;
341                                                   339   
342   if(region<0) {                                  340   if(region<0) {
343     if (verbosity >= G4VisManager::errors) {      341     if (verbosity >= G4VisManager::errors) {
344       G4warn << "ERROR: bad region index " <<  << 342       G4cerr << "ERROR: bad region index " << region << "." << G4endl;
345     }                                             343     }
346     return;                                       344     return;
347   }                                               345   }
348                                                   346   
349   G4Plotter& _plotter = G4PlotterManager::GetI    347   G4Plotter& _plotter = G4PlotterManager::GetInstance().GetPlotter(plotter);
350   _plotter.AddRegionH1(region,hid);               348   _plotter.AddRegionH1(region,hid);
351                                                   349   
352   G4Scene* pScene = fpVisManager->GetCurrentSc    350   G4Scene* pScene = fpVisManager->GetCurrentScene();
353   if(pScene) CheckSceneAndNotifyHandlers (pSce    351   if(pScene) CheckSceneAndNotifyHandlers (pScene);
354 }                                                 352 }
355                                                   353 
356 //////////////////////////////////////////////    354 /////////////////////////////////////////////////////////////////////////////
357 ////////////// /vis/plotter/add/h2 ///////////    355 ////////////// /vis/plotter/add/h2 //////////////////////////////////////////
358 //////////////////////////////////////////////    356 /////////////////////////////////////////////////////////////////////////////
359 G4VisCommandPlotterAddRegionH2::G4VisCommandPl    357 G4VisCommandPlotterAddRegionH2::G4VisCommandPlotterAddRegionH2 () {
360   fpCommand = new G4UIcommand("/vis/plotter/ad    358   fpCommand = new G4UIcommand("/vis/plotter/add/h2", this);
361   fpCommand->SetGuidance("Attach a 2D histogra    359   fpCommand->SetGuidance("Attach a 2D histogram to a plotter region.");
362                                                   360 
363   G4UIparameter* parameter;                       361   G4UIparameter* parameter;
364   parameter = new G4UIparameter("histo",'i',fa    362   parameter = new G4UIparameter("histo",'i',false);
365   fpCommand->SetParameter (parameter);            363   fpCommand->SetParameter (parameter);
366                                                   364   
367   parameter = new G4UIparameter("plotter",'s',    365   parameter = new G4UIparameter("plotter",'s',false);
368   fpCommand->SetParameter (parameter);            366   fpCommand->SetParameter (parameter);
369                                                   367   
370   parameter = new G4UIparameter("region",'i',t    368   parameter = new G4UIparameter("region",'i',true);
371   parameter->SetDefaultValue(0);                  369   parameter->SetDefaultValue(0);
372   fpCommand->SetParameter (parameter);            370   fpCommand->SetParameter (parameter);
373 }                                                 371 }
374                                                   372 
375 G4VisCommandPlotterAddRegionH2::~G4VisCommandP    373 G4VisCommandPlotterAddRegionH2::~G4VisCommandPlotterAddRegionH2 () {delete fpCommand;}
376                                                   374 
377 void G4VisCommandPlotterAddRegionH2::SetNewVal    375 void G4VisCommandPlotterAddRegionH2::SetNewValue (G4UIcommand*, G4String newValue)
378 {                                                 376 {
379   G4VisManager::Verbosity verbosity = fpVisMan    377   G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
380                                                   378 
381   int hid;                                        379   int hid;
382   G4String plotter;                               380   G4String plotter;
383   int region;                                     381   int region;
384   std::istringstream is(newValue);                382   std::istringstream is(newValue);
385   is >> hid >> plotter >> region;                 383   is >> hid >> plotter >> region;
386                                                   384   
387   if(region<0) {                                  385   if(region<0) {
388     if (verbosity >= G4VisManager::errors) {      386     if (verbosity >= G4VisManager::errors) {
389       G4warn << "ERROR: bad region index " <<  << 387       G4cerr << "ERROR: bad region index " << region << "." << G4endl;
390     }                                             388     }
391     return;                                       389     return;
392   }                                               390   }
393                                                   391   
394   G4Plotter& _plotter = G4PlotterManager::GetI    392   G4Plotter& _plotter = G4PlotterManager::GetInstance().GetPlotter(plotter);
395   _plotter.AddRegionH2(region,hid);               393   _plotter.AddRegionH2(region,hid);
396                                                   394   
397   G4Scene* pScene = fpVisManager->GetCurrentSc    395   G4Scene* pScene = fpVisManager->GetCurrentScene();
398   if(pScene) CheckSceneAndNotifyHandlers (pSce    396   if(pScene) CheckSceneAndNotifyHandlers (pScene);
399 }                                                 397 }
400                                                   398 
401                                                   399