47 #ifdef G4VIS_USE_STD11
63 RefreshIfRequired(viewer);
70 if (sceneHandler && sceneHandler->
GetScene()) {
76 G4cout <<
"Issue /vis/viewer/refresh or flush to see effect."
89 (
"Add cutaway plane to current viewer.");
92 parameter -> SetDefaultValue (0);
93 parameter -> SetGuidance (
"Coordinate of point on the plane.");
96 parameter -> SetDefaultValue (0);
97 parameter -> SetGuidance (
"Coordinate of point on the plane.");
100 parameter -> SetDefaultValue (0);
101 parameter -> SetGuidance (
"Coordinate of point on the plane.");
104 parameter -> SetDefaultValue (
"m");
105 parameter -> SetGuidance (
"Unit of point on the plane.");
108 parameter -> SetDefaultValue (1);
109 parameter -> SetGuidance (
"Component of plane normal.");
112 parameter -> SetDefaultValue (0);
113 parameter -> SetGuidance (
"Component of plane normal.");
116 parameter -> SetDefaultValue (0);
117 parameter -> SetGuidance (
"Component of plane normal.");
137 "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
145 std::istringstream is (newValue);
146 is >> x >> y >> z >> unit >> nx >> ny >> nz;
148 x *= F; y *= F; z *= F;
153 G4cout <<
"Cutaway planes for viewer \"" << viewer->
GetName() <<
"\" now:";
155 for (
size_t i = 0; i < cutaways.size(); ++i)
156 G4cout <<
"\n " << i <<
": " << cutaways[i];
168 fpCommand -> SetGuidance(
"Change cutaway plane.");
171 parameter -> SetGuidance (
"Index of plane: 0, 1, 2.");
174 parameter -> SetDefaultValue (0);
175 parameter -> SetGuidance (
"Coordinate of point on the plane.");
178 parameter -> SetDefaultValue (0);
179 parameter -> SetGuidance (
"Coordinate of point on the plane.");
182 parameter -> SetDefaultValue (0);
183 parameter -> SetGuidance (
"Coordinate of point on the plane.");
186 parameter -> SetDefaultValue (
"m");
187 parameter -> SetGuidance (
"Unit of point on the plane.");
190 parameter -> SetDefaultValue (1);
191 parameter -> SetGuidance (
"Component of plane normal.");
194 parameter -> SetDefaultValue (0);
195 parameter -> SetGuidance (
"Component of plane normal.");
198 parameter -> SetDefaultValue (0);
199 parameter -> SetGuidance (
"Component of plane normal.");
219 "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
228 std::istringstream is (newValue);
229 is >> index >> x >> y >> z >> unit >> nx >> ny >> nz;
231 x *= F; y *= F; z *= F;
237 G4cout <<
"Cutaway planes for viewer \"" << viewer->
GetName() <<
"\" now:";
239 for (
size_t i = 0; i < cutaways.size(); ++i)
240 G4cout <<
"\n " << i <<
": " << cutaways[i];
250 G4bool omitable, currentAsDefault;
252 fpCommand -> SetGuidance (
"Clears viewer.");
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",
258 currentAsDefault =
true);
267 return viewer ? viewer -> GetName () :
G4String(
"none");
278 G4cerr <<
"ERROR: Viewer \"" << clearName
279 <<
"\" not found - \"/vis/viewer/list\" to see possibilities."
289 G4cout <<
"Viewer \"" << clearName <<
"\" cleared." <<
G4endl;
298 (
"/vis/viewer/clearCutawayPlanes",
this);
299 fpCommand -> SetGuidance (
"Clear cutaway planes of current viewer.");
318 "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
327 G4cout <<
"Cutaway planes for viewer \"" << viewer->
GetName()
328 <<
"\" now cleared." <<
G4endl;
337 G4bool omitable, currentAsDefault;
339 fpCommand -> SetGuidance (
"Clears transients from viewer.");
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",
345 currentAsDefault =
true);
354 return viewer ? viewer -> GetName () :
G4String(
"none");
365 G4cerr <<
"ERROR: Viewer \"" << clearName
366 <<
"\" not found - \"/vis/viewer/list\" to see possibilities."
377 G4cout <<
"Viewer \"" << clearName <<
"\" cleared of transients."
387 (
"/vis/viewer/clearVisAttributesModifiers",
this);
388 fpCommand -> SetGuidance (
"Clear vis attribute modifiers of current viewer.");
389 fpCommand -> SetGuidance (
"(These are used for touchables, etc.)");
408 "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
417 G4cout <<
"Vis attributes modifiers for viewer \"" << viewer->
GetName()
418 <<
"\" now cleared." <<
G4endl;
429 fpCommand -> SetGuidance (
"Clones viewer.");
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.");
435 parameter =
new G4UIparameter (
"original-viewer-name",
's', omitable =
true);
436 parameter -> SetCurrentAsDefault (
true);
438 parameter =
new G4UIparameter (
"clone-name",
's', omitable =
true);
439 parameter -> SetDefaultValue (
"none");
450 return "\"" + originalName +
"\"";
458 std::istringstream is (newValue);
463 while (is.get(c) && c ==
' '){}
465 while (is.get(c) && c !=
'"') {originalName += c;}
469 while (is.get(c) && c !=
' ') {originalName += c;}
475 if (!originalViewer) {
477 G4cerr <<
"ERROR: Viewer \"" << originalName
478 <<
"\" not found - \"/vis/viewer/list\" to see possibilities."
483 originalName = originalViewer->
GetName();
485 while (is.get(c) && c ==
' '){}
487 while (is.get(c) && c !=
'"') {cloneName += c;}
491 while (is.get(c) && c !=
' ') {cloneName += c;}
496 G4bool errorWhileNaming =
false;
497 if (cloneName ==
"none") {
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)) !=
507 cloneName.insert(nextSpacePosition, oss.str());
509 G4String::size_type spacePosition = cloneName.find(
' ');
510 if (spacePosition != G4String::npos)
511 cloneName.insert(spacePosition, oss.str());
513 errorWhileNaming =
true;
515 }
while (!errorWhileNaming &&
fpVisManager -> GetViewer (cloneName));
518 if (errorWhileNaming) {
520 G4cerr <<
"ERROR: While naming clone viewer \"" << cloneName
529 G4cerr <<
"ERROR: Putative clone viewer \"" << cloneName
530 <<
"\" already exists."
542 if (keepVerbose >= 2 ||
548 (
G4String(
"/vis/viewer/create ! \"" + cloneName +
"\" " + windowSizeHint));
553 G4cout <<
"Viewer \"" << originalName <<
"\" cloned." <<
G4endl;
554 G4cout <<
"Clone \"" << cloneName <<
"\" now current." <<
G4endl;
564 (
"Copy the camera-specific parameters from the specified viewer.");
566 (
"Note: To copy scene modifications - style, etc. - please use"
567 "\n\"/vis/viewer/set/all\"");
568 fpCommand -> SetParameterName (
"from-viewer-name", omitable =
false);
584 if (!currentViewer) {
587 "ERROR: G4VisCommandsViewerCopyViewFrom::SetNewValue: no current viewer."
593 const G4String& fromViewerName = newValue;
597 G4cerr <<
"ERROR: Viewer \"" << fromViewerName
598 <<
"\" not found - \"/vis/viewer/list\" to see possibilities."
604 if (fromViewer == currentViewer) {
607 "WARNING: G4VisCommandsViewerSet::SetNewValue:"
608 "\n from-viewer and current viewer are identical."
629 G4cout <<
"Camera parameters of viewer \"" << currentViewer->
GetName()
630 <<
"\"\n set to those of viewer \"" << fromViewer->
GetName()
642 (
"Creates a viewer for the specified scene handler.");
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.");
650 parameter =
new G4UIparameter (
"scene-handler",
's', omitable =
true);
651 parameter -> SetCurrentAsDefault (
true);
653 parameter =
new G4UIparameter (
"viewer-name",
's', omitable =
true);
654 parameter -> SetCurrentAsDefault (
true);
656 parameter =
new G4UIparameter (
"window-size-hint",
's', omitable =
true);
658 (
"integer (pixels) for square window placed by window manager or"
659 " X-Windows-type geometry string, e.g. 600x600-100+100");
669 std::ostringstream oss;
671 oss <<
"viewer-" <<
fId <<
" (";
673 oss << sceneHandler -> GetGraphicsSystem () -> GetName ();
676 oss <<
"no_scene_handlers";
686 if (currentSceneHandler) {
687 currentValue = currentSceneHandler -> GetName ();
690 currentValue =
"none";
697 currentValue +=
" 600";
708 std::istringstream is (newValue);
709 is >> sceneHandlerName;
714 while (is.get(c) && c ==
' '){}
716 while (is.get(c) && c !=
'"') {newName += c;}
720 while (is.get(c) && c !=
' ') {newName += c;}
726 is >> windowSizeHintString;
730 G4int nHandlers = sceneHandlerList.size ();
731 if (nHandlers <= 0) {
734 "ERROR: G4VisCommandViewerCreate::SetNewValue: no scene handlers."
735 "\n Create a scene handler with \"/vis/sceneHandler/create\""
742 for (iHandler = 0; iHandler < nHandlers; iHandler++) {
743 if (sceneHandlerList [iHandler] -> GetName () == sceneHandlerName)
break;
746 if (iHandler < 0 || iHandler >= nHandlers) {
750 G4cout <<
"G4VisCommandViewerCreate::SetNewValue:"
751 " invalid scene handler specified."
760 if (sceneHandler !=
fpVisManager -> GetCurrentSceneHandler ()) {
769 if (newName == nextName)
fId++;
772 for (
G4int ih = 0; ih < nHandlers; ih++) {
774 const G4ViewerList& viewerList = sh -> GetViewerList ();
775 for (
size_t iViewer = 0; iViewer < viewerList.size (); iViewer++) {
776 if (viewerList [iViewer] -> GetShortName () == newShortName ) {
778 G4cerr <<
"ERROR: Viewer \"" << newShortName <<
"\" already exists."
790 fpVisManager -> CreateViewer (newName,windowSizeHintString);
793 if (newViewer && newViewer -> GetName () == newName) {
795 G4cout <<
"New viewer \"" << newName <<
"\" created." <<
G4endl;
801 G4cerr <<
"ERROR: New viewer doesn\'t match!!! Curious!!" <<
G4endl;
814 G4cout <<
"Issue /vis/viewer/refresh or flush to see effect."
824 fDollyIncrement (0.),
827 G4bool omitable, currentAsDefault;
830 (
"/vis/viewer/dolly",
this);
832 (
"Incremental dolly.");
834 (
"Moves the camera incrementally towards target point.");
837 currentAsDefault=
true);
841 (
"/vis/viewer/dollyTo",
this);
843 (
"Dolly to specific coordinate.");
845 (
"Places the camera towards target point relative to standard camera point.");
848 currentAsDefault=
true);
875 if (!currentViewer) {
878 "ERROR: G4VisCommandsViewerDolly::SetNewValue: no current viewer."
905 G4bool omitable, currentAsDefault;
908 (
"Compound command: \"/vis/viewer/refresh\" + \"/vis/viewer/update\".");
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",
916 currentAsDefault =
true);
925 G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
926 return viewer ? viewer -> GetName () :
G4String(
"none");
937 G4cerr <<
"ERROR: Viewer \"" << flushName <<
"\"" <<
938 " not found - \"/vis/viewer/list\"\n to see possibilities."
954 G4cout <<
"Viewer \"" << viewer -> GetName () <<
"\""
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.");
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/*\".");
982 (
"To export interpolated views to file for a future possible movie, "
983 "write \"export\" as 5th parameter (OpenGL only).");
985 parameter =
new G4UIparameter(
"pattern",
's', omitable =
true);
986 parameter -> SetGuidance(
"Pattern that defines the view files.");
987 parameter -> SetDefaultValue(
"*.g4view");
989 parameter =
new G4UIparameter(
"no-of-points",
'i', omitable =
true);
990 parameter -> SetGuidance (
"Number of interpolation points per interval.");
991 parameter -> SetDefaultValue(50);
993 parameter =
new G4UIparameter(
"wait-time",
's', omitable =
true);
994 parameter -> SetGuidance(
"Wait time per interpolated point");
995 parameter -> SetDefaultValue(
"20.");
997 parameter =
new G4UIparameter(
"time-unit",
's', omitable =
true);
998 parameter -> SetDefaultValue(
"millisecond");
1000 parameter =
new G4UIparameter(
"export",
's', omitable =
true);
1001 parameter -> SetDefaultValue(
"no");
1018 if (!currentViewer) {
1021 "ERROR: G4VisCommandViewerInterpolate::SetNewValue: no current viewer."
1028 G4int nInterpolationPoints;
1033 std::istringstream iss (newValue);
1036 >> nInterpolationPoints
1037 >> waitTimePerPointString
1043 if (waitTimePerPointmilliseconds < 0) waitTimePerPointmilliseconds = 0;
1046 G4String shellCommand =
"echo " + pattern;
1047 FILE *filelist = popen(shellCommand.c_str(),
"r");
1051 <<
"ERROR: G4VisCommandViewerInterpolate::SetNewValue:"
1052 <<
"\n Error obtaining pipe."
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;
1085 while (fileliststream >> pathname
1086 && safetyCount++ < safety) {
1091 if (safetyCount >= safety) {
1094 "/vis/viewer/interpolate:"
1095 "\n the number of way points exceeds the maximum currently allowed: "
1112 if (exportString ==
"export" &&
1115 #ifdef G4VIS_USE_STD11
1116 if (waitTimePerPointmilliseconds > 0)
1117 std::this_thread::sleep_for(std::chrono::milliseconds(waitTimePerPointmilliseconds));
1119 }
while (safetyCount++ < safety);
1129 G4cout <<
"Viewer \"" << currentViewer -> GetName () <<
"\""
1130 <<
" restored." <<
G4endl;
1136 #endif // WIN32 - popen is not available in Windows. _popen is there but not tried.
1143 fpCommand -> SetGuidance (
"Lists viewers(s).");
1145 (
"See \"/vis/verbose\" for definition of verbosity.");
1149 parameter -> SetDefaultValue (
"all");
1153 parameter -> SetDefaultValue (
"warnings");
1167 std::istringstream is (newValue);
1168 is >> name >> verbosityString;
1175 if (currentViewer) {
1176 currentViewerShortName = currentViewer -> GetShortName ();
1179 currentViewerShortName =
"none";
1184 G4int nHandlers = sceneHandlerList.size ();
1186 G4bool foundCurrent =
false;
1187 for (
int iHandler = 0; iHandler < nHandlers; iHandler++) {
1189 const G4ViewerList& viewerList = sceneHandler -> GetViewerList ();
1191 <<
"Scene handler \"" << sceneHandler -> GetName () <<
"\" ("
1193 const G4Scene* pScene = sceneHandler -> GetScene ();
1195 G4cout <<
", scene \"" << pScene -> GetName () <<
"\"";
1198 G4int nViewers = viewerList.size ();
1199 if (nViewers == 0) {
1200 G4cout <<
"\n No viewers for this scene handler." <<
G4endl;
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;
1212 if (thisShortName == currentViewerShortName) {
1213 foundCurrent =
true;
1219 G4cout <<
" viewer \"" << thisName <<
"\"";
1221 G4cout <<
"\n " << *thisViewer;
1228 if (!foundCurrent) {
1229 G4cout <<
"No valid current viewer - please create or select one."
1235 if (name !=
"all") {
1236 G4cout <<
" of name \"" << name <<
"\"";
1245 fPanIncrementRight (0.),
1246 fPanIncrementUp (0.),
1253 (
"/vis/viewer/pan",
this);
1255 (
"Incremental pan.");
1257 (
"Moves the camera incrementally right and up by these amounts (as seen"
1258 "\nfrom viewpoint direction).");
1260 parameter =
new G4UIparameter(
"right-increment",
'd', omitable =
true);
1261 parameter -> SetCurrentAsDefault (
true);
1263 parameter =
new G4UIparameter(
"up-increment",
'd', omitable =
true);
1264 parameter -> SetCurrentAsDefault (
true);
1266 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
1267 parameter -> SetDefaultValue (
"m");
1271 (
"/vis/viewer/panTo",
this);
1273 (
"Pan to specific coordinate.");
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);
1281 parameter -> SetCurrentAsDefault (
true);
1283 parameter =
new G4UIparameter (
"unit",
's', omitable =
true);
1284 parameter -> SetDefaultValue (
"m");
1301 return currentValue;
1311 if (!currentViewer) {
1314 "ERROR: G4VisCommandsViewerPan::SetNewValue: no current viewer."
1342 G4bool omitable, currentAsDefault;
1344 fpCommand -> SetGuidance (
"Forces rebuild of graphical database.");
1346 (
"By default, acts on current viewer. \"/vis/viewer/list\""
1347 "\nto see possible viewers. Viewer becomes current.");
1348 fpCommand -> SetParameterName (
"viewer-name",
1350 currentAsDefault =
true);
1360 return viewer -> GetName ();
1376 G4cerr <<
"ERROR: Viewer \"" << rebuildName
1377 <<
"\" not found - \"/vis/viewer/list\" to see possibilities."
1384 if (!sceneHandler) {
1386 G4cerr <<
"ERROR: Viewer \"" << viewer->
GetName() <<
"\"" <<
1387 " has no scene handler - report serious bug."
1406 G4bool omitable, currentAsDefault;
1409 (
"Refreshes viewer.");
1411 (
"By default, acts on current viewer. \"/vis/viewer/list\""
1412 "\nto see possible viewers. Viewer becomes current.");
1413 fpCommand -> SetParameterName (
"viewer-name",
1415 currentAsDefault =
true);
1424 return viewer ? viewer -> GetName () :
G4String(
"none");
1436 G4cerr <<
"ERROR: Viewer \"" << refreshName <<
"\"" <<
1437 " not found - \"/vis/viewer/list\"\n to see possibilities."
1444 if (!sceneHandler) {
1446 G4cerr <<
"ERROR: Viewer \"" << refreshName <<
"\"" <<
1447 " has no scene handler - report serious bug."
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\")."
1466 G4bool successful = scene -> AddWorldIfEmpty (warn);
1470 "WARNING: Scene is empty. Perhaps no geometry exists."
1471 "\n Try /run/initialize."
1482 G4cout <<
"Refreshing viewer \"" << viewer -> GetName () <<
"\"..."
1485 viewer -> SetView ();
1486 viewer -> ClearView ();
1487 viewer -> DrawView ();
1489 G4cout <<
"Viewer \"" << viewer -> GetName () <<
"\"" <<
" refreshed."
1490 "\n (You might also need \"/vis/viewer/update\".)" <<
G4endl;
1498 G4bool omitable, currentAsDefault;
1500 fpCommand -> SetGuidance (
"Resets viewer.");
1502 (
"By default, acts on current viewer. \"/vis/viewer/list\""
1503 "\nto see possible viewers. Viewer becomes current.");
1504 fpCommand -> SetParameterName (
"viewer-name",
1506 currentAsDefault =
true);
1516 return viewer -> GetName ();
1531 G4cerr <<
"ERROR: Viewer \"" << resetName
1532 <<
"\" not found - \"/vis/viewer/list\" to see possibilities."
1548 (
"Write commands that define the current view to file.");
1550 (
"Read them back into the same or any viewer with \"/control/execute\".");
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.");
1555 (
"If the filename is \"-\", the data are written to G4cout.");
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);
1594 if (!currentViewer) {
1597 "ERROR: G4VisCommandsViewerSave::SetNewValue: no current viewer."
1604 if (!currentScene) {
1607 "ERROR: G4VisCommandsViewerSave::SetNewValue: no current scene."
1616 const std::vector<G4ModelingParameters::VisAttributesModifier>*
1619 std::vector<G4ModelingParameters::VisAttributesModifier>::const_iterator i;
1620 for (i = privateVAMs->begin(); i != privateVAMs->end(); ++i) {
1627 if (newValue.length() == 0) {
1629 const G4int maxNoOfFiles = 100;
1630 static G4int sequenceNumber = 0;
1631 if (sequenceNumber >= maxNoOfFiles) {
1634 <<
"ERROR: G4VisCommandsViewerSave::SetNewValue: Maximum number, "
1636 <<
", of files exceeded."
1641 std::ostringstream oss;
1642 oss << std::setw(2) << std::setfill(
'0') << sequenceNumber++;
1643 filename =
"g4_" + oss.str() +
".g4view";
1646 if (filename ==
"-") {
1648 WriteCommands(
G4cout,vp,stp);
1651 std::ofstream ofs(filename);
1655 "ERROR: G4VisCommandsViewerSave::SetNewValue: Trouble opening file \""
1656 << filename <<
"\"."
1662 WriteCommands(ofs,vp,stp);
1667 G4cout <<
"Viewer \"" << currentViewer -> GetName ()
1668 <<
"\"" <<
" saved to ";
1669 if (filename ==
"-") {
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.";
1688 G4bool omitable, currentAsDefault;
1691 (
"/vis/viewer/scale",
this);
1692 fpCommandScale -> SetGuidance (
"Incremental (non-uniform) scaling.");
1694 (
"Multiplies components of current scaling by components of this factor."
1695 "\n Scales (x,y,z) by corresponding components of the resulting factor.");
1699 (
"x-scale-multiplier",
"y-scale-multiplier",
"z-scale-multiplier",
1700 omitable=
true, currentAsDefault=
true);
1703 (
"/vis/viewer/scaleTo",
this);
1706 (
"Scales (x,y,z) by corresponding components of this factor.");
1708 (
"x-scale-factor",
"y-scale-factor",
"z-scale-factor",
1709 omitable=
true, currentAsDefault=
true);
1725 return currentValue;
1735 if (!currentViewer) {
1738 "ERROR: G4VisCommandsViewerScale::SetNewValue: no current viewer."
1767 fpCommand -> SetGuidance (
"Selects viewer.");
1769 (
"Specify viewer by name. \"/vis/viewer/list\" to see possible viewers.");
1770 fpCommand -> SetParameterName (
"viewer-name", omitable =
false);
1790 G4cerr <<
"ERROR: Viewer \"" << selectName <<
"\"";
1791 G4cerr <<
" not found - \"/vis/viewer/list\""
1792 "\n to see possibilities."
1800 G4cout <<
"WARNING: Viewer \"" << viewer -> GetName () <<
"\""
1801 <<
" already selected." <<
G4endl;
1815 G4bool omitable, currentAsDefault;
1818 (
"Triggers graphical database post-processing for viewers"
1819 "\nusing that technique.");
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",
1826 currentAsDefault =
true);
1836 return viewer -> GetName ();
1853 "WARNING: command \"/vis/viewer/update\" could not be applied: no current viewer."
1860 if (!sceneHandler) {
1862 G4cerr <<
"ERROR: Viewer \"" << updateName <<
"\"" <<
1863 " has no scene handler - report serious bug."
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\")."
1883 G4cout <<
"Viewer \"" << viewer -> GetName () <<
"\"";
1886 viewer -> ShowView ();
1888 sceneHandler -> SetMarkForClearingTransientStore(
true);
1894 fZoomMultiplier (1.),
1897 G4bool omitable, currentAsDefault;
1900 (
"/vis/viewer/zoom",
this);
1903 (
"Multiplies current magnification by this factor.");
1906 currentAsDefault=
true);
1909 (
"/vis/viewer/zoomTo",
this);
1912 (
"Magnifies standard magnification by this factor.");
1915 currentAsDefault=
true);
1931 return currentValue;
1941 if (!currentViewer) {
1944 "ERROR: G4VisCommandsViewerZoom::SetNewValue: no current viewer."
const G4String & GetName() const
G4String GetCurrentValue(G4UIcommand *command)
void SetParameter(G4UIparameter *const newParameter)
G4String TouchableCommands() const
G4UIcmdWithADouble * fpCommandZoom
G4String GetCurrentValue(G4UIcommand *command)
G4double GetZoomFactor() const
G4VisCommandViewerClone()
void IncrementPan(G4double right, G4double up)
void ClearCutawayPlanes()
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
G4VisCommandViewerAddCutawayPlane()
void AddCutawayPlane(const G4Plane3D &cutawayPlane)
G4VisCommandViewerInterpolate()
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
G4VisCommandViewerCopyViewFrom()
G4String strip(G4int strip_Type=trailing, char c=' ')
void UpdateVisManagerScene(const G4String &sceneName="")
void SetNewValue(G4UIcommand *command, G4String newValue)
virtual ~G4VisCommandViewerInterpolate()
virtual ~G4VisCommandViewerClearTransients()
void SetVerboseLevel(G4int)
virtual ~G4VisCommandViewerChangeCutawayPlane()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4VisCommandViewerUpdate()
G4String GetCurrentValue(G4UIcommand *command)
G4String GetCurrentValue(G4UIcommand *command)
void SetUpVector(const G4Vector3D &upVector)
G4UIcommand * fpCommandPan
const G4ViewParameters & GetViewParameters() const
virtual ~G4VisCommandViewerClear()
void SetDefaultValue(const char *theDefaultValue)
static G4String ConvertToString(G4bool boolVal)
const G4String & GetName() const
G4String SceneModifyingCommands() const
void SetViewParameters(const G4ViewParameters &vp)
void SetViewParameters(G4VViewer *, const G4ViewParameters &)
virtual ~G4VisCommandViewerFlush()
HepGeom::Point3D< G4double > G4Point3D
G4UIcmdWithoutParameter * fpCommand
HepGeom::Vector3D< G4double > G4Vector3D
const G4Planes & GetCutawayPlanes() const
void SetNewValue(G4UIcommand *command, G4String newValue)
const char * name(G4int ptype)
G4UIcmdWith3Vector * fpCommandScaleTo
G4Vector3D fScaleMultiplier
G4String GetCurrentValue(G4UIcommand *command)
G4String GetCurrentValue(G4UIcommand *command)
static G4double GetNewDoubleValue(const char *paramString)
G4int GetVerboseLevel() const
const G4String & GetName() const
static Verbosity GetVerbosityValue(const G4String &)
static G4double ConvertToDimensionedDouble(const char *st)
void SetVerboseLevel(G4int val)
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
void SetLightsMoveWithCamera(G4bool moves)
void ClearVisAttributesModifiers()
G4String GetCurrentValue(G4UIcommand *command)
const G4Point3D & GetCurrentTargetPoint() const
G4VisCommandViewerClearVisAttributesModifiers()
static G4UImanager * GetUIpointer()
G4UIcmdWithAString * fpCommand
G4UIcmdWithADoubleAndUnit * fpCommandDolly
G4VisCommandViewerScale()
virtual ~G4VisCommandViewerClearCutawayPlanes()
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)
G4UIcmdWithAString * fpCommand
void ChangeCutawayPlane(size_t index, const G4Plane3D &cutawayPlane)
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4VisCommandViewerSelect()
const G4Point3D & GetStandardTargetPoint() const
virtual ~G4VisCommandViewerRebuild()
G4UIcmdWithAString * fpCommand
void SetNewValue(G4UIcommand *command, G4String newValue)
std::vector< G4Plane3D > G4Planes
static G4double GetNewDoubleValue(const char *paramString)
G4UIcmdWithAString * fpCommand
const std::vector< Model > & GetRunDurationModelList() const
virtual ~G4VisCommandViewerUpdate()
void SetNewValue(G4UIcommand *command, G4String newValue)
virtual ~G4VisCommandViewerCreate()
void ResetTransientsDrawnFlags()
void SetCurrentTargetPoint(const G4Point3D ¤tTargetPoint)
void SetDolly(G4double dolly)
G4VGraphicsSystem * GetGraphicsSystem() const
void SetNewValue(G4UIcommand *command, G4String newValue)
virtual ~G4VisCommandViewerRefresh()
G4UIcmdWithAString * fpCommand
void SetFieldHalfAngle(G4double fieldHalfAngle)
G4VisCommandViewerReset()
G4UIcmdWithADouble * fpCommandZoomTo
G4String GetCurrentValue(G4UIcommand *command)
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)
virtual ~G4VisCommandViewerClearVisAttributesModifiers()
G4VisCommandViewerChangeCutawayPlane()
G4UIcmdWithAString * fpCommand
G4bool contains(const std::string &) const
void RefreshIfRequired(G4VViewer *)
void SetAutoRefresh(G4bool)
G4Scene * GetScene() const
void MultiplyZoomFactor(G4double zoomFactorMultiplier)
G4UIcommand * fpCommandPanTo
G4VisCommandViewerRebuild()
virtual ~G4VisCommandViewerDolly()
void AddVisAttributesModifier(const G4ModelingParameters::VisAttributesModifier &)
G4VisCommandViewerDolly()
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 ~G4VisCommandViewerScale()
virtual const std::vector< G4ModelingParameters::VisAttributesModifier > * GetPrivateVisAttributesModifiers() const
static G4String ConvertToString(G4double x, G4double y, const char *unitName)
static G4double ValueOf(const char *unitName)
G4UIcmdWithAString * fpCommand
G4UIcmdWith3Vector * fpCommandScale
G4UIcmdWithoutParameter * fpCommand
G4String GetCurrentValue(G4UIcommand *command)
G4VisCommandViewerFlush()
virtual ~G4VisCommandViewerList()
virtual ~G4VisCommandViewerClone()
static constexpr double millisecond
static Verbosity GetVerbosity()
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4VVisCommandViewer()
G4String GetCurrentValue(G4UIcommand *command)
G4UIcmdWithAString * fpCommand
G4String GetCurrentValue(G4UIcommand *command)
G4VisCommandViewerSelect()
G4VisCommandViewerClear()
HepGeom::Plane3D< G4double > G4Plane3D
G4String CameraAndLightingCommands(const G4Point3D standardTargetPoint) const
G4bool GetLightsMoveWithCamera() const
G4VViewer * GetCurrentViewer() const
G4double GetFieldHalfAngle() const
void SetNewValue(G4UIcommand *command, G4String newValue)
void MultiplyScaleFactor(const G4Vector3D &scaleFactorMultiplier)
virtual ~G4VisCommandViewerCopyViewFrom()
virtual void ClearTransientStore()
virtual ~G4VisCommandViewerSave()
G4VisCommandViewerClearTransients()
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
virtual ~G4VisCommandViewerReset()
static void ConvertToDoublePair(const G4String ¶mString, G4double &xval, G4double &yval)
virtual ~G4VisCommandViewerZoom()
G4VisCommandViewerRefresh()
virtual ~G4VisCommandViewerPan()
G4UIcmdWithAString * fpCommand
void SetMarkForClearingTransientStore(G4bool)
G4bool IsAutoRefresh() const
G4double fPanIncrementRight
void IncrementDolly(G4double dollyIncrement)
void SetViewpointDirection(const G4Vector3D &viewpointDirection)
G4int ApplyCommand(const char *aCommand)
G4VisCommandViewerClearCutawayPlanes()
G4String GetCurrentValue(G4UIcommand *command)
virtual void FinishView()
G4GLOB_DLL std::ostream G4cerr
G4String GetCurrentValue(G4UIcommand *command)
G4String GetCurrentValue(G4UIcommand *command)
HepGeom::Normal3D< G4double > G4Normal3D
G4VisCommandViewerCreate()
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)
virtual ~G4VisCommandViewerAddCutawayPlane()