501 if (!currentViewer) {
504 "ERROR: G4VisCommandsViewerSet::SetNewValue: no current viewer."
512 if (command == fpCommandAll) {
517 "ERROR: G4VisCommandsViewerSet::SetNewValue: all:"
518 "\n unrecognised from-viewer."
523 if (fromViewer == currentViewer) {
526 "WARNING: G4VisCommandsViewerSet::SetNewValue: all:"
527 "\n from-viewer and current viewer are identical."
533 G4bool currentAutoRefresh =
538 const std::vector<G4ModelingParameters::VisAttributesModifier>*
541 std::vector<G4ModelingParameters::VisAttributesModifier>::const_iterator i;
542 for (i = privateVAMs->begin(); i != privateVAMs->end(); ++i) {
547 G4cout <<
"View parameters of viewer \"" << currentViewer->
GetName()
548 <<
"\"\n set to those of viewer \"" << fromViewer->
GetName()
554 else if (command == fpCommandAutoRefresh) {
562 << currentViewer->
GetName() <<
" is NOT auto-refesh by default"
563 <<
"\n so cannot be set to auto-refresh."
572 G4cout <<
"be automatically refreshed after a change of view parameters."
581 else if (command == fpCommandAuxEdge) {
584 G4cout <<
"Auxiliary edges will ";
590 else if (command == fpCommandBackground) {
593 std::istringstream iss(newValue);
594 iss >> redOrString >> green >> blue >> opacity;
596 const size_t iPos0 = 0;
597 if (std::isalpha(redOrString[iPos0])) {
600 G4cout <<
"WARNING: Text colour \"" << redOrString
601 <<
"\" not found. Defaulting to black and opaque."
609 colour =
G4Colour(colour.GetRed(), colour.GetGreen(), colour.GetBlue(), opacity);
612 G4cout <<
"Background colour "
619 else if (command == fpCommandCulling) {
620 G4String cullingOption, stringFlag, unit;
622 std::istringstream is (newValue);
623 is >> cullingOption >> stringFlag >> density >> unit;
625 if (cullingOption ==
"global") {
629 "G4VisCommandsViewerSet::SetNewValue: culling: global culling flag"
631 ".\n Does not change specific culling flags."
635 else if (cullingOption ==
"coveredDaughters") {
639 "G4VisCommandsViewerSet::SetNewValue: culling: culling covered"
640 "\n daughters flag set to "
642 ". Daughters covered by opaque mothers"
643 "\n will be culled, i.e., not drawn, if this flag is true."
644 "\n Note: this is only effective in surface drawing style,"
645 "\n and then only if the volumes are visible and opaque, and then"
646 "\n only if no sections or cutaways are in operation."
650 else if (cullingOption ==
"invisible") {
654 "G4VisCommandsViewerSet::SetNewValue: culling: culling invisible"
657 ". Volumes marked invisible will be culled,"
658 "\n i.e., not drawn, if this flag is true."
662 else if (cullingOption ==
"density") {
673 "G4VisCommandsViewerSet::SetNewValue: culling: culling by density"
675 ". Volumes with density less than " <<
677 "\n will be culled, i.e., not drawn, if this flag is true."
684 "ERROR: G4VisCommandsViewerSet::SetNewValue: culling:"
685 "\n option not recognised."
691 else if (command == fpCommandCutawayMode) {
692 if (newValue ==
"add" || newValue ==
"union")
694 if (newValue ==
"multiply" || newValue ==
"intersection")
698 G4cout <<
"Cutaway mode set to ";
702 G4cout <<
"cutawayIntersection";
707 else if (command == fpCommandDefaultColour) {
710 std::istringstream iss(newValue);
711 iss >> redOrString >> green >> blue >> opacity;
713 const size_t iPos0 = 0;
714 if (std::isalpha(redOrString[iPos0])) {
717 G4cout <<
"WARNING: Text colour \"" << redOrString
718 <<
"\" not found. Defaulting to white and opaque."
726 colour =
G4Colour(colour.GetRed(), colour.GetGreen(), colour.GetBlue(), opacity);
731 G4cout <<
"Default colour "
738 else if (command == fpCommandDefaultTextColour) {
741 std::istringstream iss(newValue);
742 iss >> redOrString >> green >> blue >> opacity;
744 const size_t iPos0 = 0;
745 if (std::isalpha(redOrString[iPos0])) {
748 G4cout <<
"WARNING: Text colour \"" << redOrString
749 <<
"\" not found. Defaulting to white and opaque."
757 colour =
G4Colour(colour.GetRed(), colour.GetGreen(), colour.GetBlue(), opacity);
762 G4cout <<
"Default colour "
769 else if (command == fpCommandEdge) {
772 switch (existingStyle) {
785 switch (existingStyle) {
798 G4cout <<
"Drawing style of viewer \"" << currentViewer->
GetName()
804 else if (command == fpCommandExplodeFactor) {
807 std::istringstream is (newValue);
808 is >> explodeFactor >> x >> y >> z >> unitString;
819 else if (command == fpCommandGlobalLineWidthScale) {
824 G4cout <<
"Global Line Width Scale changed to "
829 else if (command == fpCommandGlobalMarkerScale) {
834 G4cout <<
"Global Marker Scale changed to "
839 else if (command == fpCommandHiddenEdge) {
842 switch (existingStyle) {
856 switch (existingStyle) {
870 G4cout <<
"Drawing style of viewer \"" << currentViewer->
GetName()
876 else if (command == fpCommandHiddenMarker) {
881 G4cout <<
"Markers will ";
887 else if (command == fpCommandLightsMove) {
888 if (newValue.find(
"cam") != G4String::npos)
890 else if(newValue.find(
"obj") != G4String::npos)
894 G4cerr <<
"ERROR: \"" << newValue <<
"\" not recognised."
895 " Looking for \"cam\" or \"obj\" in string." <<
G4endl;
899 G4cout <<
"Lights move with ";
901 G4cout <<
"camera (object appears to rotate).";
902 else G4cout <<
"object (the viewer appears to be moving).";
907 else if (command == fpCommandLightsThetaPhi) {
910 G4double x = std::sin (theta) * std::cos (phi);
911 G4double y = std::sin (theta) * std::sin (phi);
916 G4cout <<
"Lights direction set to "
921 else if (command == fpCommandLightsVector) {
925 G4cout <<
"Lights direction set to "
930 else if (command == fpCommandLineSegments) {
935 "Number of line segements per circle in polygon approximation is "
940 else if (command == fpCommandPicking) {
945 else G4cout <<
"inhibited.";
949 G4cout <<
"You may need to issue \"/vis/viewer/update\"."
954 else if (command == fpCommandProjection) {
956 const size_t iPos0 = 0;
957 if (newValue[iPos0] ==
'o') {
960 else if (newValue[iPos0] ==
'p') {
963 std::istringstream is (newValue);
964 is >> dummy >> fieldHalfAngle >> unit;
966 if (fieldHalfAngle > 89.5 *
deg || fieldHalfAngle <= 0.0) {
969 "ERROR: Field half angle should be 0 < angle <= 89.5 degrees.";
977 G4cerr <<
"ERROR: \"" << newValue <<
"\" not recognised."
978 " Looking for 'o' or 'p' first character." <<
G4endl;
984 G4cout <<
"Projection style of viewer \"" << currentViewer->
GetName()
986 if (fieldHalfAngle == 0.) {
990 G4cout <<
"perspective\n with half angle " << fieldHalfAngle /
deg
997 else if (command == fpCommandSectionPlane) {
1000 std::istringstream is (newValue);
1001 is >> choice >> x >> y >> z >> unit >> nx >> ny >> nz;
1003 G4int iSelector = -1;
1008 if (iSelector < 0) {
1010 G4cout <<
"Choice not recognised (on/true or off/false)." <<
G4endl;
1011 G4cout <<
"Section drawing is currently: ";
1014 G4cout <<
".\nSection plane is currently: "
1023 switch (iSelector) {
1029 x *= F; y *= F; z *= F;
1036 G4cout <<
"Section drawing is now: ";
1039 G4cout <<
".\nSection plane is now: "
1045 else if (command == fpCommandRotationStyle) {
1047 if (newValue ==
"constrainUpDirection")
1049 else if (newValue ==
"freeRotation")
1053 G4cerr <<
"ERROR: \"" << newValue <<
"\" not recognised." <<
G4endl;
1059 G4cout <<
"Rotation style of viewer \"" << currentViewer->
GetName()
1065 else if (command == fpCommandStyle) {
1067 const size_t iPos0 = 0;
1068 if (newValue[iPos0] ==
'w') {
1069 switch (existingStyle) {
1082 else if (newValue[iPos0] ==
's') {
1083 switch (existingStyle) {
1098 G4cerr <<
"ERROR: \"" << newValue <<
"\" not recognised."
1099 " Looking for 'w' or 's' first character." <<
G4endl;
1104 G4cout <<
"Drawing style of viewer \"" << currentViewer->
GetName()
1110 else if (command == fpCommandTargetPoint) {
1117 G4cout <<
"Target point set to "
1120 <<
"\n\"Current Target Point\" set to "
1123 <<
"\n\"Standard Target Point\" is "
1125 (standardTargetPoint)
1130 else if (command == fpCommandUpThetaPhi) {
1133 G4double x = std::sin (theta) * std::cos (phi);
1134 G4double y = std::sin (theta) * std::sin (phi);
1143 else if (command == fpCommandUpVector) {
1151 else if (command == fpCommandViewpointThetaPhi) {
1154 G4double x = std::sin (theta) * std::cos (phi);
1155 G4double y = std::sin (theta) * std::sin (phi);
1160 G4cout <<
"Viewpoint direction set to "
1163 G4cout <<
"Lightpoint direction set to "
1169 else if (command == fpCommandViewpointVector) {
1171 if (viewpointVector.
mag2() <= 0.) {
1173 G4cerr <<
"ERROR: Null viewpoint vector. No action taken." <<
G4endl;
1176 fViewpointVector = viewpointVector.
unit();
1179 G4cout <<
"Viewpoint direction set to "
1182 G4cout <<
"Lightpoint direction set to "
1192 "ERROR: G4VisCommandsViewerSet::SetNewValue: unrecognised command."
const G4String & GetName() const
void SetMarkerNotHidden()
void SetColour(const G4Colour &)
const G4Colour & GetBackgroundColour() const
G4Vector3D & GetActualLightpointDirection()
void SetLightpointDirection(const G4Vector3D &lightpointDirection)
G4double GetVisibleDensity() const
CLHEP::Hep3Vector G4ThreeVector
void SetAuxEdgeVisible(G4bool)
G4int SetNoOfSides(G4int nSides)
void SetRotationStyle(RotationStyle)
const G4Point3D & GetExplodeCentre() const
G4double GetExplodeFactor() const
void SetUpVector(const G4Vector3D &upVector)
const G4ViewParameters & GetViewParameters() const
static G4ThreeVector GetNew3VectorValue(const char *paramString)
static G4bool GetColour(const G4String &key, G4Colour &result)
const G4Colour & GetColour() const
static G4String ConvertToString(G4bool boolVal)
void SetViewParameters(const G4ViewParameters &vp)
void SetViewParameters(G4VViewer *, const G4ViewParameters &)
HepGeom::Point3D< G4double > G4Point3D
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
void SetDensityCulling(G4bool)
void SetVisibleDensity(G4double visibleDensity)
static G4ThreeVector ConvertTo3Vector(const char *st)
void SetDefaultTextVisAttributes(const G4VisAttributes &)
void SetBackgroundColour(const G4Colour &)
void SetCutawayMode(CutawayMode)
void SetLightsMoveWithCamera(G4bool moves)
void SetViewAndLights(const G4Vector3D &viewpointDirection)
const G4Point3D & GetCurrentTargetPoint() const
const G4Vector3D & GetLightpointDirection() const
static G4double GetValueOf(const G4String &)
const G4Vector3D & GetViewpointDirection() const
void SetExplodeFactor(G4double explodeFactor)
G4GLOB_DLL std::ostream G4cout
G4bool IsAuxEdgeVisible() const
const G4ViewParameters & GetDefaultViewParameters() const
void SetGlobalMarkerScale(G4double globalMarkerScale)
static G4bool ConvertToBool(const char *st)
const G4Point3D & GetStandardTargetPoint() const
static G4double GetNewDoubleValue(const char *paramString)
void SetCurrentTargetPoint(const G4Point3D ¤tTargetPoint)
RotationStyle GetRotationStyle() const
void SetDefaultVisAttributes(const G4VisAttributes &)
void SetFieldHalfAngle(G4double fieldHalfAngle)
CutawayMode GetCutawayMode() const
void SetExplodeCentre(const G4Point3D &explodeCentre)
G4double GetGlobalLineWidthScale() const
static G4int ConvertToInt(const char *st)
const G4VisAttributes * GetDefaultTextVisAttributes() const
void SetCullingInvisible(G4bool)
void SetAutoRefresh(G4bool)
G4Scene * GetScene() const
G4bool IsMarkerNotHidden() const
void AddVisAttributesModifier(const G4ModelingParameters::VisAttributesModifier &)
G4VSceneHandler * GetSceneHandler() const
void SetDrawingStyle(G4ViewParameters::DrawingStyle style)
G4VViewer * GetViewer(const G4String &viewerName) const
virtual const std::vector< G4ModelingParameters::VisAttributesModifier > * GetPrivateVisAttributesModifiers() const
static G4double ValueOf(const char *unitName)
static Verbosity GetVerbosity()
DrawingStyle GetDrawingStyle() const
G4int compareTo(const char *, caseCompare mode=exact) const
void SetGlobalLineWidthScale(G4double globalLineWidthScale)
HepGeom::Plane3D< G4double > G4Plane3D
G4bool GetLightsMoveWithCamera() const
const G4Plane3D & GetSectionPlane() const
G4VViewer * GetCurrentViewer() const
const G4VisAttributes * GetDefaultVisAttributes() const
static constexpr double deg
void SetSectionPlane(const G4Plane3D §ionPlane)
const G4Vector3D & GetUpVector() const
static void ConvertToDoublePair(const G4String ¶mString, G4double &xval, G4double &yval)
G4bool IsAutoRefresh() const
void SetCullingCovered(G4bool)
void SetViewpointDirection(const G4Vector3D &viewpointDirection)
G4String ConvertToStringWithBestUnit(G4ThreeVector vec)
G4GLOB_DLL std::ostream G4cerr
G4double GetGlobalMarkerScale() const
HepGeom::Normal3D< G4double > G4Normal3D
static G4VisManager * fpVisManager