1138 G4cout <<
"ERROR: No current scene. Please create one." <<
G4endl;
1147 "ERROR: G4VisCommandSceneAddLogo::SetNewValue: no viewer."
1148 "\n Auto direction needs a viewer."
1155 G4String userHeightUnit, direction, auto_manual, positionUnit;
1156 std::istringstream is (newValue);
1157 is >> userHeight >> userHeightUnit >> direction
1158 >> red >> green >> blue
1160 >> xmid >> ymid >> zmid >> positionUnit;
1164 if (userHeightUnit ==
"auto") {
1171 xmid *= unit; ymid *= unit; zmid *= unit;
1173 Direction logoDirection = X;
1174 if (direction ==
"auto") {
1178 if (vp.
x() > vp.
y() && vp.
x() > vp.
z()) logoDirection = X;
1179 else if (vp.
x() < vp.
y() && vp.
x() < vp.
z()) logoDirection = minusX;
1180 else if (vp.
y() > vp.
x() && vp.
y() > vp.
z()) logoDirection = Y;
1181 else if (vp.
y() < vp.
x() && vp.
y() < vp.
z()) logoDirection = minusY;
1182 else if (vp.
z() > vp.
x() && vp.
z() > vp.
y()) logoDirection = Z;
1183 else if (vp.
z() < vp.
x() && vp.
z() < vp.
y()) logoDirection = minusZ;
1185 else if (direction(0) ==
'x') logoDirection = X;
1186 else if (direction(0) ==
'y') logoDirection = Y;
1187 else if (direction(0) ==
'z') logoDirection = Z;
1188 else if (direction(0) ==
'-') {
1189 if (direction(1) ==
'x') logoDirection = minusX;
1190 else if (direction(1) ==
'y') logoDirection = minusY;
1191 else if (direction(1) ==
'z') logoDirection = minusZ;
1194 G4cout <<
"ERROR: Unrecogniseed direction: \""
1195 << direction <<
"\"." <<
G4endl;
1200 G4bool autoPlacing =
false;
if (auto_manual ==
"auto") autoPlacing =
true;
1217 "WARNING: Existing scene does not yet have any extent."
1218 "\n Maybe you have not yet added any geometrical object."
1224 const G4double halfHeight(height / 2.);
1226 const G4double freeHeightFraction (1. + 2. * comfort);
1230 switch (logoDirection) {
1233 if (freeHeightFraction * (xmax - xmin) < height) room =
false;
break;
1236 if (freeHeightFraction * (ymax - ymin) < height) room =
false;
break;
1239 if (freeHeightFraction * (zmax - zmin) < height) room =
false;
break;
1245 "WARNING: Not enough room in existing scene. Maybe logo is too large."
1252 "WARNING: The logo you have asked for is bigger than the existing"
1253 "\n scene. Maybe you have added it too soon. It is recommended that"
1254 "\n you add the logo last so that it can be correctly auto-positioned"
1255 "\n so as not to be obscured by any existing object and so that the"
1256 "\n view parameters can be correctly recalculated."
1261 G4double sxmid(xmid), symid(ymid), szmid(zmid);
1265 const G4double xComfort = comfort * (xmax - xmin);
1266 const G4double yComfort = comfort * (ymax - ymin);
1267 const G4double zComfort = comfort * (zmax - zmin);
1268 switch (logoDirection) {
1270 sxmid = xmax + halfHeight + xComfort;
1271 symid = ymin - yComfort;
1272 szmid = zmin - zComfort;
1275 sxmid = xmin - halfHeight - xComfort;
1276 symid = ymin - yComfort;
1277 szmid = zmax + zComfort;
1280 sxmid = xmin - xComfort;
1281 symid = ymax + halfHeight + yComfort;
1282 szmid = zmin - zComfort;
1285 sxmid = xmax + xComfort;
1286 symid = ymin - halfHeight - yComfort;
1287 szmid = zmin - zComfort;
1290 sxmid = xmax + xComfort;
1291 symid = ymin - yComfort;
1292 szmid = zmax + halfHeight + zComfort;
1295 sxmid = xmin - xComfort;
1296 symid = ymin - yComfort;
1297 szmid = zmin - halfHeight - zComfort;
1303 switch (logoDirection) {
1326 visAtts.SetForceSolid(
true);
1328 G4Logo* logo =
new G4Logo(height,visAtts);
1343 const G4String& currentSceneName = pScene -> GetName ();
1344 G4bool successful = pScene -> AddRunDurationModel (model, warn);
1347 G4cout <<
"G4 Logo of height " << userHeight <<
' ' << userHeightUnit
1348 <<
", " << direction <<
"-direction, added to scene \""
1349 << currentSceneName <<
"\"";
1351 G4cout <<
"\n with extent " << extent
1358 else G4VisCommandsSceneAddUnsuccessful(verbosity);
void SetGlobalTag(const G4String &)
void UpdateVisManagerScene(const G4String &sceneName="")
const G4ViewParameters & GetViewParameters() const
void SetExtent(const G4VisExtent &)
void SetTransformation(const G4Transform3D &)
G4double GetExtentRadius() const
const G4Vector3D & GetViewpointDirection() const
G4GLOB_DLL std::ostream G4cout
const G4VisExtent & GetExtent() const
void SetType(const G4String &)
const XML_Char XML_Content * model
static G4double ValueOf(const char *unitName)
static Verbosity GetVerbosity()
G4VViewer * GetCurrentViewer() const
void SetGlobalDescription(const G4String &)
G4Scene * GetCurrentScene() const
static G4VisManager * fpVisManager