Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // 23 // >> 24 // $Id: G4VisCommandsViewerSet.cc,v 1.28 2004/12/07 23:41:02 perl Exp $ >> 25 // GEANT4 tag $Name: geant4-07-00-patch-01 $ 27 26 28 // /vis/viewer/set commands - John Allison 16 27 // /vis/viewer/set commands - John Allison 16th May 2000 29 28 30 #include "G4VisCommandsViewerSet.hh" 29 #include "G4VisCommandsViewerSet.hh" 31 30 32 #include "G4UIcommand.hh" 31 #include "G4UIcommand.hh" 33 #include "G4UIcmdWithoutParameter.hh" << 34 #include "G4UIcmdWithAString.hh" 32 #include "G4UIcmdWithAString.hh" 35 #include "G4UIcmdWithABool.hh" 33 #include "G4UIcmdWithABool.hh" 36 #include "G4UIcmdWithAnInteger.hh" 34 #include "G4UIcmdWithAnInteger.hh" 37 #include "G4UIcmdWithADouble.hh" 35 #include "G4UIcmdWithADouble.hh" 38 #include "G4UIcmdWith3VectorAndUnit.hh" << 39 #include "G4UnitsTable.hh" 36 #include "G4UnitsTable.hh" 40 #include "G4VisManager.hh" 37 #include "G4VisManager.hh" 41 #include "G4Polyhedron.hh" << 42 #include "G4SystemOfUnits.hh" << 43 << 44 #include <sstream> << 45 #include <iomanip> << 46 #include <utility> << 47 << 48 #define G4warn G4cout << 49 38 50 G4VisCommandsViewerSet::G4VisCommandsViewerSet 39 G4VisCommandsViewerSet::G4VisCommandsViewerSet (): 51 fLightsVector (G4ThreeVector(1.,1.,1.)), << 40 fLightsVector (G4ThreeVector(1.,1.,1.)), 52 fUpVector (G4ThreeVector(0.,1.,0.)), << 41 fUpVector (G4ThreeVector(0.,1.,0.)), 53 fViewpointVector (G4ThreeVector(0.,0.,1.)) << 42 fViewpointVector (G4ThreeVector(0.,0.,1.)) 54 { 43 { 55 G4bool omitable; 44 G4bool omitable; 56 G4UIparameter* parameter; 45 G4UIparameter* parameter; 57 46 58 fpCommandAll = new G4UIcmdWithAString ("/vis 47 fpCommandAll = new G4UIcmdWithAString ("/vis/viewer/set/all",this); 59 fpCommandAll->SetGuidance 48 fpCommandAll->SetGuidance 60 ("Copies view parameters."); << 49 ("/vis/viewer/set/all <from-viewer-name>" 61 fpCommandAll->SetGuidance << 50 "\nCopies view parameters (except the autoRefresh status) from" 62 ("Copies ALL view parameters (except the aut << 51 "\n from-viewer to current viewer."); 63 "\nfrom-viewer to current viewer. You may n << 64 fpCommandAll->SetGuidance << 65 ("Note: to copy only the camera-specific par << 66 "\n\"/vis/viewer/copyfrom\"."); << 67 fpCommandAll->SetParameterName ("from-viewer 52 fpCommandAll->SetParameterName ("from-viewer-name",omitable = false); >> 53 viewerNameCommands.push_back (fpCommandAll); 68 54 69 fpCommandAutoRefresh = new G4UIcmdWithABool 55 fpCommandAutoRefresh = new G4UIcmdWithABool 70 ("/vis/viewer/set/autoRefresh",this); << 56 ("/vis/viewer/set/autoRefresh",this); 71 fpCommandAutoRefresh->SetGuidance("Sets auto << 72 fpCommandAutoRefresh->SetGuidance 57 fpCommandAutoRefresh->SetGuidance 73 ("If true, view is automatically refreshed a << 58 ("/vis/viewer/set/autoRefresh [true|false]"); 74 "\nview parameters."); << 59 fpCommandAutoRefresh->SetGuidance(" default: false"); >> 60 fpCommandAutoRefresh->SetGuidance >> 61 ("View is automatically refreshed after a change of view parameters."); 75 fpCommandAutoRefresh->SetParameterName("auto 62 fpCommandAutoRefresh->SetParameterName("auto-refresh",omitable = true); 76 fpCommandAutoRefresh->SetDefaultValue(true); << 63 fpCommandAutoRefresh->SetDefaultValue(false); 77 64 78 fpCommandAuxEdge = new G4UIcmdWithABool 65 fpCommandAuxEdge = new G4UIcmdWithABool 79 ("/vis/viewer/set/auxiliaryEdge",this); << 66 ("/vis/viewer/set/auxiliaryEdge",this); 80 fpCommandAuxEdge->SetGuidance("Sets visibili << 67 fpCommandAuxEdge->SetGuidance("/vis/viewer/set/auxiliaryEdge [true|false]"); >> 68 fpCommandAuxEdge->SetGuidance(" default: false"); 81 fpCommandAuxEdge->SetGuidance 69 fpCommandAuxEdge->SetGuidance 82 ("Auxiliary edges, i.e., those that are part << 70 ("Auxiliary edges become visible/invisible."); 83 "\nsometimes called soft edges, become visi << 84 fpCommandAuxEdge->SetParameterName("edge",om 71 fpCommandAuxEdge->SetParameterName("edge",omitable = true); 85 fpCommandAuxEdge->SetDefaultValue(true); << 72 fpCommandAuxEdge->SetDefaultValue(false); 86 << 87 fpCommandBackground = new G4UIcommand << 88 ("/vis/viewer/set/background",this); << 89 fpCommandBackground->SetGuidance << 90 ("Set background colour and transparency (de << 91 fpCommandBackground->SetGuidance(ConvertToCo << 92 parameter = new G4UIparameter("red_or_string << 93 parameter -> SetDefaultValue ("0."); << 94 fpCommandBackground -> SetParameter (paramet << 95 parameter = new G4UIparameter("green", 'd', << 96 parameter -> SetDefaultValue (0.); << 97 fpCommandBackground -> SetParameter (paramet << 98 parameter = new G4UIparameter ("blue", 'd', << 99 parameter -> SetDefaultValue (0.); << 100 fpCommandBackground -> SetParameter (paramet << 101 parameter = new G4UIparameter ("opacity", 'd << 102 parameter -> SetDefaultValue (1.); << 103 fpCommandBackground -> SetParameter (paramet << 104 73 105 fpCommandCulling = new G4UIcommand("/vis/vie 74 fpCommandCulling = new G4UIcommand("/vis/viewer/set/culling",this); 106 fpCommandCulling->SetGuidance ("Set culling << 107 fpCommandCulling->SetGuidance << 108 ("\"global\": enables/disables all other cul << 109 fpCommandCulling->SetGuidance 75 fpCommandCulling->SetGuidance 110 ("\"coveredDaughters\": culls, i.e., elimina << 76 ("/vis/viewer/set/culling global|coveredDaughters|invisible|density" 111 "\nbe seen because covered by ancestor volu << 77 " [true|false] [density] [unit]"); 112 "\nand then only if the ancestors are visib << 113 "\nif no sections or cutaways are in operat << 114 "\nimprove the speed of rendering visible v << 115 fpCommandCulling->SetGuidance 78 fpCommandCulling->SetGuidance 116 ("\"invisible\": culls objects with the invi << 79 ( 117 fpCommandCulling->SetGuidance << 80 " default: none true 0.01 g/cm3" 118 ("\"density\": culls volumes with density lo << 81 "\n global: enables other culling options/disables culling." 119 "\nfor eliminating \"container volumes\" wi << 82 "\n coveredDaughters: does not send volumes that would not be seen on the" 120 "\nwhose material is usually air. If this << 83 "\n screen because covered by ancester volumes in surface drawing mode," 121 "\ndensity and unit (e.g., g/cm3, mg/cm3 or << 84 "\n and then only if the volumes are visible and opaque, and then only if" 122 ); << 85 "\n no sections or cutways are in operation. Intended solely to improve" >> 86 "\n the speed of rendering visible volumes." >> 87 "\n invisible: culls objects with invisible attribute." >> 88 "\n density: culls volumes with density lower than threshold. Useful for" >> 89 "\n eliminating \"container volumes\" with no physical correspondence whose" >> 90 "\n material is usually air. If this is selected, provide threshold" >> 91 "\n density and unit (g/cm3, mg/cm3 or kg/m3)." >> 92 ); 123 parameter = new G4UIparameter("culling-optio 93 parameter = new G4UIparameter("culling-option",'s',omitable = false); 124 parameter->SetParameterCandidates 94 parameter->SetParameterCandidates 125 ("global coveredDaughters invisible density" << 95 ("global coveredDaughters invisible density"); 126 fpCommandCulling->SetParameter(parameter); 96 fpCommandCulling->SetParameter(parameter); 127 parameter = new G4UIparameter("action",'b',o << 97 parameter = new G4UIparameter("flag",'b',omitable = true); 128 parameter->SetDefaultValue(1); << 98 parameter->SetDefaultValue("true"); 129 fpCommandCulling->SetParameter(parameter); 99 fpCommandCulling->SetParameter(parameter); 130 parameter = new G4UIparameter("density-thres << 100 parameter = new G4UIparameter("density",'d',omitable = true); 131 parameter->SetDefaultValue("0.01"); 101 parameter->SetDefaultValue("0.01"); 132 fpCommandCulling->SetParameter(parameter); 102 fpCommandCulling->SetParameter(parameter); 133 parameter = new G4UIparameter("unit",'s',omi 103 parameter = new G4UIparameter("unit",'s',omitable = true); 134 // parameter->SetParameterCandidates ("g/cm3 << 135 // Instead of the above, SetNewValue accepts << 136 parameter->SetDefaultValue("g/cm3"); 104 parameter->SetDefaultValue("g/cm3"); 137 fpCommandCulling->SetParameter(parameter); 105 fpCommandCulling->SetParameter(parameter); 138 106 139 fpCommandCutawayMode = << 140 new G4UIcmdWithAString ("/vis/viewer/set/cut << 141 fpCommandCutawayMode->SetGuidance << 142 ("Sets cutaway mode - add (union) or multipl << 143 fpCommandCutawayMode->SetParameterName ("cut << 144 fpCommandCutawayMode->SetCandidates ("add un << 145 fpCommandCutawayMode->SetDefaultValue("union << 146 << 147 fpCommandDefaultColour = new G4UIcommand << 148 ("/vis/viewer/set/defaultColour",this); << 149 fpCommandDefaultColour->SetGuidance << 150 ("Set defaultColour colour and transparency << 151 fpCommandDefaultColour->SetGuidance(ConvertT << 152 parameter = new G4UIparameter("red_or_string << 153 parameter -> SetDefaultValue ("1."); << 154 fpCommandDefaultColour -> SetParameter (para << 155 parameter = new G4UIparameter("green", 'd', << 156 parameter -> SetDefaultValue (1.); << 157 fpCommandDefaultColour -> SetParameter (para << 158 parameter = new G4UIparameter ("blue", 'd', << 159 parameter -> SetDefaultValue (1.); << 160 fpCommandDefaultColour -> SetParameter (para << 161 parameter = new G4UIparameter ("opacity", 'd << 162 parameter -> SetDefaultValue (1.); << 163 fpCommandDefaultColour -> SetParameter (para << 164 << 165 fpCommandDefaultTextColour = new G4UIcommand << 166 ("/vis/viewer/set/defaultTextColour",this); << 167 fpCommandDefaultTextColour->SetGuidance << 168 ("Set defaultTextColour colour and transpare << 169 fpCommandDefaultTextColour->SetGuidance(Conv << 170 parameter = new G4UIparameter("red_or_string << 171 parameter -> SetDefaultValue ("0."); << 172 fpCommandDefaultTextColour -> SetParameter ( << 173 parameter = new G4UIparameter("green", 'd', << 174 parameter -> SetDefaultValue (0.); << 175 fpCommandDefaultTextColour -> SetParameter ( << 176 parameter = new G4UIparameter ("blue", 'd', << 177 parameter -> SetDefaultValue (1.); << 178 fpCommandDefaultTextColour -> SetParameter ( << 179 parameter = new G4UIparameter ("opacity", 'd << 180 parameter -> SetDefaultValue (1.); << 181 fpCommandDefaultTextColour -> SetParameter ( << 182 << 183 fpCommandEdge = new G4UIcmdWithABool("/vis/v 107 fpCommandEdge = new G4UIcmdWithABool("/vis/viewer/set/edge",this); >> 108 fpCommandEdge->SetGuidance("/vis/viewer/set/edge [true|false]"); >> 109 fpCommandEdge->SetGuidance(" default: true"); 184 fpCommandEdge->SetGuidance 110 fpCommandEdge->SetGuidance 185 ("Edges become visible/invisible in surface << 111 ("Edges become visible/invisible in surface mode."); 186 fpCommandEdge->SetParameterName("edge",omita 112 fpCommandEdge->SetParameterName("edge",omitable = true); 187 fpCommandEdge->SetDefaultValue(true); 113 fpCommandEdge->SetDefaultValue(true); 188 114 189 fpCommandExplodeFactor = new G4UIcommand << 190 ("/vis/viewer/set/explodeFactor", this); << 191 fpCommandExplodeFactor->SetGuidance << 192 ("Moves top-level drawn volumes by this fact << 193 parameter = new G4UIparameter("explodeFactor << 194 parameter->SetParameterRange("explodeFactor> << 195 parameter->SetDefaultValue(1.); << 196 fpCommandExplodeFactor->SetParameter(paramet << 197 parameter = new G4UIparameter("x",'d',omitab << 198 parameter->SetDefaultValue (0); << 199 parameter->SetGuidance ("Coordinate of << 200 fpCommandExplodeFactor->SetParameter(paramet << 201 parameter = new G4UIparameter("y",'d',omitab << 202 parameter->SetDefaultValue (0); << 203 parameter->SetGuidance ("Coordinate of << 204 fpCommandExplodeFactor->SetParameter(paramet << 205 parameter = new G4UIparameter("z",'d',omitab << 206 parameter->SetDefaultValue (0); << 207 parameter->SetGuidance ("Coordinate of << 208 fpCommandExplodeFactor->SetParameter(paramet << 209 parameter = new G4UIparameter("unit",'s',omi << 210 parameter->SetDefaultValue ("m"); << 211 parameter->SetGuidance ("Unit of explod << 212 fpCommandExplodeFactor->SetParameter(paramet << 213 << 214 fpCommandGlobalLineWidthScale = new G4UIcmdW << 215 ("/vis/viewer/set/globalLineWidthScale", thi << 216 fpCommandGlobalLineWidthScale->SetGuidance << 217 ("Multiplies line widths by this factor."); << 218 fpCommandGlobalLineWidthScale-> << 219 SetParameterName("scale-factor", omitable=tr << 220 fpCommandGlobalLineWidthScale->SetDefaultVal << 221 << 222 fpCommandGlobalMarkerScale = new G4UIcmdWith 115 fpCommandGlobalMarkerScale = new G4UIcmdWithADouble 223 ("/vis/viewer/set/globalMarkerScale", this); << 116 ("/vis/viewer/set/globalMarkerScale", this); 224 fpCommandGlobalMarkerScale->SetGuidance << 117 fpCommandGlobalMarkerScale -> SetGuidance 225 ("Multiplies marker sizes by this factor."); << 118 ("/vis/viewer/set/globalMarkerScale [<scale-factor>]"); 226 fpCommandGlobalMarkerScale-> << 119 fpCommandGlobalMarkerScale -> SetGuidance 227 SetParameterName("scale-factor", omitable=tr << 120 (" default: 1"); >> 121 fpCommandGlobalMarkerScale -> SetGuidance >> 122 ("Multiplies marker sizes by this factor."); >> 123 fpCommandGlobalMarkerScale -> SetParameterName("scale-factorr", >> 124 omitable=true); 228 fpCommandGlobalMarkerScale->SetDefaultValue( 125 fpCommandGlobalMarkerScale->SetDefaultValue(1.); 229 126 230 fpCommandHiddenEdge = 127 fpCommandHiddenEdge = 231 new G4UIcmdWithABool("/vis/viewer/set/hidden << 128 new G4UIcmdWithABool("/vis/viewer/set/hiddenEdge",this); >> 129 fpCommandHiddenEdge->SetGuidance("/vis/viewer/set/hiddenEdge [true|false]"); >> 130 fpCommandHiddenEdge->SetGuidance(" default: true"); 232 fpCommandHiddenEdge->SetGuidance 131 fpCommandHiddenEdge->SetGuidance 233 ("Edges become hidden/seen in wireframe or s << 132 ("Edges become hidden/seen in wireframe or surface mode."); 234 fpCommandHiddenEdge->SetParameterName("hidde 133 fpCommandHiddenEdge->SetParameterName("hidden-edge",omitable = true); 235 fpCommandHiddenEdge->SetDefaultValue(true); 134 fpCommandHiddenEdge->SetDefaultValue(true); 236 135 237 fpCommandHiddenMarker = 136 fpCommandHiddenMarker = 238 new G4UIcmdWithABool("/vis/viewer/set/hidden << 137 new G4UIcmdWithABool("/vis/viewer/set/hiddenMarker",this); 239 fpCommandHiddenMarker->SetGuidance 138 fpCommandHiddenMarker->SetGuidance 240 ("If true, closer objects hide markers. Othe << 139 ("/vis/viewer/set/hiddenMarker [true|false]"); >> 140 fpCommandHiddenMarker->SetGuidance(" default: true"); >> 141 fpCommandHiddenMarker->SetGuidance >> 142 ("Markers are hidden by/seen though closer objects."); 241 fpCommandHiddenMarker->SetParameterName("hid 143 fpCommandHiddenMarker->SetParameterName("hidden-marker",omitable = true); 242 fpCommandHiddenMarker->SetDefaultValue(true) 144 fpCommandHiddenMarker->SetDefaultValue(true); 243 145 244 fpCommandLightsMove = new G4UIcmdWithAString 146 fpCommandLightsMove = new G4UIcmdWithAString 245 ("/vis/viewer/set/lightsMove",this); << 147 ("/vis/viewer/set/lightsMove",this); >> 148 fpCommandLightsMove->SetGuidance >> 149 ("/vis/viewer/set/lightsMove with-camera|with-object"); 246 fpCommandLightsMove->SetGuidance 150 fpCommandLightsMove->SetGuidance 247 ("Lights move with camera or with object"); << 151 ("Note: parameter will be parsed for \"cam\" or \"obj\"."); 248 fpCommandLightsMove->SetParameterName("light 152 fpCommandLightsMove->SetParameterName("lightsMove",omitable = false); 249 fpCommandLightsMove->SetCandidates << 250 ("cam camera with-camera obj object with-obj << 251 153 252 fpCommandLightsThetaPhi = new G4UIcommand 154 fpCommandLightsThetaPhi = new G4UIcommand 253 ("/vis/viewer/set/lightsThetaPhi", this); << 155 ("/vis/viewer/set/lightsThetaPhi", this); 254 fpCommandLightsThetaPhi->SetGuidance << 156 fpCommandLightsThetaPhi -> SetGuidance 255 ("Set direction from target to lights."); << 157 ("/vis/viewer/set/lightsThetaPhi [<theta>] [<phi>] [deg|rad]"); >> 158 fpCommandLightsThetaPhi -> SetGuidance >> 159 (" default: 60 45 deg - becomes \"current as default\""); >> 160 fpCommandLightsThetaPhi -> SetGuidance >> 161 ("Set direction from target to lights."); 256 parameter = new G4UIparameter("theta", 'd', 162 parameter = new G4UIparameter("theta", 'd', omitable = true); 257 parameter -> SetDefaultValue(60.); << 163 parameter -> SetCurrentAsDefault (true); 258 fpCommandLightsThetaPhi -> SetParameter (par 164 fpCommandLightsThetaPhi -> SetParameter (parameter); 259 parameter = new G4UIparameter("phi", 'd', om 165 parameter = new G4UIparameter("phi", 'd', omitable = true); 260 parameter -> SetDefaultValue(45.); << 166 parameter -> SetCurrentAsDefault (true); 261 fpCommandLightsThetaPhi -> SetParameter (par 167 fpCommandLightsThetaPhi -> SetParameter (parameter); 262 parameter = new G4UIparameter ("unit", 's', 168 parameter = new G4UIparameter ("unit", 's', omitable = true); 263 parameter -> SetDefaultValue ("deg"); 169 parameter -> SetDefaultValue ("deg"); 264 fpCommandLightsThetaPhi -> SetParameter (par 170 fpCommandLightsThetaPhi -> SetParameter (parameter); 265 171 266 fpCommandLightsVector = new G4UIcommand 172 fpCommandLightsVector = new G4UIcommand 267 ("/vis/viewer/set/lightsVector", this); << 173 ("/vis/viewer/set/lightsVector", this); 268 fpCommandLightsVector->SetGuidance << 174 fpCommandLightsVector -> SetGuidance 269 ("Set direction from target to lights."); << 175 ("/vis/viewer/set/lightsVector [<x>] [<y>] [<z>]"); >> 176 fpCommandLightsVector -> SetGuidance >> 177 (" default: 1 1 1 - becomes \"current as default\""); >> 178 fpCommandLightsVector -> SetGuidance >> 179 ("Set direction from target to lights."); 270 parameter = new G4UIparameter("x", 'd', omit 180 parameter = new G4UIparameter("x", 'd', omitable = true); 271 parameter -> SetDefaultValue (1); << 181 parameter -> SetCurrentAsDefault (true); 272 fpCommandLightsVector -> SetParameter (param 182 fpCommandLightsVector -> SetParameter (parameter); 273 parameter = new G4UIparameter("y", 'd', omit 183 parameter = new G4UIparameter("y", 'd', omitable = true); 274 parameter -> SetDefaultValue (1); << 184 parameter -> SetCurrentAsDefault (true); 275 fpCommandLightsVector -> SetParameter (param 185 fpCommandLightsVector -> SetParameter (parameter); 276 parameter = new G4UIparameter ("z", 'd', omi 186 parameter = new G4UIparameter ("z", 'd', omitable = true); 277 parameter -> SetDefaultValue (1); << 187 parameter -> SetCurrentAsDefault (true); 278 fpCommandLightsVector -> SetParameter (param 188 fpCommandLightsVector -> SetParameter (parameter); 279 189 280 fpCommandLineSegments = new G4UIcmdWithAnInt 190 fpCommandLineSegments = new G4UIcmdWithAnInteger 281 ("/vis/viewer/set/lineSegmentsPerCircle",thi << 191 ("/vis/viewer/set/lineSegmentsPerCircle",this); >> 192 fpCommandLineSegments->SetGuidance >> 193 ("/vis/viewer/set/lineSegmentsPerCircle [<number-of-sides-per-circle>]"); 282 fpCommandLineSegments->SetGuidance 194 fpCommandLineSegments->SetGuidance 283 ("Set number of sides per circle for polygon << 195 (" default: 24"); 284 fpCommandLineSegments->SetGuidance 196 fpCommandLineSegments->SetGuidance 285 ("Refers to graphical representation of obje << 197 ("Number of sides per circle in polygon/polyhedron graphical" >> 198 "\nrepresentation of objects with curved lines/surfaces."); 286 fpCommandLineSegments->SetParameterName("lin 199 fpCommandLineSegments->SetParameterName("line-segments",omitable = true); 287 fpCommandLineSegments->SetDefaultValue(24); 200 fpCommandLineSegments->SetDefaultValue(24); 288 201 289 fpCommandLineWidth = new G4UIcmdWithoutParam << 290 ("/vis/viewer/set/lineWidth",this); << 291 fpCommandLineWidth->SetGuidance << 292 ("Use \"/vis/viewer/set/globalLineWidthScale << 293 "\nFor trajectories use \"/vis/modeling/tra << 294 "\nFor volumes use \"/vis/geometry/set/line << 295 << 296 fpCommandNumberOfCloudPoints = new G4UIcmdWi << 297 ("/vis/viewer/set/numberOfCloudPoints",this) << 298 fpCommandNumberOfCloudPoints->SetGuidance << 299 ("Set number of points to be used for cloud << 300 fpCommandNumberOfCloudPoints->SetParameterNa << 301 fpCommandNumberOfCloudPoints->SetDefaultValu << 302 << 303 fpCommandPicking = new G4UIcmdWithABool << 304 ("/vis/viewer/set/picking",this); << 305 fpCommandPicking->SetGuidance("Sets picking, << 306 fpCommandPicking->SetGuidance << 307 ("If true, view is set up for picking, if av << 308 fpCommandPicking->SetGuidance << 309 ("You may need to issue \"/vis/viewer/update << 310 fpCommandPicking->SetGuidance << 311 ("For required actions, watch for instructio << 312 fpCommandPicking->SetParameterName("picking" << 313 fpCommandPicking->SetDefaultValue(true); << 314 << 315 fpCommandProjection = new G4UIcommand("/vis/ 202 fpCommandProjection = new G4UIcommand("/vis/viewer/set/projection",this); 316 fpCommandProjection->SetGuidance 203 fpCommandProjection->SetGuidance 317 ("Set projection style - o[rthogonal] or p[e << 204 ("/vis/viewer/set/projection" 318 "\nIf p[erspective], also set field half an << 205 " o[rthogonal]|p[erspective] [<field-half-angle>] [deg|rad]"); >> 206 fpCommandProjection->SetGuidance(" default: orthogonal 30 deg"); 319 parameter = new G4UIparameter("projection",' 207 parameter = new G4UIparameter("projection",'s',omitable = true); 320 parameter->SetParameterCandidates("o orthogo << 321 parameter->SetDefaultValue("orthogonal"); 208 parameter->SetDefaultValue("orthogonal"); 322 fpCommandProjection->SetParameter(parameter) 209 fpCommandProjection->SetParameter(parameter); 323 parameter = new G4UIparameter("field-half-an 210 parameter = new G4UIparameter("field-half-angle",'d',omitable = true); 324 parameter->SetDefaultValue(30.); 211 parameter->SetDefaultValue(30.); 325 //parameter->SetCurrentAsDefault(true); << 326 fpCommandProjection->SetParameter(parameter) 212 fpCommandProjection->SetParameter(parameter); 327 parameter = new G4UIparameter("unit",'s',omi 213 parameter = new G4UIparameter("unit",'s',omitable = true); 328 parameter->SetDefaultValue("deg"); 214 parameter->SetDefaultValue("deg"); 329 //parameter->SetCurrentAsDefault(true); << 330 fpCommandProjection->SetParameter(parameter) 215 fpCommandProjection->SetParameter(parameter); 331 216 332 fpCommandRotationStyle = new G4UIcmdWithAStr << 217 fpCommandSectionPlane = new G4UIcommand 333 ("/vis/viewer/set/rotationStyle",this); << 218 ("/vis/viewer/set/sectionPlane on|off [x] [y] [z] [units] [nx] [ny] [nz]",this); 334 fpCommandRotationStyle->SetGuidance << 335 ("Set style of rotation - constrainUpDirecti << 336 fpCommandRotationStyle->SetGuidance << 337 ("constrainUpDirection: conventional HEP vie << 338 fpCommandRotationStyle->SetGuidance << 339 ("freeRotation: Google-like rotation, using << 340 fpCommandRotationStyle->SetParameterName ("s << 341 fpCommandRotationStyle->SetCandidates("const << 342 << 343 fpCommandSectionPlane = new G4UIcommand("/vi << 344 fpCommandSectionPlane -> SetGuidance 219 fpCommandSectionPlane -> SetGuidance 345 ("Set plane for drawing section (DCUT)."); << 220 (" default: none 0 0 0 cm 1 0 0"); 346 fpCommandSectionPlane -> SetGuidance 221 fpCommandSectionPlane -> SetGuidance 347 ("E.g., for a y-z plane at x = 1 cm:" << 222 ( 348 "\n\"/vis/viewer/set/sectionPlane on 1 0 0 << 223 "Set plane for drawing section (DCUT). Specify plane by" 349 "\nTo turn off: /vis/viewer/set/sectionPlan << 224 "\nx y z units nx ny nz, e.g., for a y-z plane at x = 1 cm:" >> 225 "\n/vis/viewer/set/sectionPlane on 1 0 0 cm 1 0 0" >> 226 "\nTo turn off: /vis/viewer/set/sectionPlane off" >> 227 ); 350 parameter = new G4UIparameter("Selector",' 228 parameter = new G4UIparameter("Selector",'c',true); 351 parameter -> SetDefaultValue ("on"); << 229 parameter -> SetDefaultValue ("?"); 352 fpCommandSectionPlane->SetParameter(paramete 230 fpCommandSectionPlane->SetParameter(parameter); 353 parameter = new G4UIparameter("x",'d',omit 231 parameter = new G4UIparameter("x",'d',omitable = true); 354 parameter -> SetDefaultValue (0); 232 parameter -> SetDefaultValue (0); 355 parameter -> SetGuidance ("Coordinate 233 parameter -> SetGuidance ("Coordinate of point on the plane."); 356 fpCommandSectionPlane->SetParameter(paramete 234 fpCommandSectionPlane->SetParameter(parameter); 357 parameter = new G4UIparameter("y",'d',omit 235 parameter = new G4UIparameter("y",'d',omitable = true); 358 parameter -> SetDefaultValue (0); 236 parameter -> SetDefaultValue (0); 359 parameter -> SetGuidance ("Coordinate 237 parameter -> SetGuidance ("Coordinate of point on the plane."); 360 fpCommandSectionPlane->SetParameter(paramete 238 fpCommandSectionPlane->SetParameter(parameter); 361 parameter = new G4UIparameter("z",'d',omit 239 parameter = new G4UIparameter("z",'d',omitable = true); 362 parameter -> SetDefaultValue (0); 240 parameter -> SetDefaultValue (0); 363 parameter -> SetGuidance ("Coordinate 241 parameter -> SetGuidance ("Coordinate of point on the plane."); 364 fpCommandSectionPlane->SetParameter(paramete 242 fpCommandSectionPlane->SetParameter(parameter); 365 parameter = new G4UIparameter("unit",'s',o 243 parameter = new G4UIparameter("unit",'s',omitable = true); 366 parameter -> SetDefaultValue ("m"); << 244 parameter -> SetDefaultValue ("cm"); 367 parameter -> SetGuidance ("Unit of poi 245 parameter -> SetGuidance ("Unit of point on the plane."); 368 fpCommandSectionPlane->SetParameter(paramete 246 fpCommandSectionPlane->SetParameter(parameter); 369 parameter = new G4UIparameter("nx",'d',omi 247 parameter = new G4UIparameter("nx",'d',omitable = true); 370 parameter -> SetDefaultValue (1); 248 parameter -> SetDefaultValue (1); 371 parameter -> SetGuidance ("Component o 249 parameter -> SetGuidance ("Component of plane normal."); 372 fpCommandSectionPlane->SetParameter(paramete 250 fpCommandSectionPlane->SetParameter(parameter); 373 parameter = new G4UIparameter("ny",'d',omi 251 parameter = new G4UIparameter("ny",'d',omitable = true); 374 parameter -> SetDefaultValue (0); 252 parameter -> SetDefaultValue (0); 375 parameter -> SetGuidance ("Component o 253 parameter -> SetGuidance ("Component of plane normal."); 376 fpCommandSectionPlane->SetParameter(paramete 254 fpCommandSectionPlane->SetParameter(parameter); 377 parameter = new G4UIparameter("nz",'d',omi 255 parameter = new G4UIparameter("nz",'d',omitable = true); 378 parameter -> SetDefaultValue (0); 256 parameter -> SetDefaultValue (0); 379 parameter -> SetGuidance ("Component o 257 parameter -> SetGuidance ("Component of plane normal."); 380 fpCommandSectionPlane->SetParameter(paramete 258 fpCommandSectionPlane->SetParameter(parameter); 381 259 382 fpCommandSpecialMeshRendering = new G4UIcmdW << 383 ("/vis/viewer/set/specialMeshRendering",this << 384 fpCommandSpecialMeshRendering -> SetGuidance << 385 ("Request special rendering of volumes (mesh << 386 fpCommandSpecialMeshRendering->SetParameterN << 387 fpCommandSpecialMeshRendering->SetDefaultVal << 388 << 389 fpCommandSpecialMeshRenderingOption = new G4 << 390 ("/vis/viewer/set/specialMeshRenderingOption << 391 fpCommandSpecialMeshRenderingOption->SetGuid << 392 ("Set special mesh rendering option - \"defa << 393 fpCommandSpecialMeshRenderingOption->SetPara << 394 fpCommandSpecialMeshRenderingOption->SetCand << 395 fpCommandSpecialMeshRenderingOption->SetDefa << 396 << 397 fpCommandSpecialMeshVolumes = new G4UIcomman << 398 ("/vis/viewer/set/specialMeshVolumes",this); << 399 fpCommandSpecialMeshVolumes -> SetGuidance << 400 ("Specify the volumes for special rendering. << 401 "\nand is interpreted to mean \"all found m << 402 fpCommandSpecialMeshVolumes->SetGuidance << 403 ("Please provide a list of space-separated p << 404 "\nnumber pairs. Negative copy number means << 405 parameter = new G4UIparameter("volumes",'s', << 406 parameter->SetGuidance << 407 ("List of physical volume names and copy num << 408 fpCommandSpecialMeshVolumes->SetParameter(pa << 409 << 410 fpCommandStyle = new G4UIcmdWithAString ("/v 260 fpCommandStyle = new G4UIcmdWithAString ("/vis/viewer/set/style",this); 411 fpCommandStyle->SetGuidance << 261 fpCommandStyle->SetGuidance ("/vis/viewer/set/style w[ireframe]|s[urface]"); 412 ("Set style of drawing - w[ireframe] or s[ur << 413 fpCommandStyle->SetGuidance << 414 ("(Hidden line drawing is controlled by \"/v << 415 fpCommandStyle->SetParameterName ("style",om 262 fpCommandStyle->SetParameterName ("style",omitable = false); 416 fpCommandStyle->SetCandidates("w wireframe s << 417 << 418 fpCommandTargetPoint = new G4UIcmdWith3Vecto << 419 ("/vis/viewer/set/targetPoint", this); << 420 fpCommandTargetPoint->SetGuidance << 421 ("Set target point."); << 422 fpCommandTargetPoint->SetGuidance << 423 ("This sets the \"Current Target Point\" rel << 424 fpCommandTargetPoint->SetGuidance << 425 ("Target Point\" so that the actual target p << 426 fpCommandTargetPoint->SetGuidance << 427 ("(See G4ViewParameters.hh for an explanatio << 428 fpCommandTargetPoint->SetParameterName("x", << 429 fpCommandTargetPoint->SetUnitCategory("Lengt << 430 263 431 fpCommandUpThetaPhi = new G4UIcommand 264 fpCommandUpThetaPhi = new G4UIcommand 432 ("/vis/viewer/set/upThetaPhi", this); << 265 ("/vis/viewer/set/upThetaPhi", this); 433 fpCommandUpThetaPhi -> SetGuidance ("Set up << 434 fpCommandUpThetaPhi -> SetGuidance 266 fpCommandUpThetaPhi -> SetGuidance 435 ("Viewer will attempt always to show this di << 267 ("/vis/viewer/set/upThetaPhi [<theta>] [<phi>] [deg|rad]"); >> 268 fpCommandUpThetaPhi -> SetGuidance >> 269 (" default: 90 90 deg - becomes \"current as default\""); >> 270 fpCommandUpThetaPhi -> SetGuidance >> 271 ("Set up vector. Viewer will attempt always to show" >> 272 " this direction upwards."); 436 parameter = new G4UIparameter("theta", 'd', 273 parameter = new G4UIparameter("theta", 'd', omitable = true); 437 parameter -> SetDefaultValue (90.); << 274 parameter -> SetCurrentAsDefault (true); 438 fpCommandUpThetaPhi -> SetParameter (paramet 275 fpCommandUpThetaPhi -> SetParameter (parameter); 439 parameter = new G4UIparameter("phi", 'd', om 276 parameter = new G4UIparameter("phi", 'd', omitable = true); 440 parameter -> SetDefaultValue (90.); << 277 parameter -> SetCurrentAsDefault (true); 441 fpCommandUpThetaPhi -> SetParameter (paramet 278 fpCommandUpThetaPhi -> SetParameter (parameter); 442 parameter = new G4UIparameter ("unit", 's', 279 parameter = new G4UIparameter ("unit", 's', omitable = true); 443 parameter -> SetDefaultValue ("deg"); 280 parameter -> SetDefaultValue ("deg"); 444 fpCommandUpThetaPhi -> SetParameter (paramet 281 fpCommandUpThetaPhi -> SetParameter (parameter); 445 282 446 fpCommandUpVector = new G4UIcommand 283 fpCommandUpVector = new G4UIcommand 447 ("/vis/viewer/set/upVector", this); << 284 ("/vis/viewer/set/upVector", this); 448 fpCommandUpVector -> SetGuidance ("Set up ve << 285 fpCommandUpVector -> SetGuidance >> 286 ("/vis/viewer/set/upVector [<x>] [<y>] [<z>]"); 449 fpCommandUpVector -> SetGuidance 287 fpCommandUpVector -> SetGuidance 450 ("Viewer will attempt always to show this di << 288 (" default: 0 1 0 - becomes \"current as default\""); >> 289 fpCommandUpVector -> SetGuidance >> 290 ("Set up vector. Viewer will attempt always to show" >> 291 " this direction upwards."); 451 parameter = new G4UIparameter("x", 'd', omit 292 parameter = new G4UIparameter("x", 'd', omitable = true); 452 parameter -> SetDefaultValue (0.); << 293 parameter -> SetCurrentAsDefault (true); 453 fpCommandUpVector -> SetParameter (parameter 294 fpCommandUpVector -> SetParameter (parameter); 454 parameter = new G4UIparameter("y", 'd', omit 295 parameter = new G4UIparameter("y", 'd', omitable = true); 455 parameter -> SetDefaultValue (1.); << 296 parameter -> SetCurrentAsDefault (true); 456 fpCommandUpVector -> SetParameter (parameter 297 fpCommandUpVector -> SetParameter (parameter); 457 parameter = new G4UIparameter ("z", 'd', omi 298 parameter = new G4UIparameter ("z", 'd', omitable = true); 458 parameter -> SetDefaultValue (0.); << 299 parameter -> SetCurrentAsDefault (true); 459 fpCommandUpVector -> SetParameter (parameter 300 fpCommandUpVector -> SetParameter (parameter); 460 301 461 fpCommandViewpointThetaPhi = new G4UIcommand 302 fpCommandViewpointThetaPhi = new G4UIcommand 462 ("/vis/viewer/set/viewpointThetaPhi", this); << 303 ("/vis/viewer/set/viewpointThetaPhi", this); >> 304 fpCommandViewpointThetaPhi -> SetGuidance >> 305 ("/vis/viewer/set/viewpointThetaPhi [<theta>] [<phi>] [deg|rad]"); 463 fpCommandViewpointThetaPhi -> SetGuidance 306 fpCommandViewpointThetaPhi -> SetGuidance 464 ("Set direction from target to camera."); << 307 (" default: 0 0 deg - becomes \"current as default\""); 465 fpCommandViewpointThetaPhi -> SetGuidance 308 fpCommandViewpointThetaPhi -> SetGuidance 466 ("Also changes lightpoint direction if light << 309 ("Set direction from target to camera. Also changes lightpoint direction" >> 310 "\nif lights are set to move with camera."); 467 parameter = new G4UIparameter("theta", 'd', 311 parameter = new G4UIparameter("theta", 'd', omitable = true); 468 parameter -> SetDefaultValue (60.); << 312 parameter -> SetCurrentAsDefault (true); 469 fpCommandViewpointThetaPhi -> SetParameter ( 313 fpCommandViewpointThetaPhi -> SetParameter (parameter); 470 parameter = new G4UIparameter("phi", 'd', om 314 parameter = new G4UIparameter("phi", 'd', omitable = true); 471 parameter -> SetDefaultValue (45.); << 315 parameter -> SetCurrentAsDefault (true); 472 fpCommandViewpointThetaPhi -> SetParameter ( 316 fpCommandViewpointThetaPhi -> SetParameter (parameter); 473 parameter = new G4UIparameter ("unit", 's', 317 parameter = new G4UIparameter ("unit", 's', omitable = true); 474 parameter -> SetDefaultValue ("deg"); 318 parameter -> SetDefaultValue ("deg"); 475 fpCommandViewpointThetaPhi -> SetParameter ( 319 fpCommandViewpointThetaPhi -> SetParameter (parameter); 476 320 477 fpCommandViewpointVector = new G4UIcommand 321 fpCommandViewpointVector = new G4UIcommand 478 ("/vis/viewer/set/viewpointVector", this); << 322 ("/vis/viewer/set/viewpointVector", this); 479 fpCommandViewpointVector -> SetGuidance 323 fpCommandViewpointVector -> SetGuidance 480 ("Set direction from target to camera."); << 324 ("/vis/viewer/set/viewpointVector [<x>] [<y>] [<z>]"); 481 fpCommandViewpointVector -> SetGuidance 325 fpCommandViewpointVector -> SetGuidance 482 ("Also changes lightpoint direction if light << 326 (" default: 0 0 1 - becomes \"current as default\""); >> 327 fpCommandViewpointVector -> SetGuidance >> 328 ("Set direction from target to camera. Also changes lightpoint direction" >> 329 "\nif lights are set to move with camera."); 483 parameter = new G4UIparameter("x", 'd', omit 330 parameter = new G4UIparameter("x", 'd', omitable = true); 484 parameter -> SetDefaultValue (1.); << 331 parameter -> SetCurrentAsDefault (true); 485 fpCommandViewpointVector -> SetParameter (pa 332 fpCommandViewpointVector -> SetParameter (parameter); 486 parameter = new G4UIparameter("y", 'd', omit 333 parameter = new G4UIparameter("y", 'd', omitable = true); 487 parameter -> SetDefaultValue (1.); << 334 parameter -> SetCurrentAsDefault (true); 488 fpCommandViewpointVector -> SetParameter (pa 335 fpCommandViewpointVector -> SetParameter (parameter); 489 parameter = new G4UIparameter ("z", 'd', omi 336 parameter = new G4UIparameter ("z", 'd', omitable = true); 490 parameter -> SetDefaultValue (1.); << 337 parameter -> SetCurrentAsDefault (true); 491 fpCommandViewpointVector -> SetParameter (pa 338 fpCommandViewpointVector -> SetParameter (parameter); 492 << 493 fpTimeWindowDirectory = new G4UIdirectory (" << 494 fpTimeWindowDirectory -> SetGuidance ("Set t << 495 G4String timeWindowGuidance = << 496 "For these commands use" << 497 "\n /vis/scene/add/trajectories rich" << 498 "\n /vis/modeling/trajectories/drawByCharge << 499 "\nthen typically" << 500 "\n /vis/viewer/set/timeWindow/displayLight << 501 "\n /vis/viewer/set/timeWindow/displayHeadT << 502 "\n /vis/viewer/set/timeWindow/fadeFactor 1 << 503 "\n /run/beamOn # or several until you get << 504 "\n /vis/viewer/set/timeWindow/startTime 0 << 505 "\n /vis/viewer/save" << 506 "\n /vis/viewer/set/timeWindow/startTime 1 << 507 "\nthen zoom, pan etc to a view of interest << 508 "\n /vis/viewer/save" << 509 "\nthen repeat with next start time, another << 510 "\n /vis/viewer/interpolate"; << 511 << 512 fpCommandTimeWindowDisplayHeadTime = << 513 new G4UIcommand("/vis/viewer/set/timeWindow/ << 514 fpCommandTimeWindowDisplayHeadTime->SetGuida << 515 ("Display head time of range in 2D text."); << 516 fpCommandTimeWindowDisplayHeadTime->SetGuida << 517 parameter = new G4UIparameter ("displayHeadT << 518 parameter->SetDefaultValue(false); << 519 fpCommandTimeWindowDisplayHeadTime->SetParam << 520 parameter = new G4UIparameter ("screenX", 'd << 521 parameter->SetGuidance("-1 < screenX < 1"); << 522 parameter->SetParameterRange("screenX >= -1. << 523 parameter->SetDefaultValue(-0.9); << 524 fpCommandTimeWindowDisplayHeadTime->SetParam << 525 parameter = new G4UIparameter ("screenY", 'd << 526 parameter->SetGuidance("-1 < screenY < 1"); << 527 parameter->SetParameterRange("screenY >= -1. << 528 parameter->SetDefaultValue(-0.9); << 529 fpCommandTimeWindowDisplayHeadTime->SetParam << 530 parameter = new G4UIparameter ("screenSize", << 531 parameter->SetDefaultValue(24.); << 532 fpCommandTimeWindowDisplayHeadTime->SetParam << 533 parameter = new G4UIparameter ("red", 'd', o << 534 parameter->SetParameterRange("red >= 0. && r << 535 parameter->SetDefaultValue(0.); << 536 fpCommandTimeWindowDisplayHeadTime->SetParam << 537 parameter = new G4UIparameter ("green", 'd', << 538 parameter->SetParameterRange("green >= 0. && << 539 parameter->SetDefaultValue(1.); << 540 fpCommandTimeWindowDisplayHeadTime->SetParam << 541 parameter = new G4UIparameter ("blue", 'd', << 542 parameter->SetParameterRange("blue >= 0. && << 543 parameter->SetDefaultValue(1.); << 544 fpCommandTimeWindowDisplayHeadTime->SetParam << 545 << 546 fpCommandTimeWindowDisplayLightFront = << 547 new G4UIcommand("/vis/viewer/set/timeWindow/ << 548 fpCommandTimeWindowDisplayLightFront->SetGui << 549 ("Display the light front at head time."); << 550 fpCommandTimeWindowDisplayLightFront->SetGui << 551 ("Tip: The trajectories can appear of jump a << 552 "\nbecause their time range overlaps the vi << 553 "\naverage out this discrete time effect, a << 554 "\nhalf the trajectories interval. E.g., if << 555 "\ninterval is 0.01 ns:" << 556 "\n /vis/viewer/set/timeWindow/displayLigh << 557 "\nTo prevent them beating the light front << 558 "\n /vis/viewer/set/timeWindow/displayLigh << 559 fpCommandTimeWindowDisplayLightFront->SetGui << 560 parameter = new G4UIparameter ("displayLight << 561 parameter->SetDefaultValue(true); << 562 fpCommandTimeWindowDisplayLightFront->SetPar << 563 parameter = new G4UIparameter ("originX", 'd << 564 parameter->SetDefaultValue(0.); << 565 fpCommandTimeWindowDisplayLightFront->SetPar << 566 parameter = new G4UIparameter ("originY", 'd << 567 parameter->SetDefaultValue(0.); << 568 fpCommandTimeWindowDisplayLightFront->SetPar << 569 parameter = new G4UIparameter ("originZ", 'd << 570 parameter->SetDefaultValue(0.); << 571 fpCommandTimeWindowDisplayLightFront->SetPar << 572 parameter = new G4UIparameter ("space_unit", << 573 parameter->SetDefaultValue("m"); << 574 fpCommandTimeWindowDisplayLightFront->SetPar << 575 parameter = new G4UIparameter ("originT", 'd << 576 parameter->SetDefaultValue(0.); << 577 fpCommandTimeWindowDisplayLightFront->SetPar << 578 parameter = new G4UIparameter ("time_unit", << 579 parameter->SetDefaultValue("s"); << 580 fpCommandTimeWindowDisplayLightFront->SetPar << 581 parameter = new G4UIparameter ("red", 'd', o << 582 parameter->SetParameterRange("red >= 0. && r << 583 parameter->SetDefaultValue(0.); << 584 fpCommandTimeWindowDisplayLightFront->SetPar << 585 parameter = new G4UIparameter ("green", 'd', << 586 parameter->SetParameterRange("green >= 0. && << 587 parameter->SetDefaultValue(1.); << 588 fpCommandTimeWindowDisplayLightFront->SetPar << 589 parameter = new G4UIparameter ("blue", 'd', << 590 parameter->SetParameterRange("blue >= 0. && << 591 parameter->SetDefaultValue(0.); << 592 fpCommandTimeWindowDisplayLightFront->SetPar << 593 << 594 fpCommandTimeWindowEndTime = << 595 new G4UIcommand("/vis/viewer/set/timeWindow/ << 596 fpCommandTimeWindowEndTime->SetGuidance("Set << 597 fpCommandTimeWindowEndTime->SetGuidance(time << 598 parameter = new G4UIparameter ("end-time", ' << 599 parameter->SetDefaultValue(G4VisAttributes:: << 600 fpCommandTimeWindowEndTime->SetParameter(par << 601 parameter = new G4UIparameter ("end-time-uni << 602 parameter->SetDefaultValue("ns"); << 603 fpCommandTimeWindowEndTime->SetParameter(par << 604 parameter = new G4UIparameter ("time-range", << 605 parameter->SetDefaultValue(-1.); << 606 fpCommandTimeWindowEndTime->SetParameter(par << 607 parameter = new G4UIparameter ("time-range-u << 608 parameter->SetDefaultValue("ns"); << 609 fpCommandTimeWindowEndTime->SetParameter(par << 610 << 611 fpCommandTimeWindowFadeFactor = << 612 new G4UIcmdWithADouble("/vis/viewer/set/time << 613 fpCommandTimeWindowFadeFactor->SetGuidance << 614 ("0: no fade; 1: maximum fade with time wind << 615 fpCommandTimeWindowFadeFactor->SetGuidance(t << 616 fpCommandTimeWindowFadeFactor->SetParameterN << 617 fpCommandTimeWindowFadeFactor->SetRange("fad << 618 fpCommandTimeWindowFadeFactor->SetDefaultVal << 619 << 620 fpCommandTimeWindowStartTime = << 621 new G4UIcommand("/vis/viewer/set/timeWindow/ << 622 fpCommandTimeWindowStartTime->SetGuidance("S << 623 fpCommandTimeWindowStartTime->SetGuidance(ti << 624 parameter = new G4UIparameter ("start-time", << 625 parameter->SetDefaultValue(-G4VisAttributes: << 626 fpCommandTimeWindowStartTime->SetParameter(p << 627 parameter = new G4UIparameter ("start-time-u << 628 parameter->SetDefaultValue("ns"); << 629 fpCommandTimeWindowStartTime->SetParameter(p << 630 parameter = new G4UIparameter ("time-range", << 631 parameter->SetDefaultValue(-1.); << 632 fpCommandTimeWindowStartTime->SetParameter(p << 633 parameter = new G4UIparameter ("time-range-u << 634 parameter->SetDefaultValue("ns"); << 635 fpCommandTimeWindowStartTime->SetParameter(p << 636 } 339 } 637 340 638 G4VisCommandsViewerSet::~G4VisCommandsViewerSe 341 G4VisCommandsViewerSet::~G4VisCommandsViewerSet() { 639 delete fpCommandTimeWindowStartTime; << 342 delete fpCommandAll; 640 delete fpCommandTimeWindowFadeFactor; << 641 delete fpCommandTimeWindowEndTime; << 642 delete fpCommandTimeWindowDisplayLightFront; << 643 delete fpCommandTimeWindowDisplayHeadTime; << 644 delete fpTimeWindowDirectory; << 645 delete fpCommandViewpointVector; << 646 delete fpCommandViewpointThetaPhi; << 647 delete fpCommandUpVector; << 648 delete fpCommandUpThetaPhi; << 649 delete fpCommandTargetPoint; << 650 delete fpCommandStyle; << 651 delete fpCommandSpecialMeshVolumes; << 652 delete fpCommandSpecialMeshRenderingOption; << 653 delete fpCommandSpecialMeshRendering; << 654 delete fpCommandSectionPlane; << 655 delete fpCommandRotationStyle; << 656 delete fpCommandProjection; << 657 delete fpCommandPicking; << 658 delete fpCommandNumberOfCloudPoints; << 659 delete fpCommandLineWidth; << 660 delete fpCommandLineSegments; << 661 delete fpCommandLightsVector; << 662 delete fpCommandLightsThetaPhi; << 663 delete fpCommandLightsMove; << 664 delete fpCommandHiddenMarker; << 665 delete fpCommandHiddenEdge; << 666 delete fpCommandGlobalMarkerScale; << 667 delete fpCommandGlobalLineWidthScale; << 668 delete fpCommandExplodeFactor; << 669 delete fpCommandEdge; << 670 delete fpCommandDefaultTextColour; << 671 delete fpCommandDefaultColour; << 672 delete fpCommandCutawayMode; << 673 delete fpCommandCulling; << 674 delete fpCommandBackground; << 675 delete fpCommandAuxEdge; 343 delete fpCommandAuxEdge; 676 delete fpCommandAutoRefresh; 344 delete fpCommandAutoRefresh; 677 delete fpCommandAll; << 345 delete fpCommandCulling; >> 346 delete fpCommandEdge; >> 347 delete fpCommandGlobalMarkerScale; >> 348 delete fpCommandHiddenEdge; >> 349 delete fpCommandHiddenMarker; >> 350 delete fpCommandLineSegments; >> 351 delete fpCommandLightsMove; >> 352 delete fpCommandLightsThetaPhi; >> 353 delete fpCommandLightsVector; >> 354 delete fpCommandProjection; >> 355 delete fpCommandSectionPlane; >> 356 delete fpCommandStyle; >> 357 delete fpCommandUpThetaPhi; >> 358 delete fpCommandUpVector; >> 359 delete fpCommandViewpointThetaPhi; >> 360 delete fpCommandViewpointVector; 678 } 361 } 679 362 680 G4String G4VisCommandsViewerSet::GetCurrentVal << 363 G4String G4VisCommandsViewerSet::GetCurrentValue(G4UIcommand* command) { 681 return ""; << 364 G4String currentValue; >> 365 if (command == fpCommandLightsThetaPhi) { >> 366 currentValue = ConvertToString(fLightsVector.theta(), >> 367 fLightsVector.phi(), "deg"); >> 368 } >> 369 else if (command == fpCommandLightsVector) { >> 370 currentValue = G4UIcommand::ConvertToString(fLightsVector); >> 371 } >> 372 else if (command == fpCommandViewpointThetaPhi) { >> 373 currentValue = ConvertToString(fViewpointVector.theta(), >> 374 fViewpointVector.phi(), "deg"); >> 375 } >> 376 else if (command == fpCommandViewpointVector) { >> 377 currentValue = G4UIcommand::ConvertToString(fViewpointVector); >> 378 } >> 379 else { >> 380 currentValue = "invalid"; >> 381 } >> 382 return currentValue; 682 } 383 } 683 384 684 void G4VisCommandsViewerSet::SetNewValue 385 void G4VisCommandsViewerSet::SetNewValue 685 (G4UIcommand* command,G4String newValue) { 386 (G4UIcommand* command,G4String newValue) { 686 387 687 G4VisManager::Verbosity verbosity = fpVisMan 388 G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity(); 688 389 689 G4VViewer* currentViewer = fpVisManager->Get 390 G4VViewer* currentViewer = fpVisManager->GetCurrentViewer(); 690 if (!currentViewer) { 391 if (!currentViewer) { 691 if (verbosity >= G4VisManager::errors) { 392 if (verbosity >= G4VisManager::errors) { 692 G4warn << << 393 G4cout << 693 "ERROR: G4VisCommandsViewerSet::SetNewVa << 394 "ERROR: G4VisCommandsViewerSet::SetNewValue: no current viewer." 694 << G4endl; << 395 << G4endl; 695 } 396 } 696 return; 397 return; 697 } 398 } 698 399 699 G4ViewParameters vp = currentViewer->GetView 400 G4ViewParameters vp = currentViewer->GetViewParameters(); 700 401 701 if (command == fpCommandAll) { 402 if (command == fpCommandAll) { 702 G4VViewer* fromViewer = fpVisManager->GetV 403 G4VViewer* fromViewer = fpVisManager->GetViewer(newValue); 703 if (!fromViewer) { 404 if (!fromViewer) { 704 if (verbosity >= G4VisManager::errors) { 405 if (verbosity >= G4VisManager::errors) { 705 G4warn << << 406 G4cout << 706 "ERROR: G4VisCommandsViewerSet::SetNew << 407 "ERROR: G4VisCommandsViewerSet::SetNewValue: all:" 707 "\n unrecognised from-viewer." << 408 "\n unrecognised from-viewer." 708 << G4endl; << 409 << G4endl; 709 } 410 } 710 return; 411 return; 711 } 412 } 712 if (fromViewer == currentViewer) { 413 if (fromViewer == currentViewer) { 713 if (verbosity >= G4VisManager::warnings) 414 if (verbosity >= G4VisManager::warnings) { 714 G4warn << << 415 G4cout << 715 "WARNING: G4VisCommandsViewerSet::SetN << 416 "WARNING: G4VisCommandsViewerSet::SetNewValue: all:" 716 "\n from-viewer and current viewer ar << 417 "\n from-viewer and current viewer are identical." 717 << G4endl; << 418 << G4endl; 718 } 419 } 719 return; 420 return; 720 } 421 } 721 // Copy view parameters except for autoRef << 422 // Copy view parameters except for autoRefresh... 722 auto keepAutoRefresh = vp.IsAutoRefresh(); << 423 G4bool currentAutoRefresh = 723 auto keepBackground = vp.GetBackgroundCol << 424 currentViewer->GetViewParameters().IsAutoRefresh(); 724 vp = fromViewer->GetViewParameters(); 425 vp = fromViewer->GetViewParameters(); 725 vp.SetAutoRefresh(keepAutoRefresh); << 426 vp.SetAutoRefresh(currentAutoRefresh); 726 vp.SetBackgroundColour(keepBackground); << 727 // Concatenate any private vis attributes << 728 const std::vector<G4ModelingParameters::Vi << 729 privateVAMs = fromViewer->GetPrivateVisAtt << 730 if (privateVAMs) { << 731 std::vector<G4ModelingParameters::VisAtt << 732 for (i = privateVAMs->begin(); i != priv << 733 vp.AddVisAttributesModifier(*i); << 734 } << 735 } << 736 if (verbosity >= G4VisManager::confirmatio 427 if (verbosity >= G4VisManager::confirmations) { 737 G4cout << "View parameters of viewer \"" 428 G4cout << "View parameters of viewer \"" << currentViewer->GetName() 738 << "\"\n set to those of viewer \"" << << 429 << "\"\n set to those of viewer \"" << fromViewer->GetName() 739 << "\"." << 430 << "\"." 740 << G4endl; << 431 << G4endl; 741 } << 742 if (verbosity >= G4VisManager::warnings) { << 743 G4warn << "You may need \"/vis/viewer/re << 744 << G4endl; << 745 } 432 } 746 } 433 } 747 434 748 else if (command == fpCommandAutoRefresh) { 435 else if (command == fpCommandAutoRefresh) { 749 G4bool autoRefresh = G4UIcommand::ConvertT 436 G4bool autoRefresh = G4UIcommand::ConvertToBool(newValue); 750 const G4ViewParameters& defaultVP = << 751 currentViewer->GetDefaultViewParameters(); << 752 if (autoRefresh && !defaultVP.IsAutoRefres << 753 if (verbosity >= G4VisManager::warnings) << 754 G4warn << 755 << "WARNING: " << 756 << currentViewer->GetName() << " is NO << 757 << "\n so cannot be set to auto-refre << 758 << G4endl; << 759 } << 760 return; << 761 } << 762 vp.SetAutoRefresh(autoRefresh); 437 vp.SetAutoRefresh(autoRefresh); 763 if (verbosity >= G4VisManager::confirmatio 438 if (verbosity >= G4VisManager::confirmations) { 764 G4cout << "Views will "; 439 G4cout << "Views will "; 765 if (!vp.IsAutoRefresh()) G4cout << "not 440 if (!vp.IsAutoRefresh()) G4cout << "not "; 766 G4cout << "be automatically refreshed af 441 G4cout << "be automatically refreshed after a change of view parameters." 767 << G4endl; << 442 << G4endl; 768 } 443 } 769 if (!vp.IsAutoRefresh()) { << 770 currentViewer->SetViewParameters(vp); << 771 return; // Avoid a refresh if auto-refr << 772 } // ...otherwise take normal action. << 773 } 444 } 774 445 775 else if (command == fpCommandAuxEdge) { 446 else if (command == fpCommandAuxEdge) { 776 vp.SetAuxEdgeVisible(G4UIcommand::ConvertT 447 vp.SetAuxEdgeVisible(G4UIcommand::ConvertToBool(newValue)); 777 if (verbosity >= G4VisManager::confirmatio 448 if (verbosity >= G4VisManager::confirmations) { 778 G4cout << "Auxiliary edges will "; 449 G4cout << "Auxiliary edges will "; 779 if (!vp.IsAuxEdgeVisible()) G4cout << "n 450 if (!vp.IsAuxEdgeVisible()) G4cout << "not "; 780 G4cout << "be visible." << G4endl; 451 G4cout << "be visible." << G4endl; 781 } 452 } 782 } 453 } 783 454 784 else if (command == fpCommandBackground) { << 785 G4String redOrString; << 786 G4double green, blue, opacity; << 787 std::istringstream iss(newValue); << 788 iss >> redOrString >> green >> blue >> opa << 789 G4Colour colour(0.,0.,0.); // Default bla << 790 ConvertToColour(colour, redOrString, green << 791 vp.SetBackgroundColour(colour); << 792 if (verbosity >= G4VisManager::confirmatio << 793 G4cout << "Background colour " << 794 << vp.GetBackgroundColour() << 795 << " requested." << 796 << G4endl; << 797 } << 798 } << 799 << 800 else if (command == fpCommandCulling) { 455 else if (command == fpCommandCulling) { 801 G4String cullingOption, stringFlag, unit; 456 G4String cullingOption, stringFlag, unit; 802 G4double density; 457 G4double density; 803 std::istringstream is (newValue); << 458 G4bool boolFlag; >> 459 std::istrstream is ((char*)newValue.data()); 804 is >> cullingOption >> stringFlag >> densi 460 is >> cullingOption >> stringFlag >> density >> unit; 805 G4bool boolFlag = G4UIcommand::ConvertToBo << 461 boolFlag = G4UIcommand::ConvertToBool(stringFlag); 806 if (cullingOption == "global") { 462 if (cullingOption == "global") { 807 vp.SetCulling(boolFlag); 463 vp.SetCulling(boolFlag); 808 if (verbosity >= G4VisManager::confirmat 464 if (verbosity >= G4VisManager::confirmations) { 809 G4cout << << 465 G4cout << 810 "G4VisCommandsViewerSet::SetNewValue: << 466 "G4VisCommandsViewerSet::SetNewValue: culling: global culling flag" 811 " set to " << G4UIcommand::ConvertToSt << 467 " set to " << G4UIcommand::ConvertToString(boolFlag) << 812 ".\n Does not change specific culling << 468 ".\n Does not change specific culling flags." 813 << G4endl; << 469 << G4endl; 814 } 470 } 815 } 471 } 816 else if (cullingOption == "coveredDaughter 472 else if (cullingOption == "coveredDaughters") { 817 vp.SetCullingCovered(boolFlag); 473 vp.SetCullingCovered(boolFlag); 818 if (verbosity >= G4VisManager::confirmat 474 if (verbosity >= G4VisManager::confirmations) { 819 G4cout << << 475 G4cout << 820 "G4VisCommandsViewerSet::SetNewValue: << 476 "G4VisCommandsViewerSet::SetNewValue: culling: culling covered" 821 "\n daughters flag set to " << 477 "\n daughters flag set to " 822 << G4UIcommand::ConvertToString(boolFl << 478 << G4UIcommand::ConvertToString(boolFlag) << 823 ". Daughters covered by opaque mother << 479 ". Daughters covered by opaque mothers" 824 "\n will be culled, i.e., not drawn, << 480 "\n will be culled, i.e., not drawn, if this flag is true." 825 "\n Note: this is only effective in s << 481 "\n Note: this is only effective in surface drawing style," 826 "\n and then only if the volumes are << 482 "\n and then only if the volumes are visible and opaque, and then" 827 "\n only if no sections or cutaways a << 483 "\n only if no sections or cutways are in operation." 828 << G4endl; << 484 << G4endl; 829 } 485 } 830 } 486 } 831 else if (cullingOption == "invisible") { 487 else if (cullingOption == "invisible") { 832 vp.SetCullingInvisible(boolFlag); 488 vp.SetCullingInvisible(boolFlag); 833 if (verbosity >= G4VisManager::confirmat 489 if (verbosity >= G4VisManager::confirmations) { 834 G4cout << << 490 G4cout << 835 "G4VisCommandsViewerSet::SetNewValue: << 491 "G4VisCommandsViewerSet::SetNewValue: culling: culling invisible" 836 "\n flag set to " << 492 "\n flag set to " 837 << boolFlag << G4UIcommand::ConvertToS << 493 << boolFlag << G4UIcommand::ConvertToString(boolFlag) << 838 ". Volumes marked invisible will be c << 494 ". Volumes marked invisible will be culled," 839 "\n i.e., not drawn, if this flag is << 495 "\n i.e., not drawn, if this flag is true." 840 << G4endl; << 496 << G4endl; 841 } 497 } 842 } 498 } 843 else if (cullingOption == "density") { 499 else if (cullingOption == "density") { 844 const G4String where = << 500 vp.SetDensityCulling(boolFlag); 845 "G4VisCommandsViewerSet::SetNewValue: cu << 846 if (boolFlag) { 501 if (boolFlag) { 847 G4double valueOfUnit; << 502 density *= G4UnitDefinition::GetValueOf(unit); 848 // "Volumic Mass" is Michel's phrase f << 503 vp.SetVisibleDensity(density); 849 if (ProvideValueOfUnit(where,unit,"Vol << 504 } 850 // Successful outcome of unit search << 505 else { 851 vp.SetDensityCulling(boolFlag); << 506 density = vp.GetVisibleDensity(); 852 density *= valueOfUnit; << 853 vp.SetVisibleDensity(density); << 854 } else { << 855 // Unsuccessful outcome of unit sear << 856 density = vp.GetVisibleDensity(); << 857 } << 858 } else { // Reset flag but density unch << 859 vp.SetDensityCulling(boolFlag); << 860 } 507 } 861 if (verbosity >= G4VisManager::confirmat 508 if (verbosity >= G4VisManager::confirmations) { 862 G4cout << 509 G4cout << 863 << where << 510 "G4VisCommandsViewerSet::SetNewValue: culling: culling by density" 864 << "\n flag set to " << 511 "\n flag set to " << G4UIcommand::ConvertToString(boolFlag) << 865 << std::boolalpha << vp.IsDensityCulli << 512 ". Volumes with density less than " << 866 << ". Volumes with density less than << 513 G4BestUnit(density,"Volumic Mass") << 867 << G4BestUnit(density,"Volumic Mass") << 514 "\n will be culled, i.e., not drawn, if this flag is true." 868 << "\n will be culled, i.e., not draw << 515 << G4endl; 869 << G4endl; << 870 } 516 } 871 } 517 } 872 else { 518 else { 873 if (verbosity >= G4VisManager::errors) { 519 if (verbosity >= G4VisManager::errors) { 874 G4warn << << 520 G4cout << 875 "ERROR: G4VisCommandsViewerSet::SetNew << 521 "ERROR: G4VisCommandsViewerSet::SetNewValue: culling:" 876 "\n option not recognised." << 522 "\n option not recognised." 877 << G4endl; << 523 << G4endl; 878 } 524 } 879 } 525 } 880 } 526 } 881 527 882 else if (command == fpCommandCutawayMode) { << 883 if (newValue == "add" || newValue == "unio << 884 vp.SetCutawayMode(G4ViewParameters::cuta << 885 if (newValue == "multiply" || newValue == << 886 vp.SetCutawayMode(G4ViewParameters::cuta << 887 << 888 if (verbosity >= G4VisManager::confirmatio << 889 G4cout << "Cutaway mode set to "; << 890 if (vp.GetCutawayMode() == G4ViewParamet << 891 G4cout << "cutawayUnion"; << 892 if (vp.GetCutawayMode() == G4ViewParamet << 893 G4cout << "cutawayIntersection"; << 894 G4cout << G4endl; << 895 } << 896 } << 897 << 898 else if (command == fpCommandDefaultColour) << 899 G4String redOrString; << 900 G4double green, blue, opacity; << 901 std::istringstream iss(newValue); << 902 iss >> redOrString >> green >> blue >> opa << 903 G4Colour colour(1.,1.,1.); // Default whi << 904 ConvertToColour(colour, redOrString, green << 905 G4VisAttributes va = vp.GetDefaultVisAttri << 906 va.SetColour(colour); << 907 vp.SetDefaultVisAttributes(va); << 908 if (verbosity >= G4VisManager::confirmatio << 909 G4cout << "Default colour " << 910 << vp.GetDefaultVisAttributes()->GetColo << 911 << " requested." << 912 << G4endl; << 913 } << 914 } << 915 << 916 else if (command == fpCommandDefaultTextColo << 917 G4String redOrString; << 918 G4double green, blue, opacity; << 919 std::istringstream iss(newValue); << 920 iss >> redOrString >> green >> blue >> opa << 921 G4Colour colour(1.,1.,1.); // Default whi << 922 ConvertToColour(colour, redOrString, green << 923 G4VisAttributes va = vp.GetDefaultTextVisA << 924 va.SetColour(colour); << 925 vp.SetDefaultTextVisAttributes(va); << 926 if (verbosity >= G4VisManager::confirmatio << 927 G4cout << "Default colour " << 928 << vp.GetDefaultTextVisAttributes()->Get << 929 << " requested." << 930 << G4endl; << 931 } << 932 } << 933 << 934 else if (command == fpCommandEdge) { 528 else if (command == fpCommandEdge) { 935 G4ViewParameters::DrawingStyle existingSty 529 G4ViewParameters::DrawingStyle existingStyle = vp.GetDrawingStyle(); 936 if (G4UIcommand::ConvertToBool(newValue)) << 530 if (G4UIcommand::ConvertToBool(newValue)) { 937 switch (existingStyle) { 531 switch (existingStyle) { 938 case G4ViewParameters::wireframe: << 532 case G4ViewParameters::wireframe: 939 break; << 533 break; 940 case G4ViewParameters::hlr: << 534 case G4ViewParameters::hlr: 941 break; << 535 break; 942 case G4ViewParameters::hsr: << 536 case G4ViewParameters::hsr: 943 vp.SetDrawingStyle(G4ViewParameters: << 537 vp.SetDrawingStyle(G4ViewParameters::hlhsr); 944 break; << 538 break; 945 case G4ViewParameters::hlhsr: << 539 case G4ViewParameters::hlhsr: 946 break; << 540 break; 947 case G4ViewParameters::cloud: << 948 break; << 949 } 541 } 950 } 542 } 951 else { // false << 543 else { 952 switch (existingStyle) { 544 switch (existingStyle) { 953 case G4ViewParameters::wireframe: << 545 case G4ViewParameters::wireframe: 954 break; << 546 break; 955 case G4ViewParameters::hlr: << 547 case G4ViewParameters::hlr: 956 break; << 548 break; 957 case G4ViewParameters::hsr: << 549 case G4ViewParameters::hsr: 958 break; << 550 break; 959 case G4ViewParameters::hlhsr: << 551 case G4ViewParameters::hlhsr: 960 vp.SetDrawingStyle(G4ViewParameters: << 552 vp.SetDrawingStyle(G4ViewParameters::hsr); 961 break; << 553 break; 962 case G4ViewParameters::cloud: << 963 break; << 964 } 554 } 965 } 555 } 966 if (verbosity >= G4VisManager::confirmatio 556 if (verbosity >= G4VisManager::confirmations) { 967 G4cout << "Drawing style of viewer \"" < 557 G4cout << "Drawing style of viewer \"" << currentViewer->GetName() 968 << "\" set to " << vp.GetDrawingStyle() << 558 << "\" set to " << vp.GetDrawingStyle() 969 << G4endl; << 559 << G4endl; 970 } << 971 } << 972 << 973 else if (command == fpCommandExplodeFactor) << 974 G4double explodeFactor, x, y, z; << 975 G4String unitString; << 976 std::istringstream is (newValue); << 977 is >> explodeFactor >> x >> y >> z >> unit << 978 G4double unit = G4UIcommand::ValueOf(unitS << 979 vp.SetExplodeFactor(explodeFactor); << 980 vp.SetExplodeCentre(G4Point3D(x * unit, y << 981 if (verbosity >= G4VisManager::confirmatio << 982 G4cout << "Explode factor changed to " < << 983 << " from centre " << vp.GetExplodeCentr << 984 << G4endl; << 985 } << 986 } << 987 << 988 else if (command == fpCommandGlobalLineWidth << 989 G4double globalLineWidthScale << 990 = fpCommandGlobalLineWidthScale->GetNewDou << 991 vp.SetGlobalLineWidthScale(globalLineWidth << 992 if (verbosity >= G4VisManager::confirmatio << 993 G4cout << "Global Line Width Scale chang << 994 << vp.GetGlobalLineWidthScale() << G4end << 995 } 560 } 996 } 561 } 997 562 998 else if (command == fpCommandGlobalMarkerSca 563 else if (command == fpCommandGlobalMarkerScale) { 999 G4double globalMarkerScale 564 G4double globalMarkerScale 1000 = fpCommandGlobalMarkerScale->GetNewDoubl << 565 = fpCommandGlobalMarkerScale->GetNewDoubleValue(newValue); 1001 vp.SetGlobalMarkerScale(globalMarkerScale 566 vp.SetGlobalMarkerScale(globalMarkerScale); 1002 if (verbosity >= G4VisManager::confirmati 567 if (verbosity >= G4VisManager::confirmations) { 1003 G4cout << "Global Marker Scale changed 568 G4cout << "Global Marker Scale changed to " 1004 << vp.GetGlobalMarkerScale() << G4endl; << 569 << vp.GetGlobalMarkerScale() << G4endl; 1005 } 570 } 1006 } 571 } 1007 572 1008 else if (command == fpCommandHiddenEdge) { 573 else if (command == fpCommandHiddenEdge) { 1009 G4ViewParameters::DrawingStyle existingSt 574 G4ViewParameters::DrawingStyle existingStyle = vp.GetDrawingStyle(); 1010 if (G4UIcommand::ConvertToBool(newValue)) 575 if (G4UIcommand::ConvertToBool(newValue)) { 1011 switch (existingStyle) { 576 switch (existingStyle) { 1012 case G4ViewParameters::wireframe: << 577 case G4ViewParameters::wireframe: 1013 vp.SetDrawingStyle(G4ViewParameters << 578 vp.SetDrawingStyle(G4ViewParameters::hlr); 1014 break; << 579 break; 1015 case G4ViewParameters::hlr: << 580 case G4ViewParameters::hlr: 1016 break; << 581 break; 1017 case G4ViewParameters::hsr: << 582 case G4ViewParameters::hsr: 1018 vp.SetDrawingStyle(G4ViewParameters << 583 vp.SetDrawingStyle(G4ViewParameters::hlhsr); 1019 break; << 584 break; 1020 case G4ViewParameters::hlhsr: << 585 case G4ViewParameters::hlhsr: 1021 break; << 586 break; 1022 case G4ViewParameters::cloud: << 1023 break; << 1024 } 587 } 1025 } 588 } 1026 else { 589 else { 1027 switch (existingStyle) { 590 switch (existingStyle) { 1028 case G4ViewParameters::wireframe: << 591 case G4ViewParameters::wireframe: 1029 break; << 592 break; 1030 case G4ViewParameters::hlr: << 593 case G4ViewParameters::hlr: 1031 vp.SetDrawingStyle(G4ViewParameters << 594 vp.SetDrawingStyle(G4ViewParameters::wireframe); 1032 break; << 595 break; 1033 case G4ViewParameters::hsr: << 596 case G4ViewParameters::hsr: 1034 break; << 597 break; 1035 case G4ViewParameters::hlhsr: << 598 case G4ViewParameters::hlhsr: 1036 vp.SetDrawingStyle(G4ViewParameters << 599 vp.SetDrawingStyle(G4ViewParameters::hsr); 1037 break; << 600 break; 1038 case G4ViewParameters::cloud: << 1039 break; << 1040 } 601 } 1041 } 602 } 1042 if (verbosity >= G4VisManager::confirmati 603 if (verbosity >= G4VisManager::confirmations) { 1043 G4cout << "Drawing style of viewer \"" 604 G4cout << "Drawing style of viewer \"" << currentViewer->GetName() 1044 << "\" set to " << vp.GetDrawingStyle() << 605 << "\" set to " << vp.GetDrawingStyle() 1045 << G4endl; << 606 << G4endl; 1046 } 607 } 1047 } 608 } 1048 609 1049 else if (command == fpCommandHiddenMarker) 610 else if (command == fpCommandHiddenMarker) { 1050 G4bool hidden = G4UIcommand::ConvertToBoo 611 G4bool hidden = G4UIcommand::ConvertToBool(newValue); 1051 if (hidden) vp.SetMarkerHidden(); 612 if (hidden) vp.SetMarkerHidden(); 1052 else vp.SetMarkerNotHidden(); 613 else vp.SetMarkerNotHidden(); 1053 if (verbosity >= G4VisManager::confirmati 614 if (verbosity >= G4VisManager::confirmations) { 1054 G4cout << "Markers will "; 615 G4cout << "Markers will "; 1055 if (vp.IsMarkerNotHidden()) G4cout << " 616 if (vp.IsMarkerNotHidden()) G4cout << "not "; 1056 G4cout << "be hidden under solid object 617 G4cout << "be hidden under solid objects." << G4endl; 1057 } 618 } 1058 } 619 } 1059 620 1060 else if (command == fpCommandLightsMove) { 621 else if (command == fpCommandLightsMove) { 1061 if (newValue.find("cam") != G4String::npo << 622 G4String s (newValue); 1062 vp.SetLightsMoveWithCamera(true); << 623 if (s.find("cam") != G4String::npos) vp.SetLightsMoveWithCamera(true); 1063 else if(newValue.find("obj") != G4String: << 624 else if(s.find("obj") != G4String::npos) vp.SetLightsMoveWithCamera(false); 1064 vp.SetLightsMoveWithCamera(false); << 1065 else { 625 else { 1066 if (verbosity >= G4VisManager::errors) 626 if (verbosity >= G4VisManager::errors) { 1067 G4warn << "ERROR: \"" << newValue << << 627 G4cout << "ERROR: \"" << newValue << "\" not recognised." 1068 " Looking for \"cam\" or \"obj\" in << 628 " Looking for \"cam\" or \"obj\" in string." << G4endl; 1069 } 629 } 1070 } 630 } 1071 if (verbosity >= G4VisManager::confirmati 631 if (verbosity >= G4VisManager::confirmations) { 1072 G4cout << "Lights move with "; 632 G4cout << "Lights move with "; 1073 if (vp.GetLightsMoveWithCamera()) 633 if (vp.GetLightsMoveWithCamera()) 1074 G4cout << "camera (object appears to << 634 G4cout << "camera (object appears to rotate)."; 1075 else G4cout << "object (the viewer appe 635 else G4cout << "object (the viewer appears to be moving)."; 1076 G4cout << G4endl; 636 G4cout << G4endl; 1077 } 637 } 1078 } 638 } 1079 639 1080 else if (command == fpCommandLightsThetaPhi 640 else if (command == fpCommandLightsThetaPhi) { 1081 G4double theta, phi; 641 G4double theta, phi; 1082 if (ConvertToDoublePair(newValue, theta, << 642 ConvertToDoublePair(newValue, theta, phi); 1083 G4double x = std::sin (theta) * std::co << 643 G4double x = std::sin (theta) * std::cos (phi); 1084 G4double y = std::sin (theta) * std::si << 644 G4double y = std::sin (theta) * std::sin (phi); 1085 G4double z = std::cos (theta); << 645 G4double z = std::cos (theta); 1086 fLightsVector = G4ThreeVector (x, y, z) << 646 fLightsVector = G4ThreeVector (x, y, z); 1087 vp.SetLightpointDirection(fLightsVector << 647 vp.SetLightpointDirection(fLightsVector); 1088 if (verbosity >= G4VisManager::confirma << 648 if (verbosity >= G4VisManager::confirmations) { 1089 G4cout << "Lights direction set to " << 649 G4cout << "Lights direction set to " 1090 << vp.GetLightpointDirection() << G4e << 650 << vp.GetLightpointDirection() << G4endl; 1091 } << 1092 } 651 } 1093 } 652 } 1094 653 1095 else if (command == fpCommandLightsVector) 654 else if (command == fpCommandLightsVector) { 1096 fLightsVector = G4UIcommand::ConvertTo3Ve 655 fLightsVector = G4UIcommand::ConvertTo3Vector(newValue); 1097 vp.SetLightpointDirection(fLightsVector); 656 vp.SetLightpointDirection(fLightsVector); 1098 if (verbosity >= G4VisManager::confirmati 657 if (verbosity >= G4VisManager::confirmations) { 1099 G4cout << "Lights direction set to " 658 G4cout << "Lights direction set to " 1100 << vp.GetLightpointDirection() << G4end << 659 << vp.GetLightpointDirection() << G4endl; 1101 } << 1102 } << 1103 << 1104 else if (command == fpCommandLineWidth) { << 1105 if (verbosity >= G4VisManager::errors) { << 1106 // A do-nothing command << 1107 G4warn << command->GetGuidanceLine(0) < << 1108 } 660 } 1109 } 661 } 1110 662 1111 else if (command == fpCommandLineSegments) 663 else if (command == fpCommandLineSegments) { 1112 G4int nSides = G4UIcommand::ConvertToInt( 664 G4int nSides = G4UIcommand::ConvertToInt(newValue); 1113 nSides = vp.SetNoOfSides(nSides); << 665 vp.SetNoOfSides(nSides); 1114 if (verbosity >= G4VisManager::confirmati << 1115 G4cout << << 1116 "Number of line segments per circle in << 1117 << nSides << G4endl; << 1118 } << 1119 } << 1120 << 1121 else if (command == fpCommandNumberOfCloudP << 1122 G4int nPoints = G4UIcommand::ConvertToInt << 1123 nPoints = vp.SetNumberOfCloudPoints(nPoin << 1124 if (verbosity >= G4VisManager::confirmati 666 if (verbosity >= G4VisManager::confirmations) { 1125 G4cout << 667 G4cout << 1126 "Number of points to be used in cloud r << 668 "Number of line segements per circle in polygon approximation is " 1127 << nPoints << G4endl; << 669 << nSides << G4endl; 1128 } << 1129 } << 1130 << 1131 else if (command == fpCommandPicking) { << 1132 vp.SetPicking(G4UIcommand::ConvertToBool( << 1133 if (verbosity >= G4VisManager::confirmati << 1134 G4cout << "Picking "; << 1135 if (vp.IsPicking()) G4cout << "requeste << 1136 else G4cout << "inhibited."; << 1137 G4cout << G4endl; << 1138 } << 1139 if (verbosity >= G4VisManager::warnings) << 1140 G4warn << "You may need to issue \"/vis << 1141 << G4endl; << 1142 } 670 } 1143 } 671 } 1144 672 1145 else if (command == fpCommandProjection) { 673 else if (command == fpCommandProjection) { 1146 G4double fieldHalfAngle; 674 G4double fieldHalfAngle; 1147 const size_t iPos0 = 0; << 675 size_t iPos = 0; 1148 if (newValue[iPos0] == 'o') { // "orthog << 676 if (newValue[iPos] == 'o') { // "orthogonal" 1149 fieldHalfAngle = 0.; 677 fieldHalfAngle = 0.; 1150 } 678 } 1151 else if (newValue[iPos0] == 'p') { // "p << 679 else if (newValue[iPos] == 'p') { // "perspective" 1152 G4String dummy; 680 G4String dummy; 1153 G4String unit; 681 G4String unit; 1154 std::istringstream is (newValue); << 682 std::istrstream is ((char*)newValue.data()); 1155 is >> dummy >> fieldHalfAngle >> unit; 683 is >> dummy >> fieldHalfAngle >> unit; 1156 fieldHalfAngle *= G4UIcommand::ValueOf( 684 fieldHalfAngle *= G4UIcommand::ValueOf(unit); 1157 if (fieldHalfAngle > 89.5 * deg || fiel 685 if (fieldHalfAngle > 89.5 * deg || fieldHalfAngle <= 0.0) { 1158 if (verbosity >= G4VisManager::errors << 686 if (verbosity >= G4VisManager::errors) { 1159 G4warn << << 687 G4cout << 1160 "ERROR: Field half angle should be << 688 "ERROR: Field half angle should be 0 < angle <= 89.5 degrees."; 1161 G4warn << G4endl; << 689 G4cout << G4endl; 1162 } << 690 } 1163 return; << 691 return; 1164 } 692 } 1165 } 693 } 1166 else { 694 else { 1167 if (verbosity >= G4VisManager::errors) 695 if (verbosity >= G4VisManager::errors) { 1168 G4warn << "ERROR: \"" << newValue << << 696 G4cout << "ERROR: \"" << newValue << "\" not recognised." 1169 " Looking for 'o' or 'p' first chara << 697 " Looking for 'o' or 'p' first character." << G4endl; 1170 } 698 } 1171 return; 699 return; 1172 } 700 } 1173 vp.SetFieldHalfAngle(fieldHalfAngle); 701 vp.SetFieldHalfAngle(fieldHalfAngle); 1174 if (verbosity >= G4VisManager::confirmati 702 if (verbosity >= G4VisManager::confirmations) { 1175 G4cout << "Projection style of viewer \ 703 G4cout << "Projection style of viewer \"" << currentViewer->GetName() 1176 << "\" set to "; << 704 << "\" set to "; 1177 if (fieldHalfAngle == 0.) { 705 if (fieldHalfAngle == 0.) { 1178 G4cout << "orthogonal."; << 706 G4cout << "orthogonal."; 1179 } 707 } 1180 else { 708 else { 1181 G4cout << "perspective\n with half a << 709 G4cout << "perspective\n with half angle " << fieldHalfAngle / deg 1182 << " degrees."; << 710 << " degrees."; 1183 } 711 } 1184 G4cout << G4endl; 712 G4cout << G4endl; 1185 } 713 } 1186 } 714 } 1187 715 1188 else if (command == fpCommandRotationStyle) << 1189 G4ViewParameters::RotationStyle style; << 1190 if (newValue == "constrainUpDirection") << 1191 style = G4ViewParameters::constrainUpDi << 1192 else if (newValue == "freeRotation") << 1193 style = G4ViewParameters::freeRotation; << 1194 else { << 1195 if (verbosity >= G4VisManager::errors) << 1196 G4warn << "ERROR: \"" << newValue << "\" no << 1197 } << 1198 return; << 1199 } << 1200 vp.SetRotationStyle(style); << 1201 if (verbosity >= G4VisManager::confirmati << 1202 G4cout << "Rotation style of viewer \"" << 1203 << "\" set to " << vp.GetRotationStyle( << 1204 << G4endl; << 1205 } << 1206 } << 1207 << 1208 else if (command == fpCommandSectionPlane) 716 else if (command == fpCommandSectionPlane) { 1209 G4String choice, unit; 717 G4String choice, unit; 1210 G4double x, y, z, nx, ny, nz, F = 1.; << 718 G4double x, y, z, nx, ny, nz; 1211 std::istringstream is (newValue); << 719 const char* t = newValue; >> 720 std::istrstream is ((char*)t); 1212 is >> choice >> x >> y >> z >> unit >> nx 721 is >> choice >> x >> y >> z >> unit >> nx >> ny >> nz; >> 722 1213 G4int iSelector = -1; 723 G4int iSelector = -1; 1214 if (G4StrUtil::icompare(choice, "off") == << 724 if (choice.compareTo("off",G4String::ignoreCase) == 0) iSelector = 0; 1215 !G4UIcommand::ConvertToBool(choice)) << 725 if (choice.compareTo("on",G4String::ignoreCase) == 0) iSelector = 1; 1216 if (G4StrUtil::icompare(choice, "on") == << 1217 G4UIcommand::ConvertToBool(choice)) i << 1218 if (iSelector < 0) { 726 if (iSelector < 0) { 1219 if (verbosity >= G4VisManager::errors) 727 if (verbosity >= G4VisManager::errors) { 1220 G4warn << "Choice not recognised (on/ << 728 G4cout << "Choice not recognised (on/off)." << G4endl; >> 729 G4cout << "Section drawing is currently: "; >> 730 if (vp.IsSection ()) G4cout << "on"; >> 731 else G4cout << "off"; >> 732 G4cout << ".\nSection plane is currently: " >> 733 << vp.GetSectionPlane (); >> 734 G4cout << G4endl; 1221 } 735 } 1222 goto write_result; << 736 return; 1223 } 737 } 1224 // iSelector can only be 0 or 1 << 738 >> 739 G4double F; 1225 switch (iSelector) { 740 switch (iSelector) { 1226 case 0: << 741 case 0: 1227 vp.UnsetSectionPlane(); << 742 vp.UnsetSectionPlane(); 1228 break; << 743 break; 1229 case 1: << 744 case 1: 1230 F = G4UIcommand::ValueOf(unit); << 745 F = G4UIcommand::ValueOf(unit); 1231 x *= F; y *= F; z *= F; << 746 x *= F; y *= F; z *= F; 1232 if (nx == 0. && ny == 0. && nz == 0.) << 747 vp.SetSectionPlane(G4Plane3D(G4Normal3D(nx,ny,nz), 1233 if (verbosity >= G4VisManager::erro << 748 G4Point3D(x,y,z))); 1234 G4warn << "Null normal." << G4end << 749 vp.SetViewpointDirection(G4Normal3D(nx,ny,nz)); 1235 } << 750 break; 1236 break;; << 751 default: 1237 } << 752 if (verbosity >= G4VisManager::errors) { 1238 // Make sure normal is normalised << 753 G4cout << "ERROR: Choice not recognised (on/off)." 1239 const G4Normal3D& normal = G4Normal3D << 754 << G4endl; 1240 vp.SetSectionPlane(G4Plane3D(normal, << 755 } 1241 vp.SetViewpointDirection(normal); << 756 break; 1242 break; << 1243 } 757 } 1244 write_result: << 758 1245 if (verbosity >= G4VisManager::confirmati 759 if (verbosity >= G4VisManager::confirmations) { 1246 G4cout << "Section drawing is: "; << 760 G4cout << "Section drawing is now: "; 1247 if (vp.IsSection ()) G4cout << "on"; 761 if (vp.IsSection ()) G4cout << "on"; 1248 else G4cout << "off"; << 762 else G4cout << "off"; 1249 G4cout << ".\nSection plane is now: " 763 G4cout << ".\nSection plane is now: " 1250 << vp.GetSectionPlane (); << 764 << vp.GetSectionPlane (); 1251 G4cout << G4endl; 765 G4cout << G4endl; 1252 } 766 } 1253 } 767 } 1254 768 1255 else if (command == fpCommandSpecialMeshRen << 1256 vp.SetSpecialMeshRendering(G4UIcommand::C << 1257 if (verbosity >= G4VisManager::confirmati << 1258 G4cout << "Special mesh rendering"; << 1259 if (vp.IsSpecialMeshRendering()) { << 1260 G4cout << " requested. Current option << 1261 << vp.GetSpecialMeshRenderingOption() << 1262 if (vp.GetSpecialMeshVolumes().empty( << 1263 G4cout << "any mesh."; << 1264 } else{ << 1265 G4cout << "selected volumes:"; << 1266 for (const auto& pvNameCopyNo: vp.G << 1267 G4cout << "\n " << pvNameCopyNo. << 1268 if (pvNameCopyNo.GetCopyNo() >= 0 << 1269 } << 1270 } << 1271 } << 1272 else G4cout << ": off."; << 1273 G4cout << G4endl; << 1274 } << 1275 } << 1276 << 1277 else if (command == fpCommandSpecialMeshRen << 1278 G4ViewParameters::SMROption option = G4Vi << 1279 if (newValue == "dots") { << 1280 option = G4ViewParameters::meshAsDots; << 1281 } << 1282 else if(newValue == "surfaces") { << 1283 option = G4ViewParameters::meshAsSurfac << 1284 } << 1285 vp.SetSpecialMeshRenderingOption(option); << 1286 if (verbosity >= G4VisManager::confirmati << 1287 G4cout << "Special mesh rendering optio << 1288 << vp.GetSpecialMeshRenderingOption() < << 1289 << G4endl; << 1290 } << 1291 } << 1292 << 1293 else if (command == fpCommandSpecialMeshVol << 1294 std::vector<G4ModelingParameters::PVNameC << 1295 if (newValue.empty()) { << 1296 vp.SetSpecialMeshVolumes(requestedMeshe << 1297 } else { << 1298 // Algorithm from Josuttis p.476. << 1299 G4String::size_type iBegin, iEnd; << 1300 iBegin = newValue.find_first_not_of(' ' << 1301 while (iBegin != G4String::npos) { << 1302 iEnd = newValue.find_first_of(' ',iBegin); << 1303 if (iEnd == G4String::npos) { << 1304 iEnd = newValue.length(); << 1305 } << 1306 const G4String& name(newValue.substr(iBegin << 1307 iBegin = newValue.find_first_not_of(' ',iEn << 1308 if (iBegin == G4String::npos) { << 1309 if (verbosity >= G4VisManager::warnings) << 1310 G4warn << << 1311 "WARNING: G4VisCommandsViewerSet::SetNe << 1312 "\n A pair not found. (There should b << 1313 "\n Command ignored." << 1314 << G4endl; << 1315 return; << 1316 } << 1317 } << 1318 iEnd = newValue.find_first_of(' ',iBegin); << 1319 if (iEnd == G4String::npos) { << 1320 iEnd = newValue.length(); << 1321 } << 1322 G4int copyNo; << 1323 std::istringstream iss(newValue.substr(iBeg << 1324 if (!(iss >> copyNo)) { << 1325 if (verbosity >= G4VisManager::warnings) << 1326 G4warn << << 1327 "WARNING: G4VisCommandsViewerSet::SetNe << 1328 "\n Error reading copy number - it was << 1329 "\n Command ignored." << 1330 << G4endl; << 1331 return; << 1332 } << 1333 } << 1334 requestedMeshes.push_back(G4ModelingParamet << 1335 iBegin = newValue.find_first_not_of(' ',iEn << 1336 } << 1337 vp.SetSpecialMeshVolumes(requestedMeshe << 1338 } << 1339 if (verbosity >= G4VisManager::confirmati << 1340 if (vp.GetSpecialMeshVolumes().empty()) << 1341 G4cout << << 1342 "Special mesh list empty, which means \"all << 1343 << G4endl; << 1344 } else { << 1345 G4cout << "Selected special mesh volumes ar << 1346 for (const auto& pvNameCopyNo: vp.GetSpecia << 1347 G4cout << "\n " << pvNameCopyNo.GetName( << 1348 if (pvNameCopyNo.GetCopyNo() >= 0) G4cout << 1349 } << 1350 G4cout << G4endl; << 1351 } << 1352 } << 1353 } << 1354 << 1355 else if (command == fpCommandStyle) { 769 else if (command == fpCommandStyle) { 1356 G4ViewParameters::DrawingStyle existingSt 770 G4ViewParameters::DrawingStyle existingStyle = vp.GetDrawingStyle(); 1357 const size_t iPos0 = 0; << 771 size_t iPos = 0; 1358 if (newValue[iPos0] == 'w') { // "wirefr << 772 if (newValue[iPos] == 'w') { // "wireframe" 1359 switch (existingStyle) { 773 switch (existingStyle) { 1360 case G4ViewParameters::wireframe: << 774 case G4ViewParameters::wireframe: 1361 break; << 775 break; 1362 case G4ViewParameters::hlr: << 776 case G4ViewParameters::hlr: 1363 break; << 777 break; 1364 case G4ViewParameters::hsr: << 778 case G4ViewParameters::hsr: 1365 vp.SetDrawingStyle(G4ViewParameters << 779 vp.SetDrawingStyle(G4ViewParameters::wireframe); 1366 break; << 780 break; 1367 case G4ViewParameters::hlhsr: << 781 case G4ViewParameters::hlhsr: 1368 vp.SetDrawingStyle(G4ViewParameters << 782 vp.SetDrawingStyle(G4ViewParameters::hlr); 1369 break; << 783 break; 1370 case G4ViewParameters::cloud: << 1371 vp.SetDrawingStyle(G4ViewParameters << 1372 break; << 1373 } 784 } 1374 } 785 } 1375 else if (newValue[iPos0] == 's') { // "s << 786 else if (newValue[iPos] == 's') { // "surface" 1376 switch (existingStyle) { 787 switch (existingStyle) { 1377 case G4ViewParameters::wireframe: << 788 case G4ViewParameters::wireframe: 1378 vp.SetDrawingStyle(G4ViewParameters << 789 vp.SetDrawingStyle(G4ViewParameters::hsr); 1379 break; << 790 break; 1380 case G4ViewParameters::hlr: << 791 case G4ViewParameters::hlr: 1381 vp.SetDrawingStyle(G4ViewParameters << 792 vp.SetDrawingStyle(G4ViewParameters::hlhsr); 1382 break; << 793 break; 1383 case G4ViewParameters::hsr: << 794 case G4ViewParameters::hsr: 1384 break; << 795 break; 1385 case G4ViewParameters::hlhsr: << 796 case G4ViewParameters::hlhsr: 1386 break; << 797 break; 1387 case G4ViewParameters::cloud: << 1388 vp.SetDrawingStyle(G4ViewParameters << 1389 break; << 1390 } << 1391 } << 1392 else if (newValue[iPos0] == 'c') { // "c << 1393 switch (existingStyle) { << 1394 case G4ViewParameters::wireframe: << 1395 vp.SetDrawingStyle(G4ViewParameters << 1396 break; << 1397 case G4ViewParameters::hlr: << 1398 vp.SetDrawingStyle(G4ViewParameters << 1399 break; << 1400 case G4ViewParameters::hsr: << 1401 vp.SetDrawingStyle(G4ViewParameters << 1402 break; << 1403 case G4ViewParameters::hlhsr: << 1404 vp.SetDrawingStyle(G4ViewParameters << 1405 break; << 1406 case G4ViewParameters::cloud: << 1407 break; << 1408 } 798 } 1409 } 799 } 1410 else { 800 else { 1411 if (verbosity >= G4VisManager::errors) 801 if (verbosity >= G4VisManager::errors) { 1412 G4warn << "ERROR: \"" << newValue << << 802 G4cout << "ERROR: \"" << newValue << "\" not recognised." 1413 " Looking for 'w' or 's' or 'c' firs << 803 " Looking for 'w' or 's' first character." << G4endl; 1414 } 804 } 1415 return; 805 return; 1416 } 806 } 1417 if (verbosity >= G4VisManager::confirmati 807 if (verbosity >= G4VisManager::confirmations) { 1418 G4cout << "Drawing style of viewer \"" 808 G4cout << "Drawing style of viewer \"" << currentViewer->GetName() 1419 << "\" set to " << vp.GetDrawingStyle() << 809 << "\" set to " << vp.GetDrawingStyle() 1420 << G4endl; << 810 << G4endl; 1421 } << 1422 } << 1423 << 1424 else if (command == fpCommandTargetPoint) { << 1425 G4ThreeVector targetPoint = << 1426 fpCommandTargetPoint->GetNew3VectorValue( << 1427 const G4Point3D& standardTargetPoint = << 1428 currentViewer->GetSceneHandler()->GetScen << 1429 vp.SetCurrentTargetPoint(targetPoint - st << 1430 if (verbosity >= G4VisManager::confirmati << 1431 G4cout << "Target point set to " << 1432 << fpCommandTargetPoint->ConvertToStrin << 1433 (targetPoint) << 1434 << "\n\"Current Target Point\" set to << 1435 << fpCommandTargetPoint->ConvertToStrin << 1436 (vp.GetCurrentTargetPoint()) << 1437 << "\n\"Standard Target Point\" is " << 1438 << fpCommandTargetPoint->ConvertToStrin << 1439 (standardTargetPoint) << 1440 << G4endl; << 1441 } 811 } 1442 } 812 } 1443 813 1444 else if (command == fpCommandUpThetaPhi) { 814 else if (command == fpCommandUpThetaPhi) { 1445 G4double theta, phi; 815 G4double theta, phi; 1446 if (ConvertToDoublePair(newValue, theta, << 816 ConvertToDoublePair(newValue, theta, phi); 1447 G4double x = std::sin (theta) * std::co << 817 G4double x = std::sin (theta) * std::cos (phi); 1448 G4double y = std::sin (theta) * std::si << 818 G4double y = std::sin (theta) * std::sin (phi); 1449 G4double z = std::cos (theta); << 819 G4double z = std::cos (theta); 1450 fUpVector = G4ThreeVector (x, y, z); << 820 fUpVector = G4ThreeVector (x, y, z); 1451 vp.SetUpVector(fUpVector); << 821 vp.SetUpVector(fUpVector); 1452 if (verbosity >= G4VisManager::confirma << 822 if (verbosity >= G4VisManager::confirmations) { 1453 G4cout << "Up direction set to " << v << 823 G4cout << "Up direction set to " << vp.GetUpVector() << G4endl; 1454 } << 1455 } 824 } 1456 } 825 } 1457 826 1458 else if (command == fpCommandUpVector) { 827 else if (command == fpCommandUpVector) { 1459 fUpVector = G4UIcommand::ConvertTo3Vector << 828 fUpVector = G4UIcommand::ConvertTo3Vector(newValue); 1460 vp.SetUpVector(fUpVector); 829 vp.SetUpVector(fUpVector); 1461 if (verbosity >= G4VisManager::confirmati 830 if (verbosity >= G4VisManager::confirmations) { 1462 G4cout << "Up direction set to " << vp. 831 G4cout << "Up direction set to " << vp.GetUpVector() << G4endl; 1463 } 832 } 1464 } 833 } 1465 834 1466 else if (command == fpCommandViewpointTheta 835 else if (command == fpCommandViewpointThetaPhi) { 1467 G4double theta, phi; 836 G4double theta, phi; 1468 if (ConvertToDoublePair(newValue, theta, << 837 ConvertToDoublePair(newValue, theta, phi); 1469 G4double x = std::sin (theta) * std::co << 838 G4double x = std::sin (theta) * std::cos (phi); 1470 G4double y = std::sin (theta) * std::si << 839 G4double y = std::sin (theta) * std::sin (phi); 1471 G4double z = std::cos (theta); << 840 G4double z = std::cos (theta); 1472 fViewpointVector = G4ThreeVector (x, y, << 841 fViewpointVector = G4ThreeVector (x, y, z); 1473 vp.SetViewAndLights(fViewpointVector); << 842 vp.SetViewAndLights(fViewpointVector); 1474 if (verbosity >= G4VisManager::confirma << 843 if (verbosity >= G4VisManager::confirmations) { 1475 G4cout << "Viewpoint direction set to << 844 G4cout << "Viewpoint direction set to " 1476 << vp.GetViewpointDirection() << G4en << 845 << vp.GetViewpointDirection() << G4endl; 1477 if (vp.GetLightsMoveWithCamera ()) { << 846 if (vp.GetLightsMoveWithCamera ()) { 1478 G4cout << "Lightpoint direction set << 847 G4cout << "Lightpoint direction set to " 1479 << vp.GetActualLightpointDirection << 848 << vp.GetActualLightpointDirection () << G4endl; 1480 } << 1481 } 849 } 1482 } 850 } 1483 } 851 } 1484 852 1485 else if (command == fpCommandViewpointVecto 853 else if (command == fpCommandViewpointVector) { 1486 G4ThreeVector viewpointVector = G4UIcomma << 854 fViewpointVector = G4UIcommand::ConvertTo3Vector(newValue); 1487 if (viewpointVector.mag2() <= 0.) { << 855 vp.SetViewAndLights(fViewpointVector); 1488 if (verbosity >= G4VisManager::errors) << 1489 G4warn << "ERROR: Null viewpoint vect << 1490 } << 1491 } else { << 1492 fViewpointVector = viewpointVector.unit << 1493 vp.SetViewAndLights(fViewpointVector); << 1494 if (verbosity >= G4VisManager::confirma << 1495 G4cout << "Viewpoint direction set to << 1496 << vp.GetViewpointDirection() << G4en << 1497 if (vp.GetLightsMoveWithCamera ()) { << 1498 G4cout << "Lightpoint direction set << 1499 << vp.GetActualLightpointDirection << 1500 } << 1501 } << 1502 } << 1503 } << 1504 << 1505 else if (command == fpCommandTimeWindowDisp << 1506 { << 1507 G4String display; << 1508 G4double screenX, screenY, screenSize, re << 1509 std::istringstream iss(newValue); << 1510 iss >> display >> screenX >> screenY << 1511 >> screenSize >> red >> green >> blue; << 1512 vp.SetDisplayHeadTime(command->ConvertToB << 1513 vp.SetDisplayHeadTimeX(screenX); << 1514 vp.SetDisplayHeadTimeY(screenY); << 1515 vp.SetDisplayHeadTimeSize(screenSize); << 1516 vp.SetDisplayHeadTimeRed(red); << 1517 vp.SetDisplayHeadTimeGreen(green); << 1518 vp.SetDisplayHeadTimeBlue(blue); << 1519 if (verbosity >= G4VisManager::confirmati << 1520 G4cout << "Display head time flag set: << 1521 << vp << 1522 << G4endl; << 1523 } << 1524 } << 1525 << 1526 else if (command == fpCommandTimeWindowDisp << 1527 { << 1528 G4String display, originX, originY, origi << 1529 G4double red, green, blue; << 1530 std::istringstream iss(newValue); << 1531 iss >> display << 1532 >> originX >> originY >> originZ >> unitS << 1533 >> originT >> unitT << 1534 >> red >> green >> blue; << 1535 vp.SetDisplayLightFront(command->ConvertT << 1536 vp.SetDisplayLightFrontX << 1537 (command->ConvertToDimensionedDouble(G4St << 1538 vp.SetDisplayLightFrontY << 1539 (command->ConvertToDimensionedDouble(G4St << 1540 vp.SetDisplayLightFrontZ << 1541 (command->ConvertToDimensionedDouble(G4St << 1542 vp.SetDisplayLightFrontT << 1543 (command->ConvertToDimensionedDouble(G4St << 1544 vp.SetDisplayLightFrontRed(red); << 1545 vp.SetDisplayLightFrontGreen(green); << 1546 vp.SetDisplayLightFrontBlue(blue); << 1547 if (verbosity >= G4VisManager::confirmati << 1548 G4cout << "Display light front flag set << 1549 << vp << 1550 << G4endl; << 1551 } << 1552 } << 1553 << 1554 else if (command == fpCommandTimeWindowEndT << 1555 { << 1556 G4String end_time_string, end_time_unit, << 1557 time_range_string, time_range_unit; << 1558 std::istringstream iss(newValue); << 1559 iss >> end_time_string >> end_time_unit << 1560 >> time_range_string >> time_range_unit; << 1561 vp.SetEndTime << 1562 (command->ConvertToDimensionedDouble << 1563 (G4String(end_time_string + ' ' + end_ti << 1564 G4double timeRange = command->ConvertToDi << 1565 (G4String(time_range_string + ' ' + time_ << 1566 if (timeRange > 0.) { << 1567 vp.SetStartTime << 1568 (vp.GetEndTime() - timeRange); << 1569 } << 1570 if (verbosity >= G4VisManager::confirmati 856 if (verbosity >= G4VisManager::confirmations) { 1571 G4cout << 857 G4cout << "Viewpoint direction set to " 1572 << "Time window start time: " << vp.Get << 858 << vp.GetViewpointDirection() << G4endl; 1573 << ", time window end time: " << vp.Get << 859 if (vp.GetLightsMoveWithCamera ()) { 1574 if (timeRange > 0.) { << 860 G4cout << "Lightpoint direction set to " 1575 G4cout << "\n (time range: " << time << 861 << vp.GetActualLightpointDirection () << G4endl; 1576 } 862 } 1577 G4cout << G4endl; << 1578 } << 1579 } << 1580 << 1581 else if (command == fpCommandTimeWindowFade << 1582 vp.SetFadeFactor(command->ConvertToDouble << 1583 if (verbosity >= G4VisManager::confirmati << 1584 G4cout << "Time window fade factor chan << 1585 << G4endl; << 1586 } << 1587 } << 1588 << 1589 else if (command == fpCommandTimeWindowStar << 1590 { << 1591 G4String start_time_string, start_time_un << 1592 time_range_string, time_range_unit; << 1593 std::istringstream iss(newValue); << 1594 iss >> start_time_string >> start_time_un << 1595 >> time_range_string >> time_range_unit; << 1596 vp.SetStartTime << 1597 (command->ConvertToDimensionedDouble << 1598 (G4String(start_time_string + ' ' + star << 1599 G4double timeRange = command->ConvertToDi << 1600 (G4String(time_range_string + ' ' + time_ << 1601 if (timeRange > 0.) { << 1602 vp.SetEndTime << 1603 (vp.GetStartTime() + timeRange); << 1604 } << 1605 if (verbosity >= G4VisManager::confirmati << 1606 G4cout << 1607 << "Time window start time: " << vp.Get << 1608 << ", time window end time: " << vp.Get << 1609 if (timeRange > 0.) { << 1610 G4cout << "\n (time range: " << time << 1611 } << 1612 G4cout << G4endl; << 1613 } 863 } 1614 } 864 } 1615 865 1616 else { 866 else { 1617 if (verbosity >= G4VisManager::errors) { 867 if (verbosity >= G4VisManager::errors) { 1618 G4warn << << 868 G4cout << 1619 "ERROR: G4VisCommandsViewerSet::SetNewV << 869 "ERROR: G4VisCommandsViewerSet::SetNewValue: unrecognised command." 1620 << G4endl; << 870 << G4endl; 1621 } 871 } 1622 return; 872 return; 1623 } 873 } 1624 874 1625 SetViewParameters(currentViewer,vp); 875 SetViewParameters(currentViewer,vp); 1626 } 876 } 1627 877