Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // >> 27 // $Id: G4VisCommandsGeometrySet.cc 86865 2014-11-19 14:41:25Z gcosmo $ 27 28 28 // /vis/geometry commands - John Allison 31st 29 // /vis/geometry commands - John Allison 31st January 2006 29 30 30 #include "G4VisCommandsGeometrySet.hh" 31 #include "G4VisCommandsGeometrySet.hh" 31 32 32 #include "G4UIcommand.hh" 33 #include "G4UIcommand.hh" 33 #include "G4VisManager.hh" 34 #include "G4VisManager.hh" 34 #include "G4LogicalVolumeStore.hh" 35 #include "G4LogicalVolumeStore.hh" 35 #include "G4UImanager.hh" 36 #include "G4UImanager.hh" 36 37 37 #include <sstream> 38 #include <sstream> 38 << 39 #include <cctype> 39 #define G4warn G4cout << 40 40 41 void G4VVisCommandGeometrySet::Set 41 void G4VVisCommandGeometrySet::Set 42 (const G4String& requestedName, << 42 (G4String requestedName, 43 const G4VVisCommandGeometrySetFunction& setFu 43 const G4VVisCommandGeometrySetFunction& setFunction, 44 G4int requestedDepth) 44 G4int requestedDepth) 45 { 45 { 46 G4VisManager::Verbosity verbosity = fpVisMan 46 G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity(); 47 G4LogicalVolumeStore* pLVStore = G4LogicalVo 47 G4LogicalVolumeStore* pLVStore = G4LogicalVolumeStore::GetInstance(); 48 G4bool found = false; 48 G4bool found = false; 49 for (std::size_t iLV = 0; iLV < pLVStore->si << 49 for (size_t iLV = 0; iLV < pLVStore->size(); iLV++ ) { 50 G4LogicalVolume* pLV = (*pLVStore)[iLV]; 50 G4LogicalVolume* pLV = (*pLVStore)[iLV]; 51 const G4String& logVolName = pLV->GetName( 51 const G4String& logVolName = pLV->GetName(); 52 if (logVolName == requestedName) found = t 52 if (logVolName == requestedName) found = true; 53 if (requestedName == "all" || logVolName = 53 if (requestedName == "all" || logVolName == requestedName) { 54 SetLVVisAtts(pLV, setFunction, 0, reques 54 SetLVVisAtts(pLV, setFunction, 0, requestedDepth); 55 } 55 } 56 } 56 } 57 if (requestedName != "all" && !found) { 57 if (requestedName != "all" && !found) { 58 if (verbosity >= G4VisManager::errors) { 58 if (verbosity >= G4VisManager::errors) { 59 G4warn << "ERROR: Logical volume \"" << << 59 G4cerr << "ERROR: Logical volume \"" << requestedName 60 << "\" not found in logical volume stor 60 << "\" not found in logical volume store." << G4endl; 61 } 61 } 62 return; 62 return; 63 } 63 } 64 // Recalculate extent of any physical volume << 65 for (const auto& scene : fpVisManager->GetSc << 66 const auto& runDurationModelList = scene-> << 67 for (const auto& sceneModel : runDurationM << 68 auto model = sceneModel.fpModel; << 69 auto pvModel = dynamic_cast<G4PhysicalVo << 70 if (pvModel) pvModel->CalculateExtent(); << 71 } << 72 // And re-calculate the scene's extent << 73 scene->CalculateExtent(); << 74 } << 75 if (fpVisManager->GetCurrentViewer()) { 64 if (fpVisManager->GetCurrentViewer()) { 76 G4UImanager::GetUIpointer()->ApplyCommand( 65 G4UImanager::GetUIpointer()->ApplyCommand("/vis/scene/notifyHandlers"); 77 } 66 } 78 } 67 } 79 68 80 void G4VVisCommandGeometrySet::SetLVVisAtts 69 void G4VVisCommandGeometrySet::SetLVVisAtts 81 (G4LogicalVolume* pLV, 70 (G4LogicalVolume* pLV, 82 const G4VVisCommandGeometrySetFunction& setFu 71 const G4VVisCommandGeometrySetFunction& setFunction, 83 G4int depth, G4int requestedDepth) 72 G4int depth, G4int requestedDepth) 84 { 73 { 85 G4VisManager::Verbosity verbosity = fpVisMan 74 G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity(); 86 const G4VisAttributes* oldVisAtts = pLV->Get 75 const G4VisAttributes* oldVisAtts = pLV->GetVisAttributes(); 87 fVisAttsMap.insert(std::make_pair(pLV,oldVis 76 fVisAttsMap.insert(std::make_pair(pLV,oldVisAtts)); // Store old vis atts. 88 G4VisAttributes* newVisAtts = new G4VisAttri 77 G4VisAttributes* newVisAtts = new G4VisAttributes; // Memory leak! 89 if (oldVisAtts) { 78 if (oldVisAtts) { 90 *newVisAtts = *oldVisAtts; 79 *newVisAtts = *oldVisAtts; 91 } 80 } 92 setFunction(newVisAtts); // Sets whatever a 81 setFunction(newVisAtts); // Sets whatever attribute determined by 93 // function object. 82 // function object. 94 pLV->SetVisAttributes(newVisAtts); 83 pLV->SetVisAttributes(newVisAtts); 95 if (verbosity >= G4VisManager::confirmations 84 if (verbosity >= G4VisManager::confirmations) { 96 G4cout << "\nLogical Volume \"" << pLV->Ge 85 G4cout << "\nLogical Volume \"" << pLV->GetName() 97 << "\": setting vis attributes:"; 86 << "\": setting vis attributes:"; 98 if (oldVisAtts) { 87 if (oldVisAtts) { 99 G4cout << "\nwas: " << *oldVisAtts; 88 G4cout << "\nwas: " << *oldVisAtts; 100 } else { 89 } else { 101 G4cout << "\n(no old attributes)"; 90 G4cout << "\n(no old attributes)"; 102 } 91 } 103 G4cout << "\nnow: " << *newVisAtts 92 G4cout << "\nnow: " << *newVisAtts 104 << G4endl; 93 << G4endl; 105 } 94 } 106 if (requestedDepth < 0 || depth < requestedD 95 if (requestedDepth < 0 || depth < requestedDepth) { 107 G4int nDaughters = (G4int)pLV->GetNoDaught << 96 G4int nDaughters = pLV->GetNoDaughters(); 108 for (G4int i = 0; i < nDaughters; ++i) { 97 for (G4int i = 0; i < nDaughters; ++i) { 109 SetLVVisAtts(pLV->GetDaughter(i)->GetLog 98 SetLVVisAtts(pLV->GetDaughter(i)->GetLogicalVolume(), 110 setFunction, ++depth, requestedDepth); 99 setFunction, ++depth, requestedDepth); 111 } 100 } 112 } 101 } 113 } 102 } 114 103 115 ////////////// /vis/geometry/set/colour ////// 104 ////////////// /vis/geometry/set/colour /////////////////////////////////////// 116 105 117 G4VisCommandGeometrySetColour::G4VisCommandGeo 106 G4VisCommandGeometrySetColour::G4VisCommandGeometrySetColour() 118 { 107 { 119 G4bool omitable; 108 G4bool omitable; 120 fpCommand = new G4UIcommand("/vis/geometry/s 109 fpCommand = new G4UIcommand("/vis/geometry/set/colour", this); 121 fpCommand->SetGuidance("Sets colour of logic 110 fpCommand->SetGuidance("Sets colour of logical volume(s)."); 122 fpCommand->SetGuidance("\"all\" sets all log 111 fpCommand->SetGuidance("\"all\" sets all logical volumes."); 123 fpCommand->SetGuidance 112 fpCommand->SetGuidance 124 ("Optionally propagates down hierarchy to 113 ("Optionally propagates down hierarchy to given depth."); 125 G4UIparameter* parameter; 114 G4UIparameter* parameter; 126 parameter = new G4UIparameter ("logical-volu 115 parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true); 127 parameter->SetDefaultValue("all"); 116 parameter->SetDefaultValue("all"); 128 fpCommand->SetParameter(parameter); 117 fpCommand->SetParameter(parameter); 129 parameter = new G4UIparameter("depth", 'd', 118 parameter = new G4UIparameter("depth", 'd', omitable = true); 130 parameter->SetDefaultValue(0); 119 parameter->SetDefaultValue(0); 131 parameter->SetGuidance 120 parameter->SetGuidance 132 ("Depth of propagation (-1 means unlimited 121 ("Depth of propagation (-1 means unlimited depth)."); 133 fpCommand->SetParameter(parameter); 122 fpCommand->SetParameter(parameter); 134 parameter = new G4UIparameter("red", 's', om 123 parameter = new G4UIparameter("red", 's', omitable = true); 135 parameter->SetDefaultValue("1."); 124 parameter->SetDefaultValue("1."); 136 parameter->SetGuidance 125 parameter->SetGuidance 137 ("Red component or a string, e.g., \"blue\ 126 ("Red component or a string, e.g., \"blue\", in which case succeeding colour components are ignored."); 138 fpCommand->SetParameter(parameter); 127 fpCommand->SetParameter(parameter); 139 parameter = new G4UIparameter("green", 'd', 128 parameter = new G4UIparameter("green", 'd', omitable = true); 140 parameter->SetDefaultValue(1.); 129 parameter->SetDefaultValue(1.); 141 fpCommand->SetParameter(parameter); 130 fpCommand->SetParameter(parameter); 142 parameter = new G4UIparameter("blue", 'd', o 131 parameter = new G4UIparameter("blue", 'd', omitable = true); 143 parameter->SetDefaultValue(1.); 132 parameter->SetDefaultValue(1.); 144 fpCommand->SetParameter(parameter); 133 fpCommand->SetParameter(parameter); 145 parameter = new G4UIparameter("opacity", 'd' 134 parameter = new G4UIparameter("opacity", 'd', omitable = true); 146 parameter->SetDefaultValue(1.); 135 parameter->SetDefaultValue(1.); 147 fpCommand->SetParameter(parameter); 136 fpCommand->SetParameter(parameter); 148 } 137 } 149 138 150 G4VisCommandGeometrySetColour::~G4VisCommandGe 139 G4VisCommandGeometrySetColour::~G4VisCommandGeometrySetColour() 151 { 140 { 152 delete fpCommand; 141 delete fpCommand; 153 } 142 } 154 143 155 G4String G4VisCommandGeometrySetColour::GetCur 144 G4String G4VisCommandGeometrySetColour::GetCurrentValue(G4UIcommand*) 156 { 145 { 157 return ""; 146 return ""; 158 } 147 } 159 148 160 void G4VisCommandGeometrySetColour::SetNewValu 149 void G4VisCommandGeometrySetColour::SetNewValue 161 (G4UIcommand*, G4String newValue) 150 (G4UIcommand*, G4String newValue) 162 { 151 { 163 G4String name, redOrString; 152 G4String name, redOrString; 164 G4int requestedDepth; 153 G4int requestedDepth; 165 G4double green, blue, opacity; 154 G4double green, blue, opacity; 166 std::istringstream iss(newValue); 155 std::istringstream iss(newValue); 167 iss >> name >> requestedDepth >> redOrString 156 iss >> name >> requestedDepth >> redOrString >> green >> blue >> opacity; 168 G4Colour colour(1,1,1,1); // Default white 157 G4Colour colour(1,1,1,1); // Default white and opaque. 169 ConvertToColour(colour, redOrString, green, << 158 const size_t iPos0 = 0; >> 159 if (std::isalpha(redOrString[iPos0])) { >> 160 if (!G4Colour::GetColour(redOrString, colour)) { >> 161 if (fpVisManager->GetVerbosity() >= G4VisManager::warnings) { >> 162 G4cout << "WARNING: Colour \"" << redOrString >> 163 << "\" not found. Defaulting to white and opaque." >> 164 << G4endl; >> 165 } >> 166 } >> 167 } else { >> 168 colour = G4Colour(G4UIcommand::ConvertToDouble(redOrString), green, blue); >> 169 } >> 170 colour = G4Colour >> 171 (colour.GetRed(), colour.GetGreen(), colour.GetBlue(), opacity); >> 172 170 G4VisCommandGeometrySetColourFunction setCol 173 G4VisCommandGeometrySetColourFunction setColour(colour); 171 Set(name, setColour, requestedDepth); 174 Set(name, setColour, requestedDepth); 172 } 175 } 173 176 174 ////////////// /vis/geometry/set/daughtersInvi 177 ////////////// /vis/geometry/set/daughtersInvisible ////////////////////// 175 178 176 G4VisCommandGeometrySetDaughtersInvisible::G4V 179 G4VisCommandGeometrySetDaughtersInvisible::G4VisCommandGeometrySetDaughtersInvisible() 177 { 180 { 178 G4bool omitable; 181 G4bool omitable; 179 fpCommand = new G4UIcommand("/vis/geometry/s 182 fpCommand = new G4UIcommand("/vis/geometry/set/daughtersInvisible", this); 180 fpCommand->SetGuidance("Makes daughters of l 183 fpCommand->SetGuidance("Makes daughters of logical volume(s) invisible."); 181 fpCommand->SetGuidance("\"all\" sets all log 184 fpCommand->SetGuidance("\"all\" sets all logical volumes."); 182 fpCommand->SetGuidance 185 fpCommand->SetGuidance 183 ("Optionally propagates down hierarchy to 186 ("Optionally propagates down hierarchy to given depth."); 184 G4UIparameter* parameter; 187 G4UIparameter* parameter; 185 parameter = new G4UIparameter ("logical-volu 188 parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true); 186 parameter->SetDefaultValue("all"); 189 parameter->SetDefaultValue("all"); 187 fpCommand->SetParameter(parameter); 190 fpCommand->SetParameter(parameter); 188 parameter = new G4UIparameter("depth", 'd', 191 parameter = new G4UIparameter("depth", 'd', omitable = true); 189 parameter->SetDefaultValue(0); 192 parameter->SetDefaultValue(0); 190 parameter->SetGuidance 193 parameter->SetGuidance 191 ("Depth of propagation (-1 means unlimited 194 ("Depth of propagation (-1 means unlimited depth)."); 192 fpCommand->SetParameter(parameter); 195 fpCommand->SetParameter(parameter); 193 parameter = new G4UIparameter("daughtersInvi 196 parameter = new G4UIparameter("daughtersInvisible", 'b', omitable = true); 194 parameter->SetDefaultValue(true); << 197 parameter->SetDefaultValue(false); 195 fpCommand->SetParameter(parameter); 198 fpCommand->SetParameter(parameter); 196 } 199 } 197 200 198 G4VisCommandGeometrySetDaughtersInvisible::~G4 201 G4VisCommandGeometrySetDaughtersInvisible::~G4VisCommandGeometrySetDaughtersInvisible() 199 { 202 { 200 delete fpCommand; 203 delete fpCommand; 201 } 204 } 202 205 203 G4String 206 G4String 204 G4VisCommandGeometrySetDaughtersInvisible::Get 207 G4VisCommandGeometrySetDaughtersInvisible::GetCurrentValue(G4UIcommand*) 205 { 208 { 206 return ""; 209 return ""; 207 } 210 } 208 211 209 void G4VisCommandGeometrySetDaughtersInvisible 212 void G4VisCommandGeometrySetDaughtersInvisible::SetNewValue 210 (G4UIcommand*, G4String newValue) 213 (G4UIcommand*, G4String newValue) 211 { 214 { 212 G4String name; 215 G4String name; 213 G4int requestedDepth; 216 G4int requestedDepth; 214 G4String daughtersInvisibleString; 217 G4String daughtersInvisibleString; 215 std::istringstream iss(newValue); 218 std::istringstream iss(newValue); 216 iss >> name >> requestedDepth >> daughtersIn 219 iss >> name >> requestedDepth >> daughtersInvisibleString; 217 G4bool daughtersInvisible = 220 G4bool daughtersInvisible = 218 G4UIcommand::ConvertToBool(daughtersInvisi 221 G4UIcommand::ConvertToBool(daughtersInvisibleString); 219 222 220 if (requestedDepth !=0) { 223 if (requestedDepth !=0) { 221 requestedDepth = 0; 224 requestedDepth = 0; 222 if (fpVisManager->GetVerbosity() >= G4VisM 225 if (fpVisManager->GetVerbosity() >= G4VisManager::warnings) { 223 G4warn << "Recursive application suppres << 226 G4cout << "Recursive application suppressed for this attribute." 224 << G4endl; 227 << G4endl; 225 } 228 } 226 } 229 } 227 230 228 G4VisCommandGeometrySetDaughtersInvisibleFun 231 G4VisCommandGeometrySetDaughtersInvisibleFunction 229 setDaughtersInvisible(daughtersInvisible); 232 setDaughtersInvisible(daughtersInvisible); 230 Set(name, setDaughtersInvisible, requestedDe 233 Set(name, setDaughtersInvisible, requestedDepth); 231 234 232 G4VViewer* pViewer = fpVisManager->GetCurren 235 G4VViewer* pViewer = fpVisManager->GetCurrentViewer(); 233 if (pViewer) { 236 if (pViewer) { 234 const G4ViewParameters& viewParams = pView 237 const G4ViewParameters& viewParams = pViewer->GetViewParameters(); 235 if (fpVisManager->GetVerbosity() >= G4VisM 238 if (fpVisManager->GetVerbosity() >= G4VisManager::warnings) { 236 if (!viewParams.IsCulling()) { 239 if (!viewParams.IsCulling()) { 237 G4warn << << 240 G4cout << 238 "Culling must be on - \"/vis/viewer/set/cu 241 "Culling must be on - \"/vis/viewer/set/culling global true\" - to see effect." 239 << G4endl; 242 << G4endl; 240 } 243 } 241 } 244 } 242 } 245 } 243 } 246 } 244 247 245 ////////////// /vis/geometry/set/forceAuxEdgeV 248 ////////////// /vis/geometry/set/forceAuxEdgeVisible ///////////////////////// 246 249 247 G4VisCommandGeometrySetForceAuxEdgeVisible::G4 250 G4VisCommandGeometrySetForceAuxEdgeVisible::G4VisCommandGeometrySetForceAuxEdgeVisible() 248 { 251 { 249 G4bool omitable; 252 G4bool omitable; 250 fpCommand = new G4UIcommand("/vis/geometry/s 253 fpCommand = new G4UIcommand("/vis/geometry/set/forceAuxEdgeVisible", this); 251 fpCommand->SetGuidance 254 fpCommand->SetGuidance 252 ("Forces auxiliary (soft) edges of logical 255 ("Forces auxiliary (soft) edges of logical volume(s) to be visible," 253 "\nregardless of the view parameters."); 256 "\nregardless of the view parameters."); 254 fpCommand->SetGuidance("\"all\" sets all log 257 fpCommand->SetGuidance("\"all\" sets all logical volumes."); 255 fpCommand->SetGuidance 258 fpCommand->SetGuidance 256 ("Optionally propagates down hierarchy to 259 ("Optionally propagates down hierarchy to given depth."); 257 G4UIparameter* parameter; 260 G4UIparameter* parameter; 258 parameter = new G4UIparameter ("logical-volu 261 parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true); 259 parameter->SetDefaultValue("all"); 262 parameter->SetDefaultValue("all"); 260 fpCommand->SetParameter(parameter); 263 fpCommand->SetParameter(parameter); 261 parameter = new G4UIparameter("depth", 'd', 264 parameter = new G4UIparameter("depth", 'd', omitable = true); 262 parameter->SetDefaultValue(0); 265 parameter->SetDefaultValue(0); 263 parameter->SetGuidance 266 parameter->SetGuidance 264 ("Depth of propagation (-1 means unlimited 267 ("Depth of propagation (-1 means unlimited depth)."); 265 fpCommand->SetParameter(parameter); 268 fpCommand->SetParameter(parameter); 266 parameter = new G4UIparameter("forceAuxEdgeV 269 parameter = new G4UIparameter("forceAuxEdgeVisible", 'b', omitable = true); 267 parameter->SetDefaultValue(true); << 270 parameter->SetDefaultValue(false); 268 fpCommand->SetParameter(parameter); 271 fpCommand->SetParameter(parameter); 269 } 272 } 270 273 271 G4VisCommandGeometrySetForceAuxEdgeVisible::~G 274 G4VisCommandGeometrySetForceAuxEdgeVisible::~G4VisCommandGeometrySetForceAuxEdgeVisible() 272 { 275 { 273 delete fpCommand; 276 delete fpCommand; 274 } 277 } 275 278 276 G4String 279 G4String 277 G4VisCommandGeometrySetForceAuxEdgeVisible::Ge 280 G4VisCommandGeometrySetForceAuxEdgeVisible::GetCurrentValue(G4UIcommand*) 278 { 281 { 279 return ""; 282 return ""; 280 } 283 } 281 284 282 void G4VisCommandGeometrySetForceAuxEdgeVisibl 285 void G4VisCommandGeometrySetForceAuxEdgeVisible::SetNewValue 283 (G4UIcommand*, G4String newValue) 286 (G4UIcommand*, G4String newValue) 284 { 287 { 285 G4String name; 288 G4String name; 286 G4int requestedDepth; 289 G4int requestedDepth; 287 G4String forceAuxEdgeVisibleString; 290 G4String forceAuxEdgeVisibleString; 288 std::istringstream iss(newValue); 291 std::istringstream iss(newValue); 289 iss >> name >> requestedDepth >> forceAuxEdg 292 iss >> name >> requestedDepth >> forceAuxEdgeVisibleString; 290 G4bool forceAuxEdgeVisible = 293 G4bool forceAuxEdgeVisible = 291 G4UIcommand::ConvertToBool(forceAuxEdgeVis 294 G4UIcommand::ConvertToBool(forceAuxEdgeVisibleString);; 292 295 293 G4VisCommandGeometrySetForceAuxEdgeVisibleFu 296 G4VisCommandGeometrySetForceAuxEdgeVisibleFunction 294 setForceAuxEdgeVisible(forceAuxEdgeVisible 297 setForceAuxEdgeVisible(forceAuxEdgeVisible); 295 Set(name, setForceAuxEdgeVisible, requestedD 298 Set(name, setForceAuxEdgeVisible, requestedDepth); 296 } 299 } 297 300 298 ////////////// /vis/geometry/set/forceCloud // << 299 << 300 G4VisCommandGeometrySetForceCloud::G4VisComman << 301 { << 302 G4bool omitable; << 303 fpCommand = new G4UIcommand("/vis/geometry/s << 304 fpCommand->SetGuidance << 305 ("Forces logical volume(s) always to be draw << 306 "\nregardless of the view parameters."); << 307 fpCommand->SetGuidance("\"all\" sets all log << 308 fpCommand->SetGuidance << 309 ("Optionally propagates down hierarchy to << 310 G4UIparameter* parameter; << 311 parameter = new G4UIparameter ("logical-volu << 312 parameter->SetDefaultValue("all"); << 313 fpCommand->SetParameter(parameter); << 314 parameter = new G4UIparameter("depth", 'd', << 315 parameter->SetDefaultValue(0); << 316 parameter->SetGuidance << 317 ("Depth of propagation (-1 means unlimited << 318 fpCommand->SetParameter(parameter); << 319 parameter = new G4UIparameter("forceCloud", << 320 parameter->SetDefaultValue(true); << 321 fpCommand->SetParameter(parameter); << 322 parameter = new G4UIparameter("nPoints", 'd' << 323 parameter->SetGuidance << 324 ("<= 0 means under control of viewer."); << 325 parameter->SetDefaultValue(0); << 326 fpCommand->SetParameter(parameter); << 327 } << 328 << 329 G4VisCommandGeometrySetForceCloud::~G4VisComma << 330 { << 331 delete fpCommand; << 332 } << 333 << 334 G4String << 335 G4VisCommandGeometrySetForceCloud::GetCurrentV << 336 { << 337 return ""; << 338 } << 339 << 340 void G4VisCommandGeometrySetForceCloud::SetNew << 341 (G4UIcommand*, G4String newValue) << 342 { << 343 G4String name, forceCloudString; << 344 G4int requestedDepth, nPoints; << 345 std::istringstream iss(newValue); << 346 iss >> name >> requestedDepth >> forceCloudS << 347 G4bool forceCloud = G4UIcommand::ConvertToBo << 348 << 349 G4VisCommandGeometrySetForceCloudFunction se << 350 Set(name, setForceCloud, requestedDepth); << 351 } << 352 << 353 ////////////// /vis/geometry/set/forceLineSegm 301 ////////////// /vis/geometry/set/forceLineSegmentsPerCircle ///////////////////////// 354 302 355 G4VisCommandGeometrySetForceLineSegmentsPerCir 303 G4VisCommandGeometrySetForceLineSegmentsPerCircle::G4VisCommandGeometrySetForceLineSegmentsPerCircle() 356 { 304 { 357 G4bool omitable; 305 G4bool omitable; 358 fpCommand = new G4UIcommand("/vis/geometry/s 306 fpCommand = new G4UIcommand("/vis/geometry/set/forceLineSegmentsPerCircle", this); 359 fpCommand->SetGuidance 307 fpCommand->SetGuidance 360 ("Forces number of line segments per circl 308 ("Forces number of line segments per circle, the precision with which a" 361 "\ncurved line or surface is represented 309 "\ncurved line or surface is represented by a polygon or polyhedron," 362 "\nregardless of the view parameters."); 310 "\nregardless of the view parameters."); 363 fpCommand->SetGuidance("\"all\" sets all log 311 fpCommand->SetGuidance("\"all\" sets all logical volumes."); 364 fpCommand->SetGuidance 312 fpCommand->SetGuidance 365 ("Optionally propagates down hierarchy to 313 ("Optionally propagates down hierarchy to given depth."); 366 G4UIparameter* parameter; 314 G4UIparameter* parameter; 367 parameter = new G4UIparameter ("logical-volu 315 parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true); 368 parameter->SetDefaultValue("all"); 316 parameter->SetDefaultValue("all"); 369 fpCommand->SetParameter(parameter); 317 fpCommand->SetParameter(parameter); 370 parameter = new G4UIparameter("depth", 'd', 318 parameter = new G4UIparameter("depth", 'd', omitable = true); 371 parameter->SetDefaultValue(0); 319 parameter->SetDefaultValue(0); 372 parameter->SetGuidance 320 parameter->SetGuidance 373 ("Depth of propagation (-1 means unlimited 321 ("Depth of propagation (-1 means unlimited depth)."); 374 fpCommand->SetParameter(parameter); 322 fpCommand->SetParameter(parameter); 375 parameter = new G4UIparameter("lineSegmentsP 323 parameter = new G4UIparameter("lineSegmentsPerCircle", 'd', omitable = true); 376 parameter->SetGuidance 324 parameter->SetGuidance 377 ("<= 0 means not forced, i.e., under contr << 325 ("< 0 means not forced, i.e., under control of viewer."); 378 parameter->SetDefaultValue(0); << 326 parameter->SetDefaultValue(-1); 379 fpCommand->SetParameter(parameter); 327 fpCommand->SetParameter(parameter); 380 } 328 } 381 329 382 G4VisCommandGeometrySetForceLineSegmentsPerCir 330 G4VisCommandGeometrySetForceLineSegmentsPerCircle::~G4VisCommandGeometrySetForceLineSegmentsPerCircle() 383 { 331 { 384 delete fpCommand; 332 delete fpCommand; 385 } 333 } 386 334 387 G4String 335 G4String 388 G4VisCommandGeometrySetForceLineSegmentsPerCir 336 G4VisCommandGeometrySetForceLineSegmentsPerCircle::GetCurrentValue(G4UIcommand*) 389 { 337 { 390 return ""; 338 return ""; 391 } 339 } 392 340 393 void G4VisCommandGeometrySetForceLineSegmentsP 341 void G4VisCommandGeometrySetForceLineSegmentsPerCircle::SetNewValue 394 (G4UIcommand*, G4String newValue) 342 (G4UIcommand*, G4String newValue) 395 { 343 { 396 G4String name; 344 G4String name; 397 G4int requestedDepth; 345 G4int requestedDepth; 398 G4int lineSegmentsPerCircle; 346 G4int lineSegmentsPerCircle; 399 std::istringstream iss(newValue); 347 std::istringstream iss(newValue); 400 iss >> name >> requestedDepth >> lineSegment 348 iss >> name >> requestedDepth >> lineSegmentsPerCircle; 401 349 402 G4VisCommandGeometrySetForceLineSegmentsPerC << 350 G4VisCommandGeometrySetForceLineSegmentsPerCircleFunction setForceLineSegmentsPerCircle(lineSegmentsPerCircle); 403 setForceLineSegmentsPerCircle(lineSegmentsPe << 404 Set(name, setForceLineSegmentsPerCircle, req 351 Set(name, setForceLineSegmentsPerCircle, requestedDepth); 405 } 352 } 406 353 407 ////////////// /vis/geometry/set/forceSolid // 354 ////////////// /vis/geometry/set/forceSolid ///////////////////////// 408 355 409 G4VisCommandGeometrySetForceSolid::G4VisComman 356 G4VisCommandGeometrySetForceSolid::G4VisCommandGeometrySetForceSolid() 410 { 357 { 411 G4bool omitable; 358 G4bool omitable; 412 fpCommand = new G4UIcommand("/vis/geometry/s 359 fpCommand = new G4UIcommand("/vis/geometry/set/forceSolid", this); 413 fpCommand->SetGuidance 360 fpCommand->SetGuidance 414 ("Forces logical volume(s) always to be dra 361 ("Forces logical volume(s) always to be drawn solid (surface drawing)," 415 "\nregardless of the view parameters."); 362 "\nregardless of the view parameters."); 416 fpCommand->SetGuidance("\"all\" sets all log 363 fpCommand->SetGuidance("\"all\" sets all logical volumes."); 417 fpCommand->SetGuidance 364 fpCommand->SetGuidance 418 ("Optionally propagates down hierarchy to 365 ("Optionally propagates down hierarchy to given depth."); 419 G4UIparameter* parameter; 366 G4UIparameter* parameter; 420 parameter = new G4UIparameter ("logical-volu 367 parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true); 421 parameter->SetDefaultValue("all"); 368 parameter->SetDefaultValue("all"); 422 fpCommand->SetParameter(parameter); 369 fpCommand->SetParameter(parameter); 423 parameter = new G4UIparameter("depth", 'd', 370 parameter = new G4UIparameter("depth", 'd', omitable = true); 424 parameter->SetDefaultValue(0); 371 parameter->SetDefaultValue(0); 425 parameter->SetGuidance 372 parameter->SetGuidance 426 ("Depth of propagation (-1 means unlimited 373 ("Depth of propagation (-1 means unlimited depth)."); 427 fpCommand->SetParameter(parameter); 374 fpCommand->SetParameter(parameter); 428 parameter = new G4UIparameter("force", 'b', << 375 parameter = new G4UIparameter("forceSolid", 'b', omitable = true); 429 parameter->SetDefaultValue(true); << 376 parameter->SetDefaultValue(false); 430 fpCommand->SetParameter(parameter); 377 fpCommand->SetParameter(parameter); 431 } 378 } 432 379 433 G4VisCommandGeometrySetForceSolid::~G4VisComma 380 G4VisCommandGeometrySetForceSolid::~G4VisCommandGeometrySetForceSolid() 434 { 381 { 435 delete fpCommand; 382 delete fpCommand; 436 } 383 } 437 384 438 G4String 385 G4String 439 G4VisCommandGeometrySetForceSolid::GetCurrentV 386 G4VisCommandGeometrySetForceSolid::GetCurrentValue(G4UIcommand*) 440 { 387 { 441 return ""; 388 return ""; 442 } 389 } 443 390 444 void G4VisCommandGeometrySetForceSolid::SetNew 391 void G4VisCommandGeometrySetForceSolid::SetNewValue 445 (G4UIcommand*, G4String newValue) 392 (G4UIcommand*, G4String newValue) 446 { 393 { 447 G4String name; 394 G4String name; 448 G4int requestedDepth; 395 G4int requestedDepth; 449 G4String forceString; << 396 G4String forceSolidString; 450 std::istringstream iss(newValue); 397 std::istringstream iss(newValue); 451 iss >> name >> requestedDepth >> forceString << 398 iss >> name >> requestedDepth >> forceSolidString; 452 G4bool force = G4UIcommand::ConvertToBool(fo << 399 G4bool forceSolid = G4UIcommand::ConvertToBool(forceSolidString); 453 400 454 G4VisCommandGeometrySetForceSolidFunction se << 401 G4VisCommandGeometrySetForceSolidFunction setForceSolid(forceSolid); 455 Set(name, setForceSolid, requestedDepth); 402 Set(name, setForceSolid, requestedDepth); 456 } 403 } 457 404 458 ////////////// /vis/geometry/set/forceWirefram 405 ////////////// /vis/geometry/set/forceWireframe ///////////////////////// 459 406 460 G4VisCommandGeometrySetForceWireframe::G4VisCo 407 G4VisCommandGeometrySetForceWireframe::G4VisCommandGeometrySetForceWireframe() 461 { 408 { 462 G4bool omitable; 409 G4bool omitable; 463 fpCommand = new G4UIcommand("/vis/geometry/s 410 fpCommand = new G4UIcommand("/vis/geometry/set/forceWireframe", this); 464 fpCommand->SetGuidance 411 fpCommand->SetGuidance 465 ("Forces logical volume(s) always to be dra 412 ("Forces logical volume(s) always to be drawn as wireframe," 466 "\nregardless of the view parameters."); 413 "\nregardless of the view parameters."); 467 fpCommand->SetGuidance("\"all\" sets all log 414 fpCommand->SetGuidance("\"all\" sets all logical volumes."); 468 fpCommand->SetGuidance 415 fpCommand->SetGuidance 469 ("Optionally propagates down hierarchy to 416 ("Optionally propagates down hierarchy to given depth."); 470 G4UIparameter* parameter; 417 G4UIparameter* parameter; 471 parameter = new G4UIparameter ("logical-volu 418 parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true); 472 parameter->SetDefaultValue("all"); 419 parameter->SetDefaultValue("all"); 473 fpCommand->SetParameter(parameter); 420 fpCommand->SetParameter(parameter); 474 parameter = new G4UIparameter("depth", 'd', 421 parameter = new G4UIparameter("depth", 'd', omitable = true); 475 parameter->SetDefaultValue(0); 422 parameter->SetDefaultValue(0); 476 parameter->SetGuidance 423 parameter->SetGuidance 477 ("Depth of propagation (-1 means unlimited 424 ("Depth of propagation (-1 means unlimited depth)."); 478 fpCommand->SetParameter(parameter); 425 fpCommand->SetParameter(parameter); 479 parameter = new G4UIparameter("forceWirefram 426 parameter = new G4UIparameter("forceWireframe", 'b', omitable = true); 480 parameter->SetDefaultValue(true); << 427 parameter->SetDefaultValue(false); 481 fpCommand->SetParameter(parameter); 428 fpCommand->SetParameter(parameter); 482 } 429 } 483 430 484 G4VisCommandGeometrySetForceWireframe::~G4VisC 431 G4VisCommandGeometrySetForceWireframe::~G4VisCommandGeometrySetForceWireframe() 485 { 432 { 486 delete fpCommand; 433 delete fpCommand; 487 } 434 } 488 435 489 G4String 436 G4String 490 G4VisCommandGeometrySetForceWireframe::GetCurr 437 G4VisCommandGeometrySetForceWireframe::GetCurrentValue(G4UIcommand*) 491 { 438 { 492 return ""; 439 return ""; 493 } 440 } 494 441 495 void G4VisCommandGeometrySetForceWireframe::Se 442 void G4VisCommandGeometrySetForceWireframe::SetNewValue 496 (G4UIcommand*, G4String newValue) 443 (G4UIcommand*, G4String newValue) 497 { 444 { 498 G4String name; 445 G4String name; 499 G4int requestedDepth; 446 G4int requestedDepth; 500 G4String forceWireframeString; 447 G4String forceWireframeString; 501 std::istringstream iss(newValue); 448 std::istringstream iss(newValue); 502 iss >> name >> requestedDepth >> forceWirefr 449 iss >> name >> requestedDepth >> forceWireframeString; 503 G4bool forceWireframe = G4UIcommand::Convert 450 G4bool forceWireframe = G4UIcommand::ConvertToBool(forceWireframeString); 504 451 505 G4VisCommandGeometrySetForceWireframeFunctio 452 G4VisCommandGeometrySetForceWireframeFunction 506 setForceWireframe(forceWireframe); 453 setForceWireframe(forceWireframe); 507 Set(name, setForceWireframe, requestedDepth) 454 Set(name, setForceWireframe, requestedDepth); 508 } 455 } 509 456 510 ////////////// /vis/geometry/set/lineStyle /// 457 ////////////// /vis/geometry/set/lineStyle ///////////////////////////////// 511 458 512 G4VisCommandGeometrySetLineStyle::G4VisCommand 459 G4VisCommandGeometrySetLineStyle::G4VisCommandGeometrySetLineStyle() 513 { 460 { 514 G4bool omitable; 461 G4bool omitable; 515 fpCommand = new G4UIcommand("/vis/geometry/s 462 fpCommand = new G4UIcommand("/vis/geometry/set/lineStyle", this); 516 fpCommand->SetGuidance("Sets line style of l 463 fpCommand->SetGuidance("Sets line style of logical volume(s) drawing."); 517 fpCommand->SetGuidance("\"all\" sets all log 464 fpCommand->SetGuidance("\"all\" sets all logical volumes."); 518 fpCommand->SetGuidance 465 fpCommand->SetGuidance 519 ("Optionally propagates down hierarchy to 466 ("Optionally propagates down hierarchy to given depth."); 520 G4UIparameter* parameter; 467 G4UIparameter* parameter; 521 parameter = new G4UIparameter ("logical-volu 468 parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true); 522 parameter->SetDefaultValue("all"); 469 parameter->SetDefaultValue("all"); 523 fpCommand->SetParameter(parameter); 470 fpCommand->SetParameter(parameter); 524 parameter = new G4UIparameter("depth", 'd', 471 parameter = new G4UIparameter("depth", 'd', omitable = true); 525 parameter->SetDefaultValue(0); 472 parameter->SetDefaultValue(0); 526 parameter->SetGuidance 473 parameter->SetGuidance 527 ("Depth of propagation (-1 means unlimited 474 ("Depth of propagation (-1 means unlimited depth)."); 528 fpCommand->SetParameter(parameter); 475 fpCommand->SetParameter(parameter); 529 parameter = new G4UIparameter("lineStyle", ' 476 parameter = new G4UIparameter("lineStyle", 's', omitable = true); 530 parameter->SetParameterCandidates("unbroken 477 parameter->SetParameterCandidates("unbroken dashed dotted"); 531 parameter->SetDefaultValue("unbroken"); 478 parameter->SetDefaultValue("unbroken"); 532 fpCommand->SetParameter(parameter); 479 fpCommand->SetParameter(parameter); 533 } 480 } 534 481 535 G4VisCommandGeometrySetLineStyle::~G4VisComman 482 G4VisCommandGeometrySetLineStyle::~G4VisCommandGeometrySetLineStyle() 536 { 483 { 537 delete fpCommand; 484 delete fpCommand; 538 } 485 } 539 486 540 G4String 487 G4String 541 G4VisCommandGeometrySetLineStyle::GetCurrentVa 488 G4VisCommandGeometrySetLineStyle::GetCurrentValue(G4UIcommand*) 542 { 489 { 543 return ""; 490 return ""; 544 } 491 } 545 492 546 void G4VisCommandGeometrySetLineStyle::SetNewV 493 void G4VisCommandGeometrySetLineStyle::SetNewValue 547 (G4UIcommand*, G4String newValue) 494 (G4UIcommand*, G4String newValue) 548 { 495 { 549 G4String name, lineStyleString; 496 G4String name, lineStyleString; 550 G4int requestedDepth; 497 G4int requestedDepth; 551 std::istringstream iss(newValue); 498 std::istringstream iss(newValue); 552 iss >> name >> requestedDepth >> lineStyleSt 499 iss >> name >> requestedDepth >> lineStyleString; 553 G4VisAttributes::LineStyle lineStyle = G4Vis 500 G4VisAttributes::LineStyle lineStyle = G4VisAttributes::unbroken; 554 if (lineStyleString == "unbroken") lineStyle 501 if (lineStyleString == "unbroken") lineStyle = G4VisAttributes::unbroken; 555 if (lineStyleString == "dashed") lineStyle = 502 if (lineStyleString == "dashed") lineStyle = G4VisAttributes::dashed; 556 if (lineStyleString == "dotted") lineStyle = 503 if (lineStyleString == "dotted") lineStyle = G4VisAttributes::dotted; 557 504 558 G4VisCommandGeometrySetLineStyleFunction set 505 G4VisCommandGeometrySetLineStyleFunction setLineStyle(lineStyle); 559 Set(name, setLineStyle, requestedDepth); 506 Set(name, setLineStyle, requestedDepth); 560 } 507 } 561 508 562 ////////////// /vis/geometry/set/lineWidth /// 509 ////////////// /vis/geometry/set/lineWidth ///////////////////////////////// 563 510 564 G4VisCommandGeometrySetLineWidth::G4VisCommand 511 G4VisCommandGeometrySetLineWidth::G4VisCommandGeometrySetLineWidth() 565 { 512 { 566 G4bool omitable; 513 G4bool omitable; 567 fpCommand = new G4UIcommand("/vis/geometry/s 514 fpCommand = new G4UIcommand("/vis/geometry/set/lineWidth", this); 568 fpCommand->SetGuidance("Sets line width of l 515 fpCommand->SetGuidance("Sets line width of logical volume(s) drawing."); 569 fpCommand->SetGuidance("\"all\" sets all log 516 fpCommand->SetGuidance("\"all\" sets all logical volumes."); 570 fpCommand->SetGuidance 517 fpCommand->SetGuidance 571 ("Optionally propagates down hierarchy to 518 ("Optionally propagates down hierarchy to given depth."); 572 G4UIparameter* parameter; 519 G4UIparameter* parameter; 573 parameter = new G4UIparameter ("logical-volu 520 parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true); 574 parameter->SetDefaultValue("all"); 521 parameter->SetDefaultValue("all"); 575 fpCommand->SetParameter(parameter); 522 fpCommand->SetParameter(parameter); 576 parameter = new G4UIparameter("depth", 'd', 523 parameter = new G4UIparameter("depth", 'd', omitable = true); 577 parameter->SetDefaultValue(0); 524 parameter->SetDefaultValue(0); 578 parameter->SetGuidance 525 parameter->SetGuidance 579 ("Depth of propagation (-1 means unlimited 526 ("Depth of propagation (-1 means unlimited depth)."); 580 fpCommand->SetParameter(parameter); 527 fpCommand->SetParameter(parameter); 581 parameter = new G4UIparameter("lineWidth", ' 528 parameter = new G4UIparameter("lineWidth", 'd', omitable = true); 582 parameter->SetDefaultValue(1.); 529 parameter->SetDefaultValue(1.); 583 fpCommand->SetParameter(parameter); 530 fpCommand->SetParameter(parameter); 584 } 531 } 585 532 586 G4VisCommandGeometrySetLineWidth::~G4VisComman 533 G4VisCommandGeometrySetLineWidth::~G4VisCommandGeometrySetLineWidth() 587 { 534 { 588 delete fpCommand; 535 delete fpCommand; 589 } 536 } 590 537 591 G4String 538 G4String 592 G4VisCommandGeometrySetLineWidth::GetCurrentVa 539 G4VisCommandGeometrySetLineWidth::GetCurrentValue(G4UIcommand*) 593 { 540 { 594 return ""; 541 return ""; 595 } 542 } 596 543 597 void G4VisCommandGeometrySetLineWidth::SetNewV 544 void G4VisCommandGeometrySetLineWidth::SetNewValue 598 (G4UIcommand*, G4String newValue) 545 (G4UIcommand*, G4String newValue) 599 { 546 { 600 G4String name; 547 G4String name; 601 G4int requestedDepth; 548 G4int requestedDepth; 602 G4double lineWidth; 549 G4double lineWidth; 603 std::istringstream iss(newValue); 550 std::istringstream iss(newValue); 604 iss >> name >> requestedDepth >> lineWidth; 551 iss >> name >> requestedDepth >> lineWidth; 605 552 606 G4VisCommandGeometrySetLineWidthFunction set 553 G4VisCommandGeometrySetLineWidthFunction setLineWidth(lineWidth); 607 Set(name, setLineWidth, requestedDepth); 554 Set(name, setLineWidth, requestedDepth); 608 } 555 } 609 556 610 ////////////// /vis/geometry/set/visibility // 557 ////////////// /vis/geometry/set/visibility /////////////////////////////////////// 611 558 612 G4VisCommandGeometrySetVisibility::G4VisComman 559 G4VisCommandGeometrySetVisibility::G4VisCommandGeometrySetVisibility() 613 { 560 { 614 G4bool omitable; 561 G4bool omitable; 615 fpCommand = new G4UIcommand("/vis/geometry/s 562 fpCommand = new G4UIcommand("/vis/geometry/set/visibility", this); 616 fpCommand->SetGuidance("Sets visibility of l 563 fpCommand->SetGuidance("Sets visibility of logical volume(s)."); 617 fpCommand->SetGuidance("\"all\" sets all log 564 fpCommand->SetGuidance("\"all\" sets all logical volumes."); 618 fpCommand->SetGuidance 565 fpCommand->SetGuidance 619 ("Optionally propagates down hierarchy to 566 ("Optionally propagates down hierarchy to given depth."); 620 G4UIparameter* parameter; 567 G4UIparameter* parameter; 621 parameter = new G4UIparameter ("logical-volu 568 parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true); 622 parameter->SetDefaultValue("all"); 569 parameter->SetDefaultValue("all"); 623 fpCommand->SetParameter(parameter); 570 fpCommand->SetParameter(parameter); 624 parameter = new G4UIparameter("depth", 'd', 571 parameter = new G4UIparameter("depth", 'd', omitable = true); 625 parameter->SetDefaultValue(0); 572 parameter->SetDefaultValue(0); 626 parameter->SetGuidance 573 parameter->SetGuidance 627 ("Depth of propagation (-1 means unlimited 574 ("Depth of propagation (-1 means unlimited depth)."); 628 fpCommand->SetParameter(parameter); 575 fpCommand->SetParameter(parameter); 629 parameter = new G4UIparameter("visibility", 576 parameter = new G4UIparameter("visibility", 'b', omitable = true); 630 parameter->SetDefaultValue(true); 577 parameter->SetDefaultValue(true); 631 fpCommand->SetParameter(parameter); 578 fpCommand->SetParameter(parameter); 632 } 579 } 633 580 634 G4VisCommandGeometrySetVisibility::~G4VisComma 581 G4VisCommandGeometrySetVisibility::~G4VisCommandGeometrySetVisibility() 635 { 582 { 636 delete fpCommand; 583 delete fpCommand; 637 } 584 } 638 585 639 G4String G4VisCommandGeometrySetVisibility::Ge 586 G4String G4VisCommandGeometrySetVisibility::GetCurrentValue(G4UIcommand*) 640 { 587 { 641 return ""; 588 return ""; 642 } 589 } 643 590 644 void G4VisCommandGeometrySetVisibility::SetNew 591 void G4VisCommandGeometrySetVisibility::SetNewValue 645 (G4UIcommand*, G4String newValue) 592 (G4UIcommand*, G4String newValue) 646 { 593 { 647 G4String name; 594 G4String name; 648 G4int requestedDepth; 595 G4int requestedDepth; 649 G4String visibilityString; 596 G4String visibilityString; 650 std::istringstream iss(newValue); 597 std::istringstream iss(newValue); 651 iss >> name >> requestedDepth >> visibilityS 598 iss >> name >> requestedDepth >> visibilityString; 652 G4bool visibility = G4UIcommand::ConvertToBo 599 G4bool visibility = G4UIcommand::ConvertToBool(visibilityString); 653 600 654 G4VisCommandGeometrySetVisibilityFunction se 601 G4VisCommandGeometrySetVisibilityFunction setVisibility(visibility); 655 Set(name, setVisibility, requestedDepth); 602 Set(name, setVisibility, requestedDepth); 656 603 657 G4VViewer* pViewer = fpVisManager->GetCurren 604 G4VViewer* pViewer = fpVisManager->GetCurrentViewer(); 658 if (pViewer) { 605 if (pViewer) { 659 const G4ViewParameters& viewParams = pView 606 const G4ViewParameters& viewParams = pViewer->GetViewParameters(); 660 if (fpVisManager->GetVerbosity() >= G4VisM 607 if (fpVisManager->GetVerbosity() >= G4VisManager::warnings) { 661 if (!viewParams.IsCulling() || 608 if (!viewParams.IsCulling() || 662 !viewParams.IsCullingInvisible()) { 609 !viewParams.IsCullingInvisible()) { 663 G4warn << << 610 G4cout << 664 "Culling must be on - \"/vis/viewer/set/cu 611 "Culling must be on - \"/vis/viewer/set/culling global true\" and" 665 "\n \"/vis/viewer/set/culling invisible t 612 "\n \"/vis/viewer/set/culling invisible true\" - to see effect." 666 << G4endl; 613 << G4endl; 667 } 614 } 668 } 615 } 669 } 616 } 670 } 617 } 671 618 672 void G4VisCommandGeometrySetVisibility::SetNew 619 void G4VisCommandGeometrySetVisibility::SetNewValueOnLV 673 (G4LogicalVolume* pLV, G4int requestedDepth,G4 620 (G4LogicalVolume* pLV, G4int requestedDepth,G4bool visibility) 674 { 621 { 675 if (!pLV) return; 622 if (!pLV) return; 676 G4VisCommandGeometrySetVisibilityFunction se 623 G4VisCommandGeometrySetVisibilityFunction setVisibility(visibility); 677 SetLVVisAtts(pLV, setVisibility, 0, requeste 624 SetLVVisAtts(pLV, setVisibility, 0, requestedDepth); 678 625 679 G4VViewer* pViewer = fpVisManager->GetCurren 626 G4VViewer* pViewer = fpVisManager->GetCurrentViewer(); 680 if (pViewer) { 627 if (pViewer) { 681 G4UImanager::GetUIpointer()->ApplyCommand( 628 G4UImanager::GetUIpointer()->ApplyCommand("/vis/scene/notifyHandlers"); 682 const G4ViewParameters& viewParams = pView 629 const G4ViewParameters& viewParams = pViewer->GetViewParameters(); 683 if (fpVisManager->GetVerbosity() >= G4VisM 630 if (fpVisManager->GetVerbosity() >= G4VisManager::warnings) { 684 if (!viewParams.IsCulling() || 631 if (!viewParams.IsCulling() || 685 !viewParams.IsCullingInvisible()) { 632 !viewParams.IsCullingInvisible()) { 686 G4warn << << 633 G4cout << 687 "Culling must be on - \"/vis/viewer/set/cu 634 "Culling must be on - \"/vis/viewer/set/culling global true\" and" 688 "\n \"/vis/viewer/set/culling invisible t 635 "\n \"/vis/viewer/set/culling invisible true\" - to see effect." 689 << G4endl; 636 << G4endl; 690 } 637 } 691 } 638 } 692 } 639 } 693 } 640 } 694 641