#include <G4VisCommandsGeometrySet.hh>
Inheritance diagram for G4VVisCommandGeometrySet:
Protected Member Functions | |
void | Set (G4String logVolName, const G4VVisCommandGeometrySetFunction &, G4int requestedDepth) |
void | SetLVVisAtts (G4LogicalVolume *, const G4VVisCommandGeometrySetFunction &, G4int depth, G4int requestedDepth) |
Definition at line 171 of file G4VisCommandsGeometrySet.hh.
void G4VVisCommandGeometrySet::Set | ( | G4String | logVolName, | |
const G4VVisCommandGeometrySetFunction & | , | |||
G4int | requestedDepth | |||
) | [protected] |
Definition at line 42 of file G4VisCommandsGeometrySet.cc.
References G4UImanager::ApplyCommand(), G4VisManager::errors, G4cout, G4endl, G4LogicalVolumeStore::GetInstance(), and G4UImanager::GetUIpointer().
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 }
void G4VVisCommandGeometrySet::SetLVVisAtts | ( | G4LogicalVolume * | , | |
const G4VVisCommandGeometrySetFunction & | , | |||
G4int | depth, | |||
G4int | requestedDepth | |||
) | [protected] |
Definition at line 70 of file G4VisCommandsGeometrySet.cc.
References G4VisManager::confirmations, G4cout, G4endl, and G4LogicalVolume::GetVisAttributes().
00073 { 00074 G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity(); 00075 const G4VisAttributes* oldVisAtts = pLV->GetVisAttributes(); 00076 fVisAttsMap.insert(std::make_pair(pLV,oldVisAtts)); // Store old vis atts. 00077 G4VisAttributes* newVisAtts = new G4VisAttributes; // Memory leak! 00078 if (oldVisAtts) { 00079 *newVisAtts = *oldVisAtts; 00080 } 00081 setFunction(newVisAtts); // Sets whatever attribute determined by 00082 // function object. 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 }