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