G4VisCommandGeometrySetVisibility Class Reference

#include <G4VisCommandsGeometrySet.hh>

Inheritance diagram for G4VisCommandGeometrySetVisibility:

G4VVisCommandGeometrySet G4VVisCommandGeometry G4VVisCommand G4UImessenger

Public Member Functions

 G4VisCommandGeometrySetVisibility ()
virtual ~G4VisCommandGeometrySetVisibility ()
G4String GetCurrentValue (G4UIcommand *command)
void SetNewValue (G4UIcommand *command, G4String newValue)
void SetNewValueOnLV (G4LogicalVolume *pLV, G4int, G4bool)

Detailed Description

Definition at line 296 of file G4VisCommandsGeometrySet.hh.


Constructor & Destructor Documentation

G4VisCommandGeometrySetVisibility::G4VisCommandGeometrySetVisibility (  ) 

Definition at line 554 of file G4VisCommandsGeometrySet.cc.

References G4UIparameter::SetDefaultValue(), G4UIparameter::SetGuidance(), G4UIcommand::SetGuidance(), and G4UIcommand::SetParameter().

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 }

G4VisCommandGeometrySetVisibility::~G4VisCommandGeometrySetVisibility (  )  [virtual]

Definition at line 576 of file G4VisCommandsGeometrySet.cc.

00577 {
00578   delete fpCommand;
00579 }


Member Function Documentation

G4String G4VisCommandGeometrySetVisibility::GetCurrentValue ( G4UIcommand command  )  [virtual]

Reimplemented from G4UImessenger.

Definition at line 581 of file G4VisCommandsGeometrySet.cc.

00582 {
00583   return "";
00584 }

void G4VisCommandGeometrySetVisibility::SetNewValue ( G4UIcommand command,
G4String  newValue 
) [virtual]

Reimplemented from G4UImessenger.

Definition at line 587 of file G4VisCommandsGeometrySet.cc.

References G4UIcommand::ConvertToBool(), G4cout, G4endl, G4VViewer::GetViewParameters(), G4ViewParameters::IsCulling(), G4ViewParameters::IsCullingInvisible(), and G4VisManager::warnings.

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 }

void G4VisCommandGeometrySetVisibility::SetNewValueOnLV ( G4LogicalVolume pLV,
G4int  ,
G4bool   
)

Definition at line 615 of file G4VisCommandsGeometrySet.cc.

References G4UImanager::ApplyCommand(), G4cout, G4endl, G4UImanager::GetUIpointer(), G4VViewer::GetViewParameters(), G4ViewParameters::IsCulling(), G4ViewParameters::IsCullingInvisible(), and G4VisManager::warnings.

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 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:53:45 2013 for Geant4 by  doxygen 1.4.7