00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "G4VisCommandsGeometrySet.hh"
00032
00033 #include "G4UIcommand.hh"
00034 #include "G4VisManager.hh"
00035 #include "G4LogicalVolumeStore.hh"
00036 #include "G4UImanager.hh"
00037
00038 #include <sstream>
00039 #include <cctype>
00040
00041 void G4VVisCommandGeometrySet::Set
00042 (G4String requestedName,
00043 const G4VVisCommandGeometrySetFunction& setFunction,
00044 G4int requestedDepth)
00045 {
00046 G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
00047 G4LogicalVolumeStore* pLVStore = G4LogicalVolumeStore::GetInstance();
00048 G4bool found = false;
00049 for (size_t iLV = 0; iLV < pLVStore->size(); iLV++ ) {
00050 G4LogicalVolume* pLV = (*pLVStore)[iLV];
00051 const G4String& logVolName = pLV->GetName();
00052 if (logVolName == requestedName) found = true;
00053 if (requestedName == "all" || logVolName == requestedName) {
00054 SetLVVisAtts(pLV, setFunction, 0, requestedDepth);
00055 }
00056 }
00057 if (requestedName != "all" && !found) {
00058 if (verbosity >= G4VisManager::errors) {
00059 G4cout << "ERROR: Logical volume \"" << requestedName
00060 << "\" not found in logical volume store." << G4endl;
00061 }
00062 return;
00063 }
00064 if (fpVisManager->GetCurrentViewer()) {
00065 G4UImanager::GetUIpointer()->ApplyCommand("/vis/scene/notifyHandlers");
00066 }
00067 }
00068
00069 void G4VVisCommandGeometrySet::SetLVVisAtts
00070 (G4LogicalVolume* pLV,
00071 const G4VVisCommandGeometrySetFunction& setFunction,
00072 G4int depth, G4int requestedDepth)
00073 {
00074 G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
00075 const G4VisAttributes* oldVisAtts = pLV->GetVisAttributes();
00076 fVisAttsMap.insert(std::make_pair(pLV,oldVisAtts));
00077 G4VisAttributes* newVisAtts = new G4VisAttributes;
00078 if (oldVisAtts) {
00079 *newVisAtts = *oldVisAtts;
00080 }
00081 setFunction(newVisAtts);
00082
00083 pLV->SetVisAttributes(newVisAtts);
00084 if (verbosity >= G4VisManager::confirmations) {
00085 G4cout << "\nLogical Volume \"" << pLV->GetName()
00086 << "\": setting vis attributes:\nwas: " << *oldVisAtts
00087 << "\nnow: " << *newVisAtts
00088 << G4endl;
00089 }
00090 if (requestedDepth < 0 || depth++ < requestedDepth) {
00091 G4int nDaughters = pLV->GetNoDaughters();
00092 for (G4int i = 0; i < nDaughters; ++i) {
00093 SetLVVisAtts(pLV->GetDaughter(i)->GetLogicalVolume(),
00094 setFunction, depth, requestedDepth);
00095 }
00096 }
00097 }
00098
00100
00101 G4VisCommandGeometrySetColour::G4VisCommandGeometrySetColour()
00102 {
00103 G4bool omitable;
00104 fpCommand = new G4UIcommand("/vis/geometry/set/colour", this);
00105 fpCommand->SetGuidance("Sets colour of logical volume(s).");
00106 fpCommand->SetGuidance("\"all\" sets all logical volumes.");
00107 fpCommand->SetGuidance
00108 ("Optionally propagates down hierarchy to given depth.");
00109 G4UIparameter* parameter;
00110 parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true);
00111 parameter->SetDefaultValue("all");
00112 fpCommand->SetParameter(parameter);
00113 parameter = new G4UIparameter("depth", 'd', omitable = true);
00114 parameter->SetDefaultValue(0);
00115 parameter->SetGuidance
00116 ("Depth of propagation (-1 means unlimited depth).");
00117 fpCommand->SetParameter(parameter);
00118 parameter = new G4UIparameter("red", 's', omitable = true);
00119 parameter->SetDefaultValue("1.");
00120 parameter->SetGuidance
00121 ("Red component or a string, e.g., \"blue\", in which case succeeding colour components are ignored.");
00122 fpCommand->SetParameter(parameter);
00123 parameter = new G4UIparameter("green", 'd', omitable = true);
00124 parameter->SetDefaultValue(1.);
00125 fpCommand->SetParameter(parameter);
00126 parameter = new G4UIparameter("blue", 'd', omitable = true);
00127 parameter->SetDefaultValue(1.);
00128 fpCommand->SetParameter(parameter);
00129 parameter = new G4UIparameter("opacity", 'd', omitable = true);
00130 parameter->SetDefaultValue(1.);
00131 fpCommand->SetParameter(parameter);
00132 }
00133
00134 G4VisCommandGeometrySetColour::~G4VisCommandGeometrySetColour()
00135 {
00136 delete fpCommand;
00137 }
00138
00139 G4String G4VisCommandGeometrySetColour::GetCurrentValue(G4UIcommand*)
00140 {
00141 return "";
00142 }
00143
00144 void G4VisCommandGeometrySetColour::SetNewValue
00145 (G4UIcommand*, G4String newValue)
00146 {
00147 G4String name, redOrString;
00148 G4int requestedDepth;
00149 G4double green, blue, opacity;
00150 std::istringstream iss(newValue);
00151 iss >> name >> requestedDepth >> redOrString >> green >> blue >> opacity;
00152 G4Colour colour(1,1,1,1);
00153 const size_t iPos0 = 0;
00154 if (std::isalpha(redOrString[iPos0])) {
00155 if (!G4Colour::GetColour(redOrString, colour)) {
00156 if (fpVisManager->GetVerbosity() >= G4VisManager::warnings) {
00157 G4cout << "WARNING: Colour \"" << redOrString
00158 << "\" not found. Defaulting to white and opaque."
00159 << G4endl;
00160 }
00161 }
00162 } else {
00163 colour = G4Colour(G4UIcommand::ConvertToDouble(redOrString), green, blue);
00164 }
00165 colour = G4Colour
00166 (colour.GetRed(), colour.GetGreen(), colour.GetBlue(), opacity);
00167
00168 G4VisCommandGeometrySetColourFunction setColour(colour);
00169 Set(name, setColour, requestedDepth);
00170 }
00171
00173
00174 G4VisCommandGeometrySetDaughtersInvisible::G4VisCommandGeometrySetDaughtersInvisible()
00175 {
00176 G4bool omitable;
00177 fpCommand = new G4UIcommand("/vis/geometry/set/daughtersInvisible", this);
00178 fpCommand->SetGuidance("Makes daughters of logical volume(s) invisible.");
00179 fpCommand->SetGuidance("\"all\" sets all logical volumes.");
00180 fpCommand->SetGuidance
00181 ("Optionally propagates down hierarchy to given depth.");
00182 G4UIparameter* parameter;
00183 parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true);
00184 parameter->SetDefaultValue("all");
00185 fpCommand->SetParameter(parameter);
00186 parameter = new G4UIparameter("depth", 'd', omitable = true);
00187 parameter->SetDefaultValue(0);
00188 parameter->SetGuidance
00189 ("Depth of propagation (-1 means unlimited depth).");
00190 fpCommand->SetParameter(parameter);
00191 parameter = new G4UIparameter("daughtersInvisible", 'b', omitable = true);
00192 parameter->SetDefaultValue(false);
00193 fpCommand->SetParameter(parameter);
00194 }
00195
00196 G4VisCommandGeometrySetDaughtersInvisible::~G4VisCommandGeometrySetDaughtersInvisible()
00197 {
00198 delete fpCommand;
00199 }
00200
00201 G4String
00202 G4VisCommandGeometrySetDaughtersInvisible::GetCurrentValue(G4UIcommand*)
00203 {
00204 return "";
00205 }
00206
00207 void G4VisCommandGeometrySetDaughtersInvisible::SetNewValue
00208 (G4UIcommand*, G4String newValue)
00209 {
00210 G4String name;
00211 G4int requestedDepth;
00212 G4String daughtersInvisibleString;
00213 std::istringstream iss(newValue);
00214 iss >> name >> requestedDepth >> daughtersInvisibleString;
00215 G4bool daughtersInvisible =
00216 G4UIcommand::ConvertToBool(daughtersInvisibleString);
00217
00218 if (requestedDepth !=0) {
00219 requestedDepth = 0;
00220 if (fpVisManager->GetVerbosity() >= G4VisManager::warnings) {
00221 G4cout << "Recursive application suppressed for this attribute."
00222 << G4endl;
00223 }
00224 }
00225
00226 G4VisCommandGeometrySetDaughtersInvisibleFunction
00227 setDaughtersInvisible(daughtersInvisible);
00228 Set(name, setDaughtersInvisible, requestedDepth);
00229
00230 G4VViewer* pViewer = fpVisManager->GetCurrentViewer();
00231 if (pViewer) {
00232 const G4ViewParameters& viewParams = pViewer->GetViewParameters();
00233 if (fpVisManager->GetVerbosity() >= G4VisManager::warnings) {
00234 if (!viewParams.IsCulling()) {
00235 G4cout <<
00236 "Culling must be on - \"/vis/viewer/set/culling global true\" - to see effect."
00237 << G4endl;
00238 }
00239 }
00240 }
00241 }
00242
00244
00245 G4VisCommandGeometrySetForceAuxEdgeVisible::G4VisCommandGeometrySetForceAuxEdgeVisible()
00246 {
00247 G4bool omitable;
00248 fpCommand = new G4UIcommand("/vis/geometry/set/forceAuxEdgeVisible", this);
00249 fpCommand->SetGuidance
00250 ("Forces auxiliary (soft) edges of logical volume(s) to be visible,"
00251 "\nregardless of the view parameters.");
00252 fpCommand->SetGuidance("\"all\" sets all logical volumes.");
00253 fpCommand->SetGuidance
00254 ("Optionally propagates down hierarchy to given depth.");
00255 G4UIparameter* parameter;
00256 parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true);
00257 parameter->SetDefaultValue("all");
00258 fpCommand->SetParameter(parameter);
00259 parameter = new G4UIparameter("depth", 'd', omitable = true);
00260 parameter->SetDefaultValue(0);
00261 parameter->SetGuidance
00262 ("Depth of propagation (-1 means unlimited depth).");
00263 fpCommand->SetParameter(parameter);
00264 parameter = new G4UIparameter("forceAuxEdgeVisible", 'b', omitable = true);
00265 parameter->SetDefaultValue(false);
00266 fpCommand->SetParameter(parameter);
00267 }
00268
00269 G4VisCommandGeometrySetForceAuxEdgeVisible::~G4VisCommandGeometrySetForceAuxEdgeVisible()
00270 {
00271 delete fpCommand;
00272 }
00273
00274 G4String
00275 G4VisCommandGeometrySetForceAuxEdgeVisible::GetCurrentValue(G4UIcommand*)
00276 {
00277 return "";
00278 }
00279
00280 void G4VisCommandGeometrySetForceAuxEdgeVisible::SetNewValue
00281 (G4UIcommand*, G4String newValue)
00282 {
00283 G4String name;
00284 G4int requestedDepth;
00285 G4String forceAuxEdgeVisibleString;
00286 std::istringstream iss(newValue);
00287 iss >> name >> requestedDepth >> forceAuxEdgeVisibleString;
00288 G4bool forceAuxEdgeVisible =
00289 G4UIcommand::ConvertToBool(forceAuxEdgeVisibleString);;
00290
00291 G4VisCommandGeometrySetForceAuxEdgeVisibleFunction
00292 setForceAuxEdgeVisible(forceAuxEdgeVisible);
00293 Set(name, setForceAuxEdgeVisible, requestedDepth);
00294 }
00295
00297
00298 G4VisCommandGeometrySetForceLineSegmentsPerCircle::G4VisCommandGeometrySetForceLineSegmentsPerCircle()
00299 {
00300 G4bool omitable;
00301 fpCommand = new G4UIcommand("/vis/geometry/set/forceLineSegmentsPerCircle", this);
00302 fpCommand->SetGuidance
00303 ("Forces number of line segments per circle, the precision with which a"
00304 "\ncurved line or surface is represented by a polygon or polyhedron,"
00305 "\nregardless of the view parameters.");
00306 fpCommand->SetGuidance("\"all\" sets all logical volumes.");
00307 fpCommand->SetGuidance
00308 ("Optionally propagates down hierarchy to given depth.");
00309 G4UIparameter* parameter;
00310 parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true);
00311 parameter->SetDefaultValue("all");
00312 fpCommand->SetParameter(parameter);
00313 parameter = new G4UIparameter("depth", 'd', omitable = true);
00314 parameter->SetDefaultValue(0);
00315 parameter->SetGuidance
00316 ("Depth of propagation (-1 means unlimited depth).");
00317 fpCommand->SetParameter(parameter);
00318 parameter = new G4UIparameter("lineSegmentsPerCircle", 'd', omitable = true);
00319 parameter->SetGuidance
00320 ("< 0 means not forced, i.e., under control of viewer.");
00321 parameter->SetDefaultValue(-1);
00322 fpCommand->SetParameter(parameter);
00323 }
00324
00325 G4VisCommandGeometrySetForceLineSegmentsPerCircle::~G4VisCommandGeometrySetForceLineSegmentsPerCircle()
00326 {
00327 delete fpCommand;
00328 }
00329
00330 G4String
00331 G4VisCommandGeometrySetForceLineSegmentsPerCircle::GetCurrentValue(G4UIcommand*)
00332 {
00333 return "";
00334 }
00335
00336 void G4VisCommandGeometrySetForceLineSegmentsPerCircle::SetNewValue
00337 (G4UIcommand*, G4String newValue)
00338 {
00339 G4String name;
00340 G4int requestedDepth;
00341 G4int lineSegmentsPerCircle;
00342 std::istringstream iss(newValue);
00343 iss >> name >> requestedDepth >> lineSegmentsPerCircle;
00344
00345 G4VisCommandGeometrySetForceLineSegmentsPerCircleFunction setForceLineSegmentsPerCircle(lineSegmentsPerCircle);
00346 Set(name, setForceLineSegmentsPerCircle, requestedDepth);
00347 }
00348
00350
00351 G4VisCommandGeometrySetForceSolid::G4VisCommandGeometrySetForceSolid()
00352 {
00353 G4bool omitable;
00354 fpCommand = new G4UIcommand("/vis/geometry/set/forceSolid", this);
00355 fpCommand->SetGuidance
00356 ("Forces logical volume(s) always to be drawn solid (surface drawing),"
00357 "\nregardless of the view parameters.");
00358 fpCommand->SetGuidance("\"all\" sets all logical volumes.");
00359 fpCommand->SetGuidance
00360 ("Optionally propagates down hierarchy to given depth.");
00361 G4UIparameter* parameter;
00362 parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true);
00363 parameter->SetDefaultValue("all");
00364 fpCommand->SetParameter(parameter);
00365 parameter = new G4UIparameter("depth", 'd', omitable = true);
00366 parameter->SetDefaultValue(0);
00367 parameter->SetGuidance
00368 ("Depth of propagation (-1 means unlimited depth).");
00369 fpCommand->SetParameter(parameter);
00370 parameter = new G4UIparameter("forceSolid", 'b', omitable = true);
00371 parameter->SetDefaultValue(false);
00372 fpCommand->SetParameter(parameter);
00373 }
00374
00375 G4VisCommandGeometrySetForceSolid::~G4VisCommandGeometrySetForceSolid()
00376 {
00377 delete fpCommand;
00378 }
00379
00380 G4String
00381 G4VisCommandGeometrySetForceSolid::GetCurrentValue(G4UIcommand*)
00382 {
00383 return "";
00384 }
00385
00386 void G4VisCommandGeometrySetForceSolid::SetNewValue
00387 (G4UIcommand*, G4String newValue)
00388 {
00389 G4String name;
00390 G4int requestedDepth;
00391 G4String forceSolidString;
00392 std::istringstream iss(newValue);
00393 iss >> name >> requestedDepth >> forceSolidString;
00394 G4bool forceSolid = G4UIcommand::ConvertToBool(forceSolidString);
00395
00396 G4VisCommandGeometrySetForceSolidFunction setForceSolid(forceSolid);
00397 Set(name, setForceSolid, requestedDepth);
00398 }
00399
00401
00402 G4VisCommandGeometrySetForceWireframe::G4VisCommandGeometrySetForceWireframe()
00403 {
00404 G4bool omitable;
00405 fpCommand = new G4UIcommand("/vis/geometry/set/forceWireframe", this);
00406 fpCommand->SetGuidance
00407 ("Forces logical volume(s) always to be drawn as wireframe,"
00408 "\nregardless of the view parameters.");
00409 fpCommand->SetGuidance("\"all\" sets all logical volumes.");
00410 fpCommand->SetGuidance
00411 ("Optionally propagates down hierarchy to given depth.");
00412 G4UIparameter* parameter;
00413 parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true);
00414 parameter->SetDefaultValue("all");
00415 fpCommand->SetParameter(parameter);
00416 parameter = new G4UIparameter("depth", 'd', omitable = true);
00417 parameter->SetDefaultValue(0);
00418 parameter->SetGuidance
00419 ("Depth of propagation (-1 means unlimited depth).");
00420 fpCommand->SetParameter(parameter);
00421 parameter = new G4UIparameter("forceWireframe", 'b', omitable = true);
00422 parameter->SetDefaultValue(false);
00423 fpCommand->SetParameter(parameter);
00424 }
00425
00426 G4VisCommandGeometrySetForceWireframe::~G4VisCommandGeometrySetForceWireframe()
00427 {
00428 delete fpCommand;
00429 }
00430
00431 G4String
00432 G4VisCommandGeometrySetForceWireframe::GetCurrentValue(G4UIcommand*)
00433 {
00434 return "";
00435 }
00436
00437 void G4VisCommandGeometrySetForceWireframe::SetNewValue
00438 (G4UIcommand*, G4String newValue)
00439 {
00440 G4String name;
00441 G4int requestedDepth;
00442 G4String forceWireframeString;
00443 std::istringstream iss(newValue);
00444 iss >> name >> requestedDepth >> forceWireframeString;
00445 G4bool forceWireframe = G4UIcommand::ConvertToBool(forceWireframeString);
00446
00447 G4VisCommandGeometrySetForceWireframeFunction
00448 setForceWireframe(forceWireframe);
00449 Set(name, setForceWireframe, requestedDepth);
00450 }
00451
00453
00454 G4VisCommandGeometrySetLineStyle::G4VisCommandGeometrySetLineStyle()
00455 {
00456 G4bool omitable;
00457 fpCommand = new G4UIcommand("/vis/geometry/set/lineStyle", this);
00458 fpCommand->SetGuidance("Sets line style of logical volume(s) drawing.");
00459 fpCommand->SetGuidance("\"all\" sets all logical volumes.");
00460 fpCommand->SetGuidance
00461 ("Optionally propagates down hierarchy to given depth.");
00462 G4UIparameter* parameter;
00463 parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true);
00464 parameter->SetDefaultValue("all");
00465 fpCommand->SetParameter(parameter);
00466 parameter = new G4UIparameter("depth", 'd', omitable = true);
00467 parameter->SetDefaultValue(0);
00468 parameter->SetGuidance
00469 ("Depth of propagation (-1 means unlimited depth).");
00470 fpCommand->SetParameter(parameter);
00471 parameter = new G4UIparameter("lineStyle", 's', omitable = true);
00472 parameter->SetParameterCandidates("unbroken dashed dotted");
00473 parameter->SetDefaultValue("unbroken");
00474 fpCommand->SetParameter(parameter);
00475 }
00476
00477 G4VisCommandGeometrySetLineStyle::~G4VisCommandGeometrySetLineStyle()
00478 {
00479 delete fpCommand;
00480 }
00481
00482 G4String
00483 G4VisCommandGeometrySetLineStyle::GetCurrentValue(G4UIcommand*)
00484 {
00485 return "";
00486 }
00487
00488 void G4VisCommandGeometrySetLineStyle::SetNewValue
00489 (G4UIcommand*, G4String newValue)
00490 {
00491 G4String name, lineStyleString;
00492 G4int requestedDepth;
00493 std::istringstream iss(newValue);
00494 iss >> name >> requestedDepth >> lineStyleString;
00495 G4VisAttributes::LineStyle lineStyle = G4VisAttributes::unbroken;
00496 if (lineStyleString == "unbroken") lineStyle = G4VisAttributes::unbroken;
00497 if (lineStyleString == "dashed") lineStyle = G4VisAttributes::dashed;
00498 if (lineStyleString == "dotted") lineStyle = G4VisAttributes::dotted;
00499
00500 G4VisCommandGeometrySetLineStyleFunction setLineStyle(lineStyle);
00501 Set(name, setLineStyle, requestedDepth);
00502 }
00503
00505
00506 G4VisCommandGeometrySetLineWidth::G4VisCommandGeometrySetLineWidth()
00507 {
00508 G4bool omitable;
00509 fpCommand = new G4UIcommand("/vis/geometry/set/lineWidth", this);
00510 fpCommand->SetGuidance("Sets line width of logical volume(s) drawing.");
00511 fpCommand->SetGuidance("\"all\" sets all logical volumes.");
00512 fpCommand->SetGuidance
00513 ("Optionally propagates down hierarchy to given depth.");
00514 G4UIparameter* parameter;
00515 parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true);
00516 parameter->SetDefaultValue("all");
00517 fpCommand->SetParameter(parameter);
00518 parameter = new G4UIparameter("depth", 'd', omitable = true);
00519 parameter->SetDefaultValue(0);
00520 parameter->SetGuidance
00521 ("Depth of propagation (-1 means unlimited depth).");
00522 fpCommand->SetParameter(parameter);
00523 parameter = new G4UIparameter("lineWidth", 'd', omitable = true);
00524 parameter->SetDefaultValue(1.);
00525 fpCommand->SetParameter(parameter);
00526 }
00527
00528 G4VisCommandGeometrySetLineWidth::~G4VisCommandGeometrySetLineWidth()
00529 {
00530 delete fpCommand;
00531 }
00532
00533 G4String
00534 G4VisCommandGeometrySetLineWidth::GetCurrentValue(G4UIcommand*)
00535 {
00536 return "";
00537 }
00538
00539 void G4VisCommandGeometrySetLineWidth::SetNewValue
00540 (G4UIcommand*, G4String newValue)
00541 {
00542 G4String name;
00543 G4int requestedDepth;
00544 G4double lineWidth;
00545 std::istringstream iss(newValue);
00546 iss >> name >> requestedDepth >> lineWidth;
00547
00548 G4VisCommandGeometrySetLineWidthFunction setLineWidth(lineWidth);
00549 Set(name, setLineWidth, requestedDepth);
00550 }
00551
00553
00554 G4VisCommandGeometrySetVisibility::G4VisCommandGeometrySetVisibility()
00555 {
00556 G4bool omitable;
00557 fpCommand = new G4UIcommand("/vis/geometry/set/visibility", this);
00558 fpCommand->SetGuidance("Sets visibility of logical volume(s).");
00559 fpCommand->SetGuidance("\"all\" sets all logical volumes.");
00560 fpCommand->SetGuidance
00561 ("Optionally propagates down hierarchy to given depth.");
00562 G4UIparameter* parameter;
00563 parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true);
00564 parameter->SetDefaultValue("all");
00565 fpCommand->SetParameter(parameter);
00566 parameter = new G4UIparameter("depth", 'd', omitable = true);
00567 parameter->SetDefaultValue(0);
00568 parameter->SetGuidance
00569 ("Depth of propagation (-1 means unlimited depth).");
00570 fpCommand->SetParameter(parameter);
00571 parameter = new G4UIparameter("visibility", 'b', omitable = true);
00572 parameter->SetDefaultValue(true);
00573 fpCommand->SetParameter(parameter);
00574 }
00575
00576 G4VisCommandGeometrySetVisibility::~G4VisCommandGeometrySetVisibility()
00577 {
00578 delete fpCommand;
00579 }
00580
00581 G4String G4VisCommandGeometrySetVisibility::GetCurrentValue(G4UIcommand*)
00582 {
00583 return "";
00584 }
00585
00586 void G4VisCommandGeometrySetVisibility::SetNewValue
00587 (G4UIcommand*, G4String newValue)
00588 {
00589 G4String name;
00590 G4int requestedDepth;
00591 G4String visibilityString;
00592 std::istringstream iss(newValue);
00593 iss >> name >> requestedDepth >> visibilityString;
00594 G4bool visibility = G4UIcommand::ConvertToBool(visibilityString);
00595
00596 G4VisCommandGeometrySetVisibilityFunction setVisibility(visibility);
00597 Set(name, setVisibility, requestedDepth);
00598
00599 G4VViewer* pViewer = fpVisManager->GetCurrentViewer();
00600 if (pViewer) {
00601 const G4ViewParameters& viewParams = pViewer->GetViewParameters();
00602 if (fpVisManager->GetVerbosity() >= G4VisManager::warnings) {
00603 if (!viewParams.IsCulling() ||
00604 !viewParams.IsCullingInvisible()) {
00605 G4cout <<
00606 "Culling must be on - \"/vis/viewer/set/culling global true\" and"
00607 "\n \"/vis/viewer/set/culling invisible true\" - to see effect."
00608 << G4endl;
00609 }
00610 }
00611 }
00612 }
00613
00614 void G4VisCommandGeometrySetVisibility::SetNewValueOnLV
00615 (G4LogicalVolume* pLV, G4int requestedDepth,G4bool visibility)
00616 {
00617 if (!pLV) return;
00618 G4VisCommandGeometrySetVisibilityFunction setVisibility(visibility);
00619 SetLVVisAtts(pLV, setVisibility, 0, requestedDepth);
00620
00621 G4VViewer* pViewer = fpVisManager->GetCurrentViewer();
00622 if (pViewer) {
00623 G4UImanager::GetUIpointer()->ApplyCommand("/vis/scene/notifyHandlers");
00624 const G4ViewParameters& viewParams = pViewer->GetViewParameters();
00625 if (fpVisManager->GetVerbosity() >= G4VisManager::warnings) {
00626 if (!viewParams.IsCulling() ||
00627 !viewParams.IsCullingInvisible()) {
00628 G4cout <<
00629 "Culling must be on - \"/vis/viewer/set/culling global true\" and"
00630 "\n \"/vis/viewer/set/culling invisible true\" - to see effect."
00631 << G4endl;
00632 }
00633 }
00634 }
00635 }