Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // >> 27 // $Id$ 27 28 28 // /vis/touchable/set commands - John Allison 29 // /vis/touchable/set commands - John Allison 8th October 2012 29 30 30 #include "G4VisCommandsTouchableSet.hh" 31 #include "G4VisCommandsTouchableSet.hh" 31 32 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 #include <cctype> 41 #define G4warn G4cout << 42 41 43 ////////////// /vis/touchable/set/colour ///// 42 ////////////// /vis/touchable/set/colour /////////////////////////////////////// 44 43 45 G4VisCommandsTouchableSet::G4VisCommandsToucha 44 G4VisCommandsTouchableSet::G4VisCommandsTouchableSet() 46 { 45 { 47 G4bool omitable; 46 G4bool omitable; 48 G4UIparameter* parameter; 47 G4UIparameter* parameter; 49 48 50 fpCommandSetColour = new G4UIcommand 49 fpCommandSetColour = new G4UIcommand 51 ("/vis/touchable/set/colour", this); 50 ("/vis/touchable/set/colour", this); 52 fpCommandSetColour->SetGuidance("Set colour 51 fpCommandSetColour->SetGuidance("Set colour of current touchable."); 53 fpCommandSetColour->SetGuidance 52 fpCommandSetColour->SetGuidance 54 ("Use \"/vis/set/touchable\" to set current 53 ("Use \"/vis/set/touchable\" to set current touchable."); 55 fpCommandSetColour->SetGuidance(ConvertToCol << 56 parameter = new G4UIparameter("red", 's', om 54 parameter = new G4UIparameter("red", 's', omitable = true); 57 parameter->SetDefaultValue("1."); 55 parameter->SetDefaultValue("1."); >> 56 parameter->SetGuidance >> 57 ("Red component or a string, e.g., \"blue\", in which case succeeding colour" >> 58 "\ncomponents are ignored."); 58 fpCommandSetColour->SetParameter(parameter); 59 fpCommandSetColour->SetParameter(parameter); 59 parameter = new G4UIparameter("green", 'd', 60 parameter = new G4UIparameter("green", 'd', omitable = true); 60 parameter->SetDefaultValue(1.); 61 parameter->SetDefaultValue(1.); 61 fpCommandSetColour->SetParameter(parameter); 62 fpCommandSetColour->SetParameter(parameter); 62 parameter = new G4UIparameter("blue", 'd', o 63 parameter = new G4UIparameter("blue", 'd', omitable = true); 63 parameter->SetDefaultValue(1.); 64 parameter->SetDefaultValue(1.); 64 fpCommandSetColour->SetParameter(parameter); 65 fpCommandSetColour->SetParameter(parameter); 65 parameter = new G4UIparameter("opacity", 'd' 66 parameter = new G4UIparameter("opacity", 'd', omitable = true); 66 parameter->SetDefaultValue(1.); 67 parameter->SetDefaultValue(1.); 67 fpCommandSetColour->SetParameter(parameter); 68 fpCommandSetColour->SetParameter(parameter); 68 69 69 fpCommandSetDaughtersInvisible = new G4UIcmd 70 fpCommandSetDaughtersInvisible = new G4UIcmdWithABool 70 ("/vis/touchable/set/daughtersInvisible", th 71 ("/vis/touchable/set/daughtersInvisible", this); 71 fpCommandSetDaughtersInvisible->SetGuidance 72 fpCommandSetDaughtersInvisible->SetGuidance 72 ("Daughters of current touchable invisible: 73 ("Daughters of current touchable invisible: true/false."); 73 fpCommandSetDaughtersInvisible->SetGuidance 74 fpCommandSetDaughtersInvisible->SetGuidance 74 ("Use \"/vis/set/touchable\" to set current 75 ("Use \"/vis/set/touchable\" to set current touchable."); 75 fpCommandSetDaughtersInvisible->SetParameter 76 fpCommandSetDaughtersInvisible->SetParameterName("daughtersInvisible", omitable = true); 76 fpCommandSetDaughtersInvisible->SetDefaultVa << 77 fpCommandSetDaughtersInvisible->SetDefaultValue(false); 77 78 78 fpCommandSetForceAuxEdgeVisible = new G4UIcm 79 fpCommandSetForceAuxEdgeVisible = new G4UIcmdWithABool 79 ("/vis/touchable/set/forceAuxEdgeVisible", t 80 ("/vis/touchable/set/forceAuxEdgeVisible", this); 80 fpCommandSetForceAuxEdgeVisible->SetGuidance 81 fpCommandSetForceAuxEdgeVisible->SetGuidance 81 ("Force auxiliary (soft) edges of current << 82 ("Force auxiliary (soft) edges of current touchable to be visible:" >> 83 " true/false."); 82 fpCommandSetForceAuxEdgeVisible->SetGuidance 84 fpCommandSetForceAuxEdgeVisible->SetGuidance 83 ("Use \"/vis/set/touchable\" to set current 85 ("Use \"/vis/set/touchable\" to set current touchable."); 84 fpCommandSetForceAuxEdgeVisible->SetParamete 86 fpCommandSetForceAuxEdgeVisible->SetParameterName("forceAuxEdgeVisible", omitable = true); 85 fpCommandSetForceAuxEdgeVisible->SetDefaultV << 87 fpCommandSetForceAuxEdgeVisible->SetDefaultValue(false); 86 88 87 fpCommandSetForceCloud = new G4UIcmdWithABoo << 89 fpCommandSetLineSegmentsPerCircle = new G4UIcmdWithAnInteger 88 ("/vis/touchable/set/forceCloud", this); << 90 ("/vis/touchable/set/lineSegmentsPerCircle", this); 89 fpCommandSetForceCloud->SetGuidance << 91 fpCommandSetLineSegmentsPerCircle->SetGuidance 90 ("Force current touchable always to be drawn << 92 ("For current touchable, set number of line segments per circle, the" 91 fpCommandSetForceCloud->SetGuidance << 93 "\nprecision with which a curved line or surface is represented by a" >> 94 "\npolygon or polyhedron, regardless of the view parameters." >> 95 "\nNegative to pick up G4Polyhedron default value."); >> 96 fpCommandSetLineSegmentsPerCircle->SetGuidance 92 ("Use \"/vis/set/touchable\" to set current 97 ("Use \"/vis/set/touchable\" to set current touchable."); 93 fpCommandSetForceCloud->SetParameterName("fo << 98 fpCommandSetLineSegmentsPerCircle->SetParameterName("lineSegmentsPerCircle", omitable = true); 94 fpCommandSetForceCloud->SetDefaultValue(true << 99 fpCommandSetLineSegmentsPerCircle->SetDefaultValue(-1); 95 << 100 96 fpCommandSetForceSolid = new G4UIcmdWithABoo 101 fpCommandSetForceSolid = new G4UIcmdWithABool 97 ("/vis/touchable/set/forceSolid", this); 102 ("/vis/touchable/set/forceSolid", this); 98 fpCommandSetForceSolid->SetGuidance 103 fpCommandSetForceSolid->SetGuidance 99 ("Force current touchable always to be drawn 104 ("Force current touchable always to be drawn solid (surface drawing)."); 100 fpCommandSetForceSolid->SetGuidance 105 fpCommandSetForceSolid->SetGuidance 101 ("Use \"/vis/set/touchable\" to set current 106 ("Use \"/vis/set/touchable\" to set current touchable."); 102 fpCommandSetForceSolid->SetParameterName("fo << 107 fpCommandSetForceSolid->SetParameterName("forceSolid", omitable = true); 103 fpCommandSetForceSolid->SetDefaultValue(true << 108 fpCommandSetForceSolid->SetDefaultValue(false); 104 109 105 fpCommandSetForceWireframe = new G4UIcmdWith 110 fpCommandSetForceWireframe = new G4UIcmdWithABool 106 ("/vis/touchable/set/forceWireframe", this); 111 ("/vis/touchable/set/forceWireframe", this); 107 fpCommandSetForceWireframe->SetGuidance 112 fpCommandSetForceWireframe->SetGuidance 108 ("Force current touchable always to be drawn 113 ("Force current touchable always to be drawn as wireframe."); 109 fpCommandSetForceWireframe->SetGuidance 114 fpCommandSetForceWireframe->SetGuidance 110 ("Use \"/vis/set/touchable\" to set current 115 ("Use \"/vis/set/touchable\" to set current touchable."); 111 fpCommandSetForceWireframe->SetParameterName 116 fpCommandSetForceWireframe->SetParameterName("forceWireframe", omitable = true); 112 fpCommandSetForceWireframe->SetDefaultValue( << 117 fpCommandSetForceWireframe->SetDefaultValue(false); 113 << 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 118 126 fpCommandSetLineStyle = new G4UIcmdWithAStri 119 fpCommandSetLineStyle = new G4UIcmdWithAString 127 ("/vis/touchable/set/lineStyle", this); 120 ("/vis/touchable/set/lineStyle", this); 128 fpCommandSetLineStyle->SetGuidance("Set line 121 fpCommandSetLineStyle->SetGuidance("Set line style of current touchable drawing."); 129 fpCommandSetLineStyle->SetGuidance 122 fpCommandSetLineStyle->SetGuidance 130 ("Use \"/vis/set/touchable\" to set current 123 ("Use \"/vis/set/touchable\" to set current touchable."); 131 fpCommandSetLineStyle->SetParameterName("lin 124 fpCommandSetLineStyle->SetParameterName("lineStyle", omitable = true); 132 fpCommandSetLineStyle->SetCandidates("unbrok 125 fpCommandSetLineStyle->SetCandidates("unbroken dashed dotted"); 133 fpCommandSetLineStyle->SetDefaultValue("unbr 126 fpCommandSetLineStyle->SetDefaultValue("unbroken"); 134 127 135 fpCommandSetLineWidth = new G4UIcmdWithADoub 128 fpCommandSetLineWidth = new G4UIcmdWithADouble 136 ("/vis/touchable/set/lineWidth", this); 129 ("/vis/touchable/set/lineWidth", this); 137 fpCommandSetLineWidth->SetGuidance("Set line 130 fpCommandSetLineWidth->SetGuidance("Set line width of current touchable."); 138 fpCommandSetLineWidth->SetGuidance 131 fpCommandSetLineWidth->SetGuidance 139 ("Use \"/vis/set/touchable\" to set current 132 ("Use \"/vis/set/touchable\" to set current touchable."); 140 fpCommandSetLineWidth->SetParameterName("lin 133 fpCommandSetLineWidth->SetParameterName("lineWidth", omitable = true); 141 fpCommandSetLineWidth->SetDefaultValue(1.); 134 fpCommandSetLineWidth->SetDefaultValue(1.); 142 135 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 136 fpCommandSetVisibility = new G4UIcmdWithABool 154 ("/vis/touchable/set/visibility", this); 137 ("/vis/touchable/set/visibility", this); 155 fpCommandSetVisibility->SetGuidance 138 fpCommandSetVisibility->SetGuidance 156 ("Set visibility of current touchable: true/ 139 ("Set visibility of current touchable: true/false."); 157 fpCommandSetVisibility->SetGuidance 140 fpCommandSetVisibility->SetGuidance 158 ("Use \"/vis/set/touchable\" to set current 141 ("Use \"/vis/set/touchable\" to set current touchable."); 159 fpCommandSetVisibility->SetParameterName("vi 142 fpCommandSetVisibility->SetParameterName("visibility", omitable = true); 160 fpCommandSetVisibility->SetDefaultValue(true << 143 fpCommandSetVisibility->SetDefaultValue(false); 161 } 144 } 162 145 163 G4VisCommandsTouchableSet::~G4VisCommandsTouch 146 G4VisCommandsTouchableSet::~G4VisCommandsTouchableSet() { 164 delete fpCommandSetVisibility; 147 delete fpCommandSetVisibility; 165 delete fpCommandSetNumberOfCloudPoints; << 166 delete fpCommandSetLineWidth; 148 delete fpCommandSetLineWidth; 167 delete fpCommandSetLineStyle; 149 delete fpCommandSetLineStyle; 168 delete fpCommandSetForceWireframe; 150 delete fpCommandSetForceWireframe; 169 delete fpCommandSetForceSolid; 151 delete fpCommandSetForceSolid; 170 delete fpCommandSetForceCloud; << 171 delete fpCommandSetLineSegmentsPerCircle; 152 delete fpCommandSetLineSegmentsPerCircle; 172 delete fpCommandSetForceAuxEdgeVisible; 153 delete fpCommandSetForceAuxEdgeVisible; 173 delete fpCommandSetDaughtersInvisible; 154 delete fpCommandSetDaughtersInvisible; 174 delete fpCommandSetColour; 155 delete fpCommandSetColour; 175 } 156 } 176 157 177 G4String G4VisCommandsTouchableSet::GetCurrent 158 G4String G4VisCommandsTouchableSet::GetCurrentValue(G4UIcommand*) { 178 return ""; 159 return ""; 179 } 160 } 180 161 181 void G4VisCommandsTouchableSet::SetNewValue 162 void G4VisCommandsTouchableSet::SetNewValue 182 (G4UIcommand* command,G4String newValue) 163 (G4UIcommand* command,G4String newValue) 183 { 164 { 184 G4VisManager::Verbosity verbosity = fpVisMan 165 G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity(); 185 166 186 G4VViewer* currentViewer = fpVisManager->Get 167 G4VViewer* currentViewer = fpVisManager->GetCurrentViewer(); 187 if (!currentViewer) { 168 if (!currentViewer) { 188 if (verbosity >= G4VisManager::errors) { 169 if (verbosity >= G4VisManager::errors) { 189 G4warn << << 170 G4cout << 190 "ERROR: G4VisCommandsTouchableSet::SetNe 171 "ERROR: G4VisCommandsTouchableSet::SetNewValue: no current viewer." 191 << G4endl; 172 << G4endl; 192 } 173 } 193 return; 174 return; 194 } 175 } 195 176 196 G4ViewParameters workingVP = currentViewer-> 177 G4ViewParameters workingVP = currentViewer->GetViewParameters(); 197 G4VisAttributes workingVisAtts; 178 G4VisAttributes workingVisAtts; 198 179 199 if (command == fpCommandSetColour) 180 if (command == fpCommandSetColour) 200 { 181 { 201 G4String redOrString; 182 G4String redOrString; 202 G4double green, blue, opacity; 183 G4double green, blue, opacity; 203 std::istringstream iss(newValue); 184 std::istringstream iss(newValue); 204 iss >> redOrString >> green >> blue >> opa 185 iss >> redOrString >> green >> blue >> opacity; 205 G4Colour colour(1,1,1,1); // Default whit 186 G4Colour colour(1,1,1,1); // Default white and opaque. 206 ConvertToColour(colour, redOrString, green << 187 const size_t iPos0 = 0; >> 188 if (std::isalpha(redOrString[iPos0])) { >> 189 if (!G4Colour::GetColour(redOrString, colour)) { >> 190 if (fpVisManager->GetVerbosity() >= G4VisManager::warnings) { >> 191 G4cout << "WARNING: Colour \"" << redOrString >> 192 << "\" not found. Defaulting to white and opaque." >> 193 << G4endl; >> 194 } >> 195 } >> 196 } else { >> 197 colour = G4Colour(G4UIcommand::ConvertToDouble(redOrString), green, blue); >> 198 } >> 199 colour = G4Colour >> 200 (colour.GetRed(), colour.GetGreen(), colour.GetBlue(), opacity); >> 201 207 workingVisAtts.SetColour(colour); 202 workingVisAtts.SetColour(colour); 208 workingVP.AddVisAttributesModifier 203 workingVP.AddVisAttributesModifier 209 (G4ModelingParameters::VisAttributesModifi 204 (G4ModelingParameters::VisAttributesModifier 210 (workingVisAtts, 205 (workingVisAtts, 211 G4ModelingParameters::VASColour, 206 G4ModelingParameters::VASColour, 212 fCurrentTouchableProperties.fTouchablePa << 207 fCurrentTouchablePath)); 213 } 208 } 214 209 215 else if (command == fpCommandSetDaughtersInv 210 else if (command == fpCommandSetDaughtersInvisible) { 216 workingVisAtts.SetDaughtersInvisible(G4UIc 211 workingVisAtts.SetDaughtersInvisible(G4UIcommand::ConvertToBool(newValue)); 217 workingVP.AddVisAttributesModifier 212 workingVP.AddVisAttributesModifier 218 (G4ModelingParameters::VisAttributesModifi 213 (G4ModelingParameters::VisAttributesModifier 219 (workingVisAtts, 214 (workingVisAtts, 220 G4ModelingParameters::VASDaughtersInvisi 215 G4ModelingParameters::VASDaughtersInvisible, 221 fCurrentTouchableProperties.fTouchablePa << 216 fCurrentTouchablePath)); 222 } 217 } 223 218 224 else if (command == fpCommandSetForceAuxEdge 219 else if (command == fpCommandSetForceAuxEdgeVisible) { 225 workingVisAtts.SetForceAuxEdgeVisible(G4UI 220 workingVisAtts.SetForceAuxEdgeVisible(G4UIcommand::ConvertToBool(newValue)); 226 workingVP.AddVisAttributesModifier 221 workingVP.AddVisAttributesModifier 227 (G4ModelingParameters::VisAttributesModifi 222 (G4ModelingParameters::VisAttributesModifier 228 (workingVisAtts, 223 (workingVisAtts, 229 G4ModelingParameters::VASForceAuxEdgeVis 224 G4ModelingParameters::VASForceAuxEdgeVisible, 230 fCurrentTouchableProperties.fTouchablePa << 225 fCurrentTouchablePath)); 231 } 226 } 232 227 233 else if (command == fpCommandSetLineSegments 228 else if (command == fpCommandSetLineSegmentsPerCircle) { 234 workingVisAtts.SetForceLineSegmentsPerCirc 229 workingVisAtts.SetForceLineSegmentsPerCircle 235 (G4UIcommand::ConvertToInt(newValue)); 230 (G4UIcommand::ConvertToInt(newValue)); 236 workingVP.AddVisAttributesModifier 231 workingVP.AddVisAttributesModifier 237 (G4ModelingParameters::VisAttributesModifi 232 (G4ModelingParameters::VisAttributesModifier 238 (workingVisAtts, 233 (workingVisAtts, 239 G4ModelingParameters::VASForceLineSegmen 234 G4ModelingParameters::VASForceLineSegmentsPerCircle, 240 fCurrentTouchableProperties.fTouchablePa << 235 fCurrentTouchablePath)); 241 } 236 } 242 237 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) 238 else if (command == fpCommandSetForceSolid) { 253 workingVisAtts.SetForceSolid(G4UIcommand:: 239 workingVisAtts.SetForceSolid(G4UIcommand::ConvertToBool(newValue)); 254 workingVP.AddVisAttributesModifier 240 workingVP.AddVisAttributesModifier 255 (G4ModelingParameters::VisAttributesModifi 241 (G4ModelingParameters::VisAttributesModifier 256 (workingVisAtts, 242 (workingVisAtts, 257 G4ModelingParameters::VASForceSolid, 243 G4ModelingParameters::VASForceSolid, 258 fCurrentTouchableProperties.fTouchablePa << 244 fCurrentTouchablePath)); 259 } 245 } 260 << 246 261 else if (command == fpCommandSetForceWirefra 247 else if (command == fpCommandSetForceWireframe) { 262 workingVisAtts.SetForceWireframe(G4UIcomma 248 workingVisAtts.SetForceWireframe(G4UIcommand::ConvertToBool(newValue)); 263 workingVP.AddVisAttributesModifier 249 workingVP.AddVisAttributesModifier 264 (G4ModelingParameters::VisAttributesModifi 250 (G4ModelingParameters::VisAttributesModifier 265 (workingVisAtts, 251 (workingVisAtts, 266 G4ModelingParameters::VASForceWireframe, 252 G4ModelingParameters::VASForceWireframe, 267 fCurrentTouchableProperties.fTouchablePa << 253 fCurrentTouchablePath)); 268 } 254 } 269 255 270 else if (command == fpCommandSetLineStyle) { 256 else if (command == fpCommandSetLineStyle) { 271 G4VisAttributes::LineStyle lineStyle = G4V 257 G4VisAttributes::LineStyle lineStyle = G4VisAttributes::unbroken; 272 if (newValue == "dashed") { 258 if (newValue == "dashed") { 273 lineStyle = G4VisAttributes::dashed; 259 lineStyle = G4VisAttributes::dashed; 274 } else if (newValue == "dotted") { 260 } else if (newValue == "dotted") { 275 lineStyle = G4VisAttributes::dotted; 261 lineStyle = G4VisAttributes::dotted; 276 } 262 } 277 // All other values are "unbroken". 263 // All other values are "unbroken". 278 workingVisAtts.SetLineStyle(lineStyle); 264 workingVisAtts.SetLineStyle(lineStyle); 279 workingVP.AddVisAttributesModifier 265 workingVP.AddVisAttributesModifier 280 (G4ModelingParameters::VisAttributesModifi 266 (G4ModelingParameters::VisAttributesModifier 281 (workingVisAtts, 267 (workingVisAtts, 282 G4ModelingParameters::VASLineStyle, 268 G4ModelingParameters::VASLineStyle, 283 fCurrentTouchableProperties.fTouchablePa << 269 fCurrentTouchablePath)); 284 } 270 } 285 271 286 else if (command == fpCommandSetLineWidth) { 272 else if (command == fpCommandSetLineWidth) { 287 workingVisAtts.SetLineWidth(G4UIcommand::C 273 workingVisAtts.SetLineWidth(G4UIcommand::ConvertToDouble(newValue)); 288 workingVP.AddVisAttributesModifier 274 workingVP.AddVisAttributesModifier 289 (G4ModelingParameters::VisAttributesModifi 275 (G4ModelingParameters::VisAttributesModifier 290 (workingVisAtts, 276 (workingVisAtts, 291 G4ModelingParameters::VASLineWidth, 277 G4ModelingParameters::VASLineWidth, 292 fCurrentTouchableProperties.fTouchablePa << 278 fCurrentTouchablePath)); 293 } 279 } 294 280 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) 281 else if (command == fpCommandSetVisibility) { 306 workingVisAtts.SetVisibility(G4UIcommand:: 282 workingVisAtts.SetVisibility(G4UIcommand::ConvertToBool(newValue)); 307 workingVP.AddVisAttributesModifier 283 workingVP.AddVisAttributesModifier 308 (G4ModelingParameters::VisAttributesModifi 284 (G4ModelingParameters::VisAttributesModifier 309 (workingVisAtts, 285 (workingVisAtts, 310 G4ModelingParameters::VASVisibility, 286 G4ModelingParameters::VASVisibility, 311 fCurrentTouchableProperties.fTouchablePa << 287 fCurrentTouchablePath)); 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 } 288 } 327 289 328 else { 290 else { 329 if (verbosity >= G4VisManager::errors) { 291 if (verbosity >= G4VisManager::errors) { 330 G4warn << << 292 G4cout << 331 "ERROR: G4VisCommandsTouchableSet::SetNe 293 "ERROR: G4VisCommandsTouchableSet::SetNewValue: unrecognised command." 332 << G4endl; 294 << G4endl; 333 } 295 } 334 return; 296 return; 335 } 297 } 336 298 337 SetViewParameters(currentViewer,workingVP); 299 SetViewParameters(currentViewer,workingVP); 338 << 339 // To update all views << 340 G4UImanager::GetUIpointer()->ApplyCommand("/ << 341 } 300 } 342 301