| 151 | } |
| 152 | |
| 153 | void G4VisCommandsTouchable::SetNewValue |
| 154 | (G4UIcommand* command, G4String newValue) |
| 155 | { |
| 156 | G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity(); |
| 157 | G4bool warn = verbosity >= G4VisManager::warnings; |
| 158 | |
| 159 | G4UImanager* UImanager = G4UImanager::GetUIpointer(); |
| 160 | |
| 161 | G4TransportationManager* transportationManager = |
| 162 | G4TransportationManager::GetTransportationManager (); |
| 163 | |
| 164 | size_t nWorlds = transportationManager->GetNoWorlds(); |
| 165 | |
| 166 | G4VPhysicalVolume* world = *(transportationManager->GetWorldsIterator()); |
| 167 | if (!world) { |
| 168 | if (verbosity >= G4VisManager::errors) { |
| 169 | G4warn << |
| 170 | "ERROR: G4VisCommandsTouchable::SetNewValue:" |
| 171 | "\n No world. Maybe the geometry has not yet been defined." |
| 172 | "\n Try \"/run/initialize\"" |
| 173 | << G4endl; |
| 174 | } |
| 175 | return; |
| 176 | } |
| 177 | |
| 178 | if (command == fpCommandDump) { |
| 179 | |
| 180 | G4PhysicalVolumeModel::TouchableProperties properties = |
| 181 | G4TouchableUtils::FindTouchableProperties(fCurrentTouchableProperties.fTouchablePath); |
| 182 | if (properties.fpTouchablePV) { |
| 183 | // To handle parameterisations we have to set the copy number |
| 184 | properties.fpTouchablePV->SetCopyNo(properties.fCopyNo); |
| 185 | G4PhysicalVolumeModel tempPVModel |
| 186 | (properties.fpTouchablePV, |
| 187 | G4PhysicalVolumeModel::UNLIMITED, |
| 188 | properties.fTouchableGlobalTransform, |
| 189 | nullptr, // Modelling parameters (not used) |
| 190 | true, // use full extent (prevents calculating own extent, which crashes) |
| 191 | properties.fTouchableBaseFullPVPath); |
| 192 | const std::map<G4String,G4AttDef>* attDefs = tempPVModel.GetAttDefs(); |
| 193 | std::vector<G4AttValue>* attValues = tempPVModel.CreateCurrentAttValues(); |
| 194 | G4cout << G4AttCheck(attValues,attDefs); |
| 195 | delete attValues; |
| 196 | const auto lv = properties.fpTouchablePV->GetLogicalVolume(); |
| 197 | const auto polyhedron = lv->GetSolid()->GetPolyhedron(); |
| 198 | if (polyhedron) { |
| 199 | polyhedron->SetVisAttributes(lv->GetVisAttributes()); |
| 200 | G4cout << "\nLocal polyhedron coordinates:\n" << *polyhedron; |
| 201 | const G4Transform3D& transform = tempPVModel.GetCurrentTransform(); |
| 202 | polyhedron->Transform(transform); |
| 203 | G4cout << "\nGlobal polyhedron coordinates:\n" << *polyhedron; |
| 204 | } |
| 205 | } else { |
| 206 | G4warn << "Touchable not found." << G4endl; |
| 207 | } |
| 208 | return; |
| 209 | |
| 210 | } else if (command == fpCommandFindPath) { |
nothing calls this directly
no test coverage detected