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/touchable/set commands - John Allison 28 // /vis/touchable/set commands - John Allison 8th October 2012 29 29 30 #include "G4VisCommandsTouchableSet.hh" 30 #include "G4VisCommandsTouchableSet.hh" 31 31 32 #include "G4UImanager.hh" 32 #include "G4UImanager.hh" 33 #include "G4UIcommand.hh" 33 #include "G4UIcommand.hh" 34 #include "G4UIcmdWithABool.hh" 34 #include "G4UIcmdWithABool.hh" 35 #include "G4UIcmdWithADouble.hh" 35 #include "G4UIcmdWithADouble.hh" 36 #include "G4UIcmdWithAnInteger.hh" 36 #include "G4UIcmdWithAnInteger.hh" 37 #include "G4UIcmdWithAString.hh" 37 #include "G4UIcmdWithAString.hh" 38 38 39 #include <sstream> 39 #include <sstream> 40 40 41 #define G4warn G4cout << 42 << 43 ////////////// /vis/touchable/set/colour ///// 41 ////////////// /vis/touchable/set/colour /////////////////////////////////////// 44 42 45 G4VisCommandsTouchableSet::G4VisCommandsToucha 43 G4VisCommandsTouchableSet::G4VisCommandsTouchableSet() 46 { 44 { 47 G4bool omitable; 45 G4bool omitable; 48 G4UIparameter* parameter; 46 G4UIparameter* parameter; 49 47 50 fpCommandSetColour = new G4UIcommand 48 fpCommandSetColour = new G4UIcommand 51 ("/vis/touchable/set/colour", this); 49 ("/vis/touchable/set/colour", this); 52 fpCommandSetColour->SetGuidance("Set colour 50 fpCommandSetColour->SetGuidance("Set colour of current touchable."); 53 fpCommandSetColour->SetGuidance 51 fpCommandSetColour->SetGuidance 54 ("Use \"/vis/set/touchable\" to set current 52 ("Use \"/vis/set/touchable\" to set current touchable."); 55 fpCommandSetColour->SetGuidance(ConvertToCol 53 fpCommandSetColour->SetGuidance(ConvertToColourGuidance()); 56 parameter = new G4UIparameter("red", 's', om 54 parameter = new G4UIparameter("red", 's', omitable = true); 57 parameter->SetDefaultValue("1."); 55 parameter->SetDefaultValue("1."); 58 fpCommandSetColour->SetParameter(parameter); 56 fpCommandSetColour->SetParameter(parameter); 59 parameter = new G4UIparameter("green", 'd', 57 parameter = new G4UIparameter("green", 'd', omitable = true); 60 parameter->SetDefaultValue(1.); 58 parameter->SetDefaultValue(1.); 61 fpCommandSetColour->SetParameter(parameter); 59 fpCommandSetColour->SetParameter(parameter); 62 parameter = new G4UIparameter("blue", 'd', o 60 parameter = new G4UIparameter("blue", 'd', omitable = true); 63 parameter->SetDefaultValue(1.); 61 parameter->SetDefaultValue(1.); 64 fpCommandSetColour->SetParameter(parameter); 62 fpCommandSetColour->SetParameter(parameter); 65 parameter = new G4UIparameter("opacity", 'd' 63 parameter = new G4UIparameter("opacity", 'd', omitable = true); 66 parameter->SetDefaultValue(1.); 64 parameter->SetDefaultValue(1.); 67 fpCommandSetColour->SetParameter(parameter); 65 fpCommandSetColour->SetParameter(parameter); 68 66 69 fpCommandSetDaughtersInvisible = new G4UIcmd 67 fpCommandSetDaughtersInvisible = new G4UIcmdWithABool 70 ("/vis/touchable/set/daughtersInvisible", th 68 ("/vis/touchable/set/daughtersInvisible", this); 71 fpCommandSetDaughtersInvisible->SetGuidance 69 fpCommandSetDaughtersInvisible->SetGuidance 72 ("Daughters of current touchable invisible: 70 ("Daughters of current touchable invisible: true/false."); 73 fpCommandSetDaughtersInvisible->SetGuidance 71 fpCommandSetDaughtersInvisible->SetGuidance 74 ("Use \"/vis/set/touchable\" to set current 72 ("Use \"/vis/set/touchable\" to set current touchable."); 75 fpCommandSetDaughtersInvisible->SetParameter 73 fpCommandSetDaughtersInvisible->SetParameterName("daughtersInvisible", omitable = true); 76 fpCommandSetDaughtersInvisible->SetDefaultVa 74 fpCommandSetDaughtersInvisible->SetDefaultValue(true); 77 75 78 fpCommandSetForceAuxEdgeVisible = new G4UIcm 76 fpCommandSetForceAuxEdgeVisible = new G4UIcmdWithABool 79 ("/vis/touchable/set/forceAuxEdgeVisible", t 77 ("/vis/touchable/set/forceAuxEdgeVisible", this); 80 fpCommandSetForceAuxEdgeVisible->SetGuidance 78 fpCommandSetForceAuxEdgeVisible->SetGuidance 81 ("Force auxiliary (soft) edges of current 79 ("Force auxiliary (soft) edges of current touchable to be visible: true/false."); 82 fpCommandSetForceAuxEdgeVisible->SetGuidance 80 fpCommandSetForceAuxEdgeVisible->SetGuidance 83 ("Use \"/vis/set/touchable\" to set current 81 ("Use \"/vis/set/touchable\" to set current touchable."); 84 fpCommandSetForceAuxEdgeVisible->SetParamete 82 fpCommandSetForceAuxEdgeVisible->SetParameterName("forceAuxEdgeVisible", omitable = true); 85 fpCommandSetForceAuxEdgeVisible->SetDefaultV 83 fpCommandSetForceAuxEdgeVisible->SetDefaultValue(true); 86 84 87 fpCommandSetForceCloud = new G4UIcmdWithABoo << 85 fpCommandSetLineSegmentsPerCircle = new G4UIcmdWithAnInteger 88 ("/vis/touchable/set/forceCloud", this); << 86 ("/vis/touchable/set/lineSegmentsPerCircle", this); 89 fpCommandSetForceCloud->SetGuidance << 87 fpCommandSetLineSegmentsPerCircle->SetGuidance 90 ("Force current touchable always to be drawn << 88 ("For current touchable, set number of line segments per circle, the" 91 fpCommandSetForceCloud->SetGuidance << 89 "\nprecision with which a curved line or surface is represented by a" >> 90 "\npolygon or polyhedron, regardless of the view parameters." >> 91 "\nNegative to pick up G4Polyhedron default value."); >> 92 fpCommandSetLineSegmentsPerCircle->SetGuidance 92 ("Use \"/vis/set/touchable\" to set current 93 ("Use \"/vis/set/touchable\" to set current touchable."); 93 fpCommandSetForceCloud->SetParameterName("fo << 94 fpCommandSetLineSegmentsPerCircle->SetParameterName("lineSegmentsPerCircle", omitable = true); 94 fpCommandSetForceCloud->SetDefaultValue(true << 95 fpCommandSetLineSegmentsPerCircle->SetDefaultValue(0); 95 << 96 96 fpCommandSetForceSolid = new G4UIcmdWithABoo 97 fpCommandSetForceSolid = new G4UIcmdWithABool 97 ("/vis/touchable/set/forceSolid", this); 98 ("/vis/touchable/set/forceSolid", this); 98 fpCommandSetForceSolid->SetGuidance 99 fpCommandSetForceSolid->SetGuidance 99 ("Force current touchable always to be drawn 100 ("Force current touchable always to be drawn solid (surface drawing)."); 100 fpCommandSetForceSolid->SetGuidance 101 fpCommandSetForceSolid->SetGuidance 101 ("Use \"/vis/set/touchable\" to set current 102 ("Use \"/vis/set/touchable\" to set current touchable."); 102 fpCommandSetForceSolid->SetParameterName("fo << 103 fpCommandSetForceSolid->SetParameterName("forceSolid", omitable = true); 103 fpCommandSetForceSolid->SetDefaultValue(true 104 fpCommandSetForceSolid->SetDefaultValue(true); 104 105 105 fpCommandSetForceWireframe = new G4UIcmdWith 106 fpCommandSetForceWireframe = new G4UIcmdWithABool 106 ("/vis/touchable/set/forceWireframe", this); 107 ("/vis/touchable/set/forceWireframe", this); 107 fpCommandSetForceWireframe->SetGuidance 108 fpCommandSetForceWireframe->SetGuidance 108 ("Force current touchable always to be drawn 109 ("Force current touchable always to be drawn as wireframe."); 109 fpCommandSetForceWireframe->SetGuidance 110 fpCommandSetForceWireframe->SetGuidance 110 ("Use \"/vis/set/touchable\" to set current 111 ("Use \"/vis/set/touchable\" to set current touchable."); 111 fpCommandSetForceWireframe->SetParameterName 112 fpCommandSetForceWireframe->SetParameterName("forceWireframe", omitable = true); 112 fpCommandSetForceWireframe->SetDefaultValue( 113 fpCommandSetForceWireframe->SetDefaultValue(true); 113 114 114 fpCommandSetLineSegmentsPerCircle = new G4UI << 115 ("/vis/touchable/set/lineSegmentsPerCircle", << 116 fpCommandSetLineSegmentsPerCircle->SetGuidan << 117 ("For current touchable, set number of lin << 118 "\nprecision with which a curved line or << 119 "\npolygon or polyhedron, regardless of t << 120 "\nNegative to pick up G4Polyhedron defau << 121 fpCommandSetLineSegmentsPerCircle->SetGuidan << 122 ("Use \"/vis/set/touchable\" to set current << 123 fpCommandSetLineSegmentsPerCircle->SetParame << 124 fpCommandSetLineSegmentsPerCircle->SetDefaul << 125 << 126 fpCommandSetLineStyle = new G4UIcmdWithAStri 115 fpCommandSetLineStyle = new G4UIcmdWithAString 127 ("/vis/touchable/set/lineStyle", this); 116 ("/vis/touchable/set/lineStyle", this); 128 fpCommandSetLineStyle->SetGuidance("Set line 117 fpCommandSetLineStyle->SetGuidance("Set line style of current touchable drawing."); 129 fpCommandSetLineStyle->SetGuidance 118 fpCommandSetLineStyle->SetGuidance 130 ("Use \"/vis/set/touchable\" to set current 119 ("Use \"/vis/set/touchable\" to set current touchable."); 131 fpCommandSetLineStyle->SetParameterName("lin 120 fpCommandSetLineStyle->SetParameterName("lineStyle", omitable = true); 132 fpCommandSetLineStyle->SetCandidates("unbrok 121 fpCommandSetLineStyle->SetCandidates("unbroken dashed dotted"); 133 fpCommandSetLineStyle->SetDefaultValue("unbr 122 fpCommandSetLineStyle->SetDefaultValue("unbroken"); 134 123 135 fpCommandSetLineWidth = new G4UIcmdWithADoub 124 fpCommandSetLineWidth = new G4UIcmdWithADouble 136 ("/vis/touchable/set/lineWidth", this); 125 ("/vis/touchable/set/lineWidth", this); 137 fpCommandSetLineWidth->SetGuidance("Set line 126 fpCommandSetLineWidth->SetGuidance("Set line width of current touchable."); 138 fpCommandSetLineWidth->SetGuidance 127 fpCommandSetLineWidth->SetGuidance 139 ("Use \"/vis/set/touchable\" to set current 128 ("Use \"/vis/set/touchable\" to set current touchable."); 140 fpCommandSetLineWidth->SetParameterName("lin 129 fpCommandSetLineWidth->SetParameterName("lineWidth", omitable = true); 141 fpCommandSetLineWidth->SetDefaultValue(1.); 130 fpCommandSetLineWidth->SetDefaultValue(1.); 142 131 143 fpCommandSetNumberOfCloudPoints = new G4UIcm << 144 ("/vis/touchable/set/numberOfCloudPoints", t << 145 fpCommandSetNumberOfCloudPoints->SetGuidance << 146 ("For current touchable, set number of cloud << 147 "\n<= 0 means under control of viewer."); << 148 fpCommandSetNumberOfCloudPoints->SetGuidance << 149 ("Use \"/vis/set/touchable\" to set current << 150 fpCommandSetNumberOfCloudPoints->SetParamete << 151 fpCommandSetNumberOfCloudPoints->SetDefaultV << 152 << 153 fpCommandSetVisibility = new G4UIcmdWithABoo 132 fpCommandSetVisibility = new G4UIcmdWithABool 154 ("/vis/touchable/set/visibility", this); 133 ("/vis/touchable/set/visibility", this); 155 fpCommandSetVisibility->SetGuidance 134 fpCommandSetVisibility->SetGuidance 156 ("Set visibility of current touchable: true/ 135 ("Set visibility of current touchable: true/false."); 157 fpCommandSetVisibility->SetGuidance 136 fpCommandSetVisibility->SetGuidance 158 ("Use \"/vis/set/touchable\" to set current 137 ("Use \"/vis/set/touchable\" to set current touchable."); 159 fpCommandSetVisibility->SetParameterName("vi 138 fpCommandSetVisibility->SetParameterName("visibility", omitable = true); 160 fpCommandSetVisibility->SetDefaultValue(true 139 fpCommandSetVisibility->SetDefaultValue(true); 161 } 140 } 162 141 163 G4VisCommandsTouchableSet::~G4VisCommandsTouch 142 G4VisCommandsTouchableSet::~G4VisCommandsTouchableSet() { 164 delete fpCommandSetVisibility; 143 delete fpCommandSetVisibility; 165 delete fpCommandSetNumberOfCloudPoints; << 166 delete fpCommandSetLineWidth; 144 delete fpCommandSetLineWidth; 167 delete fpCommandSetLineStyle; 145 delete fpCommandSetLineStyle; 168 delete fpCommandSetForceWireframe; 146 delete fpCommandSetForceWireframe; 169 delete fpCommandSetForceSolid; 147 delete fpCommandSetForceSolid; 170 delete fpCommandSetForceCloud; << 171 delete fpCommandSetLineSegmentsPerCircle; 148 delete fpCommandSetLineSegmentsPerCircle; 172 delete fpCommandSetForceAuxEdgeVisible; 149 delete fpCommandSetForceAuxEdgeVisible; 173 delete fpCommandSetDaughtersInvisible; 150 delete fpCommandSetDaughtersInvisible; 174 delete fpCommandSetColour; 151 delete fpCommandSetColour; 175 } 152 } 176 153 177 G4String G4VisCommandsTouchableSet::GetCurrent 154 G4String G4VisCommandsTouchableSet::GetCurrentValue(G4UIcommand*) { 178 return ""; 155 return ""; 179 } 156 } 180 157 181 void G4VisCommandsTouchableSet::SetNewValue 158 void G4VisCommandsTouchableSet::SetNewValue 182 (G4UIcommand* command,G4String newValue) 159 (G4UIcommand* command,G4String newValue) 183 { 160 { 184 G4VisManager::Verbosity verbosity = fpVisMan 161 G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity(); 185 162 186 G4VViewer* currentViewer = fpVisManager->Get 163 G4VViewer* currentViewer = fpVisManager->GetCurrentViewer(); 187 if (!currentViewer) { 164 if (!currentViewer) { 188 if (verbosity >= G4VisManager::errors) { 165 if (verbosity >= G4VisManager::errors) { 189 G4warn << << 166 G4cerr << 190 "ERROR: G4VisCommandsTouchableSet::SetNe 167 "ERROR: G4VisCommandsTouchableSet::SetNewValue: no current viewer." 191 << G4endl; 168 << G4endl; 192 } 169 } 193 return; 170 return; 194 } 171 } 195 172 196 G4ViewParameters workingVP = currentViewer-> 173 G4ViewParameters workingVP = currentViewer->GetViewParameters(); 197 G4VisAttributes workingVisAtts; 174 G4VisAttributes workingVisAtts; 198 175 199 if (command == fpCommandSetColour) 176 if (command == fpCommandSetColour) 200 { 177 { 201 G4String redOrString; 178 G4String redOrString; 202 G4double green, blue, opacity; 179 G4double green, blue, opacity; 203 std::istringstream iss(newValue); 180 std::istringstream iss(newValue); 204 iss >> redOrString >> green >> blue >> opa 181 iss >> redOrString >> green >> blue >> opacity; 205 G4Colour colour(1,1,1,1); // Default whit 182 G4Colour colour(1,1,1,1); // Default white and opaque. 206 ConvertToColour(colour, redOrString, green 183 ConvertToColour(colour, redOrString, green, blue, opacity); 207 workingVisAtts.SetColour(colour); 184 workingVisAtts.SetColour(colour); 208 workingVP.AddVisAttributesModifier 185 workingVP.AddVisAttributesModifier 209 (G4ModelingParameters::VisAttributesModifi 186 (G4ModelingParameters::VisAttributesModifier 210 (workingVisAtts, 187 (workingVisAtts, 211 G4ModelingParameters::VASColour, 188 G4ModelingParameters::VASColour, 212 fCurrentTouchableProperties.fTouchablePa 189 fCurrentTouchableProperties.fTouchablePath)); 213 } 190 } 214 191 215 else if (command == fpCommandSetDaughtersInv 192 else if (command == fpCommandSetDaughtersInvisible) { 216 workingVisAtts.SetDaughtersInvisible(G4UIc 193 workingVisAtts.SetDaughtersInvisible(G4UIcommand::ConvertToBool(newValue)); 217 workingVP.AddVisAttributesModifier 194 workingVP.AddVisAttributesModifier 218 (G4ModelingParameters::VisAttributesModifi 195 (G4ModelingParameters::VisAttributesModifier 219 (workingVisAtts, 196 (workingVisAtts, 220 G4ModelingParameters::VASDaughtersInvisi 197 G4ModelingParameters::VASDaughtersInvisible, 221 fCurrentTouchableProperties.fTouchablePa 198 fCurrentTouchableProperties.fTouchablePath)); 222 } 199 } 223 200 224 else if (command == fpCommandSetForceAuxEdge 201 else if (command == fpCommandSetForceAuxEdgeVisible) { 225 workingVisAtts.SetForceAuxEdgeVisible(G4UI 202 workingVisAtts.SetForceAuxEdgeVisible(G4UIcommand::ConvertToBool(newValue)); 226 workingVP.AddVisAttributesModifier 203 workingVP.AddVisAttributesModifier 227 (G4ModelingParameters::VisAttributesModifi 204 (G4ModelingParameters::VisAttributesModifier 228 (workingVisAtts, 205 (workingVisAtts, 229 G4ModelingParameters::VASForceAuxEdgeVis 206 G4ModelingParameters::VASForceAuxEdgeVisible, 230 fCurrentTouchableProperties.fTouchablePa 207 fCurrentTouchableProperties.fTouchablePath)); 231 } 208 } 232 209 233 else if (command == fpCommandSetLineSegments 210 else if (command == fpCommandSetLineSegmentsPerCircle) { 234 workingVisAtts.SetForceLineSegmentsPerCirc 211 workingVisAtts.SetForceLineSegmentsPerCircle 235 (G4UIcommand::ConvertToInt(newValue)); 212 (G4UIcommand::ConvertToInt(newValue)); 236 workingVP.AddVisAttributesModifier 213 workingVP.AddVisAttributesModifier 237 (G4ModelingParameters::VisAttributesModifi 214 (G4ModelingParameters::VisAttributesModifier 238 (workingVisAtts, 215 (workingVisAtts, 239 G4ModelingParameters::VASForceLineSegmen 216 G4ModelingParameters::VASForceLineSegmentsPerCircle, 240 fCurrentTouchableProperties.fTouchablePa 217 fCurrentTouchableProperties.fTouchablePath)); 241 } 218 } 242 219 243 else if (command == fpCommandSetForceCloud) << 244 workingVisAtts.SetForceCloud(G4UIcommand:: << 245 workingVP.AddVisAttributesModifier << 246 (G4ModelingParameters::VisAttributesModifi << 247 (workingVisAtts, << 248 G4ModelingParameters::VASForceCloud, << 249 fCurrentTouchableProperties.fTouchablePa << 250 } << 251 << 252 else if (command == fpCommandSetForceSolid) 220 else if (command == fpCommandSetForceSolid) { 253 workingVisAtts.SetForceSolid(G4UIcommand:: 221 workingVisAtts.SetForceSolid(G4UIcommand::ConvertToBool(newValue)); 254 workingVP.AddVisAttributesModifier 222 workingVP.AddVisAttributesModifier 255 (G4ModelingParameters::VisAttributesModifi 223 (G4ModelingParameters::VisAttributesModifier 256 (workingVisAtts, 224 (workingVisAtts, 257 G4ModelingParameters::VASForceSolid, 225 G4ModelingParameters::VASForceSolid, 258 fCurrentTouchableProperties.fTouchablePa 226 fCurrentTouchableProperties.fTouchablePath)); 259 } 227 } 260 << 228 261 else if (command == fpCommandSetForceWirefra 229 else if (command == fpCommandSetForceWireframe) { 262 workingVisAtts.SetForceWireframe(G4UIcomma 230 workingVisAtts.SetForceWireframe(G4UIcommand::ConvertToBool(newValue)); 263 workingVP.AddVisAttributesModifier 231 workingVP.AddVisAttributesModifier 264 (G4ModelingParameters::VisAttributesModifi 232 (G4ModelingParameters::VisAttributesModifier 265 (workingVisAtts, 233 (workingVisAtts, 266 G4ModelingParameters::VASForceWireframe, 234 G4ModelingParameters::VASForceWireframe, 267 fCurrentTouchableProperties.fTouchablePa 235 fCurrentTouchableProperties.fTouchablePath)); 268 } 236 } 269 237 270 else if (command == fpCommandSetLineStyle) { 238 else if (command == fpCommandSetLineStyle) { 271 G4VisAttributes::LineStyle lineStyle = G4V 239 G4VisAttributes::LineStyle lineStyle = G4VisAttributes::unbroken; 272 if (newValue == "dashed") { 240 if (newValue == "dashed") { 273 lineStyle = G4VisAttributes::dashed; 241 lineStyle = G4VisAttributes::dashed; 274 } else if (newValue == "dotted") { 242 } else if (newValue == "dotted") { 275 lineStyle = G4VisAttributes::dotted; 243 lineStyle = G4VisAttributes::dotted; 276 } 244 } 277 // All other values are "unbroken". 245 // All other values are "unbroken". 278 workingVisAtts.SetLineStyle(lineStyle); 246 workingVisAtts.SetLineStyle(lineStyle); 279 workingVP.AddVisAttributesModifier 247 workingVP.AddVisAttributesModifier 280 (G4ModelingParameters::VisAttributesModifi 248 (G4ModelingParameters::VisAttributesModifier 281 (workingVisAtts, 249 (workingVisAtts, 282 G4ModelingParameters::VASLineStyle, 250 G4ModelingParameters::VASLineStyle, 283 fCurrentTouchableProperties.fTouchablePa 251 fCurrentTouchableProperties.fTouchablePath)); 284 } 252 } 285 253 286 else if (command == fpCommandSetLineWidth) { 254 else if (command == fpCommandSetLineWidth) { 287 workingVisAtts.SetLineWidth(G4UIcommand::C 255 workingVisAtts.SetLineWidth(G4UIcommand::ConvertToDouble(newValue)); 288 workingVP.AddVisAttributesModifier 256 workingVP.AddVisAttributesModifier 289 (G4ModelingParameters::VisAttributesModifi 257 (G4ModelingParameters::VisAttributesModifier 290 (workingVisAtts, 258 (workingVisAtts, 291 G4ModelingParameters::VASLineWidth, 259 G4ModelingParameters::VASLineWidth, 292 fCurrentTouchableProperties.fTouchablePa 260 fCurrentTouchableProperties.fTouchablePath)); 293 } 261 } 294 262 295 else if (command == fpCommandSetNumberOfClou << 296 workingVisAtts.SetForceNumberOfCloudPoints << 297 (G4UIcommand::ConvertToInt(newValue)); << 298 workingVP.AddVisAttributesModifier << 299 (G4ModelingParameters::VisAttributesModifi << 300 (workingVisAtts, << 301 G4ModelingParameters::VASForceNumberOfCl << 302 fCurrentTouchableProperties.fTouchablePa << 303 } << 304 << 305 else if (command == fpCommandSetVisibility) 263 else if (command == fpCommandSetVisibility) { 306 workingVisAtts.SetVisibility(G4UIcommand:: 264 workingVisAtts.SetVisibility(G4UIcommand::ConvertToBool(newValue)); 307 workingVP.AddVisAttributesModifier 265 workingVP.AddVisAttributesModifier 308 (G4ModelingParameters::VisAttributesModifi 266 (G4ModelingParameters::VisAttributesModifier 309 (workingVisAtts, 267 (workingVisAtts, 310 G4ModelingParameters::VASVisibility, 268 G4ModelingParameters::VASVisibility, 311 fCurrentTouchableProperties.fTouchablePa 269 fCurrentTouchableProperties.fTouchablePath)); 312 if (verbosity >= G4VisManager::warnings) { << 313 static G4bool first = true; << 314 if (first) { << 315 first = false; << 316 G4warn << "WARNING: If \"/vis/touchabl << 317 "\n work, check that opacity (4th com << 318 G4warn << "ALSO: The volume must be in << 319 "\n not in the \"base path\". E.g., i << 320 "\n /vis/drawVolume volume-name" << 321 "\n there is no way to make a parent << 322 "\n explicitly adding the parent:" << 323 "\n /vis/scene/add/volume parent-na << 324 } << 325 } << 326 } 270 } 327 271 328 else { 272 else { 329 if (verbosity >= G4VisManager::errors) { 273 if (verbosity >= G4VisManager::errors) { 330 G4warn << << 274 G4cerr << 331 "ERROR: G4VisCommandsTouchableSet::SetNe 275 "ERROR: G4VisCommandsTouchableSet::SetNewValue: unrecognised command." 332 << G4endl; 276 << G4endl; 333 } 277 } 334 return; 278 return; 335 } 279 } 336 280 337 SetViewParameters(currentViewer,workingVP); 281 SetViewParameters(currentViewer,workingVP); 338 282 339 // To update all views 283 // To update all views 340 G4UImanager::GetUIpointer()->ApplyCommand("/ 284 G4UImanager::GetUIpointer()->ApplyCommand("/vis/scene/notifyHandlers"); 341 } 285 } 342 286