1929 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1936 <<
"ERROR: Scene has no extent. Add volumes or use \"/vis/scene/add/extent\"." 1944 G4String userLengthUnit, direction, auto_manual, positionUnit;
1945 std::istringstream is (newValue);
1946 is >> userLength >> userLengthUnit >> direction
1947 >> red >> green >> blue
1949 >> xmid >> ymid >> zmid >> positionUnit;
1953 if (userLengthUnit ==
"auto") {
1955 const G4double intLog10Length = std::floor(std::log10(lengthMax));
1956 length = std::pow(10,intLog10Length);
1957 if (5.*length < lengthMax) length *= 5.;
1958 else if (2.*length < lengthMax) length *= 2.;
1965 xmid *= unit; ymid *= unit; zmid *= unit;
1968 if (direction(0) ==
'y') scaleDirection =
G4Scale::y;
1969 if (direction(0) ==
'z') scaleDirection =
G4Scale::z;
1975 "ERROR: G4VisCommandSceneAddScale::SetNewValue: no viewer." 1976 "\n Auto direction needs a viewer." 1987 if (direction ==
"auto") {
1988 if (std::abs(vp.
x()) > std::abs(vp.
y()) &&
1989 std::abs(vp.
x()) > std::abs(vp.
z())) {
1990 if (std::abs(up.
y()) > std::abs(up.
z())) scaleDirection =
G4Scale::z;
1993 else if (std::abs(vp.
y()) > std::abs(vp.
x()) &&
1994 std::abs(vp.
y()) > std::abs(vp.
z())) {
1995 if (std::abs(up.
x()) > std::abs(up.
z())) scaleDirection =
G4Scale::z;
1998 else if (std::abs(vp.
z()) > std::abs(vp.
x()) &&
1999 std::abs(vp.
z()) > std::abs(vp.
y())) {
2000 if (std::abs(up.
y()) > std::abs(up.
x())) scaleDirection =
G4Scale::x;
2005 G4bool autoPlacing =
false;
if (auto_manual ==
"auto") autoPlacing =
true;
2009 const G4double halfLength(length / 2.);
2011 const G4double freeLengthFraction (1. + 2. * comfort);
2026 "WARNING: Existing scene does not yet have any extent." 2027 "\n Maybe you have not yet added any geometrical object." 2033 switch (scaleDirection) {
2035 if (freeLengthFraction * (xmax - xmin) < length) room =
false;
2038 if (freeLengthFraction * (ymax - ymin) < length) room =
false;
2041 if (freeLengthFraction * (zmax - zmin) < length) room =
false;
2048 "WARNING: Not enough room in existing scene. Maybe scale is too long." 2055 "WARNING: The scale you have asked for is bigger than the existing" 2056 "\n scene. Maybe you have added it too soon. It is recommended that" 2057 "\n you add the scale last so that it can be correctly auto-positioned" 2058 "\n so as not to be obscured by any existing object and so that the" 2059 "\n view parameters can be correctly recalculated." 2067 false, xmid, ymid, zmid,
2070 scale.SetVisAttributes(visAttr);
2073 globalDescription +=
" (" + newValue +
")";
2103 G4double sxmid(xmid), symid(ymid), szmid(zmid);
2107 const G4double xComfort = comfort * (xmax - xmin);
2108 const G4double yComfort = comfort * (ymax - ymin);
2109 const G4double zComfort = comfort * (zmax - zmin);
2110 switch (scaleDirection) {
2113 sxmid = xmax + xComfort;
2114 symid = ymin - yComfort;
2115 szmid = zmin - zComfort;
2117 sxmid = xmin - xComfort;
2118 symid = ymin - yComfort;
2119 szmid = zmax + zComfort;
2124 sxmid = xmin - xComfort;
2125 symid = ymax + yComfort;
2126 szmid = zmin - zComfort;
2128 sxmid = xmax + xComfort;
2129 symid = ymin - yComfort;
2130 szmid = zmin - zComfort;
2135 sxmid = xmax + xComfort;
2136 symid = ymin - yComfort;
2137 szmid = zmax + zComfort;
2139 sxmid = xmin - xComfort;
2140 symid = ymin - yComfort;
2141 szmid = zmax + zComfort;
2197 switch (scaleDirection) {
2199 scaleExtent =
G4VisExtent(-halfLength,halfLength,0,0,0,0);
2203 scaleExtent =
G4VisExtent(0,0,-halfLength,halfLength,0,0);
2207 scaleExtent =
G4VisExtent(0,0,0,0,-halfLength,halfLength);
2221 const G4String& currentSceneName = pScene -> GetName ();
2222 G4bool successful = pScene -> AddRunDurationModel (model, warn);
2225 G4cout <<
"Scale of " << annotation
2226 <<
" added to scene \"" << currentSceneName <<
"\".";
2228 G4cout <<
"\n with extent " << scaleExtent
G4VViewer * GetCurrentViewer() const
static const double halfpi
const G4String & GetGlobalDescription() const
G4Scene * GetCurrentScene() const
void UpdateVisManagerScene(const G4String &sceneName="")
G4double GetExtentRadius() const
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
void SetExtent(const G4VisExtent &)
static G4double fCurrentTextSize
void SetTransformation(const G4Transform3D &)
const G4Vector3D & GetUpVector() const
static void G4VisCommandsSceneAddUnsuccessful(G4VisManager::Verbosity verbosity)
const G4Vector3D & GetViewpointDirection() const
G4GLOB_DLL std::ostream G4cout
const G4VisExtent & GetExtent() const
static G4double ValueOf(const char *unitName)
static Verbosity GetVerbosity()
const G4ViewParameters & GetViewParameters() const
void SetGlobalDescription(const G4String &)
G4GLOB_DLL std::ostream G4cerr
static G4VisManager * fpVisManager