1941 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1948 <<
"ERROR: Scene has no extent. Add volumes or use \"/vis/scene/add/extent\"."
1955 G4double userLength, red, green, blue, xmid, ymid, zmid;
1956 G4String userLengthUnit, direction, auto_manual, positionUnit;
1957 std::istringstream is (newValue);
1958 is >> userLength >> userLengthUnit >> direction
1959 >> red >> green >> blue
1961 >> xmid >> ymid >> zmid >> positionUnit;
1965 if (userLengthUnit ==
"auto") {
1967 const G4double intLog10Length = std::floor(std::log10(lengthMax));
1968 length = std::pow(10,intLog10Length);
1969 if (5.*length < lengthMax) length *= 5.;
1970 else if (2.*length < lengthMax) length *= 2.;
1977 xmid *= unit; ymid *= unit; zmid *= unit;
1980 if (direction(0) ==
'y') scaleDirection =
G4Scale::y;
1981 if (direction(0) ==
'z') scaleDirection =
G4Scale::z;
1987 "ERROR: G4VisCommandSceneAddScale::SetNewValue: no viewer."
1988 "\n Auto direction needs a viewer."
1999 if (direction ==
"auto") {
2000 if (std::abs(vp.
x()) > std::abs(vp.
y()) &&
2001 std::abs(vp.
x()) > std::abs(vp.
z())) {
2002 if (std::abs(up.
y()) > std::abs(up.
z())) scaleDirection =
G4Scale::z;
2005 else if (std::abs(vp.
y()) > std::abs(vp.
x()) &&
2006 std::abs(vp.
y()) > std::abs(vp.
z())) {
2007 if (std::abs(up.
x()) > std::abs(up.
z())) scaleDirection =
G4Scale::z;
2010 else if (std::abs(vp.
z()) > std::abs(vp.
x()) &&
2011 std::abs(vp.
z()) > std::abs(vp.
y())) {
2012 if (std::abs(up.
y()) > std::abs(up.
x())) scaleDirection =
G4Scale::x;
2017 G4bool autoPlacing =
false;
if (auto_manual ==
"auto") autoPlacing =
true;
2021 const G4double halfLength(length / 2.);
2023 const G4double freeLengthFraction (1. + 2. * comfort);
2038 "WARNING: Existing scene does not yet have any extent."
2039 "\n Maybe you have not yet added any geometrical object."
2045 switch (scaleDirection) {
2047 if (freeLengthFraction * (xmax - xmin) < length) room =
false;
2050 if (freeLengthFraction * (ymax - ymin) < length) room =
false;
2053 if (freeLengthFraction * (zmax - zmin) < length) room =
false;
2060 "WARNING: Not enough room in existing scene. Maybe scale is too long."
2067 "WARNING: The scale you have asked for is bigger than the existing"
2068 "\n scene. Maybe you have added it too soon. It is recommended that"
2069 "\n you add the scale last so that it can be correctly auto-positioned"
2070 "\n so as not to be obscured by any existing object and so that the"
2071 "\n view parameters can be correctly recalculated."
2078 G4Scale scale(length, annotation, scaleDirection,
2079 false, xmid, ymid, zmid,
2082 scale.SetVisAttributes(visAttr);
2085 globalDescription +=
" (" + newValue +
")";
2115 G4double sxmid(xmid), symid(ymid), szmid(zmid);
2119 const G4double xComfort = comfort * (xmax - xmin);
2120 const G4double yComfort = comfort * (ymax - ymin);
2121 const G4double zComfort = comfort * (zmax - zmin);
2122 switch (scaleDirection) {
2125 sxmid = xmax + xComfort;
2126 symid = ymin - yComfort;
2127 szmid = zmin - zComfort;
2129 sxmid = xmin - xComfort;
2130 symid = ymin - yComfort;
2131 szmid = zmax + zComfort;
2136 sxmid = xmin - xComfort;
2137 symid = ymax + yComfort;
2138 szmid = zmin - zComfort;
2140 sxmid = xmax + xComfort;
2141 symid = ymin - yComfort;
2142 szmid = zmin - zComfort;
2147 sxmid = xmax + xComfort;
2148 symid = ymin - yComfort;
2149 szmid = zmax + zComfort;
2151 sxmid = xmin - xComfort;
2152 symid = ymin - yComfort;
2153 szmid = zmax + zComfort;
2209 switch (scaleDirection) {
2211 scaleExtent =
G4VisExtent(-halfLength,halfLength,0,0,0,0);
2215 scaleExtent =
G4VisExtent(0,0,-halfLength,halfLength,0,0);
2219 scaleExtent =
G4VisExtent(0,0,0,0,-halfLength,halfLength);
2233 const G4String& currentSceneName = pScene -> GetName ();
2234 G4bool successful = pScene -> AddRunDurationModel (model, warn);
2237 G4cout <<
"Scale of " << annotation
2238 <<
" added to scene \"" << currentSceneName <<
"\".";
2240 G4cout <<
"\n with extent " << scaleExtent
void UpdateVisManagerScene(const G4String &sceneName="")
const G4ViewParameters & GetViewParameters() const
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
void SetExtent(const G4VisExtent &)
static G4double fCurrentTextSize
void SetTransformation(const G4Transform3D &)
static void G4VisCommandsSceneAddUnsuccessful(G4VisManager::Verbosity verbosity)
G4double GetExtentRadius() const
const G4Vector3D & GetViewpointDirection() const
G4GLOB_DLL std::ostream G4cout
const G4VisExtent & GetExtent() const
const G4String & GetGlobalDescription() const
static G4double ValueOf(const char *unitName)
static Verbosity GetVerbosity()
G4VViewer * GetCurrentViewer() const
static constexpr double halfpi
const G4Vector3D & GetUpVector() const
const XML_Char XML_Content * model
void SetGlobalDescription(const G4String &)
G4Scene * GetCurrentScene() const
G4GLOB_DLL std::ostream G4cerr
static G4VisManager * fpVisManager