G4VisCommandGeometryRestore Class Reference

#include <G4VisCommandsGeometry.hh>

Inheritance diagram for G4VisCommandGeometryRestore:

G4VVisCommandGeometry G4VVisCommand G4UImessenger

Public Member Functions

 G4VisCommandGeometryRestore ()
virtual ~G4VisCommandGeometryRestore ()
G4String GetCurrentValue (G4UIcommand *command)
void SetNewValue (G4UIcommand *command, G4String newValue)

Detailed Description

Definition at line 64 of file G4VisCommandsGeometry.hh.


Constructor & Destructor Documentation

G4VisCommandGeometryRestore::G4VisCommandGeometryRestore (  ) 

Definition at line 95 of file G4VisCommandsGeometry.cc.

00096 {
00097   G4bool omitable;
00098   fpCommand = new G4UIcmdWithAString("/vis/geometry/restore", this);
00099   fpCommand -> SetGuidance("Restores vis attributes of logical volume(s).");
00100   fpCommand -> SetParameterName("logical-volume-name", omitable = true);
00101   fpCommand -> SetDefaultValue("all");
00102 }

G4VisCommandGeometryRestore::~G4VisCommandGeometryRestore (  )  [virtual]

Definition at line 104 of file G4VisCommandsGeometry.cc.

00105 {
00106   delete fpCommand;
00107 }


Member Function Documentation

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

Reimplemented from G4UImessenger.

Definition at line 109 of file G4VisCommandsGeometry.cc.

00110 {
00111   return "";
00112 }

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

Reimplemented from G4UImessenger.

Definition at line 114 of file G4VisCommandsGeometry.cc.

References G4UImanager::ApplyCommand(), G4VisManager::confirmations, G4VisManager::errors, G4VVisCommand::fpVisManager, G4VVisCommandGeometry::fVisAttsMap, G4cout, G4endl, G4VisManager::GetCurrentViewer(), G4LogicalVolumeStore::GetInstance(), G4LogicalVolume::GetName(), G4UImanager::GetUIpointer(), G4VisManager::GetVerbosity(), G4LogicalVolume::GetVisAttributes(), and G4LogicalVolume::SetVisAttributes().

00115 {
00116   G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
00117   G4LogicalVolumeStore *pLVStore = G4LogicalVolumeStore::GetInstance();
00118   size_t nLV = pLVStore->size();
00119   size_t iLV;
00120   G4LogicalVolume* pLV = 0;
00121   G4bool found = false;
00122   for (iLV = 0; iLV < nLV; iLV++ ) {
00123     pLV = (*pLVStore)[iLV];
00124     const G4String& logVolName = pLV->GetName();
00125     if (logVolName == newValue) found = true;
00126     if (newValue == "all" || logVolName == newValue) {
00127       VisAttsMapIterator i = fVisAttsMap.find(pLV);
00128       if (i != fVisAttsMap.end()) {
00129         const G4VisAttributes* newVisAtts = pLV->GetVisAttributes();
00130         const G4VisAttributes* oldVisAtts = i->second;
00131         pLV->SetVisAttributes(oldVisAtts);
00132         if (verbosity >= G4VisManager::confirmations) {
00133           G4cout << "\nLogical Volume \"" << pLV->GetName()
00134                  << "\": re-setting vis attributes:\nwas: " << *newVisAtts
00135                  << "\nnow: " << *oldVisAtts
00136                  << G4endl;
00137         }
00138       }
00139     }
00140   }
00141   if (newValue != "all" && !found) {
00142     if (verbosity >= G4VisManager::errors) {
00143       G4cout << "ERROR: Logical volume \"" << newValue
00144              << "\" not found in logical volume store." << G4endl;
00145     }
00146     return;
00147   }
00148   if (fpVisManager->GetCurrentViewer()) {
00149     G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/rebuild");
00150   }
00151 }


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