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