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