1321 G4cerr <<
"ERROR: No current scene. Please create one." <<
G4endl;
1328 <<
"ERROR: Scene has no extent. Add volumes or use \"/vis/scene/add/extent\"."
1339 "ERROR: G4VisCommandSceneAddLogo::SetNewValue: no viewer."
1340 "\n Auto direction needs a viewer."
1347 G4String userHeightUnit, direction, auto_manual, positionUnit;
1348 std::istringstream is (newValue);
1349 is >> userHeight >> userHeightUnit >> direction
1350 >> red >> green >> blue
1352 >> xmid >> ymid >> zmid >> positionUnit;
1356 if (userHeightUnit ==
"auto") {
1363 xmid *= unit; ymid *= unit; zmid *= unit;
1365 Direction logoDirection = X;
1366 if (direction ==
"auto") {
1370 if (vp.
x() > vp.
y() && vp.
x() > vp.
z()) logoDirection = X;
1371 else if (vp.
x() < vp.
y() && vp.
x() < vp.
z()) logoDirection = minusX;
1372 else if (vp.
y() > vp.
x() && vp.
y() > vp.
z()) logoDirection = Y;
1373 else if (vp.
y() < vp.
x() && vp.
y() < vp.
z()) logoDirection = minusY;
1374 else if (vp.
z() > vp.
x() && vp.
z() > vp.
y()) logoDirection = Z;
1375 else if (vp.
z() < vp.
x() && vp.
z() < vp.
y()) logoDirection = minusZ;
1377 else if (direction(0) ==
'x') logoDirection = X;
1378 else if (direction(0) ==
'y') logoDirection = Y;
1379 else if (direction(0) ==
'z') logoDirection = Z;
1380 else if (direction(0) ==
'-') {
1381 if (direction(1) ==
'x') logoDirection = minusX;
1382 else if (direction(1) ==
'y') logoDirection = minusY;
1383 else if (direction(1) ==
'z') logoDirection = minusZ;
1386 G4cerr <<
"ERROR: Unrecogniseed direction: \""
1387 << direction <<
"\"." <<
G4endl;
1392 G4bool autoPlacing =
false;
if (auto_manual ==
"auto") autoPlacing =
true;
1409 "WARNING: Existing scene does not yet have any extent."
1410 "\n Maybe you have not yet added any geometrical object."
1416 const G4double halfHeight(height / 2.);
1418 const G4double freeHeightFraction (1. + 2. * comfort);
1422 switch (logoDirection) {
1425 if (freeHeightFraction * (xmax - xmin) < height) room =
false;
1429 if (freeHeightFraction * (ymax - ymin) < height) room =
false;
1433 if (freeHeightFraction * (zmax - zmin) < height) room =
false;
1440 "WARNING: Not enough room in existing scene. Maybe logo is too large."
1447 "WARNING: The logo you have asked for is bigger than the existing"
1448 "\n scene. Maybe you have added it too soon. It is recommended that"
1449 "\n you add the logo last so that it can be correctly auto-positioned"
1450 "\n so as not to be obscured by any existing object and so that the"
1451 "\n view parameters can be correctly recalculated."
1456 G4double sxmid(xmid), symid(ymid), szmid(zmid);
1460 const G4double xComfort = comfort * (xmax - xmin);
1461 const G4double yComfort = comfort * (ymax - ymin);
1462 const G4double zComfort = comfort * (zmax - zmin);
1463 switch (logoDirection) {
1465 sxmid = xmax + halfHeight + xComfort;
1466 symid = ymin - yComfort;
1467 szmid = zmin - zComfort;
1470 sxmid = xmin - halfHeight - xComfort;
1471 symid = ymin - yComfort;
1472 szmid = zmax + zComfort;
1475 sxmid = xmin - xComfort;
1476 symid = ymax + halfHeight + yComfort;
1477 szmid = zmin - zComfort;
1480 sxmid = xmax + xComfort;
1481 symid = ymin - halfHeight - yComfort;
1482 szmid = zmin - zComfort;
1485 sxmid = xmax + xComfort;
1486 symid = ymin - yComfort;
1487 szmid = zmax + halfHeight + zComfort;
1490 sxmid = xmin - xComfort;
1491 symid = ymin - yComfort;
1492 szmid = zmin - halfHeight - zComfort;
1498 switch (logoDirection) {
1521 visAtts.SetForceSolid(
true);
1523 G4Logo* logo =
new G4Logo(height,visAtts);
1538 const G4String& currentSceneName = pScene -> GetName ();
1539 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1542 G4cout <<
"G4 Logo of height " << userHeight <<
' ' << userHeightUnit
1543 <<
", " << direction <<
"-direction, added to scene \""
1544 << currentSceneName <<
"\"";
1546 G4cout <<
"\n with extent " << extent
void SetGlobalTag(const G4String &)
void UpdateVisManagerScene(const G4String &sceneName="")
const G4ViewParameters & GetViewParameters() const
void SetExtent(const G4VisExtent &)
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
void SetType(const G4String &)
static G4double ValueOf(const char *unitName)
static Verbosity GetVerbosity()
static constexpr double pi
G4VViewer * GetCurrentViewer() const
static constexpr double halfpi
const XML_Char XML_Content * model
void SetGlobalDescription(const G4String &)
G4Scene * GetCurrentScene() const
G4GLOB_DLL std::ostream G4cerr
static G4VisManager * fpVisManager