Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4VisCommandsViewer.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4VisCommandsViewer.cc 102575 2017-02-09 09:07:12Z gcosmo $
28 
29 // /vis/viewer commands - John Allison 25th October 1998
30 
31 #include "G4VisCommandsViewer.hh"
32 
33 #include "G4VisManager.hh"
34 #include "G4GraphicsSystemList.hh"
35 #include "G4VisCommandsScene.hh"
36 #include "G4UImanager.hh"
37 #include "G4UIcommand.hh"
39 #include "G4UIcmdWithAString.hh"
40 #include "G4UIcmdWithADouble.hh"
42 #include "G4UIcmdWith3Vector.hh"
43 #include "G4Point3D.hh"
44 #include "G4SystemOfUnits.hh"
45 #include "G4UnitsTable.hh"
46 #include "G4ios.hh"
47 #ifdef G4VIS_USE_STD11
48 #include <chrono>
49 #include <thread>
50 #endif
51 #include <sstream>
52 #include <fstream>
53 #include <sstream>
54 #include <iomanip>
55 #ifdef WIN32
56 #include <regex>
57 #include <filesystem>
58 #endif //WIN32
59 
61 
63 
65 (G4VViewer* viewer, const G4ViewParameters& viewParams) {
66  viewer->SetViewParameters(viewParams);
67  RefreshIfRequired(viewer);
68 }
69 
72  G4VSceneHandler* sceneHandler = viewer->GetSceneHandler();
73  const G4ViewParameters& viewParams = viewer->GetViewParameters();
74  if (sceneHandler && sceneHandler->GetScene()) {
75  if (viewParams.IsAutoRefresh()) {
76  G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
77  }
78  else {
79  if (verbosity >= G4VisManager::warnings) {
80  G4cout << "Issue /vis/viewer/refresh or flush to see effect."
81  << G4endl;
82  }
83  }
84  }
85 }
86 
88 
90  G4bool omitable;
91  fpCommand = new G4UIcommand ("/vis/viewer/addCutawayPlane", this);
92  fpCommand -> SetGuidance
93  ("Add cutaway plane to current viewer.");
94  G4UIparameter* parameter;
95  parameter = new G4UIparameter("x",'d',omitable = true);
96  parameter -> SetDefaultValue (0);
97  parameter -> SetGuidance ("Coordinate of point on the plane.");
98  fpCommand->SetParameter(parameter);
99  parameter = new G4UIparameter("y",'d',omitable = true);
100  parameter -> SetDefaultValue (0);
101  parameter -> SetGuidance ("Coordinate of point on the plane.");
102  fpCommand->SetParameter(parameter);
103  parameter = new G4UIparameter("z",'d',omitable = true);
104  parameter -> SetDefaultValue (0);
105  parameter -> SetGuidance ("Coordinate of point on the plane.");
106  fpCommand->SetParameter(parameter);
107  parameter = new G4UIparameter("unit",'s',omitable = true);
108  parameter -> SetDefaultValue ("m");
109  parameter -> SetGuidance ("Unit of point on the plane.");
110  fpCommand->SetParameter(parameter);
111  parameter = new G4UIparameter("nx",'d',omitable = true);
112  parameter -> SetDefaultValue (1);
113  parameter -> SetGuidance ("Component of plane normal.");
114  fpCommand->SetParameter(parameter);
115  parameter = new G4UIparameter("ny",'d',omitable = true);
116  parameter -> SetDefaultValue (0);
117  parameter -> SetGuidance ("Component of plane normal.");
118  fpCommand->SetParameter(parameter);
119  parameter = new G4UIparameter("nz",'d',omitable = true);
120  parameter -> SetDefaultValue (0);
121  parameter -> SetGuidance ("Component of plane normal.");
122  fpCommand->SetParameter(parameter);
123 }
124 
126  delete fpCommand;
127 }
128 
130  return "";
131 }
132 
134 
136 
137  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
138  if (!viewer) {
139  if (verbosity >= G4VisManager::errors) {
140  G4cerr <<
141  "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
142  << G4endl;
143  }
144  return;
145  }
146 
147  G4double x, y, z, nx, ny, nz;
148  G4String unit;
149  std::istringstream is (newValue);
150  is >> x >> y >> z >> unit >> nx >> ny >> nz;
151  G4double F = G4UIcommand::ValueOf(unit);
152  x *= F; y *= F; z *= F;
153 
154  G4ViewParameters vp = viewer->GetViewParameters();
155  vp.AddCutawayPlane(G4Plane3D(G4Normal3D(nx,ny,nz), G4Point3D(x,y,z)));
156  if (verbosity >= G4VisManager::confirmations) {
157  G4cout << "Cutaway planes for viewer \"" << viewer->GetName() << "\" now:";
158  const G4Planes& cutaways = vp.GetCutawayPlanes();
159  for (size_t i = 0; i < cutaways.size(); ++i)
160  G4cout << "\n " << i << ": " << cutaways[i];
161  G4cout << G4endl;
162  }
163 
164  SetViewParameters(viewer, vp);
165 }
166 
168 
170  G4bool omitable;
171  fpCommand = new G4UIcommand ("/vis/viewer/changeCutawayPlane", this);
172  fpCommand -> SetGuidance("Change cutaway plane.");
173  G4UIparameter* parameter;
174  parameter = new G4UIparameter("index",'i',omitable = false);
175  parameter -> SetGuidance ("Index of plane: 0, 1, 2.");
176  fpCommand->SetParameter(parameter);
177  parameter = new G4UIparameter("x",'d',omitable = true);
178  parameter -> SetDefaultValue (0);
179  parameter -> SetGuidance ("Coordinate of point on the plane.");
180  fpCommand->SetParameter(parameter);
181  parameter = new G4UIparameter("y",'d',omitable = true);
182  parameter -> SetDefaultValue (0);
183  parameter -> SetGuidance ("Coordinate of point on the plane.");
184  fpCommand->SetParameter(parameter);
185  parameter = new G4UIparameter("z",'d',omitable = true);
186  parameter -> SetDefaultValue (0);
187  parameter -> SetGuidance ("Coordinate of point on the plane.");
188  fpCommand->SetParameter(parameter);
189  parameter = new G4UIparameter("unit",'s',omitable = true);
190  parameter -> SetDefaultValue ("m");
191  parameter -> SetGuidance ("Unit of point on the plane.");
192  fpCommand->SetParameter(parameter);
193  parameter = new G4UIparameter("nx",'d',omitable = true);
194  parameter -> SetDefaultValue (1);
195  parameter -> SetGuidance ("Component of plane normal.");
196  fpCommand->SetParameter(parameter);
197  parameter = new G4UIparameter("ny",'d',omitable = true);
198  parameter -> SetDefaultValue (0);
199  parameter -> SetGuidance ("Component of plane normal.");
200  fpCommand->SetParameter(parameter);
201  parameter = new G4UIparameter("nz",'d',omitable = true);
202  parameter -> SetDefaultValue (0);
203  parameter -> SetGuidance ("Component of plane normal.");
204  fpCommand->SetParameter(parameter);
205 }
206 
208  delete fpCommand;
209 }
210 
212  return "";
213 }
214 
216 
218 
219  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
220  if (!viewer) {
221  if (verbosity >= G4VisManager::errors) {
222  G4cerr <<
223  "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
224  << G4endl;
225  }
226  return;
227  }
228 
229  size_t index;
230  G4double x, y, z, nx, ny, nz;
231  G4String unit;
232  std::istringstream is (newValue);
233  is >> index >> x >> y >> z >> unit >> nx >> ny >> nz;
234  G4double F = G4UIcommand::ValueOf(unit);
235  x *= F; y *= F; z *= F;
236 
237  G4ViewParameters vp = viewer->GetViewParameters();
238  vp.ChangeCutawayPlane(index,
239  G4Plane3D(G4Normal3D(nx,ny,nz), G4Point3D(x,y,z)));
240  if (verbosity >= G4VisManager::confirmations) {
241  G4cout << "Cutaway planes for viewer \"" << viewer->GetName() << "\" now:";
242  const G4Planes& cutaways = vp.GetCutawayPlanes();
243  for (size_t i = 0; i < cutaways.size(); ++i)
244  G4cout << "\n " << i << ": " << cutaways[i];
245  G4cout << G4endl;
246  }
247 
248  SetViewParameters(viewer, vp);
249 }
250 
252 
254  G4bool omitable, currentAsDefault;
255  fpCommand = new G4UIcmdWithAString ("/vis/viewer/clear", this);
256  fpCommand -> SetGuidance ("Clears viewer.");
257  fpCommand -> SetGuidance
258  ("By default, clears current viewer. Specified viewer becomes current."
259  "\n\"/vis/viewer/list\" to see possible viewer names.");
260  fpCommand -> SetParameterName ("viewer-name",
261  omitable = true,
262  currentAsDefault = true);
263 }
264 
266  delete fpCommand;
267 }
268 
270  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
271  return viewer ? viewer -> GetName () : G4String("none");
272 }
273 
275 
277 
278  G4String& clearName = newValue;
279  G4VViewer* viewer = fpVisManager -> GetViewer (clearName);
280  if (!viewer) {
281  if (verbosity >= G4VisManager::errors) {
282  G4cerr << "ERROR: Viewer \"" << clearName
283  << "\" not found - \"/vis/viewer/list\" to see possibilities."
284  << G4endl;
285  }
286  return;
287  }
288 
289  viewer->SetView();
290  viewer->ClearView();
291  viewer->FinishView();
292  if (verbosity >= G4VisManager::confirmations) {
293  G4cout << "Viewer \"" << clearName << "\" cleared." << G4endl;
294  }
295 
296 }
297 
299 
301  fpCommand = new G4UIcmdWithoutParameter
302  ("/vis/viewer/clearCutawayPlanes", this);
303  fpCommand -> SetGuidance ("Clear cutaway planes of current viewer.");
304 }
305 
307  delete fpCommand;
308 }
309 
311  return "";
312 }
313 
315 
317 
318  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
319  if (!viewer) {
320  if (verbosity >= G4VisManager::errors) {
321  G4cerr <<
322  "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
323  << G4endl;
324  }
325  return;
326  }
327 
328  G4ViewParameters vp = viewer->GetViewParameters();
329  vp.ClearCutawayPlanes();
330  if (verbosity >= G4VisManager::confirmations) {
331  G4cout << "Cutaway planes for viewer \"" << viewer->GetName()
332  << "\" now cleared." << G4endl;
333  }
334 
335  SetViewParameters(viewer, vp);
336 }
337 
339 
341  G4bool omitable, currentAsDefault;
342  fpCommand = new G4UIcmdWithAString ("/vis/viewer/clearTransients", this);
343  fpCommand -> SetGuidance ("Clears transients from viewer.");
344  fpCommand -> SetGuidance
345  ("By default, operates on current viewer. Specified viewer becomes current."
346  "\n\"/vis/viewer/list\" to see possible viewer names.");
347  fpCommand -> SetParameterName ("viewer-name",
348  omitable = true,
349  currentAsDefault = true);
350 }
351 
353  delete fpCommand;
354 }
355 
357  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
358  return viewer ? viewer -> GetName () : G4String("none");
359 }
360 
362 
364 
365  G4String& clearName = newValue;
366  G4VViewer* viewer = fpVisManager -> GetViewer (clearName);
367  if (!viewer) {
368  if (verbosity >= G4VisManager::errors) {
369  G4cerr << "ERROR: Viewer \"" << clearName
370  << "\" not found - \"/vis/viewer/list\" to see possibilities."
371  << G4endl;
372  }
373  return;
374  }
375 
376  G4VSceneHandler* sceneHandler = viewer->GetSceneHandler();
377  sceneHandler->SetMarkForClearingTransientStore(false);
379  sceneHandler->ClearTransientStore();
380  if (verbosity >= G4VisManager::confirmations) {
381  G4cout << "Viewer \"" << clearName << "\" cleared of transients."
382  << G4endl;
383  }
384 
385 }
386 
388 
390  fpCommand = new G4UIcmdWithoutParameter
391  ("/vis/viewer/clearVisAttributesModifiers", this);
392  fpCommand -> SetGuidance ("Clear vis attribute modifiers of current viewer.");
393  fpCommand -> SetGuidance ("(These are used for touchables, etc.)");
394 }
395 
397  delete fpCommand;
398 }
399 
401  return "";
402 }
403 
405 
407 
408  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
409  if (!viewer) {
410  if (verbosity >= G4VisManager::errors) {
411  G4cerr <<
412  "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
413  << G4endl;
414  }
415  return;
416  }
417 
418  G4ViewParameters vp = viewer->GetViewParameters();
420  if (verbosity >= G4VisManager::confirmations) {
421  G4cout << "Vis attributes modifiers for viewer \"" << viewer->GetName()
422  << "\" now cleared." << G4endl;
423  }
424 
425  SetViewParameters(viewer, vp);
426 }
427 
429 
431  G4bool omitable;
432  fpCommand = new G4UIcommand ("/vis/viewer/clone", this);
433  fpCommand -> SetGuidance ("Clones viewer.");
434  fpCommand -> SetGuidance
435  ("By default, clones current viewer. Clone becomes current."
436  "\nClone name, if not provided, is derived from the original name."
437  "\n\"/vis/viewer/list\" to see possible viewer names.");
438  G4UIparameter* parameter;
439  parameter = new G4UIparameter ("original-viewer-name", 's', omitable = true);
440  parameter -> SetCurrentAsDefault (true);
441  fpCommand -> SetParameter (parameter);
442  parameter = new G4UIparameter ("clone-name", 's', omitable = true);
443  parameter -> SetDefaultValue ("none");
444  fpCommand -> SetParameter (parameter);
445 }
446 
448  delete fpCommand;
449 }
450 
452  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
453  G4String originalName = viewer ? viewer -> GetName () : G4String("none");
454  return "\"" + originalName + "\"";
455 }
456 
458 
460 
461  G4String originalName, cloneName;
462  std::istringstream is (newValue);
463 
464  // Need to handle the possibility that the names contain embedded
465  // blanks within quotation marks...
466  char c = ' ';
467  while (is.get(c) && c == ' '){}
468  if (c == '"') {
469  while (is.get(c) && c != '"') {originalName += c;}
470  }
471  else {
472  originalName += c;
473  while (is.get(c) && c != ' ') {originalName += c;}
474  }
475  originalName = originalName.strip (G4String::both, ' ');
476  originalName = originalName.strip (G4String::both, '"');
477 
478  G4VViewer* originalViewer = fpVisManager -> GetViewer (originalName);
479  if (!originalViewer) {
480  if (verbosity >= G4VisManager::errors) {
481  G4cerr << "ERROR: Viewer \"" << originalName
482  << "\" not found - \"/vis/viewer/list\" to see possibilities."
483  << G4endl;
484  }
485  return;
486  }
487  originalName = originalViewer->GetName(); // Ensures long name.
488 
489  while (is.get(c) && c == ' '){}
490  if (c == '"') {
491  while (is.get(c) && c != '"') {cloneName += c;}
492  }
493  else {
494  cloneName += c;
495  while (is.get(c) && c != ' ') {cloneName += c;}
496  }
497  cloneName = cloneName.strip (G4String::both, ' ');
498  cloneName = cloneName.strip (G4String::both, '"');
499 
500  G4bool errorWhileNaming = false;
501  if (cloneName == "none") {
502  G4int subID = 0;
503  do {
504  cloneName = originalName;
505  std::ostringstream oss;
506  oss << '-' << subID++;
507  G4String::size_type lastDashPosition, nextSpacePosition;
508  if ((lastDashPosition = cloneName.rfind('-')) != G4String::npos &&
509  (nextSpacePosition = cloneName.find(" ", lastDashPosition)) !=
510  G4String::npos) {
511  cloneName.insert(nextSpacePosition, oss.str());
512  } else {
513  G4String::size_type spacePosition = cloneName.find(' ');
514  if (spacePosition != G4String::npos)
515  cloneName.insert(spacePosition, oss.str());
516  else
517  errorWhileNaming = true;
518  }
519  } while (!errorWhileNaming && fpVisManager -> GetViewer (cloneName));
520  }
521 
522  if (errorWhileNaming) {
523  if (verbosity >= G4VisManager::errors) {
524  G4cerr << "ERROR: While naming clone viewer \"" << cloneName
525  << "\"."
526  << G4endl;
527  }
528  return;
529  }
530 
531  if (fpVisManager -> GetViewer (cloneName)) {
532  if (verbosity >= G4VisManager::errors) {
533  G4cerr << "ERROR: Putative clone viewer \"" << cloneName
534  << "\" already exists."
535  << G4endl;
536  }
537  return;
538  }
539 
540  G4String windowSizeHint =
541  originalViewer->GetViewParameters().GetXGeometryString();
542 
543  G4UImanager* UImanager = G4UImanager::GetUIpointer();
544  G4int keepVerbose = UImanager->GetVerboseLevel();
545  G4int newVerbose(0);
546  if (keepVerbose >= 2 ||
548  newVerbose = 2;
549  UImanager->SetVerboseLevel(newVerbose);
550  UImanager->ApplyCommand(G4String("/vis/viewer/select " + originalName));
551  UImanager->ApplyCommand
552  (G4String("/vis/viewer/create ! \"" + cloneName + "\" " + windowSizeHint));
553  UImanager->ApplyCommand(G4String("/vis/viewer/set/all " + originalName));
554  UImanager->SetVerboseLevel(keepVerbose);
555 
556  if (verbosity >= G4VisManager::confirmations) {
557  G4cout << "Viewer \"" << originalName << "\" cloned." << G4endl;
558  G4cout << "Clone \"" << cloneName << "\" now current." << G4endl;
559  }
560 }
561 
563 
565  G4bool omitable;
566  fpCommand = new G4UIcmdWithAString ("/vis/viewer/copyViewFrom", this);
567  fpCommand -> SetGuidance
568  ("Copy the camera-specific parameters from the specified viewer.");
569  fpCommand -> SetGuidance
570  ("Note: To copy scene modifications - style, etc. - please use"
571  "\n\"/vis/viewer/set/all\"");
572  fpCommand -> SetParameterName ("from-viewer-name", omitable = false);
573 }
574 
576  delete fpCommand;
577 }
578 
580  return "";
581 }
582 
584 
586 
587  G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
588  if (!currentViewer) {
589  if (verbosity >= G4VisManager::errors) {
590  G4cerr <<
591  "ERROR: G4VisCommandsViewerCopyViewFrom::SetNewValue: no current viewer."
592  << G4endl;
593  }
594  return;
595  }
596 
597  const G4String& fromViewerName = newValue;
598  G4VViewer* fromViewer = fpVisManager -> GetViewer (fromViewerName);
599  if (!fromViewer) {
600  if (verbosity >= G4VisManager::errors) {
601  G4cerr << "ERROR: Viewer \"" << fromViewerName
602  << "\" not found - \"/vis/viewer/list\" to see possibilities."
603  << G4endl;
604  }
605  return;
606  }
607 
608  if (fromViewer == currentViewer) {
609  if (verbosity >= G4VisManager::warnings) {
610  G4cout <<
611  "WARNING: G4VisCommandsViewerSet::SetNewValue:"
612  "\n from-viewer and current viewer are identical."
613  << G4endl;
614  }
615  return;
616  }
617 
618  // Copy camera-specific view parameters
619  G4ViewParameters vp = currentViewer->GetViewParameters();
620  const G4ViewParameters& fromVP = fromViewer->GetViewParameters();
624  vp.SetUpVector (fromVP.GetUpVector());
625  vp.SetFieldHalfAngle (fromVP.GetFieldHalfAngle());
626  vp.SetZoomFactor (fromVP.GetZoomFactor());
627  vp.SetScaleFactor (fromVP.GetScaleFactor());
629  vp.SetDolly (fromVP.GetDolly());
630  SetViewParameters(currentViewer, vp);
631 
632  if (verbosity >= G4VisManager::confirmations) {
633  G4cout << "Camera parameters of viewer \"" << currentViewer->GetName()
634  << "\"\n set to those of viewer \"" << fromViewer->GetName()
635  << "\"."
636  << G4endl;
637  }
638 }
639 
641 
643  G4bool omitable;
644  fpCommand = new G4UIcommand ("/vis/viewer/create", this);
645  fpCommand -> SetGuidance
646  ("Creates a viewer for the specified scene handler.");
647  fpCommand -> SetGuidance
648  ("Default scene handler is the current scene handler. Invents a name"
649  "\nif not supplied. (Note: the system adds information to the name"
650  "\nfor identification - only the characters up to the first blank are"
651  "\nused for removing, selecting, etc.) This scene handler and viewer"
652  "\nbecome current.");
653  G4UIparameter* parameter;
654  parameter = new G4UIparameter ("scene-handler", 's', omitable = true);
655  parameter -> SetCurrentAsDefault (true);
656  fpCommand -> SetParameter (parameter);
657  parameter = new G4UIparameter ("viewer-name", 's', omitable = true);
658  parameter -> SetCurrentAsDefault (true);
659  fpCommand -> SetParameter (parameter);
660  parameter = new G4UIparameter ("window-size-hint", 's', omitable = true);
661  parameter->SetGuidance
662  ("integer (pixels) for square window placed by window manager or"
663  " X-Windows-type geometry string, e.g. 600x600-100+100");
664  parameter->SetDefaultValue("600");
665  fpCommand -> SetParameter (parameter);
666 }
667 
669  delete fpCommand;
670 }
671 
672 G4String G4VisCommandViewerCreate::NextName () {
673  std::ostringstream oss;
674  G4VSceneHandler* sceneHandler = fpVisManager -> GetCurrentSceneHandler ();
675  oss << "viewer-" << fId << " (";
676  if (sceneHandler) {
677  oss << sceneHandler -> GetGraphicsSystem () -> GetName ();
678  }
679  else {
680  oss << "no_scene_handlers";
681  }
682  oss << ")";
683  return oss.str();
684 }
685 
687  G4String currentValue;
688  G4VSceneHandler* currentSceneHandler =
689  fpVisManager -> GetCurrentSceneHandler ();
690  if (currentSceneHandler) {
691  currentValue = currentSceneHandler -> GetName ();
692  }
693  else {
694  currentValue = "none";
695  }
696  currentValue += ' ';
697  currentValue += '"';
698  currentValue += NextName ();
699  currentValue += '"';
700 
701  currentValue += " 600"; // Default number of pixels for window size hint.
702 
703  return currentValue;
704 }
705 
707 
709 
710  G4String sceneHandlerName, newName;
711  G4String windowSizeHintString;
712  std::istringstream is (newValue);
713  is >> sceneHandlerName;
714 
715  // Now need to handle the possibility that the second string
716  // contains embedded blanks within quotation marks...
717  char c = ' ';
718  while (is.get(c) && c == ' '){}
719  if (c == '"') {
720  while (is.get(c) && c != '"') {newName += c;}
721  }
722  else {
723  newName += c;
724  while (is.get(c) && c != ' ') {newName += c;}
725  }
726  newName = newName.strip (G4String::both, ' ');
727  newName = newName.strip (G4String::both, '"');
728 
729  // Now get window size hint...
730  is >> windowSizeHintString;
731 
732  const G4SceneHandlerList& sceneHandlerList =
733  fpVisManager -> GetAvailableSceneHandlers ();
734  G4int nHandlers = sceneHandlerList.size ();
735  if (nHandlers <= 0) {
736  if (verbosity >= G4VisManager::errors) {
737  G4cerr <<
738  "ERROR: G4VisCommandViewerCreate::SetNewValue: no scene handlers."
739  "\n Create a scene handler with \"/vis/sceneHandler/create\""
740  << G4endl;
741  }
742  return;
743  }
744 
745  G4int iHandler;
746  for (iHandler = 0; iHandler < nHandlers; iHandler++) {
747  if (sceneHandlerList [iHandler] -> GetName () == sceneHandlerName) break;
748  }
749 
750  if (iHandler < 0 || iHandler >= nHandlers) {
751  // Invalid command line argument or none.
752  // This shouldn't happen!!!!!!
753  if (verbosity >= G4VisManager::errors) {
754  G4cout << "G4VisCommandViewerCreate::SetNewValue:"
755  " invalid scene handler specified."
756  << G4endl;
757  }
758  return;
759  }
760 
761  // Valid index. Set current scene handler and graphics system in
762  // preparation for creating viewer.
763  G4VSceneHandler* sceneHandler = sceneHandlerList [iHandler];
764  if (sceneHandler != fpVisManager -> GetCurrentSceneHandler ()) {
765  fpVisManager -> SetCurrentSceneHandler (sceneHandler);
766  }
767 
768  // Now deal with name of viewer.
769  G4String nextName = NextName ();
770  if (newName == "") {
771  newName = nextName;
772  }
773  if (newName == nextName) fId++;
774  G4String newShortName = fpVisManager -> ViewerShortName (newName);
775 
776  for (G4int ih = 0; ih < nHandlers; ih++) {
777  G4VSceneHandler* sh = sceneHandlerList [ih];
778  const G4ViewerList& viewerList = sh -> GetViewerList ();
779  for (size_t iViewer = 0; iViewer < viewerList.size (); iViewer++) {
780  if (viewerList [iViewer] -> GetShortName () == newShortName ) {
781  if (verbosity >= G4VisManager::errors) {
782  G4cerr << "ERROR: Viewer \"" << newShortName << "\" already exists."
783  << G4endl;
784  }
785  return;
786  }
787  }
788  }
789 
790  // WindowSizeHint and XGeometryString are picked up from the vis
791  // manager in the G4VViewer constructor. In G4VisManager, after Viewer
792  // creation, we will store theses parameters in G4ViewParameters.
793 
794  fpVisManager -> CreateViewer (newName,windowSizeHintString);
795 
796  G4VViewer* newViewer = fpVisManager -> GetCurrentViewer ();
797  if (newViewer && newViewer -> GetName () == newName) {
798  if (verbosity >= G4VisManager::confirmations) {
799  G4cout << "New viewer \"" << newName << "\" created." << G4endl;
800  }
801  }
802  else {
803  if (verbosity >= G4VisManager::errors) {
804  if (newViewer) {
805  G4cerr << "ERROR: New viewer doesn\'t match!!! Curious!!" << G4endl;
806  } else {
807  G4cout << "WARNING: No viewer created." << G4endl;
808  }
809  }
810  }
811  // Refresh if appropriate...
812  if (newViewer) {
813  if (newViewer->GetViewParameters().IsAutoRefresh()) {
814  G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
815  }
816  else {
817  if (verbosity >= G4VisManager::warnings) {
818  G4cout << "Issue /vis/viewer/refresh or flush to see effect."
819  << G4endl;
820  }
821  }
822  }
823 }
824 
826 
828  fDollyIncrement (0.),
829  fDollyTo (0.)
830 {
831  G4bool omitable, currentAsDefault;
832 
833  fpCommandDolly = new G4UIcmdWithADoubleAndUnit
834  ("/vis/viewer/dolly", this);
835  fpCommandDolly -> SetGuidance
836  ("Incremental dolly.");
837  fpCommandDolly -> SetGuidance
838  ("Moves the camera incrementally towards target point.");
839  fpCommandDolly -> SetParameterName("increment",
840  omitable=true,
841  currentAsDefault=true);
842  fpCommandDolly -> SetDefaultUnit("m");
843 
844  fpCommandDollyTo = new G4UIcmdWithADoubleAndUnit
845  ("/vis/viewer/dollyTo", this);
846  fpCommandDollyTo -> SetGuidance
847  ("Dolly to specific coordinate.");
848  fpCommandDollyTo -> SetGuidance
849  ("Places the camera towards target point relative to standard camera point.");
850  fpCommandDollyTo -> SetParameterName("distance",
851  omitable=true,
852  currentAsDefault=true);
853  fpCommandDollyTo -> SetDefaultUnit("m");
854 }
855 
857  delete fpCommandDolly;
858  delete fpCommandDollyTo;
859 }
860 
862  G4String currentValue;
863  if (command == fpCommandDolly) {
864  currentValue = fpCommandDolly->ConvertToString(fDollyIncrement, "m");
865  }
866  else if (command == fpCommandDollyTo) {
867  currentValue = fpCommandDollyTo->ConvertToString(fDollyTo, "m");
868  }
869  return currentValue;
870 }
871 
873  G4String newValue) {
874 
875 
877 
878  G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
879  if (!currentViewer) {
880  if (verbosity >= G4VisManager::errors) {
881  G4cerr <<
882  "ERROR: G4VisCommandsViewerDolly::SetNewValue: no current viewer."
883  << G4endl;
884  }
885  return;
886  }
887 
888  G4ViewParameters vp = currentViewer->GetViewParameters();
889 
890  if (command == fpCommandDolly) {
891  fDollyIncrement = fpCommandDolly->GetNewDoubleValue(newValue);
892  vp.IncrementDolly(fDollyIncrement);
893  }
894  else if (command == fpCommandDollyTo) {
895  fDollyTo = fpCommandDolly->GetNewDoubleValue(newValue);
896  vp.SetDolly(fDollyTo);
897  }
898 
899  if (verbosity >= G4VisManager::confirmations) {
900  G4cout << "Dolly distance changed to " << vp.GetDolly() << G4endl;
901  }
902 
903  SetViewParameters(currentViewer, vp);
904 }
905 
907 
909  G4bool omitable, currentAsDefault;
910  fpCommand = new G4UIcmdWithAString ("/vis/viewer/flush", this);
911  fpCommand -> SetGuidance
912  ("Compound command: \"/vis/viewer/refresh\" + \"/vis/viewer/update\".");
913  fpCommand -> SetGuidance
914  ("Useful for refreshing and initiating post-processing for graphics"
915  "\nsystems which need post-processing. By default, acts on current"
916  "\nviewer. \"/vis/viewer/list\" to see possible viewers. Viewer"
917  "\nbecomes current.");
918  fpCommand -> SetParameterName ("viewer-name",
919  omitable = true,
920  currentAsDefault = true);
921 }
922 
924  delete fpCommand;
925 }
926 
929  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
930  return viewer ? viewer -> GetName () : G4String("none");
931 }
932 
934 
936 
937  G4String& flushName = newValue;
938  G4VViewer* viewer = fpVisManager -> GetViewer (flushName);
939  if (!viewer) {
940  if (verbosity >= G4VisManager::errors) {
941  G4cerr << "ERROR: Viewer \"" << flushName << "\"" <<
942  " not found - \"/vis/viewer/list\"\n to see possibilities."
943  << G4endl;
944  }
945  return;
946  }
947 
949  G4int keepVerbose = ui->GetVerboseLevel();
950  G4int newVerbose(0);
951  if (keepVerbose >= 2 || verbosity >= G4VisManager::confirmations)
952  newVerbose = 2;
953  ui->SetVerboseLevel(newVerbose);
954  ui->ApplyCommand(G4String("/vis/viewer/refresh " + flushName));
955  ui->ApplyCommand(G4String("/vis/viewer/update " + flushName));
956  ui->SetVerboseLevel(keepVerbose);
957  if (verbosity >= G4VisManager::confirmations) {
958  G4cout << "Viewer \"" << viewer -> GetName () << "\""
959  << " flushed." << G4endl;
960  }
961 }
962 
964 
966  G4bool omitable;
967  fpCommand = new G4UIcommand ("/vis/viewer/interpolate", this);
968  fpCommand -> SetGuidance
969  ("Interpolate views defined by the first argument, which can contain "
970  "Unix-shell-style pattern matching characters such as '*', '?' and '[' "
971  "- see \"man sh\" and look for \"Pattern Matching\". The contents "
972  "of each file are assumed to be \"/vis/viewer\" commands "
973  "that specify a particular view. The files are processed in alphanumeric "
974  "order of filename. The files may be written by hand or produced by the "
975  "\"/vis/viewer/save\" command.");
976  fpCommand -> SetGuidance
977  ("The default is to search the working directory for files with a .g4view "
978  "extension. Another procedure is to assemble view files in a subdirectory, "
979  "e.g., \"myviews\"; then they can be interpolated with\n"
980  "\"/vis/viewer/interpolate myviews/*\".");
981  fpCommand -> SetGuidance
982  ("To export interpolated views to file for a future possible movie, "
983  "write \"export\" as 5th parameter (OpenGL only).");
984  G4UIparameter* parameter;
985  parameter = new G4UIparameter("pattern", 's', omitable = true);
986  parameter -> SetGuidance("Pattern that defines the view files.");
987  parameter -> SetDefaultValue("*.g4view");
988  fpCommand -> SetParameter(parameter);
989  parameter = new G4UIparameter("no-of-points", 'i', omitable = true);
990  parameter -> SetGuidance ("Number of interpolation points per interval.");
991  parameter -> SetDefaultValue(50);
992  fpCommand -> SetParameter(parameter);
993  parameter = new G4UIparameter("wait-time", 's', omitable = true);
994  parameter -> SetGuidance("Wait time per interpolated point");
995  parameter -> SetDefaultValue("20.");
996  fpCommand -> SetParameter(parameter);
997  parameter = new G4UIparameter("time-unit", 's', omitable = true);
998  parameter -> SetDefaultValue("millisecond");
999  fpCommand -> SetParameter (parameter);
1000  parameter = new G4UIparameter("export", 's', omitable = true);
1001  parameter -> SetDefaultValue("no");
1002  fpCommand -> SetParameter (parameter);
1003 }
1004 
1006  delete fpCommand;
1007 }
1008 
1010  return "";
1011 }
1012 
1014 
1016 
1017  G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
1018  if (!currentViewer) {
1019  if (verbosity >= G4VisManager::errors) {
1020  G4cerr <<
1021  "ERROR: G4VisCommandViewerInterpolate::SetNewValue: no current viewer."
1022  << G4endl;
1023  }
1024  return;
1025  }
1026 
1027  G4String pattern;
1028  G4int nInterpolationPoints;
1029  G4String waitTimePerPointString;
1030  G4String timeUnit;
1031  G4String exportString;
1032 
1033  std::istringstream iss (newValue);
1034  iss
1035  >> pattern
1036  >> nInterpolationPoints
1037  >> waitTimePerPointString
1038  >> timeUnit
1039  >> exportString;
1040  G4String waitTimePerPointDimString(waitTimePerPointString + ' ' + timeUnit);
1041  const G4double waitTimePerPoint =
1042  G4UIcommand::ConvertToDimensionedDouble(waitTimePerPointDimString.c_str());
1043  G4int waitTimePerPointmilliseconds = waitTimePerPoint/millisecond;
1044  if (waitTimePerPointmilliseconds < 0) waitTimePerPointmilliseconds = 0;
1045 
1046  G4UImanager* uiManager = G4UImanager::GetUIpointer();
1047 
1048  // Save current view parameters
1049  G4ViewParameters saveVP = currentViewer->GetViewParameters();
1050 
1051  // Save current verbosities
1052  G4VisManager::Verbosity keepVisVerbosity = fpVisManager->GetVerbosity();
1053  G4int keepUIVerbosity = uiManager->GetVerboseLevel();
1054 
1055  // Set verbosities for this operation
1057  uiManager->SetVerboseLevel(0);
1058 
1059  // Switch off auto-refresh while we read in the view files (it will be
1060  // restored later). Note: the view files do not set auto-refresh.
1061  G4ViewParameters non_auto = saveVP;
1062  non_auto.SetAutoRefresh(false);
1063  currentViewer->SetViewParameters(non_auto);
1064 
1065  // View vector of way points
1066  std::vector<G4ViewParameters> viewVector;
1067 
1068  const G4int safety = 9999;
1069  G4int safetyCount = 0;
1070  G4String pathname;
1071 
1072 #ifndef WIN32
1073 
1074  // Execute pattern and get resulting list of filles
1075  G4String shellCommand = "echo " + pattern;
1076  FILE *filelist = popen(shellCommand.c_str(), "r");
1077  if (!filelist) {
1078  if (verbosity >= G4VisManager::errors) {
1079  G4cerr
1080  << "ERROR: G4VisCommandViewerInterpolate::SetNewValue:"
1081  << "\n Error obtaining pipe."
1082  << G4endl;
1083  }
1084  return;
1085  }
1086 
1087  // Build view vector of way points
1088  const size_t BUFLENGTH = 999999;
1089  char buf[BUFLENGTH];
1090  fgets(buf, BUFLENGTH, filelist);
1091  std::istringstream fileliststream(buf);
1092  while (fileliststream >> pathname
1093  && safetyCount++ < safety) { // Loop checking, 16.02.2016, J.Allison
1094  uiManager->ApplyCommand("/control/execute " + pathname);
1095  viewVector.push_back(currentViewer->GetViewParameters());
1096  }
1097  pclose(filelist);
1098 
1099 #else // WIN32 (popen is not available in Windows)
1100 
1101  std::experimental::filesystem::v1::path filePattern(pattern);
1102 
1103  // Default pattern : *.g4view
1104  // Translated to a regexp : ^.*\\.g4view
1105  // Convert pattern into a regexp
1106  std::string regexp_pattern("^" + filePattern.filename().string());
1107  std::string result_pattern = "";
1108  // Replace '.' by "\\."
1109  size_t currentPos = 0;
1110  size_t nextPos = 0;
1111  std::string currentReplacement = "";
1112  size_t pos1 = regexp_pattern.find('.', nextPos);
1113  size_t pos2 = regexp_pattern.find('*', nextPos);
1114  size_t pos3 = regexp_pattern.find('?', nextPos);
1115  while ((pos1 != std::string::npos) || (pos2 != std::string::npos) || (pos3 != std::string::npos)) {
1116  nextPos = pos1;
1117  currentReplacement = "\\.";
1118  if (pos2 < nextPos) {
1119  nextPos = pos2;
1120  currentReplacement = ".*";
1121  }
1122  if (pos3 < nextPos) {
1123  nextPos = pos3;
1124  currentReplacement = "(.{1,1})";
1125  }
1126  result_pattern += regexp_pattern.substr(currentPos, nextPos - currentPos) + currentReplacement;
1127  nextPos++;
1128  currentPos = nextPos;
1129  pos1 = regexp_pattern.find('.', currentPos);
1130  pos2 = regexp_pattern.find('*', currentPos);
1131  pos3 = regexp_pattern.find('?', currentPos);
1132  }
1133  result_pattern += regexp_pattern.substr(currentPos);
1134 
1135  // Build view vector of way points
1136  // Add "./" for empty paths
1137  G4String parentPath(filePattern.parent_path().string().length() ? filePattern.parent_path().string() : std::string("./"));
1138  // Iterate through files in directory and apply regex match to filter appropriate files
1139  std::regex result_pattern_regex (result_pattern, std::regex_constants::basic | std::regex_constants::icase);
1140  for (auto iter = std::experimental::filesystem::v1::directory_iterator(parentPath);
1141  iter != std::experimental::filesystem::v1::directory_iterator() && safetyCount++ < safety;
1142  ++iter)
1143  {
1144  const auto& file = iter->path();
1145 
1146  G4String filename(file.filename().string());
1147  if (std::regex_match(filename, result_pattern_regex))
1148  {
1149  uiManager->ApplyCommand("/control/execute " + filename);
1150  viewVector.push_back(currentViewer->GetViewParameters());
1151  }
1152  }
1153 
1154 #endif // WIN32
1155 
1156  if (safetyCount >= safety) {
1157  if (verbosity >= G4VisManager::errors) {
1158  G4cout <<
1159  "/vis/viewer/interpolate:"
1160  "\n the number of way points exceeds the maximum currently allowed: "
1161  << safety << G4endl;
1162  }
1163  return;
1164  }
1165 
1166  // Interpolate views
1167  safetyCount = 0;
1168  do {
1169  G4ViewParameters* vp =
1170  G4ViewParameters::CatmullRomCubicSplineInterpolation(viewVector,nInterpolationPoints);
1171  if (!vp) break; // Finished.
1172  // Set original auto-refresh status.
1173  vp->SetAutoRefresh(saveVP.IsAutoRefresh());
1174  currentViewer->SetViewParameters(*vp);
1175  currentViewer->RefreshView();
1176  if (exportString == "export" &&
1177  currentViewer->GetName().contains("OpenGL"))
1178  uiManager->ApplyCommand("/vis/ogl/export");
1179 #ifdef G4VIS_USE_STD11
1180  if (waitTimePerPointmilliseconds > 0)
1181  std::this_thread::sleep_for(std::chrono::milliseconds(waitTimePerPointmilliseconds));
1182 #endif
1183  } while (safetyCount++ < safety); // Loop checking, 16.02.2016, J.Allison
1184 
1185  // Restore original verbosities
1186  uiManager->SetVerboseLevel(keepUIVerbosity);
1187  fpVisManager->SetVerboseLevel(keepVisVerbosity);
1188 
1189  // Restore original view parameters
1190  currentViewer->SetViewParameters(saveVP);
1191  currentViewer->RefreshView();
1192  if (verbosity >= G4VisManager::confirmations) {
1193  G4cout << "Viewer \"" << currentViewer -> GetName () << "\""
1194  << " restored." << G4endl;
1195  }
1196 }
1197 
1199 
1201  G4bool omitable;
1202  fpCommand = new G4UIcommand ("/vis/viewer/list", this);
1203  fpCommand -> SetGuidance ("Lists viewers(s).");
1204  fpCommand -> SetGuidance
1205  ("See \"/vis/verbose\" for definition of verbosity.");
1206  G4UIparameter* parameter;
1207  parameter = new G4UIparameter("viewer-name", 's',
1208  omitable = true);
1209  parameter -> SetDefaultValue ("all");
1210  fpCommand -> SetParameter (parameter);
1211  parameter = new G4UIparameter ("verbosity", 's',
1212  omitable = true);
1213  parameter -> SetDefaultValue ("warnings");
1214  fpCommand -> SetParameter (parameter);
1215 }
1216 
1218  delete fpCommand;
1219 }
1220 
1222  return "";
1223 }
1224 
1226  G4String name, verbosityString;
1227  std::istringstream is (newValue);
1228  is >> name >> verbosityString;
1229  G4String shortName = fpVisManager -> ViewerShortName (name);
1230  G4VisManager::Verbosity verbosity =
1231  fpVisManager->GetVerbosityValue(verbosityString);
1232 
1233  const G4VViewer* currentViewer = fpVisManager -> GetCurrentViewer ();
1234  G4String currentViewerShortName;
1235  if (currentViewer) {
1236  currentViewerShortName = currentViewer -> GetShortName ();
1237  }
1238  else {
1239  currentViewerShortName = "none";
1240  }
1241 
1242  const G4SceneHandlerList& sceneHandlerList =
1243  fpVisManager -> GetAvailableSceneHandlers ();
1244  G4int nHandlers = sceneHandlerList.size ();
1245  G4bool found = false;
1246  G4bool foundCurrent = false;
1247  for (int iHandler = 0; iHandler < nHandlers; iHandler++) {
1248  G4VSceneHandler* sceneHandler = sceneHandlerList [iHandler];
1249  const G4ViewerList& viewerList = sceneHandler -> GetViewerList ();
1250  G4cout
1251  << "Scene handler \"" << sceneHandler -> GetName () << "\" ("
1252  << sceneHandler->GetGraphicsSystem()->GetNickname() << ')';
1253  const G4Scene* pScene = sceneHandler -> GetScene ();
1254  if (pScene) {
1255  G4cout << ", scene \"" << pScene -> GetName () << "\"";
1256  }
1257  G4cout << ':';
1258  G4int nViewers = viewerList.size ();
1259  if (nViewers == 0) {
1260  G4cout << "\n No viewers for this scene handler." << G4endl;
1261  }
1262  else {
1263  for (int iViewer = 0; iViewer < nViewers; iViewer++) {
1264  const G4VViewer* thisViewer = viewerList [iViewer];
1265  G4String thisName = thisViewer -> GetName ();
1266  G4String thisShortName = thisViewer -> GetShortName ();
1267  if (name != "all") {
1268  if (thisShortName != shortName) continue;
1269  }
1270  found = true;
1271  G4cout << "\n ";
1272  if (thisShortName == currentViewerShortName) {
1273  foundCurrent = true;
1274  G4cout << "(current)";
1275  }
1276  else {
1277  G4cout << " ";
1278  }
1279  G4cout << " viewer \"" << thisName << "\"";
1280  if (verbosity >= G4VisManager::parameters) {
1281  G4cout << "\n " << *thisViewer;
1282  }
1283  }
1284  }
1285  G4cout << G4endl;
1286  }
1287 
1288  if (!foundCurrent) {
1289  G4cout << "No valid current viewer - please create or select one."
1290  << G4endl;
1291  }
1292 
1293  if (!found) {
1294  G4cout << "No viewers";
1295  if (name != "all") {
1296  G4cout << " of name \"" << name << "\"";
1297  }
1298  G4cout << " found." << G4endl;
1299  }
1300 }
1301 
1303 
1305  fPanIncrementRight (0.),
1306  fPanIncrementUp (0.),
1307  fPanToRight (0.),
1308  fPanToUp (0.)
1309 {
1310  G4bool omitable;
1311 
1312  fpCommandPan = new G4UIcommand
1313  ("/vis/viewer/pan", this);
1314  fpCommandPan -> SetGuidance
1315  ("Incremental pan.");
1316  fpCommandPan -> SetGuidance
1317  ("Moves the camera incrementally right and up by these amounts (as seen"
1318  "\nfrom viewpoint direction).");
1319  G4UIparameter* parameter;
1320  parameter = new G4UIparameter("right-increment", 'd', omitable = true);
1321  parameter -> SetCurrentAsDefault (true);
1322  fpCommandPan -> SetParameter (parameter);
1323  parameter = new G4UIparameter("up-increment", 'd', omitable = true);
1324  parameter -> SetCurrentAsDefault (true);
1325  fpCommandPan -> SetParameter (parameter);
1326  parameter = new G4UIparameter ("unit", 's', omitable = true);
1327  parameter -> SetDefaultValue ("m");
1328  fpCommandPan -> SetParameter (parameter);
1329 
1330  fpCommandPanTo = new G4UIcommand
1331  ("/vis/viewer/panTo", this);
1332  fpCommandPanTo -> SetGuidance
1333  ("Pan to specific coordinate.");
1334  fpCommandPanTo -> SetGuidance
1335  ("Places the camera in this position right and up relative to standard"
1336  "\ntarget point (as seen from viewpoint direction).");
1337  parameter = new G4UIparameter("right", 'd', omitable = true);
1338  parameter -> SetCurrentAsDefault (true);
1339  fpCommandPanTo -> SetParameter (parameter);
1340  parameter = new G4UIparameter("up", 'd', omitable = true);
1341  parameter -> SetCurrentAsDefault (true);
1342  fpCommandPanTo -> SetParameter (parameter);
1343  parameter = new G4UIparameter ("unit", 's', omitable = true);
1344  parameter -> SetDefaultValue ("m");
1345  fpCommandPanTo -> SetParameter (parameter);
1346 }
1347 
1349  delete fpCommandPan;
1350  delete fpCommandPanTo;
1351 }
1352 
1354  G4String currentValue;
1355  if (command == fpCommandPan) {
1356  currentValue = ConvertToString(fPanIncrementRight, fPanIncrementUp, "m");
1357  }
1358  else if (command == fpCommandPanTo) {
1359  currentValue = ConvertToString(fPanToRight, fPanToUp, "m");
1360  }
1361  return currentValue;
1362 }
1363 
1365  G4String newValue) {
1366 
1367 
1369 
1370  G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
1371  if (!currentViewer) {
1372  if (verbosity >= G4VisManager::errors) {
1373  G4cerr <<
1374  "ERROR: G4VisCommandsViewerPan::SetNewValue: no current viewer."
1375  << G4endl;
1376  }
1377  return;
1378  }
1379 
1380  G4ViewParameters vp = currentViewer->GetViewParameters();
1381 
1382  if (command == fpCommandPan) {
1383  ConvertToDoublePair(newValue, fPanIncrementRight, fPanIncrementUp);
1384  vp.IncrementPan(fPanIncrementRight, fPanIncrementUp);
1385  }
1386  else if (command == fpCommandPanTo) {
1387  ConvertToDoublePair(newValue, fPanToRight, fPanToUp);
1388  vp.SetPan(fPanToRight, fPanToUp);
1389  }
1390 
1391  if (verbosity >= G4VisManager::confirmations) {
1392  G4cout << "Current target point now " << vp.GetCurrentTargetPoint()
1393  << G4endl;
1394  }
1395 
1396  SetViewParameters(currentViewer, vp);
1397 }
1398 
1400 
1402  G4bool omitable, currentAsDefault;
1403  fpCommand = new G4UIcmdWithAString ("/vis/viewer/rebuild", this);
1404  fpCommand -> SetGuidance ("Forces rebuild of graphical database.");
1405  fpCommand -> SetGuidance
1406  ("By default, acts on current viewer. \"/vis/viewer/list\""
1407  "\nto see possible viewers. Viewer becomes current.");
1408  fpCommand -> SetParameterName ("viewer-name",
1409  omitable = true,
1410  currentAsDefault = true);
1411 }
1412 
1414  delete fpCommand;
1415 }
1416 
1418  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
1419  if (viewer) {
1420  return viewer -> GetName ();
1421  }
1422  else {
1423  return "none";
1424  }
1425 }
1426 
1428 
1430 
1431  G4String& rebuildName = newValue;
1432 
1433  G4VViewer* viewer = fpVisManager -> GetViewer (rebuildName);
1434  if (!viewer) {
1435  if (verbosity >= G4VisManager::errors) {
1436  G4cerr << "ERROR: Viewer \"" << rebuildName
1437  << "\" not found - \"/vis/viewer/list\" to see possibilities."
1438  << G4endl;
1439  }
1440  return;
1441  }
1442 
1443  G4VSceneHandler* sceneHandler = viewer->GetSceneHandler();
1444  if (!sceneHandler) {
1445  if (verbosity >= G4VisManager::errors) {
1446  G4cerr << "ERROR: Viewer \"" << viewer->GetName() << "\"" <<
1447  " has no scene handler - report serious bug."
1448  << G4endl;
1449  }
1450  return;
1451  }
1452 
1453  sceneHandler->ClearTransientStore();
1454  viewer->NeedKernelVisit();
1455  viewer->SetView();
1456  viewer->ClearView();
1457  viewer->DrawView();
1458 
1459  // Check auto-refresh and print confirmations.
1460  RefreshIfRequired(viewer);
1461 }
1462 
1464 
1466  G4bool omitable, currentAsDefault;
1467  fpCommand = new G4UIcmdWithAString ("/vis/viewer/refresh", this);
1468  fpCommand -> SetGuidance
1469  ("Refreshes viewer.");
1470  fpCommand -> SetGuidance
1471  ("By default, acts on current viewer. \"/vis/viewer/list\""
1472  "\nto see possible viewers. Viewer becomes current.");
1473  fpCommand -> SetParameterName ("viewer-name",
1474  omitable = true,
1475  currentAsDefault = true);
1476 }
1477 
1479  delete fpCommand;
1480 }
1481 
1483  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
1484  return viewer ? viewer -> GetName () : G4String("none");
1485 }
1486 
1488 
1490  G4bool warn(verbosity >= G4VisManager::warnings);
1491 
1492  G4String& refreshName = newValue;
1493  G4VViewer* viewer = fpVisManager -> GetViewer (refreshName);
1494  if (!viewer) {
1495  if (verbosity >= G4VisManager::errors) {
1496  G4cerr << "ERROR: Viewer \"" << refreshName << "\"" <<
1497  " not found - \"/vis/viewer/list\"\n to see possibilities."
1498  << G4endl;
1499  }
1500  return;
1501  }
1502 
1503  G4VSceneHandler* sceneHandler = viewer->GetSceneHandler();
1504  if (!sceneHandler) {
1505  if (verbosity >= G4VisManager::errors) {
1506  G4cerr << "ERROR: Viewer \"" << refreshName << "\"" <<
1507  " has no scene handler - report serious bug."
1508  << G4endl;
1509  }
1510  return;
1511  }
1512 
1513  G4Scene* scene = sceneHandler->GetScene();
1514  if (!scene) {
1515  if (verbosity >= G4VisManager::confirmations) {
1516  G4cout << "NOTE: SceneHandler \"" << sceneHandler->GetName()
1517  << "\", to which viewer \"" << refreshName << "\"" <<
1518  "\n is attached, has no scene - \"/vis/scene/create\" and"
1519  " \"/vis/sceneHandler/attach\""
1520  "\n (or use compound command \"/vis/drawVolume\")."
1521  << G4endl;
1522  }
1523  return;
1524  }
1525  if (scene->GetRunDurationModelList().empty()) {
1526  G4bool successful = scene -> AddWorldIfEmpty (warn);
1527  if (!successful) {
1528  if (verbosity >= G4VisManager::warnings) {
1529  G4cout <<
1530  "WARNING: Scene is empty. Perhaps no geometry exists."
1531  "\n Try /run/initialize."
1532  << G4endl;
1533  }
1534  return;
1535  }
1536  // Scene has changed. UpdateVisManagerScene issues
1537  // /vis/scene/notifyHandlers, which does a refresh anyway, so the
1538  // ordinary refresh becomes part of the else phrase...
1539  UpdateVisManagerScene(scene->GetName());
1540  } else {
1541  if (verbosity >= G4VisManager::confirmations) {
1542  G4cout << "Refreshing viewer \"" << viewer -> GetName () << "\"..."
1543  << G4endl;
1544  }
1545  viewer -> SetView ();
1546  viewer -> ClearView ();
1547  viewer -> DrawView ();
1548  if (verbosity >= G4VisManager::confirmations) {
1549  G4cout << "Viewer \"" << viewer -> GetName () << "\"" << " refreshed."
1550  "\n (You might also need \"/vis/viewer/update\".)" << G4endl;
1551  }
1552  }
1553 }
1554 
1556 
1558  G4bool omitable, currentAsDefault;
1559  fpCommand = new G4UIcmdWithAString ("/vis/viewer/reset", this);
1560  fpCommand -> SetGuidance ("Resets viewer.");
1561  fpCommand -> SetGuidance
1562  ("By default, acts on current viewer. \"/vis/viewer/list\""
1563  "\nto see possible viewers. Viewer becomes current.");
1564  fpCommand -> SetParameterName ("viewer-name",
1565  omitable = true,
1566  currentAsDefault = true);
1567 }
1568 
1570  delete fpCommand;
1571 }
1572 
1574  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
1575  if (viewer) {
1576  return viewer -> GetName ();
1577  }
1578  else {
1579  return "none";
1580  }
1581 }
1582 
1584 
1586 
1587  G4String& resetName = newValue;
1588  G4VViewer* viewer = fpVisManager -> GetViewer (resetName);
1589  if (!viewer) {
1590  if (verbosity >= G4VisManager::errors) {
1591  G4cerr << "ERROR: Viewer \"" << resetName
1592  << "\" not found - \"/vis/viewer/list\" to see possibilities."
1593  << G4endl;
1594  }
1595  return;
1596  }
1597 
1598  viewer->ResetView();
1599  RefreshIfRequired(viewer);
1600 }
1601 
1603 
1605  G4bool omitable;
1606  fpCommand = new G4UIcmdWithAString ("/vis/viewer/save", this);
1607  fpCommand -> SetGuidance
1608  ("Write commands that define the current view to file.");
1609  fpCommand -> SetGuidance
1610  ("Read them back into the same or any viewer with \"/control/execute\".");
1611  fpCommand -> SetGuidance
1612  ("If the filename is omitted the view is saved to a file "
1613  "\"g4_nn.g4view\", where nn is a sequential two-digit number.");
1614  fpCommand -> SetGuidance
1615  ("If the filename is \"-\", the data are written to G4cout.");
1616  fpCommand -> SetGuidance
1617  ("If you are wanting to save views for future interpolation a recommended "
1618  "procedure is: save views to \"g4_nn.g4view\", as above, then move the files "
1619  "into a sub-directory, say, \"views\", then interpolate with"
1620  "\"/vis/viewer/interpolate views/\" (note the trailing \'/\').");
1621  fpCommand -> SetParameterName ("filename", omitable = true);
1622  fpCommand -> SetDefaultValue ("");
1623 }
1624 
1626  delete fpCommand;
1627 }
1628 
1631  return "";
1632 }
1633 
1634 namespace {
1635  void WriteCommands
1636  (std::ostream& os,
1637  const G4ViewParameters& vp,
1638  const G4Point3D& stp) // Standard Target Point
1639  {
1640  os
1641  << vp.CameraAndLightingCommands(stp)
1642  << vp.DrawingStyleCommands()
1643  << vp.SceneModifyingCommands()
1644  << vp.TouchableCommands()
1645  << std::endl;
1646  }
1647 }
1648 
1650 
1652 
1653  const G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
1654  if (!currentViewer) {
1655  if (verbosity >= G4VisManager::errors) {
1656  G4cerr <<
1657  "ERROR: G4VisCommandsViewerSave::SetNewValue: no current viewer."
1658  << G4endl;
1659  }
1660  return;
1661  }
1662 
1663  const G4Scene* currentScene = currentViewer->GetSceneHandler()->GetScene();
1664  if (!currentScene) {
1665  if (verbosity >= G4VisManager::errors) {
1666  G4cerr <<
1667  "ERROR: G4VisCommandsViewerSave::SetNewValue: no current scene."
1668  << G4endl;
1669  }
1670  return;
1671  }
1672 
1673  // Get view parameters and ther relevant information.
1674  G4ViewParameters vp = currentViewer->GetViewParameters();
1675  // Concatenate any private vis attributes modifiers...
1676  const std::vector<G4ModelingParameters::VisAttributesModifier>*
1677  privateVAMs = currentViewer->GetPrivateVisAttributesModifiers();
1678  if (privateVAMs) {
1679  std::vector<G4ModelingParameters::VisAttributesModifier>::const_iterator i;
1680  for (i = privateVAMs->begin(); i != privateVAMs->end(); ++i) {
1681  vp.AddVisAttributesModifier(*i);
1682  }
1683  }
1684  const G4Point3D& stp = currentScene->GetStandardTargetPoint();
1685 
1686  G4String filename = newValue;
1687  if (newValue.length() == 0) {
1688  // Null filename - generate a filename
1689  const G4int maxNoOfFiles = 100;
1690  static G4int sequenceNumber = 0;
1691  if (sequenceNumber >= maxNoOfFiles) {
1692  if (verbosity >= G4VisManager::errors) {
1693  G4cerr
1694  << "ERROR: G4VisCommandsViewerSave::SetNewValue: Maximum number, "
1695  << maxNoOfFiles
1696  << ", of files exceeded."
1697  << G4endl;
1698  }
1699  return;
1700  }
1701  std::ostringstream oss;
1702  oss << std::setw(2) << std::setfill('0') << sequenceNumber++;
1703  filename = "g4_" + oss.str() + ".g4view";
1704  }
1705 
1706  if (filename == "-") {
1707  // Write to standard output
1708  WriteCommands(G4cout,vp,stp);
1709  } else {
1710  // Write to file
1711  std::ofstream ofs(filename);
1712  if (!ofs) {
1713  if (verbosity >= G4VisManager::errors) {
1714  G4cerr <<
1715  "ERROR: G4VisCommandsViewerSave::SetNewValue: Trouble opening file \""
1716  << filename << "\"."
1717  << G4endl;
1718  }
1719  ofs.close();
1720  return;
1721  }
1722  WriteCommands(ofs,vp,stp);
1723  ofs.close();
1724  }
1725 
1726  if (verbosity >= G4VisManager::warnings) {
1727  G4cout << "Viewer \"" << currentViewer -> GetName ()
1728  << "\"" << " saved to ";
1729  if (filename == "-") {
1730  G4cout << "G4cout.";
1731  } else {
1732  G4cout << "file \'" << filename << "\"." <<
1733  "\n Read the view back into this or any viewer with"
1734  "\n \"/control/execute " << filename << "\" or use"
1735  "\n \"/vis/viewer/interpolate\" if you have several saved files -"
1736  "\n see \"help /vis/viewer/interpolate\" for guidance.";
1737  }
1738  G4cout << G4endl;
1739  }
1740 }
1741 
1743 
1745  fScaleMultiplier (G4Vector3D (1., 1., 1.)),
1746  fScaleTo (G4Vector3D (1., 1., 1.))
1747 {
1748  G4bool omitable, currentAsDefault;
1749 
1750  fpCommandScale = new G4UIcmdWith3Vector
1751  ("/vis/viewer/scale", this);
1752  fpCommandScale -> SetGuidance ("Incremental (non-uniform) scaling.");
1753  fpCommandScale -> SetGuidance
1754  ("Multiplies components of current scaling by components of this factor."
1755  "\n Scales (x,y,z) by corresponding components of the resulting factor.");
1756  fpCommandScale -> SetGuidance
1757  ("");
1758  fpCommandScale -> SetParameterName
1759  ("x-scale-multiplier","y-scale-multiplier","z-scale-multiplier",
1760  omitable=true, currentAsDefault=true);
1761 
1762  fpCommandScaleTo = new G4UIcmdWith3Vector
1763  ("/vis/viewer/scaleTo", this);
1764  fpCommandScaleTo -> SetGuidance ("Absolute (non-uniform) scaling.");
1765  fpCommandScaleTo -> SetGuidance
1766  ("Scales (x,y,z) by corresponding components of this factor.");
1767  fpCommandScaleTo -> SetParameterName
1768  ("x-scale-factor","y-scale-factor","z-scale-factor",
1769  omitable=true, currentAsDefault=true);
1770 }
1771 
1773  delete fpCommandScale;
1774  delete fpCommandScaleTo;
1775 }
1776 
1778  G4String currentValue;
1779  if (command == fpCommandScale) {
1780  currentValue = fpCommandScale->ConvertToString(G4ThreeVector(fScaleMultiplier));
1781  }
1782  else if (command == fpCommandScaleTo) {
1783  currentValue = fpCommandScaleTo->ConvertToString(G4ThreeVector(fScaleTo));
1784  }
1785  return currentValue;
1786 }
1787 
1789  G4String newValue) {
1790 
1791 
1793 
1794  G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
1795  if (!currentViewer) {
1796  if (verbosity >= G4VisManager::errors) {
1797  G4cerr <<
1798  "ERROR: G4VisCommandsViewerScale::SetNewValue: no current viewer."
1799  << G4endl;
1800  }
1801  return;
1802  }
1803 
1804  G4ViewParameters vp = currentViewer->GetViewParameters();
1805 
1806  if (command == fpCommandScale) {
1807  fScaleMultiplier = fpCommandScale->GetNew3VectorValue(newValue);
1808  vp.MultiplyScaleFactor(fScaleMultiplier);
1809  }
1810  else if (command == fpCommandScaleTo) {
1811  fScaleTo = fpCommandScale->GetNew3VectorValue(newValue);
1812  vp.SetScaleFactor(fScaleTo);
1813  }
1814 
1815  if (verbosity >= G4VisManager::confirmations) {
1816  G4cout << "Scale factor changed to " << vp.GetScaleFactor() << G4endl;
1817  }
1818 
1819  SetViewParameters(currentViewer, vp);
1820 }
1821 
1823 
1825  G4bool omitable;
1826  fpCommand = new G4UIcmdWithAString ("/vis/viewer/select", this);
1827  fpCommand -> SetGuidance ("Selects viewer.");
1828  fpCommand -> SetGuidance
1829  ("Specify viewer by name. \"/vis/viewer/list\" to see possible viewers.");
1830  fpCommand -> SetParameterName ("viewer-name", omitable = false);
1831 }
1832 
1834  delete fpCommand;
1835 }
1836 
1838  return "";
1839 }
1840 
1842 
1844 
1845  G4String& selectName = newValue;
1846  G4VViewer* viewer = fpVisManager -> GetViewer (selectName);
1847 
1848  if (!viewer) {
1849  if (verbosity >= G4VisManager::errors) {
1850  G4cerr << "ERROR: Viewer \"" << selectName << "\"";
1851  G4cerr << " not found - \"/vis/viewer/list\""
1852  "\n to see possibilities."
1853  << G4endl;
1854  }
1855  return;
1856  }
1857 
1858  if (viewer == fpVisManager -> GetCurrentViewer ()) {
1859  if (verbosity >= G4VisManager::warnings) {
1860  G4cout << "WARNING: Viewer \"" << viewer -> GetName () << "\""
1861  << " already selected." << G4endl;
1862  }
1863  return;
1864  }
1865 
1866  // Set pointers, call SetView and print confirmation.
1867  fpVisManager -> SetCurrentViewer (viewer);
1868 
1869  RefreshIfRequired(viewer);
1870 }
1871 
1873 
1875  G4bool omitable, currentAsDefault;
1876  fpCommand = new G4UIcmdWithAString ("/vis/viewer/update", this);
1877  fpCommand -> SetGuidance
1878  ("Triggers graphical database post-processing for viewers"
1879  "\nusing that technique.");
1880  fpCommand -> SetGuidance
1881  ("For such viewers the view only becomes visible with this command."
1882  "\nBy default, acts on current viewer. \"/vis/viewer/list\""
1883  "\nto see possible viewers. Viewer becomes current.");
1884  fpCommand -> SetParameterName ("viewer-name",
1885  omitable = true,
1886  currentAsDefault = true);
1887 }
1888 
1890  delete fpCommand;
1891 }
1892 
1894  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
1895  if (viewer) {
1896  return viewer -> GetName ();
1897  }
1898  else {
1899  return "none";
1900  }
1901 }
1902 
1904 
1906 
1907  G4String& updateName = newValue;
1908 
1909  G4VViewer* viewer = fpVisManager -> GetViewer (updateName);
1910  if (!viewer) {
1911  if (verbosity >= G4VisManager::errors) {
1912  G4cout <<
1913  "WARNING: command \"/vis/viewer/update\" could not be applied: no current viewer."
1914  << G4endl;
1915  }
1916  return;
1917  }
1918 
1919  G4VSceneHandler* sceneHandler = viewer->GetSceneHandler();
1920  if (!sceneHandler) {
1921  if (verbosity >= G4VisManager::errors) {
1922  G4cerr << "ERROR: Viewer \"" << updateName << "\"" <<
1923  " has no scene handler - report serious bug."
1924  << G4endl;
1925  }
1926  return;
1927  }
1928 
1929  G4Scene* scene = sceneHandler->GetScene();
1930  if (!scene) {
1931  if (verbosity >= G4VisManager::confirmations) {
1932  G4cout << "NOTE: SceneHandler \"" << sceneHandler->GetName()
1933  << "\", to which viewer \"" << updateName << "\"" <<
1934  "\n is attached, has no scene - \"/vis/scene/create\" and"
1935  " \"/vis/sceneHandler/attach\""
1936  "\n (or use compound command \"/vis/drawVolume\")."
1937  << G4endl;
1938  }
1939  return;
1940  }
1941 
1942  if (verbosity >= G4VisManager::confirmations) {
1943  G4cout << "Viewer \"" << viewer -> GetName () << "\"";
1944  G4cout << " post-processing triggered." << G4endl;
1945  }
1946  viewer -> ShowView ();
1947  // Assume future need to "refresh" transients...
1948  sceneHandler -> SetMarkForClearingTransientStore(true);
1949 }
1950 
1952 
1954  fZoomMultiplier (1.),
1955  fZoomTo (1.)
1956 {
1957  G4bool omitable, currentAsDefault;
1958 
1959  fpCommandZoom = new G4UIcmdWithADouble
1960  ("/vis/viewer/zoom", this);
1961  fpCommandZoom -> SetGuidance ("Incremental zoom.");
1962  fpCommandZoom -> SetGuidance
1963  ("Multiplies current magnification by this factor.");
1964  fpCommandZoom -> SetParameterName("multiplier",
1965  omitable=true,
1966  currentAsDefault=true);
1967 
1968  fpCommandZoomTo = new G4UIcmdWithADouble
1969  ("/vis/viewer/zoomTo", this);
1970  fpCommandZoomTo -> SetGuidance ("Absolute zoom.");
1971  fpCommandZoomTo -> SetGuidance
1972  ("Magnifies standard magnification by this factor.");
1973  fpCommandZoomTo -> SetParameterName("factor",
1974  omitable=true,
1975  currentAsDefault=true);
1976 }
1977 
1979  delete fpCommandZoom;
1980  delete fpCommandZoomTo;
1981 }
1982 
1984  G4String currentValue;
1985  if (command == fpCommandZoom) {
1986  currentValue = fpCommandZoom->ConvertToString(fZoomMultiplier);
1987  }
1988  else if (command == fpCommandZoomTo) {
1989  currentValue = fpCommandZoomTo->ConvertToString(fZoomTo);
1990  }
1991  return currentValue;
1992 }
1993 
1995  G4String newValue) {
1996 
1997 
1999 
2000  G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
2001  if (!currentViewer) {
2002  if (verbosity >= G4VisManager::errors) {
2003  G4cerr <<
2004  "ERROR: G4VisCommandsViewerZoom::SetNewValue: no current viewer."
2005  << G4endl;
2006  }
2007  return;
2008  }
2009 
2010  G4ViewParameters vp = currentViewer->GetViewParameters();
2011 
2012  if (command == fpCommandZoom) {
2013  fZoomMultiplier = fpCommandZoom->GetNewDoubleValue(newValue);
2014  vp.MultiplyZoomFactor(fZoomMultiplier);
2015  }
2016  else if (command == fpCommandZoomTo) {
2017  fZoomTo = fpCommandZoom->GetNewDoubleValue(newValue);
2018  vp.SetZoomFactor(fZoomTo);
2019  }
2020 
2021  if (verbosity >= G4VisManager::confirmations) {
2022  G4cout << "Zoom factor changed to " << vp.GetZoomFactor() << G4endl;
2023  }
2024 
2025  SetViewParameters(currentViewer, vp);
2026 }
const G4String & GetName() const
G4String GetCurrentValue(G4UIcommand *command)
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:152
const XML_Char * name
Definition: expat.h:151
G4String TouchableCommands() const
G4String GetCurrentValue(G4UIcommand *command)
G4double GetZoomFactor() const
void IncrementPan(G4double right, G4double up)
void ClearCutawayPlanes()
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
virtual void SetView()=0
void AddCutawayPlane(const G4Plane3D &cutawayPlane)
G4double GetDolly() const
void SetNewValue(G4UIcommand *command, G4String newValue)
void SetLightpointDirection(const G4Vector3D &lightpointDirection)
void SetPan(G4double right, G4double up)
void SetNewValue(G4UIcommand *command, G4String newValue)
void SetScaleFactor(const G4Vector3D &scaleFactor)
CLHEP::Hep3Vector G4ThreeVector
void SetNewValue(G4UIcommand *command, G4String newValue)
virtual void ClearView()=0
G4String strip(G4int strip_Type=trailing, char c=' ')
void UpdateVisManagerScene(const G4String &sceneName="")
void SetNewValue(G4UIcommand *command, G4String newValue)
void SetVerboseLevel(G4int)
void SetNewValue(G4UIcommand *command, G4String newValue)
G4String GetCurrentValue(G4UIcommand *command)
G4String GetCurrentValue(G4UIcommand *command)
void SetUpVector(const G4Vector3D &upVector)
const G4ViewParameters & GetViewParameters() const
void SetDefaultValue(const char *theDefaultValue)
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:372
const G4String & GetName() const
G4String SceneModifyingCommands() const
void SetViewParameters(const G4ViewParameters &vp)
Definition: G4VViewer.cc:120
void SetViewParameters(G4VViewer *, const G4ViewParameters &)
HepGeom::Point3D< G4double > G4Point3D
Definition: G4Point3D.hh:35
const G4Planes & GetCutawayPlanes() const
tuple x
Definition: test.py:50
void SetNewValue(G4UIcommand *command, G4String newValue)
G4String GetCurrentValue(G4UIcommand *command)
G4String GetCurrentValue(G4UIcommand *command)
static G4double GetNewDoubleValue(const char *paramString)
G4int GetVerboseLevel() const
Definition: G4UImanager.hh:227
const G4String & GetName() const
int G4int
Definition: G4Types.hh:78
static Verbosity GetVerbosityValue(const G4String &)
static G4double ConvertToDimensionedDouble(const char *st)
Definition: G4UIcommand.cc:463
void SetVerboseLevel(G4int val)
Definition: G4UImanager.hh:225
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
void SetLightsMoveWithCamera(G4bool moves)
void ClearVisAttributesModifiers()
G4String GetCurrentValue(G4UIcommand *command)
const G4Point3D & GetCurrentTargetPoint() const
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
const G4Vector3D & GetLightpointDirection() const
const G4String & GetXGeometryString() const
void SetNewValue(G4UIcommand *command, G4String newValue)
void SetNewValue(G4UIcommand *command, G4String newValue)
const G4Vector3D & GetViewpointDirection() const
G4GLOB_DLL std::ostream G4cout
void SetZoomFactor(G4double zoomFactor)
static G4ThreeVector GetNew3VectorValue(const char *paramString)
void ChangeCutawayPlane(size_t index, const G4Plane3D &cutawayPlane)
G4String GetCurrentValue(G4UIcommand *command)
virtual void ResetView()
const G4Point3D & GetStandardTargetPoint() const
bool G4bool
Definition: G4Types.hh:79
void SetNewValue(G4UIcommand *command, G4String newValue)
std::vector< G4Plane3D > G4Planes
static G4double GetNewDoubleValue(const char *paramString)
const std::vector< Model > & GetRunDurationModelList() const
void SetNewValue(G4UIcommand *command, G4String newValue)
void ResetTransientsDrawnFlags()
void SetCurrentTargetPoint(const G4Point3D &currentTargetPoint)
void SetDolly(G4double dolly)
G4VGraphicsSystem * GetGraphicsSystem() const
void SetNewValue(G4UIcommand *command, G4String newValue)
void SetFieldHalfAngle(G4double fieldHalfAngle)
void SetNewValue(G4UIcommand *command, G4String newValue)
const G4String & GetNickname() const
G4String GetCurrentValue(G4UIcommand *command)
G4String DrawingStyleCommands() const
void SetNewValue(G4UIcommand *command, G4String newValue)
void SetNewValue(G4UIcommand *command, G4String newValue)
G4bool contains(const std::string &) const
void RefreshIfRequired(G4VViewer *)
void SetAutoRefresh(G4bool)
G4Scene * GetScene() const
void MultiplyZoomFactor(G4double zoomFactorMultiplier)
void AddVisAttributesModifier(const G4ModelingParameters::VisAttributesModifier &)
G4VSceneHandler * GetSceneHandler() const
void SetNewValue(G4UIcommand *command, G4String newValue)
void SetNewValue(G4UIcommand *command, G4String newValue)
void SetNewValue(G4UIcommand *command, G4String newValue)
const G4Vector3D & GetScaleFactor() const
virtual const std::vector< G4ModelingParameters::VisAttributesModifier > * GetPrivateVisAttributesModifiers() const
static G4String ConvertToString(G4double x, G4double y, const char *unitName)
static G4double ValueOf(const char *unitName)
Definition: G4UIcommand.cc:309
G4String GetCurrentValue(G4UIcommand *command)
static constexpr double millisecond
Definition: G4SIunits.hh:159
static Verbosity GetVerbosity()
void NeedKernelVisit()
Definition: G4VViewer.cc:78
G4String GetCurrentValue(G4UIcommand *command)
tuple z
Definition: test.py:28
void RefreshView()
G4String GetCurrentValue(G4UIcommand *command)
G4String GetCurrentValue(G4UIcommand *command)
HepGeom::Plane3D< G4double > G4Plane3D
Definition: G4Plane3D.hh:37
G4String CameraAndLightingCommands(const G4Point3D standardTargetPoint) const
G4bool GetLightsMoveWithCamera() const
#define G4endl
Definition: G4ios.hh:61
G4VViewer * GetCurrentViewer() const
G4double GetFieldHalfAngle() const
void SetNewValue(G4UIcommand *command, G4String newValue)
void MultiplyScaleFactor(const G4Vector3D &scaleFactorMultiplier)
double G4double
Definition: G4Types.hh:76
virtual void ClearTransientStore()
tuple c
Definition: test.py:13
void SetGuidance(const char *theGuidance)
static G4ViewParameters * CatmullRomCubicSplineInterpolation(const std::vector< G4ViewParameters > &views, G4int nInterpolationPoints=50)
G4String GetCurrentValue(G4UIcommand *command)
G4String GetCurrentValue(G4UIcommand *command)
const G4Vector3D & GetUpVector() const
static void ConvertToDoublePair(const G4String &paramString, G4double &xval, G4double &yval)
void SetMarkForClearingTransientStore(G4bool)
G4bool IsAutoRefresh() const
void IncrementDolly(G4double dollyIncrement)
void SetViewpointDirection(const G4Vector3D &viewpointDirection)
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447
G4String GetCurrentValue(G4UIcommand *command)
virtual void FinishView()
Definition: G4VViewer.cc:101
G4GLOB_DLL std::ostream G4cerr
G4String GetCurrentValue(G4UIcommand *command)
G4String GetCurrentValue(G4UIcommand *command)
HepGeom::Normal3D< G4double > G4Normal3D
Definition: G4Normal3D.hh:35
virtual void DrawView()=0
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
static G4VisManager * fpVisManager
void SetNewValue(G4UIcommand *command, G4String newValue)