Geant4  10.03
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 99440 2016-09-22 08:34:04Z 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 
57 
59 
61 (G4VViewer* viewer, const G4ViewParameters& viewParams) {
62  viewer->SetViewParameters(viewParams);
63  RefreshIfRequired(viewer);
64 }
65 
68  G4VSceneHandler* sceneHandler = viewer->GetSceneHandler();
69  const G4ViewParameters& viewParams = viewer->GetViewParameters();
70  if (sceneHandler && sceneHandler->GetScene()) {
71  if (viewParams.IsAutoRefresh()) {
72  G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
73  }
74  else {
75  if (verbosity >= G4VisManager::warnings) {
76  G4cout << "Issue /vis/viewer/refresh or flush to see effect."
77  << G4endl;
78  }
79  }
80  }
81 }
82 
84 
86  G4bool omitable;
87  fpCommand = new G4UIcommand ("/vis/viewer/addCutawayPlane", this);
88  fpCommand -> SetGuidance
89  ("Add cutaway plane to current viewer.");
90  G4UIparameter* parameter;
91  parameter = new G4UIparameter("x",'d',omitable = true);
92  parameter -> SetDefaultValue (0);
93  parameter -> SetGuidance ("Coordinate of point on the plane.");
94  fpCommand->SetParameter(parameter);
95  parameter = new G4UIparameter("y",'d',omitable = true);
96  parameter -> SetDefaultValue (0);
97  parameter -> SetGuidance ("Coordinate of point on the plane.");
98  fpCommand->SetParameter(parameter);
99  parameter = new G4UIparameter("z",'d',omitable = true);
100  parameter -> SetDefaultValue (0);
101  parameter -> SetGuidance ("Coordinate of point on the plane.");
102  fpCommand->SetParameter(parameter);
103  parameter = new G4UIparameter("unit",'s',omitable = true);
104  parameter -> SetDefaultValue ("m");
105  parameter -> SetGuidance ("Unit of point on the plane.");
106  fpCommand->SetParameter(parameter);
107  parameter = new G4UIparameter("nx",'d',omitable = true);
108  parameter -> SetDefaultValue (1);
109  parameter -> SetGuidance ("Component of plane normal.");
110  fpCommand->SetParameter(parameter);
111  parameter = new G4UIparameter("ny",'d',omitable = true);
112  parameter -> SetDefaultValue (0);
113  parameter -> SetGuidance ("Component of plane normal.");
114  fpCommand->SetParameter(parameter);
115  parameter = new G4UIparameter("nz",'d',omitable = true);
116  parameter -> SetDefaultValue (0);
117  parameter -> SetGuidance ("Component of plane normal.");
118  fpCommand->SetParameter(parameter);
119 }
120 
122  delete fpCommand;
123 }
124 
126  return "";
127 }
128 
130 
132 
133  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
134  if (!viewer) {
135  if (verbosity >= G4VisManager::errors) {
136  G4cerr <<
137  "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
138  << G4endl;
139  }
140  return;
141  }
142 
143  G4double x, y, z, nx, ny, nz;
144  G4String unit;
145  std::istringstream is (newValue);
146  is >> x >> y >> z >> unit >> nx >> ny >> nz;
147  G4double F = G4UIcommand::ValueOf(unit);
148  x *= F; y *= F; z *= F;
149 
150  G4ViewParameters vp = viewer->GetViewParameters();
151  vp.AddCutawayPlane(G4Plane3D(G4Normal3D(nx,ny,nz), G4Point3D(x,y,z)));
152  if (verbosity >= G4VisManager::confirmations) {
153  G4cout << "Cutaway planes for viewer \"" << viewer->GetName() << "\" now:";
154  const G4Planes& cutaways = vp.GetCutawayPlanes();
155  for (size_t i = 0; i < cutaways.size(); ++i)
156  G4cout << "\n " << i << ": " << cutaways[i];
157  G4cout << G4endl;
158  }
159 
160  SetViewParameters(viewer, vp);
161 }
162 
164 
166  G4bool omitable;
167  fpCommand = new G4UIcommand ("/vis/viewer/changeCutawayPlane", this);
168  fpCommand -> SetGuidance("Change cutaway plane.");
169  G4UIparameter* parameter;
170  parameter = new G4UIparameter("index",'i',omitable = false);
171  parameter -> SetGuidance ("Index of plane: 0, 1, 2.");
172  fpCommand->SetParameter(parameter);
173  parameter = new G4UIparameter("x",'d',omitable = true);
174  parameter -> SetDefaultValue (0);
175  parameter -> SetGuidance ("Coordinate of point on the plane.");
176  fpCommand->SetParameter(parameter);
177  parameter = new G4UIparameter("y",'d',omitable = true);
178  parameter -> SetDefaultValue (0);
179  parameter -> SetGuidance ("Coordinate of point on the plane.");
180  fpCommand->SetParameter(parameter);
181  parameter = new G4UIparameter("z",'d',omitable = true);
182  parameter -> SetDefaultValue (0);
183  parameter -> SetGuidance ("Coordinate of point on the plane.");
184  fpCommand->SetParameter(parameter);
185  parameter = new G4UIparameter("unit",'s',omitable = true);
186  parameter -> SetDefaultValue ("m");
187  parameter -> SetGuidance ("Unit of point on the plane.");
188  fpCommand->SetParameter(parameter);
189  parameter = new G4UIparameter("nx",'d',omitable = true);
190  parameter -> SetDefaultValue (1);
191  parameter -> SetGuidance ("Component of plane normal.");
192  fpCommand->SetParameter(parameter);
193  parameter = new G4UIparameter("ny",'d',omitable = true);
194  parameter -> SetDefaultValue (0);
195  parameter -> SetGuidance ("Component of plane normal.");
196  fpCommand->SetParameter(parameter);
197  parameter = new G4UIparameter("nz",'d',omitable = true);
198  parameter -> SetDefaultValue (0);
199  parameter -> SetGuidance ("Component of plane normal.");
200  fpCommand->SetParameter(parameter);
201 }
202 
204  delete fpCommand;
205 }
206 
208  return "";
209 }
210 
212 
214 
215  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
216  if (!viewer) {
217  if (verbosity >= G4VisManager::errors) {
218  G4cerr <<
219  "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
220  << G4endl;
221  }
222  return;
223  }
224 
225  size_t index;
226  G4double x, y, z, nx, ny, nz;
227  G4String unit;
228  std::istringstream is (newValue);
229  is >> index >> x >> y >> z >> unit >> nx >> ny >> nz;
230  G4double F = G4UIcommand::ValueOf(unit);
231  x *= F; y *= F; z *= F;
232 
233  G4ViewParameters vp = viewer->GetViewParameters();
234  vp.ChangeCutawayPlane(index,
235  G4Plane3D(G4Normal3D(nx,ny,nz), G4Point3D(x,y,z)));
236  if (verbosity >= G4VisManager::confirmations) {
237  G4cout << "Cutaway planes for viewer \"" << viewer->GetName() << "\" now:";
238  const G4Planes& cutaways = vp.GetCutawayPlanes();
239  for (size_t i = 0; i < cutaways.size(); ++i)
240  G4cout << "\n " << i << ": " << cutaways[i];
241  G4cout << G4endl;
242  }
243 
244  SetViewParameters(viewer, vp);
245 }
246 
248 
250  G4bool omitable, currentAsDefault;
251  fpCommand = new G4UIcmdWithAString ("/vis/viewer/clear", this);
252  fpCommand -> SetGuidance ("Clears viewer.");
253  fpCommand -> SetGuidance
254  ("By default, clears current viewer. Specified viewer becomes current."
255  "\n\"/vis/viewer/list\" to see possible viewer names.");
256  fpCommand -> SetParameterName ("viewer-name",
257  omitable = true,
258  currentAsDefault = true);
259 }
260 
262  delete fpCommand;
263 }
264 
266  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
267  return viewer ? viewer -> GetName () : G4String("none");
268 }
269 
271 
273 
274  G4String& clearName = newValue;
275  G4VViewer* viewer = fpVisManager -> GetViewer (clearName);
276  if (!viewer) {
277  if (verbosity >= G4VisManager::errors) {
278  G4cerr << "ERROR: Viewer \"" << clearName
279  << "\" not found - \"/vis/viewer/list\" to see possibilities."
280  << G4endl;
281  }
282  return;
283  }
284 
285  viewer->SetView();
286  viewer->ClearView();
287  viewer->FinishView();
288  if (verbosity >= G4VisManager::confirmations) {
289  G4cout << "Viewer \"" << clearName << "\" cleared." << G4endl;
290  }
291 
292 }
293 
295 
298  ("/vis/viewer/clearCutawayPlanes", this);
299  fpCommand -> SetGuidance ("Clear cutaway planes of current viewer.");
300 }
301 
303  delete fpCommand;
304 }
305 
307  return "";
308 }
309 
311 
313 
314  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
315  if (!viewer) {
316  if (verbosity >= G4VisManager::errors) {
317  G4cerr <<
318  "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
319  << G4endl;
320  }
321  return;
322  }
323 
324  G4ViewParameters vp = viewer->GetViewParameters();
325  vp.ClearCutawayPlanes();
326  if (verbosity >= G4VisManager::confirmations) {
327  G4cout << "Cutaway planes for viewer \"" << viewer->GetName()
328  << "\" now cleared." << G4endl;
329  }
330 
331  SetViewParameters(viewer, vp);
332 }
333 
335 
337  G4bool omitable, currentAsDefault;
338  fpCommand = new G4UIcmdWithAString ("/vis/viewer/clearTransients", this);
339  fpCommand -> SetGuidance ("Clears transients from viewer.");
340  fpCommand -> SetGuidance
341  ("By default, operates on current viewer. Specified viewer becomes current."
342  "\n\"/vis/viewer/list\" to see possible viewer names.");
343  fpCommand -> SetParameterName ("viewer-name",
344  omitable = true,
345  currentAsDefault = true);
346 }
347 
349  delete fpCommand;
350 }
351 
353  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
354  return viewer ? viewer -> GetName () : G4String("none");
355 }
356 
358 
360 
361  G4String& clearName = newValue;
362  G4VViewer* viewer = fpVisManager -> GetViewer (clearName);
363  if (!viewer) {
364  if (verbosity >= G4VisManager::errors) {
365  G4cerr << "ERROR: Viewer \"" << clearName
366  << "\" not found - \"/vis/viewer/list\" to see possibilities."
367  << G4endl;
368  }
369  return;
370  }
371 
372  G4VSceneHandler* sceneHandler = viewer->GetSceneHandler();
373  sceneHandler->SetMarkForClearingTransientStore(false);
375  sceneHandler->ClearTransientStore();
376  if (verbosity >= G4VisManager::confirmations) {
377  G4cout << "Viewer \"" << clearName << "\" cleared of transients."
378  << G4endl;
379  }
380 
381 }
382 
384 
387  ("/vis/viewer/clearVisAttributesModifiers", this);
388  fpCommand -> SetGuidance ("Clear vis attribute modifiers of current viewer.");
389  fpCommand -> SetGuidance ("(These are used for touchables, etc.)");
390 }
391 
393  delete fpCommand;
394 }
395 
397  return "";
398 }
399 
401 
403 
404  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
405  if (!viewer) {
406  if (verbosity >= G4VisManager::errors) {
407  G4cerr <<
408  "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
409  << G4endl;
410  }
411  return;
412  }
413 
414  G4ViewParameters vp = viewer->GetViewParameters();
416  if (verbosity >= G4VisManager::confirmations) {
417  G4cout << "Vis attributes modifiers for viewer \"" << viewer->GetName()
418  << "\" now cleared." << G4endl;
419  }
420 
421  SetViewParameters(viewer, vp);
422 }
423 
425 
427  G4bool omitable;
428  fpCommand = new G4UIcommand ("/vis/viewer/clone", this);
429  fpCommand -> SetGuidance ("Clones viewer.");
430  fpCommand -> SetGuidance
431  ("By default, clones current viewer. Clone becomes current."
432  "\nClone name, if not provided, is derived from the original name."
433  "\n\"/vis/viewer/list\" to see possible viewer names.");
434  G4UIparameter* parameter;
435  parameter = new G4UIparameter ("original-viewer-name", 's', omitable = true);
436  parameter -> SetCurrentAsDefault (true);
437  fpCommand -> SetParameter (parameter);
438  parameter = new G4UIparameter ("clone-name", 's', omitable = true);
439  parameter -> SetDefaultValue ("none");
440  fpCommand -> SetParameter (parameter);
441 }
442 
444  delete fpCommand;
445 }
446 
448  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
449  G4String originalName = viewer ? viewer -> GetName () : G4String("none");
450  return "\"" + originalName + "\"";
451 }
452 
454 
456 
457  G4String originalName, cloneName;
458  std::istringstream is (newValue);
459 
460  // Need to handle the possibility that the names contain embedded
461  // blanks within quotation marks...
462  char c = ' ';
463  while (is.get(c) && c == ' '){}
464  if (c == '"') {
465  while (is.get(c) && c != '"') {originalName += c;}
466  }
467  else {
468  originalName += c;
469  while (is.get(c) && c != ' ') {originalName += c;}
470  }
471  originalName = originalName.strip (G4String::both, ' ');
472  originalName = originalName.strip (G4String::both, '"');
473 
474  G4VViewer* originalViewer = fpVisManager -> GetViewer (originalName);
475  if (!originalViewer) {
476  if (verbosity >= G4VisManager::errors) {
477  G4cerr << "ERROR: Viewer \"" << originalName
478  << "\" not found - \"/vis/viewer/list\" to see possibilities."
479  << G4endl;
480  }
481  return;
482  }
483  originalName = originalViewer->GetName(); // Ensures long name.
484 
485  while (is.get(c) && c == ' '){}
486  if (c == '"') {
487  while (is.get(c) && c != '"') {cloneName += c;}
488  }
489  else {
490  cloneName += c;
491  while (is.get(c) && c != ' ') {cloneName += c;}
492  }
493  cloneName = cloneName.strip (G4String::both, ' ');
494  cloneName = cloneName.strip (G4String::both, '"');
495 
496  G4bool errorWhileNaming = false;
497  if (cloneName == "none") {
498  G4int subID = 0;
499  do {
500  cloneName = originalName;
501  std::ostringstream oss;
502  oss << '-' << subID++;
503  G4String::size_type lastDashPosition, nextSpacePosition;
504  if ((lastDashPosition = cloneName.rfind('-')) != G4String::npos &&
505  (nextSpacePosition = cloneName.find(" ", lastDashPosition)) !=
506  G4String::npos) {
507  cloneName.insert(nextSpacePosition, oss.str());
508  } else {
509  G4String::size_type spacePosition = cloneName.find(' ');
510  if (spacePosition != G4String::npos)
511  cloneName.insert(spacePosition, oss.str());
512  else
513  errorWhileNaming = true;
514  }
515  } while (!errorWhileNaming && fpVisManager -> GetViewer (cloneName));
516  }
517 
518  if (errorWhileNaming) {
519  if (verbosity >= G4VisManager::errors) {
520  G4cerr << "ERROR: While naming clone viewer \"" << cloneName
521  << "\"."
522  << G4endl;
523  }
524  return;
525  }
526 
527  if (fpVisManager -> GetViewer (cloneName)) {
528  if (verbosity >= G4VisManager::errors) {
529  G4cerr << "ERROR: Putative clone viewer \"" << cloneName
530  << "\" already exists."
531  << G4endl;
532  }
533  return;
534  }
535 
536  G4String windowSizeHint =
537  originalViewer->GetViewParameters().GetXGeometryString();
538 
539  G4UImanager* UImanager = G4UImanager::GetUIpointer();
540  G4int keepVerbose = UImanager->GetVerboseLevel();
541  G4int newVerbose(0);
542  if (keepVerbose >= 2 ||
544  newVerbose = 2;
545  UImanager->SetVerboseLevel(newVerbose);
546  UImanager->ApplyCommand(G4String("/vis/viewer/select " + originalName));
547  UImanager->ApplyCommand
548  (G4String("/vis/viewer/create ! \"" + cloneName + "\" " + windowSizeHint));
549  UImanager->ApplyCommand(G4String("/vis/viewer/set/all " + originalName));
550  UImanager->SetVerboseLevel(keepVerbose);
551 
552  if (verbosity >= G4VisManager::confirmations) {
553  G4cout << "Viewer \"" << originalName << "\" cloned." << G4endl;
554  G4cout << "Clone \"" << cloneName << "\" now current." << G4endl;
555  }
556 }
557 
559 
561  G4bool omitable;
562  fpCommand = new G4UIcmdWithAString ("/vis/viewer/copyViewFrom", this);
563  fpCommand -> SetGuidance
564  ("Copy the camera-specific parameters from the specified viewer.");
565  fpCommand -> SetGuidance
566  ("Note: To copy scene modifications - style, etc. - please use"
567  "\n\"/vis/viewer/set/all\"");
568  fpCommand -> SetParameterName ("from-viewer-name", omitable = false);
569 }
570 
572  delete fpCommand;
573 }
574 
576  return "";
577 }
578 
580 
582 
583  G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
584  if (!currentViewer) {
585  if (verbosity >= G4VisManager::errors) {
586  G4cerr <<
587  "ERROR: G4VisCommandsViewerCopyViewFrom::SetNewValue: no current viewer."
588  << G4endl;
589  }
590  return;
591  }
592 
593  const G4String& fromViewerName = newValue;
594  G4VViewer* fromViewer = fpVisManager -> GetViewer (fromViewerName);
595  if (!fromViewer) {
596  if (verbosity >= G4VisManager::errors) {
597  G4cerr << "ERROR: Viewer \"" << fromViewerName
598  << "\" not found - \"/vis/viewer/list\" to see possibilities."
599  << G4endl;
600  }
601  return;
602  }
603 
604  if (fromViewer == currentViewer) {
605  if (verbosity >= G4VisManager::warnings) {
606  G4cout <<
607  "WARNING: G4VisCommandsViewerSet::SetNewValue:"
608  "\n from-viewer and current viewer are identical."
609  << G4endl;
610  }
611  return;
612  }
613 
614  // Copy camera-specific view parameters
615  G4ViewParameters vp = currentViewer->GetViewParameters();
616  const G4ViewParameters& fromVP = fromViewer->GetViewParameters();
620  vp.SetUpVector (fromVP.GetUpVector());
621  vp.SetFieldHalfAngle (fromVP.GetFieldHalfAngle());
622  vp.SetZoomFactor (fromVP.GetZoomFactor());
623  vp.SetScaleFactor (fromVP.GetScaleFactor());
625  vp.SetDolly (fromVP.GetDolly());
626  SetViewParameters(currentViewer, vp);
627 
628  if (verbosity >= G4VisManager::confirmations) {
629  G4cout << "Camera parameters of viewer \"" << currentViewer->GetName()
630  << "\"\n set to those of viewer \"" << fromViewer->GetName()
631  << "\"."
632  << G4endl;
633  }
634 }
635 
637 
639  G4bool omitable;
640  fpCommand = new G4UIcommand ("/vis/viewer/create", this);
641  fpCommand -> SetGuidance
642  ("Creates a viewer for the specified scene handler.");
643  fpCommand -> SetGuidance
644  ("Default scene handler is the current scene handler. Invents a name"
645  "\nif not supplied. (Note: the system adds information to the name"
646  "\nfor identification - only the characters up to the first blank are"
647  "\nused for removing, selecting, etc.) This scene handler and viewer"
648  "\nbecome current.");
649  G4UIparameter* parameter;
650  parameter = new G4UIparameter ("scene-handler", 's', omitable = true);
651  parameter -> SetCurrentAsDefault (true);
652  fpCommand -> SetParameter (parameter);
653  parameter = new G4UIparameter ("viewer-name", 's', omitable = true);
654  parameter -> SetCurrentAsDefault (true);
655  fpCommand -> SetParameter (parameter);
656  parameter = new G4UIparameter ("window-size-hint", 's', omitable = true);
657  parameter->SetGuidance
658  ("integer (pixels) for square window placed by window manager or"
659  " X-Windows-type geometry string, e.g. 600x600-100+100");
660  parameter->SetDefaultValue("600");
661  fpCommand -> SetParameter (parameter);
662 }
663 
665  delete fpCommand;
666 }
667 
669  std::ostringstream oss;
670  G4VSceneHandler* sceneHandler = fpVisManager -> GetCurrentSceneHandler ();
671  oss << "viewer-" << fId << " (";
672  if (sceneHandler) {
673  oss << sceneHandler -> GetGraphicsSystem () -> GetName ();
674  }
675  else {
676  oss << "no_scene_handlers";
677  }
678  oss << ")";
679  return oss.str();
680 }
681 
683  G4String currentValue;
684  G4VSceneHandler* currentSceneHandler =
685  fpVisManager -> GetCurrentSceneHandler ();
686  if (currentSceneHandler) {
687  currentValue = currentSceneHandler -> GetName ();
688  }
689  else {
690  currentValue = "none";
691  }
692  currentValue += ' ';
693  currentValue += '"';
694  currentValue += NextName ();
695  currentValue += '"';
696 
697  currentValue += " 600"; // Default number of pixels for window size hint.
698 
699  return currentValue;
700 }
701 
703 
705 
706  G4String sceneHandlerName, newName;
707  G4String windowSizeHintString;
708  std::istringstream is (newValue);
709  is >> sceneHandlerName;
710 
711  // Now need to handle the possibility that the second string
712  // contains embedded blanks within quotation marks...
713  char c = ' ';
714  while (is.get(c) && c == ' '){}
715  if (c == '"') {
716  while (is.get(c) && c != '"') {newName += c;}
717  }
718  else {
719  newName += c;
720  while (is.get(c) && c != ' ') {newName += c;}
721  }
722  newName = newName.strip (G4String::both, ' ');
723  newName = newName.strip (G4String::both, '"');
724 
725  // Now get window size hint...
726  is >> windowSizeHintString;
727 
728  const G4SceneHandlerList& sceneHandlerList =
729  fpVisManager -> GetAvailableSceneHandlers ();
730  G4int nHandlers = sceneHandlerList.size ();
731  if (nHandlers <= 0) {
732  if (verbosity >= G4VisManager::errors) {
733  G4cerr <<
734  "ERROR: G4VisCommandViewerCreate::SetNewValue: no scene handlers."
735  "\n Create a scene handler with \"/vis/sceneHandler/create\""
736  << G4endl;
737  }
738  return;
739  }
740 
741  G4int iHandler;
742  for (iHandler = 0; iHandler < nHandlers; iHandler++) {
743  if (sceneHandlerList [iHandler] -> GetName () == sceneHandlerName) break;
744  }
745 
746  if (iHandler < 0 || iHandler >= nHandlers) {
747  // Invalid command line argument or none.
748  // This shouldn't happen!!!!!!
749  if (verbosity >= G4VisManager::errors) {
750  G4cout << "G4VisCommandViewerCreate::SetNewValue:"
751  " invalid scene handler specified."
752  << G4endl;
753  }
754  return;
755  }
756 
757  // Valid index. Set current scene handler and graphics system in
758  // preparation for creating viewer.
759  G4VSceneHandler* sceneHandler = sceneHandlerList [iHandler];
760  if (sceneHandler != fpVisManager -> GetCurrentSceneHandler ()) {
761  fpVisManager -> SetCurrentSceneHandler (sceneHandler);
762  }
763 
764  // Now deal with name of viewer.
765  G4String nextName = NextName ();
766  if (newName == "") {
767  newName = nextName;
768  }
769  if (newName == nextName) fId++;
770  G4String newShortName = fpVisManager -> ViewerShortName (newName);
771 
772  for (G4int ih = 0; ih < nHandlers; ih++) {
773  G4VSceneHandler* sh = sceneHandlerList [ih];
774  const G4ViewerList& viewerList = sh -> GetViewerList ();
775  for (size_t iViewer = 0; iViewer < viewerList.size (); iViewer++) {
776  if (viewerList [iViewer] -> GetShortName () == newShortName ) {
777  if (verbosity >= G4VisManager::errors) {
778  G4cerr << "ERROR: Viewer \"" << newShortName << "\" already exists."
779  << G4endl;
780  }
781  return;
782  }
783  }
784  }
785 
786  // WindowSizeHint and XGeometryString are picked up from the vis
787  // manager in the G4VViewer constructor. In G4VisManager, after Viewer
788  // creation, we will store theses parameters in G4ViewParameters.
789 
790  fpVisManager -> CreateViewer (newName,windowSizeHintString);
791 
792  G4VViewer* newViewer = fpVisManager -> GetCurrentViewer ();
793  if (newViewer && newViewer -> GetName () == newName) {
794  if (verbosity >= G4VisManager::confirmations) {
795  G4cout << "New viewer \"" << newName << "\" created." << G4endl;
796  }
797  }
798  else {
799  if (verbosity >= G4VisManager::errors) {
800  if (newViewer) {
801  G4cerr << "ERROR: New viewer doesn\'t match!!! Curious!!" << G4endl;
802  } else {
803  G4cout << "WARNING: No viewer created." << G4endl;
804  }
805  }
806  }
807  // Refresh if appropriate...
808  if (newViewer) {
809  if (newViewer->GetViewParameters().IsAutoRefresh()) {
810  G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
811  }
812  else {
813  if (verbosity >= G4VisManager::warnings) {
814  G4cout << "Issue /vis/viewer/refresh or flush to see effect."
815  << G4endl;
816  }
817  }
818  }
819 }
820 
822 
824  fDollyIncrement (0.),
825  fDollyTo (0.)
826 {
827  G4bool omitable, currentAsDefault;
828 
830  ("/vis/viewer/dolly", this);
831  fpCommandDolly -> SetGuidance
832  ("Incremental dolly.");
833  fpCommandDolly -> SetGuidance
834  ("Moves the camera incrementally towards target point.");
835  fpCommandDolly -> SetParameterName("increment",
836  omitable=true,
837  currentAsDefault=true);
838  fpCommandDolly -> SetDefaultUnit("m");
839 
841  ("/vis/viewer/dollyTo", this);
842  fpCommandDollyTo -> SetGuidance
843  ("Dolly to specific coordinate.");
844  fpCommandDollyTo -> SetGuidance
845  ("Places the camera towards target point relative to standard camera point.");
846  fpCommandDollyTo -> SetParameterName("distance",
847  omitable=true,
848  currentAsDefault=true);
849  fpCommandDollyTo -> SetDefaultUnit("m");
850 }
851 
853  delete fpCommandDolly;
854  delete fpCommandDollyTo;
855 }
856 
858  G4String currentValue;
859  if (command == fpCommandDolly) {
860  currentValue = fpCommandDolly->ConvertToString(fDollyIncrement, "m");
861  }
862  else if (command == fpCommandDollyTo) {
863  currentValue = fpCommandDollyTo->ConvertToString(fDollyTo, "m");
864  }
865  return currentValue;
866 }
867 
869  G4String newValue) {
870 
871 
873 
874  G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
875  if (!currentViewer) {
876  if (verbosity >= G4VisManager::errors) {
877  G4cerr <<
878  "ERROR: G4VisCommandsViewerDolly::SetNewValue: no current viewer."
879  << G4endl;
880  }
881  return;
882  }
883 
884  G4ViewParameters vp = currentViewer->GetViewParameters();
885 
886  if (command == fpCommandDolly) {
889  }
890  else if (command == fpCommandDollyTo) {
892  vp.SetDolly(fDollyTo);
893  }
894 
895  if (verbosity >= G4VisManager::confirmations) {
896  G4cout << "Dolly distance changed to " << vp.GetDolly() << G4endl;
897  }
898 
899  SetViewParameters(currentViewer, vp);
900 }
901 
903 
905  G4bool omitable, currentAsDefault;
906  fpCommand = new G4UIcmdWithAString ("/vis/viewer/flush", this);
907  fpCommand -> SetGuidance
908  ("Compound command: \"/vis/viewer/refresh\" + \"/vis/viewer/update\".");
909  fpCommand -> SetGuidance
910  ("Useful for refreshing and initiating post-processing for graphics"
911  "\nsystems which need post-processing. By default, acts on current"
912  "\nviewer. \"/vis/viewer/list\" to see possible viewers. Viewer"
913  "\nbecomes current.");
914  fpCommand -> SetParameterName ("viewer-name",
915  omitable = true,
916  currentAsDefault = true);
917 }
918 
920  delete fpCommand;
921 }
922 
925  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
926  return viewer ? viewer -> GetName () : G4String("none");
927 }
928 
930 
932 
933  G4String& flushName = newValue;
934  G4VViewer* viewer = fpVisManager -> GetViewer (flushName);
935  if (!viewer) {
936  if (verbosity >= G4VisManager::errors) {
937  G4cerr << "ERROR: Viewer \"" << flushName << "\"" <<
938  " not found - \"/vis/viewer/list\"\n to see possibilities."
939  << G4endl;
940  }
941  return;
942  }
943 
945  G4int keepVerbose = ui->GetVerboseLevel();
946  G4int newVerbose(0);
947  if (keepVerbose >= 2 || verbosity >= G4VisManager::confirmations)
948  newVerbose = 2;
949  ui->SetVerboseLevel(newVerbose);
950  ui->ApplyCommand(G4String("/vis/viewer/refresh " + flushName));
951  ui->ApplyCommand(G4String("/vis/viewer/update " + flushName));
952  ui->SetVerboseLevel(keepVerbose);
953  if (verbosity >= G4VisManager::confirmations) {
954  G4cout << "Viewer \"" << viewer -> GetName () << "\""
955  << " flushed." << G4endl;
956  }
957 }
958 
960 
961 #ifndef WIN32
962 // popen is not available in Windows. _popen is said to be available in
963 // Windows but this has not been tried.
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  const G4double waitTimePerPoint =
1041  G4UIcommand::ConvertToDimensionedDouble((waitTimePerPointString + ' ' + timeUnit).c_str());
1042  G4int waitTimePerPointmilliseconds = waitTimePerPoint/millisecond;
1043  if (waitTimePerPointmilliseconds < 0) waitTimePerPointmilliseconds = 0;
1044 
1045  // Execute pattern and get resulting list of filles
1046  G4String shellCommand = "echo " + pattern;
1047  FILE *filelist = popen(shellCommand.c_str(), "r");
1048  if (!filelist) {
1049  if (verbosity >= G4VisManager::errors) {
1050  G4cerr
1051  << "ERROR: G4VisCommandViewerInterpolate::SetNewValue:"
1052  << "\n Error obtaining pipe."
1053  << G4endl;
1054  }
1055  return;
1056  }
1057 
1058  // Save current view parameters
1059  G4ViewParameters saveVP = currentViewer->GetViewParameters();
1060 
1061  // Save current verbosities
1062  G4VisManager::Verbosity keepVisVerbosity = fpVisManager->GetVerbosity();
1064  G4int keepUIVerbosity = ui->GetVerboseLevel();
1065 
1066  // Set verbosities for this operation
1068  ui->SetVerboseLevel(0);
1069 
1070  // Switch off auto-refresh while we read in the view files (it will be
1071  // restored later). Note: the view files do not set auto-refresh.
1072  G4ViewParameters non_auto = saveVP;
1073  non_auto.SetAutoRefresh(false);
1074  currentViewer->SetViewParameters(non_auto);
1075 
1076  // Build view vector of way points
1077  std::vector<G4ViewParameters> viewVector;
1078  const size_t BUFLENGTH = 999999;
1079  char buf[BUFLENGTH];
1080  fgets(buf, BUFLENGTH, filelist);
1081  std::istringstream fileliststream(buf);
1082  const G4int safety = 9999;
1083  G4int safetyCount = 0;
1084  G4String pathname;
1085  while (fileliststream >> pathname
1086  && safetyCount++ < safety) { // Loop checking, 16.02.2016, J.Allison
1087  ui->ApplyCommand("/control/execute " + pathname);
1088  viewVector.push_back(currentViewer->GetViewParameters());
1089  }
1090 
1091  if (safetyCount >= safety) {
1092  if (verbosity >= G4VisManager::errors) {
1093  G4cout <<
1094  "/vis/viewer/interpolate:"
1095  "\n the number of way points exceeds the maximum currently allowed: "
1096  << safety << G4endl;
1097  }
1098  pclose(filelist);
1099  return;
1100  }
1101 
1102  // Interpolate views
1103  safetyCount = 0;
1104  do {
1105  G4ViewParameters* vp =
1106  G4ViewParameters::CatmullRomCubicSplineInterpolation(viewVector,nInterpolationPoints);
1107  if (!vp) break; // Finished.
1108  // Set original auto-refresh status.
1109  vp->SetAutoRefresh(saveVP.IsAutoRefresh());
1110  currentViewer->SetViewParameters(*vp);
1111  currentViewer->RefreshView();
1112  if (exportString == "export" &&
1113  currentViewer->GetName().contains("OpenGL"))
1114  ui->ApplyCommand("/vis/ogl/export");
1115 #ifdef G4VIS_USE_STD11
1116  if (waitTimePerPointmilliseconds > 0)
1117  std::this_thread::sleep_for(std::chrono::milliseconds(waitTimePerPointmilliseconds));
1118 #endif
1119  } while (safetyCount++ < safety); // Loop checking, 16.02.2016, J.Allison
1120 
1121  // Restore original verbosities
1122  ui->SetVerboseLevel(keepUIVerbosity);
1123  fpVisManager->SetVerboseLevel(keepVisVerbosity);
1124 
1125  // Restore original view parameters
1126  currentViewer->SetViewParameters(saveVP);
1127  currentViewer->RefreshView();
1128  if (verbosity >= G4VisManager::confirmations) {
1129  G4cout << "Viewer \"" << currentViewer -> GetName () << "\""
1130  << " restored." << G4endl;
1131  }
1132 
1133  pclose(filelist);
1134 }
1135 
1136 #endif // WIN32 - popen is not available in Windows. _popen is there but not tried.
1137 
1139 
1141  G4bool omitable;
1142  fpCommand = new G4UIcommand ("/vis/viewer/list", this);
1143  fpCommand -> SetGuidance ("Lists viewers(s).");
1144  fpCommand -> SetGuidance
1145  ("See \"/vis/verbose\" for definition of verbosity.");
1146  G4UIparameter* parameter;
1147  parameter = new G4UIparameter("viewer-name", 's',
1148  omitable = true);
1149  parameter -> SetDefaultValue ("all");
1150  fpCommand -> SetParameter (parameter);
1151  parameter = new G4UIparameter ("verbosity", 's',
1152  omitable = true);
1153  parameter -> SetDefaultValue ("warnings");
1154  fpCommand -> SetParameter (parameter);
1155 }
1156 
1158  delete fpCommand;
1159 }
1160 
1162  return "";
1163 }
1164 
1166  G4String name, verbosityString;
1167  std::istringstream is (newValue);
1168  is >> name >> verbosityString;
1169  G4String shortName = fpVisManager -> ViewerShortName (name);
1170  G4VisManager::Verbosity verbosity =
1171  fpVisManager->GetVerbosityValue(verbosityString);
1172 
1173  const G4VViewer* currentViewer = fpVisManager -> GetCurrentViewer ();
1174  G4String currentViewerShortName;
1175  if (currentViewer) {
1176  currentViewerShortName = currentViewer -> GetShortName ();
1177  }
1178  else {
1179  currentViewerShortName = "none";
1180  }
1181 
1182  const G4SceneHandlerList& sceneHandlerList =
1183  fpVisManager -> GetAvailableSceneHandlers ();
1184  G4int nHandlers = sceneHandlerList.size ();
1185  G4bool found = false;
1186  G4bool foundCurrent = false;
1187  for (int iHandler = 0; iHandler < nHandlers; iHandler++) {
1188  G4VSceneHandler* sceneHandler = sceneHandlerList [iHandler];
1189  const G4ViewerList& viewerList = sceneHandler -> GetViewerList ();
1190  G4cout
1191  << "Scene handler \"" << sceneHandler -> GetName () << "\" ("
1192  << sceneHandler->GetGraphicsSystem()->GetNickname() << ')';
1193  const G4Scene* pScene = sceneHandler -> GetScene ();
1194  if (pScene) {
1195  G4cout << ", scene \"" << pScene -> GetName () << "\"";
1196  }
1197  G4cout << ':';
1198  G4int nViewers = viewerList.size ();
1199  if (nViewers == 0) {
1200  G4cout << "\n No viewers for this scene handler." << G4endl;
1201  }
1202  else {
1203  for (int iViewer = 0; iViewer < nViewers; iViewer++) {
1204  const G4VViewer* thisViewer = viewerList [iViewer];
1205  G4String thisName = thisViewer -> GetName ();
1206  G4String thisShortName = thisViewer -> GetShortName ();
1207  if (name != "all") {
1208  if (thisShortName != shortName) continue;
1209  }
1210  found = true;
1211  G4cout << "\n ";
1212  if (thisShortName == currentViewerShortName) {
1213  foundCurrent = true;
1214  G4cout << "(current)";
1215  }
1216  else {
1217  G4cout << " ";
1218  }
1219  G4cout << " viewer \"" << thisName << "\"";
1220  if (verbosity >= G4VisManager::parameters) {
1221  G4cout << "\n " << *thisViewer;
1222  }
1223  }
1224  }
1225  G4cout << G4endl;
1226  }
1227 
1228  if (!foundCurrent) {
1229  G4cout << "No valid current viewer - please create or select one."
1230  << G4endl;
1231  }
1232 
1233  if (!found) {
1234  G4cout << "No viewers";
1235  if (name != "all") {
1236  G4cout << " of name \"" << name << "\"";
1237  }
1238  G4cout << " found." << G4endl;
1239  }
1240 }
1241 
1243 
1245  fPanIncrementRight (0.),
1246  fPanIncrementUp (0.),
1247  fPanToRight (0.),
1248  fPanToUp (0.)
1249 {
1250  G4bool omitable;
1251 
1253  ("/vis/viewer/pan", this);
1254  fpCommandPan -> SetGuidance
1255  ("Incremental pan.");
1256  fpCommandPan -> SetGuidance
1257  ("Moves the camera incrementally right and up by these amounts (as seen"
1258  "\nfrom viewpoint direction).");
1259  G4UIparameter* parameter;
1260  parameter = new G4UIparameter("right-increment", 'd', omitable = true);
1261  parameter -> SetCurrentAsDefault (true);
1262  fpCommandPan -> SetParameter (parameter);
1263  parameter = new G4UIparameter("up-increment", 'd', omitable = true);
1264  parameter -> SetCurrentAsDefault (true);
1265  fpCommandPan -> SetParameter (parameter);
1266  parameter = new G4UIparameter ("unit", 's', omitable = true);
1267  parameter -> SetDefaultValue ("m");
1268  fpCommandPan -> SetParameter (parameter);
1269 
1271  ("/vis/viewer/panTo", this);
1272  fpCommandPanTo -> SetGuidance
1273  ("Pan to specific coordinate.");
1274  fpCommandPanTo -> SetGuidance
1275  ("Places the camera in this position right and up relative to standard"
1276  "\ntarget point (as seen from viewpoint direction).");
1277  parameter = new G4UIparameter("right", 'd', omitable = true);
1278  parameter -> SetCurrentAsDefault (true);
1279  fpCommandPanTo -> SetParameter (parameter);
1280  parameter = new G4UIparameter("up", 'd', omitable = true);
1281  parameter -> SetCurrentAsDefault (true);
1282  fpCommandPanTo -> SetParameter (parameter);
1283  parameter = new G4UIparameter ("unit", 's', omitable = true);
1284  parameter -> SetDefaultValue ("m");
1285  fpCommandPanTo -> SetParameter (parameter);
1286 }
1287 
1289  delete fpCommandPan;
1290  delete fpCommandPanTo;
1291 }
1292 
1294  G4String currentValue;
1295  if (command == fpCommandPan) {
1296  currentValue = ConvertToString(fPanIncrementRight, fPanIncrementUp, "m");
1297  }
1298  else if (command == fpCommandPanTo) {
1299  currentValue = ConvertToString(fPanToRight, fPanToUp, "m");
1300  }
1301  return currentValue;
1302 }
1303 
1305  G4String newValue) {
1306 
1307 
1309 
1310  G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
1311  if (!currentViewer) {
1312  if (verbosity >= G4VisManager::errors) {
1313  G4cerr <<
1314  "ERROR: G4VisCommandsViewerPan::SetNewValue: no current viewer."
1315  << G4endl;
1316  }
1317  return;
1318  }
1319 
1320  G4ViewParameters vp = currentViewer->GetViewParameters();
1321 
1322  if (command == fpCommandPan) {
1325  }
1326  else if (command == fpCommandPanTo) {
1329  }
1330 
1331  if (verbosity >= G4VisManager::confirmations) {
1332  G4cout << "Current target point now " << vp.GetCurrentTargetPoint()
1333  << G4endl;
1334  }
1335 
1336  SetViewParameters(currentViewer, vp);
1337 }
1338 
1340 
1342  G4bool omitable, currentAsDefault;
1343  fpCommand = new G4UIcmdWithAString ("/vis/viewer/rebuild", this);
1344  fpCommand -> SetGuidance ("Forces rebuild of graphical database.");
1345  fpCommand -> SetGuidance
1346  ("By default, acts on current viewer. \"/vis/viewer/list\""
1347  "\nto see possible viewers. Viewer becomes current.");
1348  fpCommand -> SetParameterName ("viewer-name",
1349  omitable = true,
1350  currentAsDefault = true);
1351 }
1352 
1354  delete fpCommand;
1355 }
1356 
1358  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
1359  if (viewer) {
1360  return viewer -> GetName ();
1361  }
1362  else {
1363  return "none";
1364  }
1365 }
1366 
1368 
1370 
1371  G4String& rebuildName = newValue;
1372 
1373  G4VViewer* viewer = fpVisManager -> GetViewer (rebuildName);
1374  if (!viewer) {
1375  if (verbosity >= G4VisManager::errors) {
1376  G4cerr << "ERROR: Viewer \"" << rebuildName
1377  << "\" not found - \"/vis/viewer/list\" to see possibilities."
1378  << G4endl;
1379  }
1380  return;
1381  }
1382 
1383  G4VSceneHandler* sceneHandler = viewer->GetSceneHandler();
1384  if (!sceneHandler) {
1385  if (verbosity >= G4VisManager::errors) {
1386  G4cerr << "ERROR: Viewer \"" << viewer->GetName() << "\"" <<
1387  " has no scene handler - report serious bug."
1388  << G4endl;
1389  }
1390  return;
1391  }
1392 
1393  sceneHandler->ClearTransientStore();
1394  viewer->NeedKernelVisit();
1395  viewer->SetView();
1396  viewer->ClearView();
1397  viewer->DrawView();
1398 
1399  // Check auto-refresh and print confirmations.
1400  RefreshIfRequired(viewer);
1401 }
1402 
1404 
1406  G4bool omitable, currentAsDefault;
1407  fpCommand = new G4UIcmdWithAString ("/vis/viewer/refresh", this);
1408  fpCommand -> SetGuidance
1409  ("Refreshes viewer.");
1410  fpCommand -> SetGuidance
1411  ("By default, acts on current viewer. \"/vis/viewer/list\""
1412  "\nto see possible viewers. Viewer becomes current.");
1413  fpCommand -> SetParameterName ("viewer-name",
1414  omitable = true,
1415  currentAsDefault = true);
1416 }
1417 
1419  delete fpCommand;
1420 }
1421 
1423  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
1424  return viewer ? viewer -> GetName () : G4String("none");
1425 }
1426 
1428 
1430  G4bool warn(verbosity >= G4VisManager::warnings);
1431 
1432  G4String& refreshName = newValue;
1433  G4VViewer* viewer = fpVisManager -> GetViewer (refreshName);
1434  if (!viewer) {
1435  if (verbosity >= G4VisManager::errors) {
1436  G4cerr << "ERROR: Viewer \"" << refreshName << "\"" <<
1437  " not found - \"/vis/viewer/list\"\n 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 \"" << refreshName << "\"" <<
1447  " has no scene handler - report serious bug."
1448  << G4endl;
1449  }
1450  return;
1451  }
1452 
1453  G4Scene* scene = sceneHandler->GetScene();
1454  if (!scene) {
1455  if (verbosity >= G4VisManager::confirmations) {
1456  G4cout << "NOTE: SceneHandler \"" << sceneHandler->GetName()
1457  << "\", to which viewer \"" << refreshName << "\"" <<
1458  "\n is attached, has no scene - \"/vis/scene/create\" and"
1459  " \"/vis/sceneHandler/attach\""
1460  "\n (or use compound command \"/vis/drawVolume\")."
1461  << G4endl;
1462  }
1463  return;
1464  }
1465  if (scene->GetRunDurationModelList().empty()) {
1466  G4bool successful = scene -> AddWorldIfEmpty (warn);
1467  if (!successful) {
1468  if (verbosity >= G4VisManager::warnings) {
1469  G4cout <<
1470  "WARNING: Scene is empty. Perhaps no geometry exists."
1471  "\n Try /run/initialize."
1472  << G4endl;
1473  }
1474  return;
1475  }
1476  // Scene has changed. UpdateVisManagerScene issues
1477  // /vis/scene/notifyHandlers, which does a refresh anyway, so the
1478  // ordinary refresh becomes part of the else phrase...
1479  UpdateVisManagerScene(scene->GetName());
1480  } else {
1481  if (verbosity >= G4VisManager::confirmations) {
1482  G4cout << "Refreshing viewer \"" << viewer -> GetName () << "\"..."
1483  << G4endl;
1484  }
1485  viewer -> SetView ();
1486  viewer -> ClearView ();
1487  viewer -> DrawView ();
1488  if (verbosity >= G4VisManager::confirmations) {
1489  G4cout << "Viewer \"" << viewer -> GetName () << "\"" << " refreshed."
1490  "\n (You might also need \"/vis/viewer/update\".)" << G4endl;
1491  }
1492  }
1493 }
1494 
1496 
1498  G4bool omitable, currentAsDefault;
1499  fpCommand = new G4UIcmdWithAString ("/vis/viewer/reset", this);
1500  fpCommand -> SetGuidance ("Resets viewer.");
1501  fpCommand -> SetGuidance
1502  ("By default, acts on current viewer. \"/vis/viewer/list\""
1503  "\nto see possible viewers. Viewer becomes current.");
1504  fpCommand -> SetParameterName ("viewer-name",
1505  omitable = true,
1506  currentAsDefault = true);
1507 }
1508 
1510  delete fpCommand;
1511 }
1512 
1514  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
1515  if (viewer) {
1516  return viewer -> GetName ();
1517  }
1518  else {
1519  return "none";
1520  }
1521 }
1522 
1524 
1526 
1527  G4String& resetName = newValue;
1528  G4VViewer* viewer = fpVisManager -> GetViewer (resetName);
1529  if (!viewer) {
1530  if (verbosity >= G4VisManager::errors) {
1531  G4cerr << "ERROR: Viewer \"" << resetName
1532  << "\" not found - \"/vis/viewer/list\" to see possibilities."
1533  << G4endl;
1534  }
1535  return;
1536  }
1537 
1538  viewer->ResetView();
1539  RefreshIfRequired(viewer);
1540 }
1541 
1543 
1545  G4bool omitable;
1546  fpCommand = new G4UIcmdWithAString ("/vis/viewer/save", this);
1547  fpCommand -> SetGuidance
1548  ("Write commands that define the current view to file.");
1549  fpCommand -> SetGuidance
1550  ("Read them back into the same or any viewer with \"/control/execute\".");
1551  fpCommand -> SetGuidance
1552  ("If the filename is omitted the view is saved to a file "
1553  "\"g4_nn.g4view\", where nn is a sequential two-digit number.");
1554  fpCommand -> SetGuidance
1555  ("If the filename is \"-\", the data are written to G4cout.");
1556  fpCommand -> SetGuidance
1557  ("If you are wanting to save views for future interpolation a recommended "
1558  "procedure is: save views to \"g4_nn.g4view\", as above, then move the files "
1559  "into a sub-directory, say, \"views\", then interpolate with"
1560  "\"/vis/viewer/interpolate views/\" (note the trailing \'/\').");
1561  fpCommand -> SetParameterName ("filename", omitable = true);
1562  fpCommand -> SetDefaultValue ("");
1563 }
1564 
1566  delete fpCommand;
1567 }
1568 
1571  return "";
1572 }
1573 
1574 namespace {
1575  void WriteCommands
1576  (std::ostream& os,
1577  const G4ViewParameters& vp,
1578  const G4Point3D& stp) // Standard Target Point
1579  {
1580  os
1581  << vp.CameraAndLightingCommands(stp)
1582  << vp.DrawingStyleCommands()
1583  << vp.SceneModifyingCommands()
1584  << vp.TouchableCommands()
1585  << std::endl;
1586  }
1587 }
1588 
1590 
1592 
1593  const G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
1594  if (!currentViewer) {
1595  if (verbosity >= G4VisManager::errors) {
1596  G4cerr <<
1597  "ERROR: G4VisCommandsViewerSave::SetNewValue: no current viewer."
1598  << G4endl;
1599  }
1600  return;
1601  }
1602 
1603  const G4Scene* currentScene = currentViewer->GetSceneHandler()->GetScene();
1604  if (!currentScene) {
1605  if (verbosity >= G4VisManager::errors) {
1606  G4cerr <<
1607  "ERROR: G4VisCommandsViewerSave::SetNewValue: no current scene."
1608  << G4endl;
1609  }
1610  return;
1611  }
1612 
1613  // Get view parameters and ther relevant information.
1614  G4ViewParameters vp = currentViewer->GetViewParameters();
1615  // Concatenate any private vis attributes modifiers...
1616  const std::vector<G4ModelingParameters::VisAttributesModifier>*
1617  privateVAMs = currentViewer->GetPrivateVisAttributesModifiers();
1618  if (privateVAMs) {
1619  std::vector<G4ModelingParameters::VisAttributesModifier>::const_iterator i;
1620  for (i = privateVAMs->begin(); i != privateVAMs->end(); ++i) {
1621  vp.AddVisAttributesModifier(*i);
1622  }
1623  }
1624  const G4Point3D& stp = currentScene->GetStandardTargetPoint();
1625 
1626  G4String filename = newValue;
1627  if (newValue.length() == 0) {
1628  // Null filename - generate a filename
1629  const G4int maxNoOfFiles = 100;
1630  static G4int sequenceNumber = 0;
1631  if (sequenceNumber >= maxNoOfFiles) {
1632  if (verbosity >= G4VisManager::errors) {
1633  G4cerr
1634  << "ERROR: G4VisCommandsViewerSave::SetNewValue: Maximum number, "
1635  << maxNoOfFiles
1636  << ", of files exceeded."
1637  << G4endl;
1638  }
1639  return;
1640  }
1641  std::ostringstream oss;
1642  oss << std::setw(2) << std::setfill('0') << sequenceNumber++;
1643  filename = "g4_" + oss.str() + ".g4view";
1644  }
1645 
1646  if (filename == "-") {
1647  // Write to standard output
1648  WriteCommands(G4cout,vp,stp);
1649  } else {
1650  // Write to file
1651  std::ofstream ofs(filename);
1652  if (!ofs) {
1653  if (verbosity >= G4VisManager::errors) {
1654  G4cerr <<
1655  "ERROR: G4VisCommandsViewerSave::SetNewValue: Trouble opening file \""
1656  << filename << "\"."
1657  << G4endl;
1658  }
1659  ofs.close();
1660  return;
1661  }
1662  WriteCommands(ofs,vp,stp);
1663  ofs.close();
1664  }
1665 
1666  if (verbosity >= G4VisManager::warnings) {
1667  G4cout << "Viewer \"" << currentViewer -> GetName ()
1668  << "\"" << " saved to ";
1669  if (filename == "-") {
1670  G4cout << "G4cout.";
1671  } else {
1672  G4cout << "file \'" << filename << "\"." <<
1673  "\n Read the view back into this or any viewer with"
1674  "\n \"/control/execute " << filename << "\" or use"
1675  "\n \"/vis/viewer/interpolate\" if you have several saved files -"
1676  "\n see \"help /vis/viewer/interpolate\" for guidance.";
1677  }
1678  G4cout << G4endl;
1679  }
1680 }
1681 
1683 
1685  fScaleMultiplier (G4Vector3D (1., 1., 1.)),
1686  fScaleTo (G4Vector3D (1., 1., 1.))
1687 {
1688  G4bool omitable, currentAsDefault;
1689 
1691  ("/vis/viewer/scale", this);
1692  fpCommandScale -> SetGuidance ("Incremental (non-uniform) scaling.");
1693  fpCommandScale -> SetGuidance
1694  ("Multiplies components of current scaling by components of this factor."
1695  "\n Scales (x,y,z) by corresponding components of the resulting factor.");
1696  fpCommandScale -> SetGuidance
1697  ("");
1698  fpCommandScale -> SetParameterName
1699  ("x-scale-multiplier","y-scale-multiplier","z-scale-multiplier",
1700  omitable=true, currentAsDefault=true);
1701 
1703  ("/vis/viewer/scaleTo", this);
1704  fpCommandScaleTo -> SetGuidance ("Absolute (non-uniform) scaling.");
1705  fpCommandScaleTo -> SetGuidance
1706  ("Scales (x,y,z) by corresponding components of this factor.");
1707  fpCommandScaleTo -> SetParameterName
1708  ("x-scale-factor","y-scale-factor","z-scale-factor",
1709  omitable=true, currentAsDefault=true);
1710 }
1711 
1713  delete fpCommandScale;
1714  delete fpCommandScaleTo;
1715 }
1716 
1718  G4String currentValue;
1719  if (command == fpCommandScale) {
1721  }
1722  else if (command == fpCommandScaleTo) {
1724  }
1725  return currentValue;
1726 }
1727 
1729  G4String newValue) {
1730 
1731 
1733 
1734  G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
1735  if (!currentViewer) {
1736  if (verbosity >= G4VisManager::errors) {
1737  G4cerr <<
1738  "ERROR: G4VisCommandsViewerScale::SetNewValue: no current viewer."
1739  << G4endl;
1740  }
1741  return;
1742  }
1743 
1744  G4ViewParameters vp = currentViewer->GetViewParameters();
1745 
1746  if (command == fpCommandScale) {
1749  }
1750  else if (command == fpCommandScaleTo) {
1753  }
1754 
1755  if (verbosity >= G4VisManager::confirmations) {
1756  G4cout << "Scale factor changed to " << vp.GetScaleFactor() << G4endl;
1757  }
1758 
1759  SetViewParameters(currentViewer, vp);
1760 }
1761 
1763 
1765  G4bool omitable;
1766  fpCommand = new G4UIcmdWithAString ("/vis/viewer/select", this);
1767  fpCommand -> SetGuidance ("Selects viewer.");
1768  fpCommand -> SetGuidance
1769  ("Specify viewer by name. \"/vis/viewer/list\" to see possible viewers.");
1770  fpCommand -> SetParameterName ("viewer-name", omitable = false);
1771 }
1772 
1774  delete fpCommand;
1775 }
1776 
1778  return "";
1779 }
1780 
1782 
1784 
1785  G4String& selectName = newValue;
1786  G4VViewer* viewer = fpVisManager -> GetViewer (selectName);
1787 
1788  if (!viewer) {
1789  if (verbosity >= G4VisManager::errors) {
1790  G4cerr << "ERROR: Viewer \"" << selectName << "\"";
1791  G4cerr << " not found - \"/vis/viewer/list\""
1792  "\n to see possibilities."
1793  << G4endl;
1794  }
1795  return;
1796  }
1797 
1798  if (viewer == fpVisManager -> GetCurrentViewer ()) {
1799  if (verbosity >= G4VisManager::warnings) {
1800  G4cout << "WARNING: Viewer \"" << viewer -> GetName () << "\""
1801  << " already selected." << G4endl;
1802  }
1803  return;
1804  }
1805 
1806  // Set pointers, call SetView and print confirmation.
1807  fpVisManager -> SetCurrentViewer (viewer);
1808 
1809  RefreshIfRequired(viewer);
1810 }
1811 
1813 
1815  G4bool omitable, currentAsDefault;
1816  fpCommand = new G4UIcmdWithAString ("/vis/viewer/update", this);
1817  fpCommand -> SetGuidance
1818  ("Triggers graphical database post-processing for viewers"
1819  "\nusing that technique.");
1820  fpCommand -> SetGuidance
1821  ("For such viewers the view only becomes visible with this command."
1822  "\nBy default, acts on current viewer. \"/vis/viewer/list\""
1823  "\nto see possible viewers. Viewer becomes current.");
1824  fpCommand -> SetParameterName ("viewer-name",
1825  omitable = true,
1826  currentAsDefault = true);
1827 }
1828 
1830  delete fpCommand;
1831 }
1832 
1834  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
1835  if (viewer) {
1836  return viewer -> GetName ();
1837  }
1838  else {
1839  return "none";
1840  }
1841 }
1842 
1844 
1846 
1847  G4String& updateName = newValue;
1848 
1849  G4VViewer* viewer = fpVisManager -> GetViewer (updateName);
1850  if (!viewer) {
1851  if (verbosity >= G4VisManager::errors) {
1852  G4cout <<
1853  "WARNING: command \"/vis/viewer/update\" could not be applied: no current viewer."
1854  << G4endl;
1855  }
1856  return;
1857  }
1858 
1859  G4VSceneHandler* sceneHandler = viewer->GetSceneHandler();
1860  if (!sceneHandler) {
1861  if (verbosity >= G4VisManager::errors) {
1862  G4cerr << "ERROR: Viewer \"" << updateName << "\"" <<
1863  " has no scene handler - report serious bug."
1864  << G4endl;
1865  }
1866  return;
1867  }
1868 
1869  G4Scene* scene = sceneHandler->GetScene();
1870  if (!scene) {
1871  if (verbosity >= G4VisManager::confirmations) {
1872  G4cout << "NOTE: SceneHandler \"" << sceneHandler->GetName()
1873  << "\", to which viewer \"" << updateName << "\"" <<
1874  "\n is attached, has no scene - \"/vis/scene/create\" and"
1875  " \"/vis/sceneHandler/attach\""
1876  "\n (or use compound command \"/vis/drawVolume\")."
1877  << G4endl;
1878  }
1879  return;
1880  }
1881 
1882  if (verbosity >= G4VisManager::confirmations) {
1883  G4cout << "Viewer \"" << viewer -> GetName () << "\"";
1884  G4cout << " post-processing triggered." << G4endl;
1885  }
1886  viewer -> ShowView ();
1887  // Assume future need to "refresh" transients...
1888  sceneHandler -> SetMarkForClearingTransientStore(true);
1889 }
1890 
1892 
1894  fZoomMultiplier (1.),
1895  fZoomTo (1.)
1896 {
1897  G4bool omitable, currentAsDefault;
1898 
1900  ("/vis/viewer/zoom", this);
1901  fpCommandZoom -> SetGuidance ("Incremental zoom.");
1902  fpCommandZoom -> SetGuidance
1903  ("Multiplies current magnification by this factor.");
1904  fpCommandZoom -> SetParameterName("multiplier",
1905  omitable=true,
1906  currentAsDefault=true);
1907 
1909  ("/vis/viewer/zoomTo", this);
1910  fpCommandZoomTo -> SetGuidance ("Absolute zoom.");
1911  fpCommandZoomTo -> SetGuidance
1912  ("Magnifies standard magnification by this factor.");
1913  fpCommandZoomTo -> SetParameterName("factor",
1914  omitable=true,
1915  currentAsDefault=true);
1916 }
1917 
1919  delete fpCommandZoom;
1920  delete fpCommandZoomTo;
1921 }
1922 
1924  G4String currentValue;
1925  if (command == fpCommandZoom) {
1927  }
1928  else if (command == fpCommandZoomTo) {
1929  currentValue = fpCommandZoomTo->ConvertToString(fZoomTo);
1930  }
1931  return currentValue;
1932 }
1933 
1935  G4String newValue) {
1936 
1937 
1939 
1940  G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
1941  if (!currentViewer) {
1942  if (verbosity >= G4VisManager::errors) {
1943  G4cerr <<
1944  "ERROR: G4VisCommandsViewerZoom::SetNewValue: no current viewer."
1945  << G4endl;
1946  }
1947  return;
1948  }
1949 
1950  G4ViewParameters vp = currentViewer->GetViewParameters();
1951 
1952  if (command == fpCommandZoom) {
1955  }
1956  else if (command == fpCommandZoomTo) {
1958  vp.SetZoomFactor(fZoomTo);
1959  }
1960 
1961  if (verbosity >= G4VisManager::confirmations) {
1962  G4cout << "Zoom factor changed to " << vp.GetZoomFactor() << G4endl;
1963  }
1964 
1965  SetViewParameters(currentViewer, vp);
1966 }
const G4String & GetName() const
G4String GetCurrentValue(G4UIcommand *command)
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:152
G4String TouchableCommands() const
G4UIcmdWithADouble * fpCommandZoom
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:371
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
HepGeom::Vector3D< G4double > G4Vector3D
Definition: G4Vector3D.hh:35
const G4Planes & GetCutawayPlanes() const
void SetNewValue(G4UIcommand *command, G4String newValue)
const char * name(G4int ptype)
G4UIcmdWith3Vector * fpCommandScaleTo
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:451
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:58
G4UIcmdWithAString * fpCommand
G4UIcmdWithADoubleAndUnit * fpCommandDolly
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
G4UIcmdWithAString * fpCommand
bool G4bool
Definition: G4Types.hh:79
void SetNewValue(G4UIcommand *command, G4String newValue)
std::vector< G4Plane3D > G4Planes
static G4double GetNewDoubleValue(const char *paramString)
G4UIcmdWithAString * fpCommand
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)
G4UIcmdWithAString * fpCommand
void SetFieldHalfAngle(G4double fieldHalfAngle)
G4UIcmdWithADouble * fpCommandZoomTo
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)
G4UIcmdWithAString * fpCommand
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:308
G4UIcmdWith3Vector * fpCommandScale
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)
void RefreshView()
G4String GetCurrentValue(G4UIcommand *command)
G4UIcmdWithAString * fpCommand
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()
void SetGuidance(const char *theGuidance)
static G4ViewParameters * CatmullRomCubicSplineInterpolation(const std::vector< G4ViewParameters > &views, G4int nInterpolationPoints=50)
G4UIcmdWithADoubleAndUnit * fpCommandDollyTo
G4String GetCurrentValue(G4UIcommand *command)
G4String GetCurrentValue(G4UIcommand *command)
const G4Vector3D & GetUpVector() const
static void ConvertToDoublePair(const G4String &paramString, G4double &xval, G4double &yval)
G4UIcmdWithAString * fpCommand
void SetMarkForClearingTransientStore(G4bool)
G4bool IsAutoRefresh() const
void IncrementDolly(G4double dollyIncrement)
void SetViewpointDirection(const G4Vector3D &viewpointDirection)
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:446
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)
G4UIcmdWithAString * fpCommand
static G4VisManager * fpVisManager
void SetNewValue(G4UIcommand *command, G4String newValue)