63 (
"Add cutaway plane to current viewer.");
66 parameter -> SetDefaultValue (0);
67 parameter -> SetGuidance (
"Coordinate of point on the plane.");
70 parameter -> SetDefaultValue (0);
71 parameter -> SetGuidance (
"Coordinate of point on the plane.");
74 parameter -> SetDefaultValue (0);
75 parameter -> SetGuidance (
"Coordinate of point on the plane.");
78 parameter -> SetDefaultValue (
"m");
79 parameter -> SetGuidance (
"Unit of point on the plane.");
82 parameter -> SetDefaultValue (1);
83 parameter -> SetGuidance (
"Component of plane normal.");
86 parameter -> SetDefaultValue (0);
87 parameter -> SetGuidance (
"Component of plane normal.");
90 parameter -> SetDefaultValue (0);
91 parameter -> SetGuidance (
"Component of plane normal.");
111 "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
119 std::istringstream is (newValue);
120 is >> x >> y >> z >> unit >> nx >> ny >> nz;
122 x *= F; y *= F; z *= F;
127 G4cout <<
"Cutaway planes for viewer \"" << viewer->
GetName() <<
"\" now:";
129 for (
size_t i = 0; i < cutaways.size(); ++i)
130 G4cout <<
"\n " << i <<
": " << cutaways[i];
143 (
"Centre and zoom in on the given physical volume.");
145 (
"The names of all volumes in all worlds are matched against pv-name. If"
146 "\ncopy-no is supplied, it matches the copy number too. If pv-name is of the"
147 "\nform \"/regexp/\", where regexp is a regular expression (see C++ regex),"
148 "\nthe match uses the usual rules of regular expression matching."
149 "\nOtherwise an exact match is required."
150 "\nFor example, \"/Shap/\" matches \"Shape1\" and \"Shape2\".");
152 (
"It may help to see a textual representation of the geometry hierarchy of"
153 "\nthe worlds. Try \"/vis/drawTree [worlds]\" or one of the driver/browser"
154 "\ncombinations that have the required functionality, e.g., HepRepFile.");
156 (
"If there are more than one matching physical volumes they will all be"
157 "\nincluded. If this is not what you want, and what you want is to centre on a"
158 "\nparticular touchable, then select the touchable (\"/vis/set/touchable\") and"
159 "\nuse \"/vis/touchable/centreOn\". (You may need \"/vis/touchable/findPath\".)");
161 parameter =
new G4UIparameter(
"pv-name",
's',omitable =
false);
164 parameter =
new G4UIparameter(
"copy-no",
'i',omitable =
true);
166 parameter->
SetGuidance (
"Copy number. -1 means any or all copy numbers");
192 if (!currentViewer) {
195 "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
203 std::istringstream is (newValue);
204 is >> pvName >> copyNo;
209 size_t nWorlds = transportationManager->
GetNoWorlds();
210 std::vector<G4PhysicalVolumesSearchScene::Findings> findingsVector;
211 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
213 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
220 for (
const auto& findings: searchScene.
GetFindings()) {
221 findingsVector.push_back(findings);
225 if (findingsVector.empty()) {
228 <<
"WARNING: Volume \"" << pvName <<
"\" ";
230 G4cerr <<
"copy number " << copyNo;
238 G4Scene tempScene(
"Centre Scene");
239 for (
const auto& findings: findingsVector) {
241 findings.fpFoundPV->SetCopyNo(findings.fFoundPVCopyNo);
248 findings.fFoundObjectTransformation,
251 findings.fFoundBasePVPath);
256 G4cout <<
"\"" << findings.fpFoundPV->GetName()
257 <<
"\", copy no. " << findings.fFoundPVCopyNo
258 <<
",\n found in searched volume \""
259 << findings.fpSearchPV->GetName()
260 <<
"\" at depth " << findings.fFoundDepth
261 <<
",\n base path: \"" << findings.fFoundBasePVPath
262 <<
",\n has been added to temporary scene \"" << tempScene.
GetName() <<
"\"."
269 delete sceneModel.fpModel;
293 <<
"Viewer \"" << currentViewer->
GetName()
296 G4cout <<
"and zoomed in";
298 G4cout <<
" on physical volume(s) \"" << pvName <<
'\"'
310 fpCommand -> SetGuidance(
"Change cutaway plane.");
313 parameter -> SetGuidance (
"Index of plane: 0, 1, 2.");
316 parameter -> SetDefaultValue (0);
317 parameter -> SetGuidance (
"Coordinate of point on the plane.");
320 parameter -> SetDefaultValue (0);
321 parameter -> SetGuidance (
"Coordinate of point on the plane.");
324 parameter -> SetDefaultValue (0);
325 parameter -> SetGuidance (
"Coordinate of point on the plane.");
328 parameter -> SetDefaultValue (
"m");
329 parameter -> SetGuidance (
"Unit of point on the plane.");
332 parameter -> SetDefaultValue (1);
333 parameter -> SetGuidance (
"Component of plane normal.");
336 parameter -> SetDefaultValue (0);
337 parameter -> SetGuidance (
"Component of plane normal.");
340 parameter -> SetDefaultValue (0);
341 parameter -> SetGuidance (
"Component of plane normal.");
361 "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
370 std::istringstream is (newValue);
371 is >> index >> x >> y >> z >> unit >> nx >> ny >> nz;
373 x *= F; y *= F; z *= F;
379 G4cout <<
"Cutaway planes for viewer \"" << viewer->
GetName() <<
"\" now:";
381 for (
size_t i = 0; i < cutaways.size(); ++i)
382 G4cout <<
"\n " << i <<
": " << cutaways[i];
392 G4bool omitable, currentAsDefault;
394 fpCommand -> SetGuidance (
"Clears viewer.");
396 (
"By default, clears current viewer. Specified viewer becomes current."
397 "\n\"/vis/viewer/list\" to see possible viewer names.");
398 fpCommand -> SetParameterName (
"viewer-name",
400 currentAsDefault =
true);
409 return viewer ? viewer -> GetName () :
G4String(
"none");
420 G4cerr <<
"ERROR: Viewer \"" << clearName
421 <<
"\" not found - \"/vis/viewer/list\" to see possibilities."
431 G4cout <<
"Viewer \"" << clearName <<
"\" cleared." <<
G4endl;
440 (
"/vis/viewer/clearCutawayPlanes",
this);
441 fpCommand -> SetGuidance (
"Clear cutaway planes of current viewer.");
460 "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
469 G4cout <<
"Cutaway planes for viewer \"" << viewer->
GetName()
470 <<
"\" now cleared." <<
G4endl;
479 G4bool omitable, currentAsDefault;
481 fpCommand -> SetGuidance (
"Clears transients from viewer.");
483 (
"By default, operates on current viewer. Specified viewer becomes current."
484 "\n\"/vis/viewer/list\" to see possible viewer names.");
485 fpCommand -> SetParameterName (
"viewer-name",
487 currentAsDefault =
true);
496 return viewer ? viewer -> GetName () :
G4String(
"none");
507 G4cerr <<
"ERROR: Viewer \"" << clearName
508 <<
"\" not found - \"/vis/viewer/list\" to see possibilities."
519 G4cout <<
"Viewer \"" << clearName <<
"\" cleared of transients."
529 (
"/vis/viewer/clearVisAttributesModifiers",
this);
530 fpCommand -> SetGuidance (
"Clear vis attribute modifiers of current viewer.");
531 fpCommand -> SetGuidance (
"(These are used for touchables, etc.)");
550 "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
559 G4cout <<
"Vis attributes modifiers for viewer \"" << viewer->
GetName()
560 <<
"\" now cleared." <<
G4endl;
571 fpCommand -> SetGuidance (
"Clones viewer.");
573 (
"By default, clones current viewer. Clone becomes current."
574 "\nClone name, if not provided, is derived from the original name."
575 "\n\"/vis/viewer/list\" to see possible viewer names.");
577 parameter =
new G4UIparameter (
"original-viewer-name",
's', omitable =
true);
578 parameter -> SetCurrentAsDefault (
true);
580 parameter =
new G4UIparameter (
"clone-name",
's', omitable =
true);
581 parameter -> SetDefaultValue (
"none");
592 return "\"" + originalName +
"\"";
600 std::istringstream is (newValue);
605 while (is.get(c) && c ==
' '){}
607 while (is.get(c) && c !=
'"') {originalName += c;}
611 while (is.get(c) && c !=
' ') {originalName += c;}
617 if (!originalViewer) {
619 G4cerr <<
"ERROR: Viewer \"" << originalName
620 <<
"\" not found - \"/vis/viewer/list\" to see possibilities."
625 originalName = originalViewer->
GetName();
627 while (is.get(c) && c ==
' '){}
629 while (is.get(c) && c !=
'"') {cloneName += c;}
633 while (is.get(c) && c !=
' ') {cloneName += c;}
638 G4bool errorWhileNaming =
false;
639 if (cloneName ==
"none") {
642 cloneName = originalName;
643 std::ostringstream oss;
644 oss <<
'-' << subID++;
645 G4String::size_type lastDashPosition, nextSpacePosition;
646 if ((lastDashPosition = cloneName.rfind(
'-')) != G4String::npos &&
647 (nextSpacePosition = cloneName.find(
" ", lastDashPosition)) !=
649 cloneName.insert(nextSpacePosition, oss.str());
651 G4String::size_type spacePosition = cloneName.find(
' ');
652 if (spacePosition != G4String::npos)
653 cloneName.insert(spacePosition, oss.str());
655 errorWhileNaming =
true;
657 }
while (!errorWhileNaming &&
fpVisManager -> GetViewer (cloneName));
660 if (errorWhileNaming) {
662 G4cerr <<
"ERROR: While naming clone viewer \"" << cloneName
671 G4cerr <<
"ERROR: Putative clone viewer \"" << cloneName
672 <<
"\" already exists."
684 if (keepVerbose >= 2 ||
690 (
G4String(
"/vis/viewer/create ! \"" + cloneName +
"\" " + windowSizeHint));
695 G4cout <<
"Viewer \"" << originalName <<
"\" cloned." <<
G4endl;
696 G4cout <<
"Clone \"" << cloneName <<
"\" now current." <<
G4endl;
706 (
"If a volume has no vis attributes, colour it by density.");
708 (
"Provide algorithm number, e.g., \"1\" (or \"0\" to switch off)."
709 "\nThen a unit of density, e.g., \"g/cm3\"."
710 "\nThen parameters for the algorithm assumed to be densities in that unit.");
712 (
"Algorithm 1: Simple algorithm takes 3 parameters: d0, d1 and d2."
713 "\n Volumes with density < d0 are invisible."
714 "\n Volumes with d0 <= density < d1 have colour on range red->green."
715 "\n Volumes with d1 <= density < d2 have colour on range green->blue."
716 "\n Volumes with density > d2 are blue.");
719 parameter -> SetGuidance (
"Algorithm number (or \"0\" to switch off).");
720 parameter -> SetDefaultValue (1);
723 parameter -> SetGuidance (
"Unit of following densities, e.g., \"g/cm3\".");
724 parameter -> SetDefaultValue (
"g/cm3");
727 parameter -> SetGuidance (
"Density parameter 0");
728 parameter -> SetDefaultValue (0.5);
731 parameter -> SetGuidance (
"Density parameter 1");
732 parameter -> SetDefaultValue (3.0);
735 parameter -> SetGuidance (
"Density parameter 2.");
736 parameter -> SetDefaultValue (10.0);
756 "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
763 G4int algorithmNumber;
766 std::istringstream is (newValue);
767 is >> algorithmNumber >> unit >> d0 >>
d1 >>
d2;
769 if (algorithmNumber < 0 || algorithmNumber > 1) {
772 "ERROR: Unrecognised algorithm number: " << algorithmNumber
778 std::vector<G4double> parameters;
779 if (algorithmNumber > 0) {
780 const G4String where =
"G4VisCommandViewerColourByDensity::SetNewValue";
785 d0 *= valueOfUnit;
d1 *= valueOfUnit;
d2 *= valueOfUnit;
789 "ERROR: Unrecognised or inappropriate unit: " << unit
794 parameters.push_back(d0);
795 parameters.push_back(
d1);
796 parameters.push_back(
d2);
806 <<
" selected for viewer \"" << viewer->
GetName()
824 (
"Copy the camera-specific parameters from the specified viewer.");
826 (
"Note: To copy ALL view parameters, including scene modifications,"
827 "\nuse \"/vis/viewer/set/all\"");
828 fpCommand -> SetParameterName (
"from-viewer-name", omitable =
false);
844 if (!currentViewer) {
847 "ERROR: G4VisCommandsViewerCopyViewFrom::SetNewValue: no current viewer."
853 const G4String& fromViewerName = newValue;
857 G4cerr <<
"ERROR: Viewer \"" << fromViewerName
858 <<
"\" not found - \"/vis/viewer/list\" to see possibilities."
864 if (fromViewer == currentViewer) {
867 "WARNING: G4VisCommandsViewerSet::SetNewValue:"
868 "\n from-viewer and current viewer are identical."
880 G4cout <<
"Camera parameters of viewer \"" << currentViewer->
GetName()
881 <<
"\"\n set to those of viewer \"" << fromViewer->
GetName()
893 (
"Creates a viewer for the specified scene handler.");
895 (
"Default scene handler is the current scene handler. Invents a name"
896 "\nif not supplied. (Note: the system adds information to the name"
897 "\nfor identification - only the characters up to the first blank are"
898 "\nused for removing, selecting, etc.) This scene handler and viewer"
899 "\nbecome current.");
901 parameter =
new G4UIparameter (
"scene-handler",
's', omitable =
true);
902 parameter -> SetCurrentAsDefault (
true);
904 parameter =
new G4UIparameter (
"viewer-name",
's', omitable =
true);
905 parameter -> SetCurrentAsDefault (
true);
907 parameter =
new G4UIparameter (
"window-size-hint",
's', omitable =
true);
909 (
"integer (pixels) for square window placed by window manager or"
910 " X-Windows-type geometry string, e.g. 600x600-100+100");
920 std::ostringstream oss;
922 oss <<
"viewer-" <<
fId <<
" (";
924 oss << sceneHandler -> GetGraphicsSystem () -> GetName ();
927 oss <<
"no_scene_handlers";
937 if (currentSceneHandler) {
938 currentValue = currentSceneHandler -> GetName ();
941 currentValue =
"none";
948 currentValue +=
" 600";
959 std::istringstream is (newValue);
960 is >> sceneHandlerName;
965 while (is.get(c) && c ==
' '){}
967 while (is.get(c) && c !=
'"') {newName += c;}
971 while (is.get(c) && c !=
' ') {newName += c;}
977 is >> windowSizeHintString;
981 G4int nHandlers = sceneHandlerList.size ();
982 if (nHandlers <= 0) {
985 "ERROR: G4VisCommandViewerCreate::SetNewValue: no scene handlers."
986 "\n Create a scene handler with \"/vis/sceneHandler/create\"";
992 for (iHandler = 0; iHandler < nHandlers; iHandler++) {
993 if (sceneHandlerList [iHandler] -> GetName () == sceneHandlerName)
break;
996 if (iHandler < 0 || iHandler >= nHandlers) {
1001 "G4VisCommandViewerCreate::SetNewValue: invalid scene handler specified.";
1009 if (sceneHandler !=
fpVisManager -> GetCurrentSceneHandler ()) {
1015 if (newName ==
"") {
1018 if (newName == nextName)
fId++;
1021 for (
G4int ih = 0; ih < nHandlers; ih++) {
1023 const G4ViewerList& viewerList = sh -> GetViewerList ();
1024 for (
size_t iViewer = 0; iViewer < viewerList.size (); iViewer++) {
1025 if (viewerList [iViewer] -> GetShortName () == newShortName ) {
1028 "ERROR: Viewer \"" << newShortName <<
"\" already exists.";
1050 fpVisManager -> CreateViewer (newName,windowSizeHintString);
1054 if (newViewer && newViewer -> GetName () == newName) {
1061 G4cout <<
"New viewer \"" << newName <<
"\" created." <<
G4endl;
1067 ed <<
"ERROR: New viewer doesn\'t match!!! Curious!!";
1069 ed <<
"WARNING: No viewer created.";
1081 G4cout <<
"Issue /vis/viewer/refresh or flush to see effect."
1091 fDollyIncrement (0.),
1094 G4bool omitable, currentAsDefault;
1097 (
"/vis/viewer/dolly",
this);
1099 (
"Incremental dolly.");
1101 (
"Moves the camera incrementally towards target point.");
1104 currentAsDefault=
true);
1108 (
"/vis/viewer/dollyTo",
this);
1110 (
"Dolly to specific coordinate.");
1112 (
"Places the camera towards target point relative to standard camera point.");
1115 currentAsDefault=
true);
1132 return currentValue;
1142 if (!currentViewer) {
1145 "ERROR: G4VisCommandsViewerDolly::SetNewValue: no current viewer."
1172 G4bool omitable, currentAsDefault;
1175 (
"Compound command: \"/vis/viewer/refresh\" + \"/vis/viewer/update\".");
1177 (
"Useful for refreshing and initiating post-processing for graphics"
1178 "\nsystems which need post-processing. By default, acts on current"
1179 "\nviewer. \"/vis/viewer/list\" to see possible viewers. Viewer"
1180 "\nbecomes current.");
1181 fpCommand -> SetParameterName (
"viewer-name",
1183 currentAsDefault =
true);
1193 return viewer ? viewer -> GetName () :
G4String(
"none");
1204 G4cerr <<
"ERROR: Viewer \"" << flushName <<
"\"" <<
1205 " not found - \"/vis/viewer/list\"\n to see possibilities."
1213 G4int newVerbose(0);
1221 G4cout <<
"Viewer \"" << viewer -> GetName () <<
"\""
1222 <<
" flushed." <<
G4endl;
1232 (
"Interpolate views defined by the first argument, which can contain "
1233 "Unix-shell-style pattern matching characters such as '*', '?' and '[' "
1234 "- see \"man sh\" and look for \"Pattern Matching\". The contents "
1235 "of each file are assumed to be \"/vis/viewer\" commands "
1236 "that specify a particular view. The files are processed in alphanumeric "
1237 "order of filename. The files may be written by hand or produced by the "
1238 "\"/vis/viewer/save\" command.");
1240 (
"The default is to search the working directory for files with a .g4view "
1241 "extension. Another procedure is to assemble view files in a subdirectory, "
1242 "e.g., \"myviews\"; then they can be interpolated with\n"
1243 "\"/vis/viewer/interpolate myviews\".");
1245 (
"To export interpolated views to file for a future possible movie, "
1246 "write \"export\" as 5th parameter (OpenGL only).");
1248 parameter =
new G4UIparameter(
"pattern",
's', omitable =
true);
1249 parameter -> SetGuidance(
"Pattern that defines the view files.");
1250 parameter -> SetDefaultValue(
"*.g4view");
1252 parameter =
new G4UIparameter(
"no-of-points",
'i', omitable =
true);
1253 parameter -> SetGuidance (
"Number of interpolation points per interval.");
1254 parameter -> SetDefaultValue(50);
1256 parameter =
new G4UIparameter(
"wait-time",
's', omitable =
true);
1257 parameter -> SetGuidance(
"Wait time per interpolated point");
1258 parameter -> SetDefaultValue(
"20.");
1260 parameter =
new G4UIparameter(
"time-unit",
's', omitable =
true);
1261 parameter -> SetDefaultValue(
"millisecond");
1263 parameter =
new G4UIparameter(
"export",
's', omitable =
true);
1264 parameter -> SetDefaultValue(
"no");
1281 if (!currentViewer) {
1284 "ERROR: G4VisCommandViewerInterpolate::SetNewValue: no current viewer."
1291 G4int nInterpolationPoints;
1296 std::istringstream iss (newValue);
1299 >> nInterpolationPoints
1300 >> waitTimePerPointString
1303 G4String waitTimePerPointDimString(waitTimePerPointString +
' ' + timeUnit);
1307 if (waitTimePerPointmilliseconds < 0) waitTimePerPointmilliseconds = 0;
1328 const G4int safety = 99;
1329 G4int safetyCount = 0;
1330 G4fs::path pathPattern = pattern.c_str();
1334 (pathPattern.parent_path().string().length() ?
1335 pathPattern.parent_path().string() :
1337 G4fs::path parentPath = parentPathString.c_str();
1340 std::set<G4fs::path> paths;
1342 if (G4fs::is_directory(pathPattern)) {
1345 for (
const auto& path: G4fs::directory_iterator(pathPattern)) {
1346 if (safetyCount++ >= safety)
break;
1356 for (
size_t i = 0; i < pattern.length(); ++i) {
1357 if (pattern[i] ==
'.') {
1358 regexp_pattern +=
"\\.";
1359 }
else if (pattern[i] ==
'*') {
1360 regexp_pattern +=
".*";
1361 }
else if (pattern[i] ==
'?') {
1362 regexp_pattern +=
"(.{1,1})";
1364 regexp_pattern += pattern[i];
1367 std::regex regexp(regexp_pattern, std::regex_constants::basic | std::regex_constants::icase);
1369 for (
const auto& path: G4fs::directory_iterator(parentPath)) {
1370 const auto& pathname = path.path().relative_path().string();
1371 if (std::regex_match(pathname, regexp)) {
1372 if (safetyCount++ >= safety)
break;
1378 if (safetyCount > safety) {
1381 "/vis/viewer/interpolate:"
1382 "\n the number of way points has been limited to the maximum currently allowed: "
1388 std::vector<G4ViewParameters> viewVector;
1389 for (
const auto& path: paths) {
1390 uiManager->
ApplyCommand(
"/control/execute " + path.relative_path().string());
1394 viewVector.push_back(vp);
1398 (currentViewer,viewVector,
1399 nInterpolationPoints,waitTimePerPointmilliseconds,exportString);
1409 G4cout <<
"Viewer \"" << currentViewer -> GetName () <<
"\""
1410 <<
" restored." <<
G4endl;
1419 fpCommand -> SetGuidance (
"Lists viewers(s).");
1421 (
"See \"/vis/verbose\" for definition of verbosity.");
1425 parameter -> SetDefaultValue (
"all");
1429 parameter -> SetDefaultValue (
"warnings");
1443 std::istringstream is (newValue);
1444 is >>
name >> verbosityString;
1451 if (currentViewer) {
1452 currentViewerShortName = currentViewer -> GetShortName ();
1455 currentViewerShortName =
"none";
1460 G4int nHandlers = sceneHandlerList.size ();
1462 G4bool foundCurrent =
false;
1463 for (
int iHandler = 0; iHandler < nHandlers; iHandler++) {
1465 const G4ViewerList& viewerList = sceneHandler -> GetViewerList ();
1467 <<
"Scene handler \"" << sceneHandler -> GetName () <<
"\" ("
1469 const G4Scene* pScene = sceneHandler -> GetScene ();
1471 G4cout <<
", scene \"" << pScene -> GetName () <<
"\"";
1474 G4int nViewers = viewerList.size ();
1475 if (nViewers == 0) {
1476 G4cout <<
"\n No viewers for this scene handler." <<
G4endl;
1479 for (
int iViewer = 0; iViewer < nViewers; iViewer++) {
1480 const G4VViewer* thisViewer = viewerList [iViewer];
1481 G4String thisName = thisViewer -> GetName ();
1482 G4String thisShortName = thisViewer -> GetShortName ();
1483 if (
name !=
"all") {
1484 if (thisShortName != shortName)
continue;
1488 if (thisShortName == currentViewerShortName) {
1489 foundCurrent =
true;
1495 G4cout <<
" viewer \"" << thisName <<
"\"";
1497 G4cout <<
"\n " << *thisViewer;
1504 if (!foundCurrent) {
1505 G4cout <<
"No valid current viewer - please create or select one."
1511 if (
name !=
"all") {
1521 fPanIncrementRight (0.),
1522 fPanIncrementUp (0.),
1529 (
"/vis/viewer/pan",
this);
1531 (
"Incremental pan.");
1533 (
"Moves the camera incrementally right and up by these amounts (as seen"
1534 "\nfrom viewpoint direction).");
1536 parameter =
new G4UIparameter(
"right-increment",
'd', omitable =
true);
1537 parameter -> SetCurrentAsDefault (
true);
1539 parameter =
new G4UIparameter(
"up-increment",
'd', omitable =
true);
1540 parameter -> SetCurrentAsDefault (
true);
1542 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
1543 parameter -> SetDefaultValue (
"m");
1547 (
"/vis/viewer/panTo",
this);
1549 (
"Pan to specific coordinate.");
1551 (
"Places the camera in this position right and up relative to standard"
1552 "\ntarget point (as seen from viewpoint direction).");
1553 parameter =
new G4UIparameter(
"right",
'd', omitable =
true);
1554 parameter -> SetCurrentAsDefault (
true);
1557 parameter -> SetCurrentAsDefault (
true);
1559 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
1560 parameter -> SetDefaultValue (
"m");
1577 return currentValue;
1587 if (!currentViewer) {
1590 "ERROR: G4VisCommandsViewerPan::SetNewValue: no current viewer."
1618 G4bool omitable, currentAsDefault;
1620 fpCommand -> SetGuidance (
"Forces rebuild of graphical database.");
1622 (
"By default, acts on current viewer. \"/vis/viewer/list\""
1623 "\nto see possible viewers. Viewer becomes current.");
1624 fpCommand -> SetParameterName (
"viewer-name",
1626 currentAsDefault =
true);
1636 return viewer -> GetName ();
1652 G4cerr <<
"ERROR: Viewer \"" << rebuildName
1653 <<
"\" not found - \"/vis/viewer/list\" to see possibilities."
1660 if (!sceneHandler) {
1662 G4cerr <<
"ERROR: Viewer \"" << viewer->
GetName() <<
"\"" <<
1663 " has no scene handler - report serious bug."
1682 G4bool omitable, currentAsDefault;
1685 (
"Refreshes viewer.");
1687 (
"By default, acts on current viewer. \"/vis/viewer/list\""
1688 "\nto see possible viewers. Viewer becomes current.");
1689 fpCommand -> SetParameterName (
"viewer-name",
1691 currentAsDefault =
true);
1700 return viewer ? viewer -> GetName () :
G4String(
"none");
1712 G4cerr <<
"ERROR: Viewer \"" << refreshName <<
"\"" <<
1713 " not found - \"/vis/viewer/list\"\n to see possibilities."
1720 if (!sceneHandler) {
1722 G4cerr <<
"ERROR: Viewer \"" << refreshName <<
"\"" <<
1723 " has no scene handler - report serious bug."
1732 G4cout <<
"NOTE: SceneHandler \"" << sceneHandler->
GetName()
1733 <<
"\", to which viewer \"" << refreshName <<
"\"" <<
1734 "\n is attached, has no scene - \"/vis/scene/create\" and"
1735 " \"/vis/sceneHandler/attach\""
1736 "\n (or use compound command \"/vis/drawVolume\")."
1742 G4bool successful = scene -> AddWorldIfEmpty (warn);
1746 "WARNING: Scene is empty. Perhaps no geometry exists."
1747 "\n Try /run/initialize."
1758 G4cout <<
"Refreshing viewer \"" << viewer -> GetName () <<
"\"..."
1761 viewer -> SetView ();
1762 viewer -> ClearView ();
1763 viewer -> DrawView ();
1765 G4cout <<
"Viewer \"" << viewer -> GetName () <<
"\"" <<
" refreshed."
1766 "\n (You might also need \"/vis/viewer/update\".)" <<
G4endl;
1774 G4bool omitable, currentAsDefault;
1776 fpCommand -> SetGuidance (
"Resets viewer.");
1778 (
"By default, acts on current viewer. \"/vis/viewer/list\""
1779 "\nto see possible viewers. Viewer becomes current.");
1780 fpCommand -> SetParameterName (
"viewer-name",
1782 currentAsDefault =
true);
1792 return viewer -> GetName ();
1807 G4cerr <<
"ERROR: Viewer \"" << resetName
1808 <<
"\" not found - \"/vis/viewer/list\" to see possibilities."
1824 (
"Write commands that define the current view to file.");
1826 (
"Read them back into the same or any viewer with \"/control/execute\".");
1828 (
"If the filename is omitted the view is saved to a file "
1829 "\"g4_nn.g4view\", where nn is a sequential two-digit number.");
1831 (
"If the filename is \"-\", the data are written to G4cout.");
1833 (
"If you are wanting to save views for future interpolation a recommended "
1834 "procedure is: save views to \"g4_nn.g4view\", as above, then move the files "
1835 "into a sub-directory, say, \"views\", then interpolate with"
1836 "\"/vis/viewer/interpolate views\"");
1837 fpCommand -> SetParameterName (
"filename", omitable =
true);
1871 if (!currentViewer) {
1874 "ERROR: G4VisCommandsViewerSave::SetNewValue: no current viewer."
1881 if (!currentScene) {
1884 "ERROR: G4VisCommandsViewerSave::SetNewValue: no current scene."
1893 const std::vector<G4ModelingParameters::VisAttributesModifier>*
1896 std::vector<G4ModelingParameters::VisAttributesModifier>::const_iterator i;
1897 for (i = privateVAMs->begin(); i != privateVAMs->end(); ++i) {
1905 if (newValue.length() == 0) {
1907 const G4int maxNoOfFiles = 100;
1908 static G4int sequenceNumber = 0;
1909 if (sequenceNumber >= maxNoOfFiles) {
1912 <<
"ERROR: G4VisCommandsViewerSave::SetNewValue: Maximum number, "
1914 <<
", of files exceeded."
1919 std::ostringstream oss;
1920 oss << std::setw(2) << std::setfill(
'0') << sequenceNumber++;
1921 filename =
"g4_" + oss.str() +
".g4view";
1924 if (filename ==
"-") {
1931 filename +=
".g4view";
1933 std::ofstream ofs(filename);
1937 "ERROR: G4VisCommandsViewerSave::SetNewValue: Trouble opening file \""
1938 << filename <<
"\"."
1949 G4cout <<
"Viewer \"" << currentViewer -> GetName ()
1950 <<
"\"" <<
" saved to ";
1951 if (filename ==
"-") {
1954 G4cout <<
"file \'" << filename <<
"\"." <<
1955 "\n Read the view back into this or any viewer with"
1956 "\n \"/control/execute " << filename <<
"\" or use"
1957 "\n \"/vis/viewer/interpolate\" if you have several saved files -"
1958 "\n see \"help /vis/viewer/interpolate\" for guidance.";
1970 G4bool omitable, currentAsDefault;
1973 (
"/vis/viewer/scale",
this);
1974 fpCommandScale -> SetGuidance (
"Incremental (non-uniform) scaling.");
1976 (
"Multiplies components of current scaling by components of this factor."
1977 "\n Scales (x,y,z) by corresponding components of the resulting factor.");
1981 (
"x-scale-multiplier",
"y-scale-multiplier",
"z-scale-multiplier",
1982 omitable=
true, currentAsDefault=
true);
1985 (
"/vis/viewer/scaleTo",
this);
1988 (
"Scales (x,y,z) by corresponding components of this factor.");
1990 (
"x-scale-factor",
"y-scale-factor",
"z-scale-factor",
1991 omitable=
true, currentAsDefault=
true);
2007 return currentValue;
2017 if (!currentViewer) {
2020 "ERROR: G4VisCommandsViewerScale::SetNewValue: no current viewer."
2049 fpCommand -> SetGuidance (
"Selects viewer.");
2051 (
"Specify viewer by name. \"/vis/viewer/list\" to see possible viewers.");
2052 fpCommand -> SetParameterName (
"viewer-name", omitable =
false);
2072 G4cerr <<
"ERROR: Viewer \"" << selectName <<
"\"";
2073 G4cerr <<
" not found - \"/vis/viewer/list\""
2074 "\n to see possibilities."
2082 G4cout <<
"WARNING: Viewer \"" << viewer -> GetName () <<
"\""
2083 <<
" already selected." <<
G4endl;
2097 G4bool omitable, currentAsDefault;
2100 (
"Triggers graphical database post-processing for viewers"
2101 "\nusing that technique.");
2103 (
"For such viewers the view only becomes visible with this command."
2104 "\nBy default, acts on current viewer. \"/vis/viewer/list\""
2105 "\nto see possible viewers. Viewer becomes current.");
2106 fpCommand -> SetParameterName (
"viewer-name",
2108 currentAsDefault =
true);
2118 return viewer -> GetName ();
2135 "WARNING: command \"/vis/viewer/update\" could not be applied: no current viewer."
2142 if (!sceneHandler) {
2144 G4cerr <<
"ERROR: Viewer \"" << updateName <<
"\"" <<
2145 " has no scene handler - report serious bug."
2154 G4cout <<
"NOTE: SceneHandler \"" << sceneHandler->
GetName()
2155 <<
"\", to which viewer \"" << updateName <<
"\"" <<
2156 "\n is attached, has no scene - \"/vis/scene/create\" and"
2157 " \"/vis/sceneHandler/attach\""
2158 "\n (or use compound command \"/vis/drawVolume\")."
2165 G4cout <<
"Viewer \"" << viewer -> GetName () <<
"\"";
2168 viewer -> ShowView ();
2170 sceneHandler -> SetMarkForClearingTransientStore(
true);
2176 fZoomMultiplier (1.),
2179 G4bool omitable, currentAsDefault;
2182 (
"/vis/viewer/zoom",
this);
2185 (
"Multiplies current magnification by this factor.");
2188 currentAsDefault=
true);
2191 (
"/vis/viewer/zoomTo",
this);
2194 (
"Magnifies standard magnification by this factor.");
2197 currentAsDefault=
true);
2213 return currentValue;
2223 if (!currentViewer) {
2226 "ERROR: G4VisCommandsViewerZoom::SetNewValue: no current viewer."
std::ostringstream G4ExceptionDescription
HepGeom::Normal3D< G4double > G4Normal3D
HepGeom::Plane3D< G4double > G4Plane3D
HepGeom::Point3D< G4double > G4Point3D
static constexpr double millisecond
CLHEP::Hep3Vector G4ThreeVector
std::vector< G4Plane3D > G4Planes
G4GLOB_DLL std::ostream G4cerr
G4GLOB_DLL std::ostream G4cout
void DescribeYourselfTo(G4VGraphicsScene &)
const std::vector< Findings > & GetFindings() const
G4bool AddRunDurationModel(G4VModel *, G4bool warn=false)
const std::vector< Model > & GetRunDurationModelList() const
const G4VisExtent & GetExtent() const
const G4Point3D & GetStandardTargetPoint() const
const G4String & GetName() const
static G4TransportationManager * GetTransportationManager()
std::vector< G4VPhysicalVolume * >::iterator GetWorldsIterator()
size_t GetNoWorlds() const
static G4ThreeVector GetNew3VectorValue(const char *paramString)
static G4double GetNewDoubleValue(const char *paramString)
static G4double GetNewDoubleValue(const char *paramString)
static G4double ValueOf(const char *unitName)
static G4String ConvertToString(G4bool boolVal)
void SetParameter(G4UIparameter *const newParameter)
void SetGuidance(const char *aGuidance)
void CommandFailed(G4int errCode, G4ExceptionDescription &ed)
static G4double ConvertToDimensionedDouble(const char *st)
G4int ApplyCommand(const char *aCommand)
G4int GetVerboseLevel() const
static G4UImanager * GetUIpointer()
void SetVerboseLevel(G4int val)
void SetDefaultValue(const char *theDefaultValue)
void SetGuidance(const char *theGuidance)
const G4String & GetNickname() const
void SetModelingParameters(const G4ModelingParameters *)
virtual void ClearTransientStore()
void SetMarkForClearingTransientStore(G4bool)
G4VGraphicsSystem * GetGraphicsSystem() const
G4Scene * GetScene() const
const G4String & GetName() const
const G4String & GetName() const
virtual void DrawView()=0
const G4ViewParameters & GetViewParameters() const
virtual const std::vector< G4ModelingParameters::VisAttributesModifier > * GetPrivateVisAttributesModifiers() const
virtual void FinishView()
void SetViewParameters(const G4ViewParameters &vp)
virtual void ClearView()=0
G4VSceneHandler * GetSceneHandler() const
void CopyCameraParameters(G4ViewParameters &target, const G4ViewParameters &from)
void CheckSceneAndNotifyHandlers(G4Scene *=nullptr)
static G4VisManager * fpVisManager
void InterpolateToNewView(G4VViewer *currentViewer, const G4ViewParameters &oldVP, const G4ViewParameters &newVP, const G4int nInterpolationPoints=50, const G4int waitTimePerPointmilliseconds=20, const G4String exportString="")
static G4bool ConvertToDoublePair(const G4String ¶mString, G4double &xval, G4double &yval)
void RefreshIfRequired(G4VViewer *viewer)
void SetViewParameters(G4VViewer *viewer, const G4ViewParameters &viewParams)
void CopyParametersFrom(const G4UIcommand *fromCmd, G4UIcommand *toCmd)
static G4ViewParameters fVPExistingViewer
G4bool ProvideValueOfUnit(const G4String &where, const G4String &unit, const G4String &category, G4double &value)
void CopyMostViewParameters(G4ViewParameters &target, const G4ViewParameters &from)
static G4bool fThereWasAViewer
static G4String ConvertToString(G4double x, G4double y, const char *unitName)
void CopyGuidanceFrom(const G4UIcommand *fromCmd, G4UIcommand *toCmd, G4int startLine=0)
void InterpolateViews(G4VViewer *currentViewer, std::vector< G4ViewParameters > viewVector, const G4int nInterpolationPoints=50, const G4int waitTimePerPointmilliseconds=20, const G4String exportString="")
void SetCBDParameters(const std::vector< G4double > &)
void SetScaleFactor(const G4Vector3D &scaleFactor)
const G4Vector3D & GetScaleFactor() const
void SetAutoRefresh(G4bool)
const G4String & GetXGeometryString() const
G4String CameraAndLightingCommands(const G4Point3D standardTargetPoint) const
void AddVisAttributesModifier(const G4ModelingParameters::VisAttributesModifier &)
void SetCurrentTargetPoint(const G4Point3D ¤tTargetPoint)
void ClearCutawayPlanes()
const G4Point3D & GetCurrentTargetPoint() const
void SetCBDAlgorithmNumber(G4int)
void MultiplyScaleFactor(const G4Vector3D &scaleFactorMultiplier)
G4double GetZoomFactor() const
void SetDolly(G4double dolly)
G4String SceneModifyingCommands() const
void IncrementPan(G4double right, G4double up)
G4String TimeWindowCommands() const
G4String TouchableCommands() const
const std::vector< G4double > & GetCBDParameters() const
G4int GetCBDAlgorithmNumber() const
void ChangeCutawayPlane(size_t index, const G4Plane3D &cutawayPlane)
void SetZoomFactor(G4double zoomFactor)
void SetPan(G4double right, G4double up)
const G4Planes & GetCutawayPlanes() const
void MultiplyZoomFactor(G4double zoomFactorMultiplier)
G4String DrawingStyleCommands() const
G4bool IsAutoRefresh() const
void IncrementDolly(G4double dollyIncrement)
void ClearVisAttributesModifiers()
void AddCutawayPlane(const G4Plane3D &cutawayPlane)
G4double GetDolly() const
G4VisCommandViewerAddCutawayPlane()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4VisCommandViewerAddCutawayPlane()
G4VisCommandViewerCentreOn()
virtual ~G4VisCommandViewerCentreOn()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4UIcommand * fpCommandCentreOn
G4String GetCurrentValue(G4UIcommand *command)
G4UIcommand * fpCommandCentreAndZoomInOn
G4VisCommandViewerChangeCutawayPlane()
virtual ~G4VisCommandViewerChangeCutawayPlane()
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
void SetNewValue(G4UIcommand *command, G4String newValue)
G4VisCommandViewerClearCutawayPlanes()
virtual ~G4VisCommandViewerClearCutawayPlanes()
G4UIcmdWithoutParameter * fpCommand
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
G4String GetCurrentValue(G4UIcommand *command)
G4VisCommandViewerClearTransients()
virtual ~G4VisCommandViewerClearTransients()
G4UIcmdWithAString * fpCommand
G4VisCommandViewerClearVisAttributesModifiers()
void SetNewValue(G4UIcommand *command, G4String newValue)
virtual ~G4VisCommandViewerClearVisAttributesModifiers()
G4String GetCurrentValue(G4UIcommand *command)
G4UIcmdWithoutParameter * fpCommand
void SetNewValue(G4UIcommand *command, G4String newValue)
G4VisCommandViewerClear()
G4UIcmdWithAString * fpCommand
virtual ~G4VisCommandViewerClear()
G4String GetCurrentValue(G4UIcommand *command)
G4VisCommandViewerClone()
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4VisCommandViewerClone()
void SetNewValue(G4UIcommand *command, G4String newValue)
void SetNewValue(G4UIcommand *command, G4String newValue)
virtual ~G4VisCommandViewerColourByDensity()
G4VisCommandViewerColourByDensity()
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
G4UIcmdWithAString * fpCommand
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4VisCommandViewerCopyViewFrom()
G4VisCommandViewerCopyViewFrom()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4String GetCurrentValue(G4UIcommand *command)
G4VisCommandViewerCreate()
virtual ~G4VisCommandViewerCreate()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4VisCommandViewerDolly()
G4UIcmdWithADoubleAndUnit * fpCommandDollyTo
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4VisCommandViewerDolly()
G4UIcmdWithADoubleAndUnit * fpCommandDolly
virtual ~G4VisCommandViewerFlush()
G4UIcmdWithAString * fpCommand
void SetNewValue(G4UIcommand *command, G4String newValue)
G4VisCommandViewerFlush()
G4String GetCurrentValue(G4UIcommand *command)
G4VisCommandViewerInterpolate()
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
virtual ~G4VisCommandViewerInterpolate()
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4VisCommandViewerList()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4double fPanIncrementRight
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4VisCommandViewerPan()
G4UIcommand * fpCommandPan
G4UIcommand * fpCommandPanTo
void SetNewValue(G4UIcommand *command, G4String newValue)
G4VisCommandViewerRebuild()
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4VisCommandViewerRebuild()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4UIcmdWithAString * fpCommand
virtual ~G4VisCommandViewerRefresh()
G4String GetCurrentValue(G4UIcommand *command)
G4UIcmdWithAString * fpCommand
void SetNewValue(G4UIcommand *command, G4String newValue)
G4VisCommandViewerRefresh()
G4UIcmdWithAString * fpCommand
G4VisCommandViewerReset()
void SetNewValue(G4UIcommand *command, G4String newValue)
virtual ~G4VisCommandViewerReset()
G4String GetCurrentValue(G4UIcommand *command)
G4UIcmdWithAString * fpCommand
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
virtual ~G4VisCommandViewerSave()
G4UIcmdWith3Vector * fpCommandScale
G4UIcmdWith3Vector * fpCommandScaleTo
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
G4Vector3D fScaleMultiplier
virtual ~G4VisCommandViewerScale()
G4VisCommandViewerScale()
G4UIcmdWithAString * fpCommand
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4VisCommandViewerSelect()
G4VisCommandViewerSelect()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4VisCommandViewerUpdate()
G4String GetCurrentValue(G4UIcommand *command)
G4UIcmdWithAString * fpCommand
virtual ~G4VisCommandViewerUpdate()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4UIcmdWithADouble * fpCommandZoom
G4String GetCurrentValue(G4UIcommand *command)
G4UIcmdWithADouble * fpCommandZoomTo
virtual ~G4VisCommandViewerZoom()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4double GetExtentRadius() const
const G4Point3D & GetExtentCentre() const
G4VViewer * GetCurrentViewer() const
static Verbosity GetVerbosity()
void ResetTransientsDrawnFlags()
void SetVerboseLevel(G4int)
static Verbosity GetVerbosityValue(const G4String &)
const char * name(G4int ptype)
void strip(G4String &str, char c=' ')
Remove leading and trailing characters from string.
G4bool contains(const G4String &str, std::string_view ss)
Check if a string contains a given substring.
void WriteCommands(std::ostream &os, const G4ViewParameters &vp, const G4Point3D &stp)