| 1 | //
|
|---|
| 2 | // ********************************************************************
|
|---|
| 3 | // * License and Disclaimer *
|
|---|
| 4 | // * *
|
|---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of *
|
|---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and *
|
|---|
| 7 | // * conditions of the Geant4 Software License, included in the file *
|
|---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These *
|
|---|
| 9 | // * include a list of copyright holders. *
|
|---|
| 10 | // * *
|
|---|
| 11 | // * Neither the authors of this software system, nor their employing *
|
|---|
| 12 | // * institutes,nor the agencies providing financial support for this *
|
|---|
| 13 | // * work make any representation or warranty, express or implied, *
|
|---|
| 14 | // * regarding this software system or assume any liability for its *
|
|---|
| 15 | // * use. Please see the license in the file LICENSE and URL above *
|
|---|
| 16 | // * for the full disclaimer and the limitation of liability. *
|
|---|
| 17 | // * *
|
|---|
| 18 | // * This code implementation is the result of the scientific and *
|
|---|
| 19 | // * technical work of the GEANT4 collaboration. *
|
|---|
| 20 | // * By using, copying, modifying or distributing the software (or *
|
|---|
| 21 | // * any work based on the software) you agree to acknowledge its *
|
|---|
| 22 | // * use in resulting scientific publications, and indicate your *
|
|---|
| 23 | // * acceptance of all terms of the Geant4 Software license. *
|
|---|
| 24 | // ********************************************************************
|
|---|
| 25 | //
|
|---|
| 26 | //
|
|---|
| 27 | // $Id: G4VisCommandsViewerSet.cc,v 1.53 2010/11/05 15:57:20 allison Exp $
|
|---|
| 28 | // GEANT4 tag $Name: $
|
|---|
| 29 |
|
|---|
| 30 | // /vis/viewer/set commands - John Allison 16th May 2000
|
|---|
| 31 |
|
|---|
| 32 | #include "G4VisCommandsViewerSet.hh"
|
|---|
| 33 |
|
|---|
| 34 | #include "G4UIcommand.hh"
|
|---|
| 35 | #include "G4UIcmdWithAString.hh"
|
|---|
| 36 | #include "G4UIcmdWithABool.hh"
|
|---|
| 37 | #include "G4UIcmdWithAnInteger.hh"
|
|---|
| 38 | #include "G4UIcmdWithADouble.hh"
|
|---|
| 39 | #include "G4UIcmdWith3VectorAndUnit.hh"
|
|---|
| 40 | #include "G4UnitsTable.hh"
|
|---|
| 41 | #include "G4VisManager.hh"
|
|---|
| 42 | #include "G4Polyhedron.hh"
|
|---|
| 43 |
|
|---|
| 44 | #include <sstream>
|
|---|
| 45 | #include <cctype>
|
|---|
| 46 |
|
|---|
| 47 | G4VisCommandsViewerSet::G4VisCommandsViewerSet ():
|
|---|
| 48 | fLightsVector (G4ThreeVector(1.,1.,1.)),
|
|---|
| 49 | fUpVector (G4ThreeVector(0.,1.,0.)),
|
|---|
| 50 | fViewpointVector (G4ThreeVector(0.,0.,1.))
|
|---|
| 51 | {
|
|---|
| 52 | G4bool omitable;
|
|---|
| 53 | G4UIparameter* parameter;
|
|---|
| 54 |
|
|---|
| 55 | fpCommandAll = new G4UIcmdWithAString ("/vis/viewer/set/all",this);
|
|---|
| 56 | fpCommandAll->SetGuidance
|
|---|
| 57 | ("Copies view parameters.");
|
|---|
| 58 | fpCommandAll->SetGuidance
|
|---|
| 59 | ("Copies view parameters (except the autoRefresh status) from"
|
|---|
| 60 | "\nfrom-viewer to current viewer.");
|
|---|
| 61 | fpCommandAll->SetParameterName ("from-viewer-name",omitable = false);
|
|---|
| 62 |
|
|---|
| 63 | fpCommandAutoRefresh = new G4UIcmdWithABool
|
|---|
| 64 | ("/vis/viewer/set/autoRefresh",this);
|
|---|
| 65 | fpCommandAutoRefresh->SetGuidance("Sets auto-refresh.");
|
|---|
| 66 | fpCommandAutoRefresh->SetGuidance
|
|---|
| 67 | ("If true, view is automatically refreshed after a change of"
|
|---|
| 68 | "\nview parameters.");
|
|---|
| 69 | fpCommandAutoRefresh->SetParameterName("auto-refresh",omitable = true);
|
|---|
| 70 | fpCommandAutoRefresh->SetDefaultValue(true);
|
|---|
| 71 |
|
|---|
| 72 | fpCommandAuxEdge = new G4UIcmdWithABool
|
|---|
| 73 | ("/vis/viewer/set/auxiliaryEdge",this);
|
|---|
| 74 | fpCommandAuxEdge->SetGuidance("Sets visibility of auxiliary edges");
|
|---|
| 75 | fpCommandAuxEdge->SetGuidance
|
|---|
| 76 | ("Auxiliary edges, i.e., those that are part of a curved surface,"
|
|---|
| 77 | "\nsometimes called soft edges, become visible/invisible.");
|
|---|
| 78 | fpCommandAuxEdge->SetParameterName("edge",omitable = true);
|
|---|
| 79 | fpCommandAuxEdge->SetDefaultValue(true);
|
|---|
| 80 |
|
|---|
| 81 | fpCommandBackground = new G4UIcommand
|
|---|
| 82 | ("/vis/viewer/set/background",this);
|
|---|
| 83 | fpCommandBackground->SetGuidance
|
|---|
| 84 | ("Set background colour and transparency (default black and opaque).");
|
|---|
| 85 | fpCommandBackground->SetGuidance
|
|---|
| 86 | ("Accepts (a) RGB triplet. e.g., \".3 .4 .5\", or"
|
|---|
| 87 | "\n(b) string such as \"white\", \"black\", \"grey\", \"red\"..."
|
|---|
| 88 | "\n(c) an additional number for opacity, e.g., \".3 .4 .5 .6\""
|
|---|
| 89 | "\n or \"grey ! ! .6\" (note \"!\"'s for unused green and blue parameters),"
|
|---|
| 90 | "\n e.g. \"! ! ! 0.\" for a transparent background.");
|
|---|
| 91 | parameter = new G4UIparameter("red_or_string", 's', omitable = true);
|
|---|
| 92 | parameter -> SetDefaultValue ("0.");
|
|---|
| 93 | fpCommandBackground -> SetParameter (parameter);
|
|---|
| 94 | parameter = new G4UIparameter("green", 'd', omitable = true);
|
|---|
| 95 | parameter -> SetDefaultValue (0.);
|
|---|
| 96 | fpCommandBackground -> SetParameter (parameter);
|
|---|
| 97 | parameter = new G4UIparameter ("blue", 'd', omitable = true);
|
|---|
| 98 | parameter -> SetDefaultValue (0.);
|
|---|
| 99 | fpCommandBackground -> SetParameter (parameter);
|
|---|
| 100 | parameter = new G4UIparameter ("opacity", 'd', omitable = true);
|
|---|
| 101 | parameter -> SetDefaultValue (1.);
|
|---|
| 102 | fpCommandBackground -> SetParameter (parameter);
|
|---|
| 103 |
|
|---|
| 104 | fpCommandCulling = new G4UIcommand("/vis/viewer/set/culling",this);
|
|---|
| 105 | fpCommandCulling->SetGuidance ("Set culling options.");
|
|---|
| 106 | fpCommandCulling->SetGuidance
|
|---|
| 107 | ("\"global\": enables/disables all other culling options.");
|
|---|
| 108 | fpCommandCulling->SetGuidance
|
|---|
| 109 | ("\"coveredDaughters\": culls, i.e., eliminates, volumes that would not"
|
|---|
| 110 | "\nbe seen because covered by ancester volumes in surface drawing mode,"
|
|---|
| 111 | "\nand then only if the ancesters are visible and opaque, and then only"
|
|---|
| 112 | "\nif no sections or cutaways are in operation. Intended solely to"
|
|---|
| 113 | "\nimprove the speed of rendering visible volumes.");
|
|---|
| 114 | fpCommandCulling->SetGuidance
|
|---|
| 115 | ("\"invisible\": culls objects with the invisible attribute set.");
|
|---|
| 116 | fpCommandCulling->SetGuidance
|
|---|
| 117 | ("\"density\": culls volumes with density lower than threshold. Useful"
|
|---|
| 118 | "\nfor eliminating \"container volumes\" with no physical correspondence,"
|
|---|
| 119 | "\nwhose material is usually air. If this is selected, provide threshold"
|
|---|
| 120 | "\ndensity and unit (g/cm3 mg/cm3 or kg/m3)."
|
|---|
| 121 | );
|
|---|
| 122 | parameter = new G4UIparameter("culling-option",'s',omitable = false);
|
|---|
| 123 | parameter->SetParameterCandidates
|
|---|
| 124 | ("global coveredDaughters invisible density");
|
|---|
| 125 | fpCommandCulling->SetParameter(parameter);
|
|---|
| 126 | parameter = new G4UIparameter("action",'b',omitable = true);
|
|---|
| 127 | parameter->SetDefaultValue(1);
|
|---|
| 128 | fpCommandCulling->SetParameter(parameter);
|
|---|
| 129 | parameter = new G4UIparameter("density-threshold",'d',omitable = true);
|
|---|
| 130 | parameter->SetDefaultValue("0.01");
|
|---|
| 131 | fpCommandCulling->SetParameter(parameter);
|
|---|
| 132 | parameter = new G4UIparameter("unit",'s',omitable = true);
|
|---|
| 133 | parameter->SetParameterCandidates ("g/cm3, mg/cm3 kg/m3");
|
|---|
| 134 | parameter->SetDefaultValue("g/cm3");
|
|---|
| 135 | fpCommandCulling->SetParameter(parameter);
|
|---|
| 136 |
|
|---|
| 137 | fpCommandCutawayMode =
|
|---|
| 138 | new G4UIcmdWithAString ("/vis/viewer/set/cutawayMode", this);
|
|---|
| 139 | fpCommandCutawayMode->SetGuidance
|
|---|
| 140 | ("Sets cutaway mode - add (union) or multiply (intersection).");
|
|---|
| 141 | fpCommandCutawayMode->SetParameterName ("cutaway-mode",omitable = false);
|
|---|
| 142 | fpCommandCutawayMode->SetCandidates ("add union multiply intersection");
|
|---|
| 143 | fpCommandCutawayMode->SetDefaultValue("union");
|
|---|
| 144 |
|
|---|
| 145 | fpCommandDefaultColour = new G4UIcommand
|
|---|
| 146 | ("/vis/viewer/set/defaultColour",this);
|
|---|
| 147 | fpCommandDefaultColour->SetGuidance
|
|---|
| 148 | ("Set defaultColour colour and transparency (default white and opaque).");
|
|---|
| 149 | fpCommandDefaultColour->SetGuidance
|
|---|
| 150 | ("Accepts (a) RGB triplet. e.g., \".3 .4 .5\", or"
|
|---|
| 151 | "\n(b) string such as \"white\", \"black\", \"grey\", \"red\"..."
|
|---|
| 152 | "\n(c) an additional number for opacity, e.g., \".3 .4 .5 .6\""
|
|---|
| 153 | "\n or \"grey ! ! .6\" (note \"!\"'s for unused green and blue parameters),"
|
|---|
| 154 | "\n e.g. \"! ! ! 0.\" for a transparent colour.");
|
|---|
| 155 | parameter = new G4UIparameter("red_or_string", 's', omitable = true);
|
|---|
| 156 | parameter -> SetDefaultValue ("1.");
|
|---|
| 157 | fpCommandDefaultColour -> SetParameter (parameter);
|
|---|
| 158 | parameter = new G4UIparameter("green", 'd', omitable = true);
|
|---|
| 159 | parameter -> SetDefaultValue (1.);
|
|---|
| 160 | fpCommandDefaultColour -> SetParameter (parameter);
|
|---|
| 161 | parameter = new G4UIparameter ("blue", 'd', omitable = true);
|
|---|
| 162 | parameter -> SetDefaultValue (1.);
|
|---|
| 163 | fpCommandDefaultColour -> SetParameter (parameter);
|
|---|
| 164 | parameter = new G4UIparameter ("opacity", 'd', omitable = true);
|
|---|
| 165 | parameter -> SetDefaultValue (1.);
|
|---|
| 166 | fpCommandDefaultColour -> SetParameter (parameter);
|
|---|
| 167 |
|
|---|
| 168 | fpCommandDefaultTextColour = new G4UIcommand
|
|---|
| 169 | ("/vis/viewer/set/defaultTextColour",this);
|
|---|
| 170 | fpCommandDefaultTextColour->SetGuidance
|
|---|
| 171 | ("Set defaultTextColour colour and transparency (default white and opaque).");
|
|---|
| 172 | fpCommandDefaultTextColour->SetGuidance
|
|---|
| 173 | ("Accepts (a) RGB triplet. e.g., \".3 .4 .5\", or"
|
|---|
| 174 | "\n(b) string such as \"white\", \"black\", \"grey\", \"red\"..."
|
|---|
| 175 | "\n(c) an additional number for opacity, e.g., \".3 .4 .5 .6\""
|
|---|
| 176 | "\n or \"grey ! ! .6\" (note \"!\"'s for unused green and blue parameters),"
|
|---|
| 177 | "\n e.g. \"! ! ! 0.\" for a transparent colour.");
|
|---|
| 178 | parameter = new G4UIparameter("red_or_string", 's', omitable = true);
|
|---|
| 179 | parameter -> SetDefaultValue ("1.");
|
|---|
| 180 | fpCommandDefaultTextColour -> SetParameter (parameter);
|
|---|
| 181 | parameter = new G4UIparameter("green", 'd', omitable = true);
|
|---|
| 182 | parameter -> SetDefaultValue (1.);
|
|---|
| 183 | fpCommandDefaultTextColour -> SetParameter (parameter);
|
|---|
| 184 | parameter = new G4UIparameter ("blue", 'd', omitable = true);
|
|---|
| 185 | parameter -> SetDefaultValue (1.);
|
|---|
| 186 | fpCommandDefaultTextColour -> SetParameter (parameter);
|
|---|
| 187 | parameter = new G4UIparameter ("opacity", 'd', omitable = true);
|
|---|
| 188 | parameter -> SetDefaultValue (1.);
|
|---|
| 189 | fpCommandDefaultTextColour -> SetParameter (parameter);
|
|---|
| 190 |
|
|---|
| 191 | fpCommandEdge = new G4UIcmdWithABool("/vis/viewer/set/edge",this);
|
|---|
| 192 | fpCommandEdge->SetGuidance
|
|---|
| 193 | ("Edges become visible/invisible in surface mode.");
|
|---|
| 194 | fpCommandEdge->SetParameterName("edge",omitable = true);
|
|---|
| 195 | fpCommandEdge->SetDefaultValue(true);
|
|---|
| 196 |
|
|---|
| 197 | fpCommandExplodeFactor = new G4UIcommand
|
|---|
| 198 | ("/vis/viewer/set/explodeFactor", this);
|
|---|
| 199 | fpCommandExplodeFactor->SetGuidance
|
|---|
| 200 | ("Moves top-level drawn volumes by this factor from this centre.");
|
|---|
| 201 | parameter = new G4UIparameter("explodeFactor", 'd', omitable=true);
|
|---|
| 202 | parameter->SetParameterRange("explodeFactor>=1.");
|
|---|
| 203 | parameter->SetDefaultValue(1.);
|
|---|
| 204 | fpCommandExplodeFactor->SetParameter(parameter);
|
|---|
| 205 | parameter = new G4UIparameter("x",'d',omitable = true);
|
|---|
| 206 | parameter->SetDefaultValue (0);
|
|---|
| 207 | parameter->SetGuidance ("Coordinate of explode centre.");
|
|---|
| 208 | fpCommandExplodeFactor->SetParameter(parameter);
|
|---|
| 209 | parameter = new G4UIparameter("y",'d',omitable = true);
|
|---|
| 210 | parameter->SetDefaultValue (0);
|
|---|
| 211 | parameter->SetGuidance ("Coordinate of explode centre.");
|
|---|
| 212 | fpCommandExplodeFactor->SetParameter(parameter);
|
|---|
| 213 | parameter = new G4UIparameter("z",'d',omitable = true);
|
|---|
| 214 | parameter->SetDefaultValue (0);
|
|---|
| 215 | parameter->SetGuidance ("Coordinate of explode centre.");
|
|---|
| 216 | fpCommandExplodeFactor->SetParameter(parameter);
|
|---|
| 217 | parameter = new G4UIparameter("unit",'s',omitable = true);
|
|---|
| 218 | parameter->SetDefaultValue ("m");
|
|---|
| 219 | parameter->SetGuidance ("Unit of explode centre.");
|
|---|
| 220 | fpCommandExplodeFactor->SetParameter(parameter);
|
|---|
| 221 |
|
|---|
| 222 | fpCommandGlobalLineWidthScale = new G4UIcmdWithADouble
|
|---|
| 223 | ("/vis/viewer/set/globalLineWidthScale", this);
|
|---|
| 224 | fpCommandGlobalLineWidthScale->SetGuidance
|
|---|
| 225 | ("Multiplies line widths by this factor.");
|
|---|
| 226 | fpCommandGlobalLineWidthScale->
|
|---|
| 227 | SetParameterName("scale-factor", omitable=true);
|
|---|
| 228 | fpCommandGlobalLineWidthScale->SetDefaultValue(1.);
|
|---|
| 229 |
|
|---|
| 230 | fpCommandGlobalMarkerScale = new G4UIcmdWithADouble
|
|---|
| 231 | ("/vis/viewer/set/globalMarkerScale", this);
|
|---|
| 232 | fpCommandGlobalMarkerScale->SetGuidance
|
|---|
| 233 | ("Multiplies marker sizes by this factor.");
|
|---|
| 234 | fpCommandGlobalMarkerScale->
|
|---|
| 235 | SetParameterName("scale-factor", omitable=true);
|
|---|
| 236 | fpCommandGlobalMarkerScale->SetDefaultValue(1.);
|
|---|
| 237 |
|
|---|
| 238 | fpCommandHiddenEdge =
|
|---|
| 239 | new G4UIcmdWithABool("/vis/viewer/set/hiddenEdge",this);
|
|---|
| 240 | fpCommandHiddenEdge->SetGuidance
|
|---|
| 241 | ("Edges become hidden/seen in wireframe or surface mode.");
|
|---|
| 242 | fpCommandHiddenEdge->SetParameterName("hidden-edge",omitable = true);
|
|---|
| 243 | fpCommandHiddenEdge->SetDefaultValue(true);
|
|---|
| 244 |
|
|---|
| 245 | fpCommandHiddenMarker =
|
|---|
| 246 | new G4UIcmdWithABool("/vis/viewer/set/hiddenMarker",this);
|
|---|
| 247 | fpCommandHiddenMarker->SetGuidance
|
|---|
| 248 | ("If true, closer objects hide markers. Otherwise, markers always show.");
|
|---|
| 249 | fpCommandHiddenMarker->SetParameterName("hidden-marker",omitable = true);
|
|---|
| 250 | fpCommandHiddenMarker->SetDefaultValue(true);
|
|---|
| 251 |
|
|---|
| 252 | fpCommandLightsMove = new G4UIcmdWithAString
|
|---|
| 253 | ("/vis/viewer/set/lightsMove",this);
|
|---|
| 254 | fpCommandLightsMove->SetGuidance
|
|---|
| 255 | ("Lights move with camera or with object");
|
|---|
| 256 | fpCommandLightsMove->SetParameterName("lightsMove",omitable = false);
|
|---|
| 257 | fpCommandLightsMove->SetCandidates
|
|---|
| 258 | ("cam camera with-camera obj object with-object");
|
|---|
| 259 |
|
|---|
| 260 | fpCommandLightsThetaPhi = new G4UIcommand
|
|---|
| 261 | ("/vis/viewer/set/lightsThetaPhi", this);
|
|---|
| 262 | fpCommandLightsThetaPhi->SetGuidance
|
|---|
| 263 | ("Set direction from target to lights.");
|
|---|
| 264 | parameter = new G4UIparameter("theta", 'd', omitable = true);
|
|---|
| 265 | parameter -> SetDefaultValue(60.);
|
|---|
| 266 | fpCommandLightsThetaPhi -> SetParameter (parameter);
|
|---|
| 267 | parameter = new G4UIparameter("phi", 'd', omitable = true);
|
|---|
| 268 | parameter -> SetDefaultValue(45.);
|
|---|
| 269 | fpCommandLightsThetaPhi -> SetParameter (parameter);
|
|---|
| 270 | parameter = new G4UIparameter ("unit", 's', omitable = true);
|
|---|
| 271 | parameter -> SetDefaultValue ("deg");
|
|---|
| 272 | fpCommandLightsThetaPhi -> SetParameter (parameter);
|
|---|
| 273 |
|
|---|
| 274 | fpCommandLightsVector = new G4UIcommand
|
|---|
| 275 | ("/vis/viewer/set/lightsVector", this);
|
|---|
| 276 | fpCommandLightsVector->SetGuidance
|
|---|
| 277 | ("Set direction from target to lights.");
|
|---|
| 278 | parameter = new G4UIparameter("x", 'd', omitable = true);
|
|---|
| 279 | parameter -> SetDefaultValue (1);
|
|---|
| 280 | fpCommandLightsVector -> SetParameter (parameter);
|
|---|
| 281 | parameter = new G4UIparameter("y", 'd', omitable = true);
|
|---|
| 282 | parameter -> SetDefaultValue (1);
|
|---|
| 283 | fpCommandLightsVector -> SetParameter (parameter);
|
|---|
| 284 | parameter = new G4UIparameter ("z", 'd', omitable = true);
|
|---|
| 285 | parameter -> SetDefaultValue (1);
|
|---|
| 286 | fpCommandLightsVector -> SetParameter (parameter);
|
|---|
| 287 |
|
|---|
| 288 | fpCommandLineSegments = new G4UIcmdWithAnInteger
|
|---|
| 289 | ("/vis/viewer/set/lineSegmentsPerCircle",this);
|
|---|
| 290 | fpCommandLineSegments->SetGuidance
|
|---|
| 291 | ("Set number of sides per circle for polygon/polyhedron drawing.");
|
|---|
| 292 | fpCommandLineSegments->SetGuidance
|
|---|
| 293 | ("Refers to graphical representation of objects with curved lines/surfaces.");
|
|---|
| 294 | fpCommandLineSegments->SetParameterName("line-segments",omitable = true);
|
|---|
| 295 | fpCommandLineSegments->SetDefaultValue(24);
|
|---|
| 296 |
|
|---|
| 297 | fpCommandPicking = new G4UIcmdWithABool
|
|---|
| 298 | ("/vis/viewer/set/picking",this);
|
|---|
| 299 | fpCommandPicking->SetGuidance("Sets picking, if available.");
|
|---|
| 300 | fpCommandPicking->SetGuidance
|
|---|
| 301 | ("If true, view is set up for picking, if available."
|
|---|
| 302 | "\nFor required actions, watch for instructions for viewer.");
|
|---|
| 303 | fpCommandPicking->SetParameterName("picking",omitable = true);
|
|---|
| 304 | fpCommandPicking->SetDefaultValue(true);
|
|---|
| 305 |
|
|---|
| 306 | fpCommandProjection = new G4UIcommand("/vis/viewer/set/projection",this);
|
|---|
| 307 | fpCommandProjection->SetGuidance
|
|---|
| 308 | ("Orthogonal or perspective projection.");
|
|---|
| 309 | parameter = new G4UIparameter("projection",'s',omitable = true);
|
|---|
| 310 | parameter->SetParameterCandidates("o orthogonal p perspective");
|
|---|
| 311 | parameter->SetDefaultValue("orthogonal");
|
|---|
| 312 | fpCommandProjection->SetParameter(parameter);
|
|---|
| 313 | parameter = new G4UIparameter("field-half-angle",'d',omitable = true);
|
|---|
| 314 | parameter->SetDefaultValue(30.);
|
|---|
| 315 | //parameter->SetCurrentAsDefault(true);
|
|---|
| 316 | fpCommandProjection->SetParameter(parameter);
|
|---|
| 317 | parameter = new G4UIparameter("unit",'s',omitable = true);
|
|---|
| 318 | parameter->SetDefaultValue("deg");
|
|---|
| 319 | //parameter->SetCurrentAsDefault(true);
|
|---|
| 320 | fpCommandProjection->SetParameter(parameter);
|
|---|
| 321 |
|
|---|
| 322 | fpCommandSectionPlane = new G4UIcommand("/vis/viewer/set/sectionPlane",this);
|
|---|
| 323 | fpCommandSectionPlane -> SetGuidance
|
|---|
| 324 | ("Set plane for drawing section (DCUT).");
|
|---|
| 325 | fpCommandSectionPlane -> SetGuidance
|
|---|
| 326 | ("E.g., for a y-z plane at x = 1 cm:"
|
|---|
| 327 | "\n\"/vis/viewer/set/sectionPlane on 1 0 0 cm 1 0 0\"."
|
|---|
| 328 | "\nTo turn off: /vis/viewer/set/sectionPlane off");
|
|---|
| 329 | parameter = new G4UIparameter("Selector",'c',true);
|
|---|
| 330 | parameter -> SetDefaultValue ("on");
|
|---|
| 331 | fpCommandSectionPlane->SetParameter(parameter);
|
|---|
| 332 | parameter = new G4UIparameter("x",'d',omitable = true);
|
|---|
| 333 | parameter -> SetDefaultValue (0);
|
|---|
| 334 | parameter -> SetGuidance ("Coordinate of point on the plane.");
|
|---|
| 335 | fpCommandSectionPlane->SetParameter(parameter);
|
|---|
| 336 | parameter = new G4UIparameter("y",'d',omitable = true);
|
|---|
| 337 | parameter -> SetDefaultValue (0);
|
|---|
| 338 | parameter -> SetGuidance ("Coordinate of point on the plane.");
|
|---|
| 339 | fpCommandSectionPlane->SetParameter(parameter);
|
|---|
| 340 | parameter = new G4UIparameter("z",'d',omitable = true);
|
|---|
| 341 | parameter -> SetDefaultValue (0);
|
|---|
| 342 | parameter -> SetGuidance ("Coordinate of point on the plane.");
|
|---|
| 343 | fpCommandSectionPlane->SetParameter(parameter);
|
|---|
| 344 | parameter = new G4UIparameter("unit",'s',omitable = true);
|
|---|
| 345 | parameter -> SetDefaultValue ("m");
|
|---|
| 346 | parameter -> SetGuidance ("Unit of point on the plane.");
|
|---|
| 347 | fpCommandSectionPlane->SetParameter(parameter);
|
|---|
| 348 | parameter = new G4UIparameter("nx",'d',omitable = true);
|
|---|
| 349 | parameter -> SetDefaultValue (1);
|
|---|
| 350 | parameter -> SetGuidance ("Component of plane normal.");
|
|---|
| 351 | fpCommandSectionPlane->SetParameter(parameter);
|
|---|
| 352 | parameter = new G4UIparameter("ny",'d',omitable = true);
|
|---|
| 353 | parameter -> SetDefaultValue (0);
|
|---|
| 354 | parameter -> SetGuidance ("Component of plane normal.");
|
|---|
| 355 | fpCommandSectionPlane->SetParameter(parameter);
|
|---|
| 356 | parameter = new G4UIparameter("nz",'d',omitable = true);
|
|---|
| 357 | parameter -> SetDefaultValue (0);
|
|---|
| 358 | parameter -> SetGuidance ("Component of plane normal.");
|
|---|
| 359 | fpCommandSectionPlane->SetParameter(parameter);
|
|---|
| 360 |
|
|---|
| 361 | fpCommandStyle = new G4UIcmdWithAString ("/vis/viewer/set/style",this);
|
|---|
| 362 | fpCommandStyle->SetGuidance
|
|---|
| 363 | ("Set style of drawing - w[ireframe] or s[urface].");
|
|---|
| 364 | fpCommandStyle->SetGuidance
|
|---|
| 365 | ("(Hidden line drawing is controlled by \"/vis/viewer/set/hiddenEdge\".)");
|
|---|
| 366 | fpCommandStyle->SetParameterName ("style",omitable = false);
|
|---|
| 367 |
|
|---|
| 368 | fpCommandTargetPoint = new G4UIcmdWith3VectorAndUnit
|
|---|
| 369 | ("/vis/viewer/set/targetPoint", this);
|
|---|
| 370 | fpCommandTargetPoint->SetGuidance
|
|---|
| 371 | ("Set target point.");
|
|---|
| 372 | fpCommandTargetPoint->SetGuidance
|
|---|
| 373 | ("This sets the \"Current Target Point\" relative to the \"Standard");
|
|---|
| 374 | fpCommandTargetPoint->SetGuidance
|
|---|
| 375 | ("Target Point\" so that the actual target point is as requested.");
|
|---|
| 376 | fpCommandTargetPoint->SetGuidance
|
|---|
| 377 | ("(See G4ViewParameters.hh for an explanation of target points.)");
|
|---|
| 378 | fpCommandTargetPoint->SetParameterName("x", "y", "z", omitable = false);
|
|---|
| 379 | fpCommandTargetPoint->SetUnitCategory("Length");
|
|---|
| 380 |
|
|---|
| 381 | fpCommandUpThetaPhi = new G4UIcommand
|
|---|
| 382 | ("/vis/viewer/set/upThetaPhi", this);
|
|---|
| 383 | fpCommandUpThetaPhi -> SetGuidance ("Set up vector.");
|
|---|
| 384 | fpCommandUpThetaPhi -> SetGuidance
|
|---|
| 385 | ("Viewer will attempt always to show this direction upwards.");
|
|---|
| 386 | parameter = new G4UIparameter("theta", 'd', omitable = true);
|
|---|
| 387 | parameter -> SetDefaultValue (90.);
|
|---|
| 388 | fpCommandUpThetaPhi -> SetParameter (parameter);
|
|---|
| 389 | parameter = new G4UIparameter("phi", 'd', omitable = true);
|
|---|
| 390 | parameter -> SetDefaultValue (90.);
|
|---|
| 391 | fpCommandUpThetaPhi -> SetParameter (parameter);
|
|---|
| 392 | parameter = new G4UIparameter ("unit", 's', omitable = true);
|
|---|
| 393 | parameter -> SetDefaultValue ("deg");
|
|---|
| 394 | fpCommandUpThetaPhi -> SetParameter (parameter);
|
|---|
| 395 |
|
|---|
| 396 | fpCommandUpVector = new G4UIcommand
|
|---|
| 397 | ("/vis/viewer/set/upVector", this);
|
|---|
| 398 | fpCommandUpVector -> SetGuidance ("Set up vector.");
|
|---|
| 399 | fpCommandUpVector -> SetGuidance
|
|---|
| 400 | ("Viewer will attempt always to show this direction upwards.");
|
|---|
| 401 | parameter = new G4UIparameter("x", 'd', omitable = true);
|
|---|
| 402 | parameter -> SetDefaultValue (0.);
|
|---|
| 403 | fpCommandUpVector -> SetParameter (parameter);
|
|---|
| 404 | parameter = new G4UIparameter("y", 'd', omitable = true);
|
|---|
| 405 | parameter -> SetDefaultValue (1.);
|
|---|
| 406 | fpCommandUpVector -> SetParameter (parameter);
|
|---|
| 407 | parameter = new G4UIparameter ("z", 'd', omitable = true);
|
|---|
| 408 | parameter -> SetDefaultValue (0.);
|
|---|
| 409 | fpCommandUpVector -> SetParameter (parameter);
|
|---|
| 410 |
|
|---|
| 411 | fpCommandViewpointThetaPhi = new G4UIcommand
|
|---|
| 412 | ("/vis/viewer/set/viewpointThetaPhi", this);
|
|---|
| 413 | fpCommandViewpointThetaPhi -> SetGuidance
|
|---|
| 414 | ("Set direction from target to camera.");
|
|---|
| 415 | fpCommandViewpointThetaPhi -> SetGuidance
|
|---|
| 416 | ("Also changes lightpoint direction if lights are set to move with camera.");
|
|---|
| 417 | parameter = new G4UIparameter("theta", 'd', omitable = true);
|
|---|
| 418 | parameter -> SetDefaultValue (60.);
|
|---|
| 419 | fpCommandViewpointThetaPhi -> SetParameter (parameter);
|
|---|
| 420 | parameter = new G4UIparameter("phi", 'd', omitable = true);
|
|---|
| 421 | parameter -> SetDefaultValue (45.);
|
|---|
| 422 | fpCommandViewpointThetaPhi -> SetParameter (parameter);
|
|---|
| 423 | parameter = new G4UIparameter ("unit", 's', omitable = true);
|
|---|
| 424 | parameter -> SetDefaultValue ("deg");
|
|---|
| 425 | fpCommandViewpointThetaPhi -> SetParameter (parameter);
|
|---|
| 426 |
|
|---|
| 427 | fpCommandViewpointVector = new G4UIcommand
|
|---|
| 428 | ("/vis/viewer/set/viewpointVector", this);
|
|---|
| 429 | fpCommandViewpointVector -> SetGuidance
|
|---|
| 430 | ("Set direction from target to camera.");
|
|---|
| 431 | fpCommandViewpointVector -> SetGuidance
|
|---|
| 432 | ("Also changes lightpoint direction if lights are set to move with camera.");
|
|---|
| 433 | parameter = new G4UIparameter("x", 'd', omitable = true);
|
|---|
| 434 | parameter -> SetDefaultValue (1.);
|
|---|
| 435 | fpCommandViewpointVector -> SetParameter (parameter);
|
|---|
| 436 | parameter = new G4UIparameter("y", 'd', omitable = true);
|
|---|
| 437 | parameter -> SetDefaultValue (1.);
|
|---|
| 438 | fpCommandViewpointVector -> SetParameter (parameter);
|
|---|
| 439 | parameter = new G4UIparameter ("z", 'd', omitable = true);
|
|---|
| 440 | parameter -> SetDefaultValue (1.);
|
|---|
| 441 | fpCommandViewpointVector -> SetParameter (parameter);
|
|---|
| 442 | }
|
|---|
| 443 |
|
|---|
| 444 | G4VisCommandsViewerSet::~G4VisCommandsViewerSet() {
|
|---|
| 445 | delete fpCommandAll;
|
|---|
| 446 | delete fpCommandAuxEdge;
|
|---|
| 447 | delete fpCommandAutoRefresh;
|
|---|
| 448 | delete fpCommandBackground;
|
|---|
| 449 | delete fpCommandCulling;
|
|---|
| 450 | delete fpCommandCutawayMode;
|
|---|
| 451 | delete fpCommandDefaultColour;
|
|---|
| 452 | delete fpCommandDefaultTextColour;
|
|---|
| 453 | delete fpCommandEdge;
|
|---|
| 454 | delete fpCommandExplodeFactor;
|
|---|
| 455 | delete fpCommandGlobalLineWidthScale;
|
|---|
| 456 | delete fpCommandGlobalMarkerScale;
|
|---|
| 457 | delete fpCommandHiddenEdge;
|
|---|
| 458 | delete fpCommandHiddenMarker;
|
|---|
| 459 | delete fpCommandLineSegments;
|
|---|
| 460 | delete fpCommandLightsMove;
|
|---|
| 461 | delete fpCommandLightsThetaPhi;
|
|---|
| 462 | delete fpCommandLightsVector;
|
|---|
| 463 | delete fpCommandPicking;
|
|---|
| 464 | delete fpCommandProjection;
|
|---|
| 465 | delete fpCommandSectionPlane;
|
|---|
| 466 | delete fpCommandStyle;
|
|---|
| 467 | delete fpCommandTargetPoint;
|
|---|
| 468 | delete fpCommandUpThetaPhi;
|
|---|
| 469 | delete fpCommandUpVector;
|
|---|
| 470 | delete fpCommandViewpointThetaPhi;
|
|---|
| 471 | delete fpCommandViewpointVector;
|
|---|
| 472 | }
|
|---|
| 473 |
|
|---|
| 474 | G4String G4VisCommandsViewerSet::GetCurrentValue(G4UIcommand*) {
|
|---|
| 475 | return "";
|
|---|
| 476 | }
|
|---|
| 477 |
|
|---|
| 478 | void G4VisCommandsViewerSet::SetNewValue
|
|---|
| 479 | (G4UIcommand* command,G4String newValue) {
|
|---|
| 480 |
|
|---|
| 481 | G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
|
|---|
| 482 |
|
|---|
| 483 | G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
|
|---|
| 484 | if (!currentViewer) {
|
|---|
| 485 | if (verbosity >= G4VisManager::errors) {
|
|---|
| 486 | G4cout <<
|
|---|
| 487 | "ERROR: G4VisCommandsViewerSet::SetNewValue: no current viewer."
|
|---|
| 488 | << G4endl;
|
|---|
| 489 | }
|
|---|
| 490 | return;
|
|---|
| 491 | }
|
|---|
| 492 |
|
|---|
| 493 | G4ViewParameters vp = currentViewer->GetViewParameters();
|
|---|
| 494 |
|
|---|
| 495 | if (command == fpCommandAll) {
|
|---|
| 496 | G4VViewer* fromViewer = fpVisManager->GetViewer(newValue);
|
|---|
| 497 | if (!fromViewer) {
|
|---|
| 498 | if (verbosity >= G4VisManager::errors) {
|
|---|
| 499 | G4cout <<
|
|---|
| 500 | "ERROR: G4VisCommandsViewerSet::SetNewValue: all:"
|
|---|
| 501 | "\n unrecognised from-viewer."
|
|---|
| 502 | << G4endl;
|
|---|
| 503 | }
|
|---|
| 504 | return;
|
|---|
| 505 | }
|
|---|
| 506 | if (fromViewer == currentViewer) {
|
|---|
| 507 | if (verbosity >= G4VisManager::warnings) {
|
|---|
| 508 | G4cout <<
|
|---|
| 509 | "WARNING: G4VisCommandsViewerSet::SetNewValue: all:"
|
|---|
| 510 | "\n from-viewer and current viewer are identical."
|
|---|
| 511 | << G4endl;
|
|---|
| 512 | }
|
|---|
| 513 | return;
|
|---|
| 514 | }
|
|---|
| 515 | // Copy view parameters except for autoRefresh...
|
|---|
| 516 | G4bool currentAutoRefresh =
|
|---|
| 517 | currentViewer->GetViewParameters().IsAutoRefresh();
|
|---|
| 518 | vp = fromViewer->GetViewParameters();
|
|---|
| 519 | vp.SetAutoRefresh(currentAutoRefresh);
|
|---|
| 520 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 521 | G4cout << "View parameters of viewer \"" << currentViewer->GetName()
|
|---|
| 522 | << "\"\n set to those of viewer \"" << fromViewer->GetName()
|
|---|
| 523 | << "\"."
|
|---|
| 524 | << G4endl;
|
|---|
| 525 | }
|
|---|
| 526 | }
|
|---|
| 527 |
|
|---|
| 528 | else if (command == fpCommandAutoRefresh) {
|
|---|
| 529 | G4bool autoRefresh = G4UIcommand::ConvertToBool(newValue);
|
|---|
| 530 | vp.SetAutoRefresh(autoRefresh);
|
|---|
| 531 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 532 | G4cout << "Views will ";
|
|---|
| 533 | if (!vp.IsAutoRefresh()) G4cout << "not ";
|
|---|
| 534 | G4cout << "be automatically refreshed after a change of view parameters."
|
|---|
| 535 | << G4endl;
|
|---|
| 536 | }
|
|---|
| 537 | if (!vp.IsAutoRefresh()) {
|
|---|
| 538 | currentViewer->SetViewParameters(vp);
|
|---|
| 539 | return; // Avoid a refresh id auto-refresh has been set to off...
|
|---|
| 540 | } // ...otherwise take normal action.
|
|---|
| 541 | }
|
|---|
| 542 |
|
|---|
| 543 | else if (command == fpCommandAuxEdge) {
|
|---|
| 544 | vp.SetAuxEdgeVisible(G4UIcommand::ConvertToBool(newValue));
|
|---|
| 545 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 546 | G4cout << "Auxiliary edges will ";
|
|---|
| 547 | if (!vp.IsAuxEdgeVisible()) G4cout << "not ";
|
|---|
| 548 | G4cout << "be visible." << G4endl;
|
|---|
| 549 | }
|
|---|
| 550 | }
|
|---|
| 551 |
|
|---|
| 552 | else if (command == fpCommandBackground) {
|
|---|
| 553 | G4String redOrString;
|
|---|
| 554 | G4double green, blue, opacity;
|
|---|
| 555 | std::istringstream iss(newValue);
|
|---|
| 556 | iss >> redOrString >> green >> blue >> opacity;
|
|---|
| 557 | G4Colour colour(0.,0.,0.); // Default black and opaque.
|
|---|
| 558 | const size_t iPos0 = 0;
|
|---|
| 559 | if (std::isalpha(redOrString[iPos0])) {
|
|---|
| 560 | G4Colour::GetColour(redOrString, colour); // Remains default (black) if
|
|---|
| 561 | // not found.
|
|---|
| 562 | } else {
|
|---|
| 563 | colour = G4Colour(G4UIcommand::ConvertTo3Vector(newValue));
|
|---|
| 564 | }
|
|---|
| 565 | colour = G4Colour(colour.GetRed(), colour.GetGreen(), colour.GetBlue(), opacity);
|
|---|
| 566 | vp.SetBackgroundColour(colour);
|
|---|
| 567 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 568 | G4cout << "Background colour "
|
|---|
| 569 | << vp.GetBackgroundColour()
|
|---|
| 570 | << " requested."
|
|---|
| 571 | << G4endl;
|
|---|
| 572 | }
|
|---|
| 573 | }
|
|---|
| 574 |
|
|---|
| 575 | else if (command == fpCommandCulling) {
|
|---|
| 576 | G4String cullingOption, stringFlag, unit;
|
|---|
| 577 | G4double density;
|
|---|
| 578 | std::istringstream is (newValue);
|
|---|
| 579 | is >> cullingOption >> stringFlag >> density >> unit;
|
|---|
| 580 | G4bool boolFlag = G4UIcommand::ConvertToBool(stringFlag);
|
|---|
| 581 | if (cullingOption == "global") {
|
|---|
| 582 | vp.SetCulling(boolFlag);
|
|---|
| 583 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 584 | G4cout <<
|
|---|
| 585 | "G4VisCommandsViewerSet::SetNewValue: culling: global culling flag"
|
|---|
| 586 | " set to " << G4UIcommand::ConvertToString(boolFlag) <<
|
|---|
| 587 | ".\n Does not change specific culling flags."
|
|---|
| 588 | << G4endl;
|
|---|
| 589 | }
|
|---|
| 590 | }
|
|---|
| 591 | else if (cullingOption == "coveredDaughters") {
|
|---|
| 592 | vp.SetCullingCovered(boolFlag);
|
|---|
| 593 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 594 | G4cout <<
|
|---|
| 595 | "G4VisCommandsViewerSet::SetNewValue: culling: culling covered"
|
|---|
| 596 | "\n daughters flag set to "
|
|---|
| 597 | << G4UIcommand::ConvertToString(boolFlag) <<
|
|---|
| 598 | ". Daughters covered by opaque mothers"
|
|---|
| 599 | "\n will be culled, i.e., not drawn, if this flag is true."
|
|---|
| 600 | "\n Note: this is only effective in surface drawing style,"
|
|---|
| 601 | "\n and then only if the volumes are visible and opaque, and then"
|
|---|
| 602 | "\n only if no sections or cutaways are in operation."
|
|---|
| 603 | << G4endl;
|
|---|
| 604 | }
|
|---|
| 605 | }
|
|---|
| 606 | else if (cullingOption == "invisible") {
|
|---|
| 607 | vp.SetCullingInvisible(boolFlag);
|
|---|
| 608 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 609 | G4cout <<
|
|---|
| 610 | "G4VisCommandsViewerSet::SetNewValue: culling: culling invisible"
|
|---|
| 611 | "\n flag set to "
|
|---|
| 612 | << boolFlag << G4UIcommand::ConvertToString(boolFlag) <<
|
|---|
| 613 | ". Volumes marked invisible will be culled,"
|
|---|
| 614 | "\n i.e., not drawn, if this flag is true."
|
|---|
| 615 | << G4endl;
|
|---|
| 616 | }
|
|---|
| 617 | }
|
|---|
| 618 | else if (cullingOption == "density") {
|
|---|
| 619 | vp.SetDensityCulling(boolFlag);
|
|---|
| 620 | if (boolFlag) {
|
|---|
| 621 | density *= G4UnitDefinition::GetValueOf(unit);
|
|---|
| 622 | vp.SetVisibleDensity(density);
|
|---|
| 623 | }
|
|---|
| 624 | else {
|
|---|
| 625 | density = vp.GetVisibleDensity();
|
|---|
| 626 | }
|
|---|
| 627 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 628 | G4cout <<
|
|---|
| 629 | "G4VisCommandsViewerSet::SetNewValue: culling: culling by density"
|
|---|
| 630 | "\n flag set to " << G4UIcommand::ConvertToString(boolFlag) <<
|
|---|
| 631 | ". Volumes with density less than " <<
|
|---|
| 632 | G4BestUnit(density,"Volumic Mass") <<
|
|---|
| 633 | "\n will be culled, i.e., not drawn, if this flag is true."
|
|---|
| 634 | << G4endl;
|
|---|
| 635 | }
|
|---|
| 636 | }
|
|---|
| 637 | else {
|
|---|
| 638 | if (verbosity >= G4VisManager::errors) {
|
|---|
| 639 | G4cout <<
|
|---|
| 640 | "ERROR: G4VisCommandsViewerSet::SetNewValue: culling:"
|
|---|
| 641 | "\n option not recognised."
|
|---|
| 642 | << G4endl;
|
|---|
| 643 | }
|
|---|
| 644 | }
|
|---|
| 645 | }
|
|---|
| 646 |
|
|---|
| 647 | else if (command == fpCommandCutawayMode) {
|
|---|
| 648 | if (newValue == "add" || newValue == "union")
|
|---|
| 649 | vp.SetCutawayMode(G4ViewParameters::cutawayUnion);
|
|---|
| 650 | if (newValue == "multiply" || newValue == "intersection")
|
|---|
| 651 | vp.SetCutawayMode(G4ViewParameters::cutawayIntersection);
|
|---|
| 652 |
|
|---|
| 653 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 654 | G4cout << "Cutaway mode set to ";
|
|---|
| 655 | if (vp.GetCutawayMode() == G4ViewParameters::cutawayUnion)
|
|---|
| 656 | G4cout << "cutawayUnion";
|
|---|
| 657 | if (vp.GetCutawayMode() == G4ViewParameters::cutawayIntersection)
|
|---|
| 658 | G4cout << "cutawayIntersection";
|
|---|
| 659 | G4cout << G4endl;
|
|---|
| 660 | }
|
|---|
| 661 | }
|
|---|
| 662 |
|
|---|
| 663 | else if (command == fpCommandDefaultColour) {
|
|---|
| 664 | G4String redOrString;
|
|---|
| 665 | G4double green, blue, opacity;
|
|---|
| 666 | std::istringstream iss(newValue);
|
|---|
| 667 | iss >> redOrString >> green >> blue >> opacity;
|
|---|
| 668 | G4Colour colour(1.,1.,1.); // Default white and opaque.
|
|---|
| 669 | const size_t iPos0 = 0;
|
|---|
| 670 | if (std::isalpha(redOrString[iPos0])) {
|
|---|
| 671 | G4Colour::GetColour(redOrString, colour); // Remains default (white) if
|
|---|
| 672 | // not found.
|
|---|
| 673 | } else {
|
|---|
| 674 | colour = G4Colour(G4UIcommand::ConvertTo3Vector(newValue));
|
|---|
| 675 | }
|
|---|
| 676 | colour = G4Colour(colour.GetRed(), colour.GetGreen(), colour.GetBlue(), opacity);
|
|---|
| 677 | G4VisAttributes va = vp.GetDefaultVisAttributes();
|
|---|
| 678 | va.SetColour(colour);
|
|---|
| 679 | vp.SetDefaultVisAttributes(va);
|
|---|
| 680 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 681 | G4cout << "Default colour "
|
|---|
| 682 | << vp.GetDefaultVisAttributes()->GetColour()
|
|---|
| 683 | << " requested."
|
|---|
| 684 | << G4endl;
|
|---|
| 685 | }
|
|---|
| 686 | }
|
|---|
| 687 |
|
|---|
| 688 | else if (command == fpCommandDefaultTextColour) {
|
|---|
| 689 | G4String redOrString;
|
|---|
| 690 | G4double green, blue, opacity;
|
|---|
| 691 | std::istringstream iss(newValue);
|
|---|
| 692 | iss >> redOrString >> green >> blue >> opacity;
|
|---|
| 693 | G4Colour colour(1.,1.,1.); // Default white and opaque.
|
|---|
| 694 | const size_t iPos0 = 0;
|
|---|
| 695 | if (std::isalpha(redOrString[iPos0])) {
|
|---|
| 696 | G4Colour::GetColour(redOrString, colour); // Remains default (white) if
|
|---|
| 697 | // not found.
|
|---|
| 698 | } else {
|
|---|
| 699 | colour = G4Colour(G4UIcommand::ConvertTo3Vector(newValue));
|
|---|
| 700 | }
|
|---|
| 701 | colour = G4Colour(colour.GetRed(), colour.GetGreen(), colour.GetBlue(), opacity);
|
|---|
| 702 | G4VisAttributes va = vp.GetDefaultTextVisAttributes();
|
|---|
| 703 | va.SetColour(colour);
|
|---|
| 704 | vp.SetDefaultTextVisAttributes(va);
|
|---|
| 705 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 706 | G4cout << "Default colour "
|
|---|
| 707 | << vp.GetDefaultTextVisAttributes()->GetColour()
|
|---|
| 708 | << " requested."
|
|---|
| 709 | << G4endl;
|
|---|
| 710 | }
|
|---|
| 711 | }
|
|---|
| 712 |
|
|---|
| 713 | else if (command == fpCommandEdge) {
|
|---|
| 714 | G4ViewParameters::DrawingStyle existingStyle = vp.GetDrawingStyle();
|
|---|
| 715 | if (G4UIcommand::ConvertToBool(newValue)) {
|
|---|
| 716 | switch (existingStyle) {
|
|---|
| 717 | case G4ViewParameters::wireframe:
|
|---|
| 718 | break;
|
|---|
| 719 | case G4ViewParameters::hlr:
|
|---|
| 720 | break;
|
|---|
| 721 | case G4ViewParameters::hsr:
|
|---|
| 722 | vp.SetDrawingStyle(G4ViewParameters::hlhsr);
|
|---|
| 723 | break;
|
|---|
| 724 | case G4ViewParameters::hlhsr:
|
|---|
| 725 | break;
|
|---|
| 726 | }
|
|---|
| 727 | }
|
|---|
| 728 | else {
|
|---|
| 729 | switch (existingStyle) {
|
|---|
| 730 | case G4ViewParameters::wireframe:
|
|---|
| 731 | break;
|
|---|
| 732 | case G4ViewParameters::hlr:
|
|---|
| 733 | break;
|
|---|
| 734 | case G4ViewParameters::hsr:
|
|---|
| 735 | break;
|
|---|
| 736 | case G4ViewParameters::hlhsr:
|
|---|
| 737 | vp.SetDrawingStyle(G4ViewParameters::hsr);
|
|---|
| 738 | break;
|
|---|
| 739 | }
|
|---|
| 740 | }
|
|---|
| 741 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 742 | G4cout << "Drawing style of viewer \"" << currentViewer->GetName()
|
|---|
| 743 | << "\" set to " << vp.GetDrawingStyle()
|
|---|
| 744 | << G4endl;
|
|---|
| 745 | }
|
|---|
| 746 | }
|
|---|
| 747 |
|
|---|
| 748 | else if (command == fpCommandExplodeFactor) {
|
|---|
| 749 | G4double explodeFactor, x, y, z;
|
|---|
| 750 | G4String unitString;
|
|---|
| 751 | std::istringstream is (newValue);
|
|---|
| 752 | is >> explodeFactor >> x >> y >> z >> unitString;
|
|---|
| 753 | G4double unit = G4UIcommand::ValueOf(unitString);
|
|---|
| 754 | vp.SetExplodeFactor(explodeFactor);
|
|---|
| 755 | vp.SetExplodeCentre(G4Point3D(x * unit, y * unit, z * unit));
|
|---|
| 756 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 757 | G4cout << "Explode factor changed to " << vp.GetExplodeFactor()
|
|---|
| 758 | << " from centre " << vp.GetExplodeCentre()
|
|---|
| 759 | << G4endl;
|
|---|
| 760 | }
|
|---|
| 761 | }
|
|---|
| 762 |
|
|---|
| 763 | else if (command == fpCommandGlobalLineWidthScale) {
|
|---|
| 764 | G4double globalLineWidthScale
|
|---|
| 765 | = fpCommandGlobalLineWidthScale->GetNewDoubleValue(newValue);
|
|---|
| 766 | vp.SetGlobalLineWidthScale(globalLineWidthScale);
|
|---|
| 767 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 768 | G4cout << "Global Line Width Scale changed to "
|
|---|
| 769 | << vp.GetGlobalLineWidthScale() << G4endl;
|
|---|
| 770 | }
|
|---|
| 771 | }
|
|---|
| 772 |
|
|---|
| 773 | else if (command == fpCommandGlobalMarkerScale) {
|
|---|
| 774 | G4double globalMarkerScale
|
|---|
| 775 | = fpCommandGlobalMarkerScale->GetNewDoubleValue(newValue);
|
|---|
| 776 | vp.SetGlobalMarkerScale(globalMarkerScale);
|
|---|
| 777 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 778 | G4cout << "Global Marker Scale changed to "
|
|---|
| 779 | << vp.GetGlobalMarkerScale() << G4endl;
|
|---|
| 780 | }
|
|---|
| 781 | }
|
|---|
| 782 |
|
|---|
| 783 | else if (command == fpCommandHiddenEdge) {
|
|---|
| 784 | G4ViewParameters::DrawingStyle existingStyle = vp.GetDrawingStyle();
|
|---|
| 785 | if (G4UIcommand::ConvertToBool(newValue)) {
|
|---|
| 786 | switch (existingStyle) {
|
|---|
| 787 | case G4ViewParameters::wireframe:
|
|---|
| 788 | vp.SetDrawingStyle(G4ViewParameters::hlr);
|
|---|
| 789 | break;
|
|---|
| 790 | case G4ViewParameters::hlr:
|
|---|
| 791 | break;
|
|---|
| 792 | case G4ViewParameters::hsr:
|
|---|
| 793 | vp.SetDrawingStyle(G4ViewParameters::hlhsr);
|
|---|
| 794 | break;
|
|---|
| 795 | case G4ViewParameters::hlhsr:
|
|---|
| 796 | break;
|
|---|
| 797 | }
|
|---|
| 798 | }
|
|---|
| 799 | else {
|
|---|
| 800 | switch (existingStyle) {
|
|---|
| 801 | case G4ViewParameters::wireframe:
|
|---|
| 802 | break;
|
|---|
| 803 | case G4ViewParameters::hlr:
|
|---|
| 804 | vp.SetDrawingStyle(G4ViewParameters::wireframe);
|
|---|
| 805 | break;
|
|---|
| 806 | case G4ViewParameters::hsr:
|
|---|
| 807 | break;
|
|---|
| 808 | case G4ViewParameters::hlhsr:
|
|---|
| 809 | vp.SetDrawingStyle(G4ViewParameters::hsr);
|
|---|
| 810 | break;
|
|---|
| 811 | }
|
|---|
| 812 | }
|
|---|
| 813 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 814 | G4cout << "Drawing style of viewer \"" << currentViewer->GetName()
|
|---|
| 815 | << "\" set to " << vp.GetDrawingStyle()
|
|---|
| 816 | << G4endl;
|
|---|
| 817 | }
|
|---|
| 818 | }
|
|---|
| 819 |
|
|---|
| 820 | else if (command == fpCommandHiddenMarker) {
|
|---|
| 821 | G4bool hidden = G4UIcommand::ConvertToBool(newValue);
|
|---|
| 822 | if (hidden) vp.SetMarkerHidden();
|
|---|
| 823 | else vp.SetMarkerNotHidden();
|
|---|
| 824 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 825 | G4cout << "Markers will ";
|
|---|
| 826 | if (vp.IsMarkerNotHidden()) G4cout << "not ";
|
|---|
| 827 | G4cout << "be hidden under solid objects." << G4endl;
|
|---|
| 828 | }
|
|---|
| 829 | }
|
|---|
| 830 |
|
|---|
| 831 | else if (command == fpCommandLightsMove) {
|
|---|
| 832 | G4String s (newValue);
|
|---|
| 833 | if (s.find("cam") != G4String::npos) vp.SetLightsMoveWithCamera(true);
|
|---|
| 834 | else if(s.find("obj") != G4String::npos) vp.SetLightsMoveWithCamera(false);
|
|---|
| 835 | else {
|
|---|
| 836 | if (verbosity >= G4VisManager::errors) {
|
|---|
| 837 | G4cout << "ERROR: \"" << newValue << "\" not recognised."
|
|---|
| 838 | " Looking for \"cam\" or \"obj\" in string." << G4endl;
|
|---|
| 839 | }
|
|---|
| 840 | }
|
|---|
| 841 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 842 | G4cout << "Lights move with ";
|
|---|
| 843 | if (vp.GetLightsMoveWithCamera())
|
|---|
| 844 | G4cout << "camera (object appears to rotate).";
|
|---|
| 845 | else G4cout << "object (the viewer appears to be moving).";
|
|---|
| 846 | G4cout << G4endl;
|
|---|
| 847 | }
|
|---|
| 848 | }
|
|---|
| 849 |
|
|---|
| 850 | else if (command == fpCommandLightsThetaPhi) {
|
|---|
| 851 | G4double theta, phi;
|
|---|
| 852 | ConvertToDoublePair(newValue, theta, phi);
|
|---|
| 853 | G4double x = std::sin (theta) * std::cos (phi);
|
|---|
| 854 | G4double y = std::sin (theta) * std::sin (phi);
|
|---|
| 855 | G4double z = std::cos (theta);
|
|---|
| 856 | fLightsVector = G4ThreeVector (x, y, z);
|
|---|
| 857 | vp.SetLightpointDirection(fLightsVector);
|
|---|
| 858 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 859 | G4cout << "Lights direction set to "
|
|---|
| 860 | << vp.GetLightpointDirection() << G4endl;
|
|---|
| 861 | }
|
|---|
| 862 | }
|
|---|
| 863 |
|
|---|
| 864 | else if (command == fpCommandLightsVector) {
|
|---|
| 865 | fLightsVector = G4UIcommand::ConvertTo3Vector(newValue);
|
|---|
| 866 | vp.SetLightpointDirection(fLightsVector);
|
|---|
| 867 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 868 | G4cout << "Lights direction set to "
|
|---|
| 869 | << vp.GetLightpointDirection() << G4endl;
|
|---|
| 870 | }
|
|---|
| 871 | }
|
|---|
| 872 |
|
|---|
| 873 | else if (command == fpCommandLineSegments) {
|
|---|
| 874 | G4int nSides = G4UIcommand::ConvertToInt(newValue);
|
|---|
| 875 | nSides = vp.SetNoOfSides(nSides);
|
|---|
| 876 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 877 | G4cout <<
|
|---|
| 878 | "Number of line segements per circle in polygon approximation is "
|
|---|
| 879 | << nSides << G4endl;
|
|---|
| 880 | }
|
|---|
| 881 | }
|
|---|
| 882 |
|
|---|
| 883 | else if (command == fpCommandPicking) {
|
|---|
| 884 | vp.SetPicking(G4UIcommand::ConvertToBool(newValue));
|
|---|
| 885 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 886 | G4cout << "Picking ";
|
|---|
| 887 | if (vp.IsPicking()) G4cout << "requested.";
|
|---|
| 888 | else G4cout << "inhibited.";
|
|---|
| 889 | G4cout << G4endl;
|
|---|
| 890 | }
|
|---|
| 891 | }
|
|---|
| 892 |
|
|---|
| 893 | else if (command == fpCommandProjection) {
|
|---|
| 894 | G4double fieldHalfAngle;
|
|---|
| 895 | const size_t iPos0 = 0;
|
|---|
| 896 | if (newValue[iPos0] == 'o') { // "orthogonal"
|
|---|
| 897 | fieldHalfAngle = 0.;
|
|---|
| 898 | }
|
|---|
| 899 | else if (newValue[iPos0] == 'p') { // "perspective"
|
|---|
| 900 | G4String dummy;
|
|---|
| 901 | G4String unit;
|
|---|
| 902 | std::istringstream is (newValue);
|
|---|
| 903 | is >> dummy >> fieldHalfAngle >> unit;
|
|---|
| 904 | fieldHalfAngle *= G4UIcommand::ValueOf(unit);
|
|---|
| 905 | if (fieldHalfAngle > 89.5 * deg || fieldHalfAngle <= 0.0) {
|
|---|
| 906 | if (verbosity >= G4VisManager::errors) {
|
|---|
| 907 | G4cout <<
|
|---|
| 908 | "ERROR: Field half angle should be 0 < angle <= 89.5 degrees.";
|
|---|
| 909 | G4cout << G4endl;
|
|---|
| 910 | }
|
|---|
| 911 | return;
|
|---|
| 912 | }
|
|---|
| 913 | }
|
|---|
| 914 | else {
|
|---|
| 915 | if (verbosity >= G4VisManager::errors) {
|
|---|
| 916 | G4cout << "ERROR: \"" << newValue << "\" not recognised."
|
|---|
| 917 | " Looking for 'o' or 'p' first character." << G4endl;
|
|---|
| 918 | }
|
|---|
| 919 | return;
|
|---|
| 920 | }
|
|---|
| 921 | vp.SetFieldHalfAngle(fieldHalfAngle);
|
|---|
| 922 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 923 | G4cout << "Projection style of viewer \"" << currentViewer->GetName()
|
|---|
| 924 | << "\" set to ";
|
|---|
| 925 | if (fieldHalfAngle == 0.) {
|
|---|
| 926 | G4cout << "orthogonal.";
|
|---|
| 927 | }
|
|---|
| 928 | else {
|
|---|
| 929 | G4cout << "perspective\n with half angle " << fieldHalfAngle / deg
|
|---|
| 930 | << " degrees.";
|
|---|
| 931 | }
|
|---|
| 932 | G4cout << G4endl;
|
|---|
| 933 | }
|
|---|
| 934 | }
|
|---|
| 935 |
|
|---|
| 936 | else if (command == fpCommandSectionPlane) {
|
|---|
| 937 | G4String choice, unit;
|
|---|
| 938 | G4double x, y, z, nx, ny, nz;
|
|---|
| 939 | std::istringstream is (newValue);
|
|---|
| 940 | is >> choice >> x >> y >> z >> unit >> nx >> ny >> nz;
|
|---|
| 941 |
|
|---|
| 942 | G4int iSelector = -1;
|
|---|
| 943 | if (choice.compareTo("off",G4String::ignoreCase) == 0 ||
|
|---|
| 944 | !G4UIcommand::ConvertToBool(choice)) iSelector = 0;
|
|---|
| 945 | if (choice.compareTo("on",G4String::ignoreCase) == 0 ||
|
|---|
| 946 | G4UIcommand::ConvertToBool(choice)) iSelector = 1;
|
|---|
| 947 | if (iSelector < 0) {
|
|---|
| 948 | if (verbosity >= G4VisManager::errors) {
|
|---|
| 949 | G4cout << "Choice not recognised (on/true or off/false)." << G4endl;
|
|---|
| 950 | G4cout << "Section drawing is currently: ";
|
|---|
| 951 | if (vp.IsSection ()) G4cout << "on";
|
|---|
| 952 | else G4cout << "off";
|
|---|
| 953 | G4cout << ".\nSection plane is currently: "
|
|---|
| 954 | << vp.GetSectionPlane ();
|
|---|
| 955 | G4cout << G4endl;
|
|---|
| 956 | }
|
|---|
| 957 | return;
|
|---|
| 958 | }
|
|---|
| 959 |
|
|---|
| 960 | G4double F = 1.;
|
|---|
| 961 | switch (iSelector) {
|
|---|
| 962 | default:
|
|---|
| 963 | case 0:
|
|---|
| 964 | vp.UnsetSectionPlane();
|
|---|
| 965 | break;
|
|---|
| 966 | case 1:
|
|---|
| 967 | F = G4UIcommand::ValueOf(unit);
|
|---|
| 968 | x *= F; y *= F; z *= F;
|
|---|
| 969 | vp.SetSectionPlane(G4Plane3D(G4Normal3D(nx,ny,nz), G4Point3D(x,y,z)));
|
|---|
| 970 | vp.SetViewpointDirection(G4Normal3D(nx,ny,nz));
|
|---|
| 971 | break;
|
|---|
| 972 | }
|
|---|
| 973 |
|
|---|
| 974 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 975 | G4cout << "Section drawing is now: ";
|
|---|
| 976 | if (vp.IsSection ()) G4cout << "on";
|
|---|
| 977 | else G4cout << "off";
|
|---|
| 978 | G4cout << ".\nSection plane is now: "
|
|---|
| 979 | << vp.GetSectionPlane ();
|
|---|
| 980 | G4cout << G4endl;
|
|---|
| 981 | }
|
|---|
| 982 | }
|
|---|
| 983 |
|
|---|
| 984 | else if (command == fpCommandStyle) {
|
|---|
| 985 | G4ViewParameters::DrawingStyle existingStyle = vp.GetDrawingStyle();
|
|---|
| 986 | const size_t iPos0 = 0;
|
|---|
| 987 | if (newValue[iPos0] == 'w') { // "wireframe"
|
|---|
| 988 | switch (existingStyle) {
|
|---|
| 989 | case G4ViewParameters::wireframe:
|
|---|
| 990 | break;
|
|---|
| 991 | case G4ViewParameters::hlr:
|
|---|
| 992 | break;
|
|---|
| 993 | case G4ViewParameters::hsr:
|
|---|
| 994 | vp.SetDrawingStyle(G4ViewParameters::wireframe);
|
|---|
| 995 | break;
|
|---|
| 996 | case G4ViewParameters::hlhsr:
|
|---|
| 997 | vp.SetDrawingStyle(G4ViewParameters::hlr);
|
|---|
| 998 | break;
|
|---|
| 999 | }
|
|---|
| 1000 | }
|
|---|
| 1001 | else if (newValue[iPos0] == 's') { // "surface"
|
|---|
| 1002 | switch (existingStyle) {
|
|---|
| 1003 | case G4ViewParameters::wireframe:
|
|---|
| 1004 | vp.SetDrawingStyle(G4ViewParameters::hsr);
|
|---|
| 1005 | break;
|
|---|
| 1006 | case G4ViewParameters::hlr:
|
|---|
| 1007 | vp.SetDrawingStyle(G4ViewParameters::hlhsr);
|
|---|
| 1008 | break;
|
|---|
| 1009 | case G4ViewParameters::hsr:
|
|---|
| 1010 | break;
|
|---|
| 1011 | case G4ViewParameters::hlhsr:
|
|---|
| 1012 | break;
|
|---|
| 1013 | }
|
|---|
| 1014 | }
|
|---|
| 1015 | else {
|
|---|
| 1016 | if (verbosity >= G4VisManager::errors) {
|
|---|
| 1017 | G4cout << "ERROR: \"" << newValue << "\" not recognised."
|
|---|
| 1018 | " Looking for 'w' or 's' first character." << G4endl;
|
|---|
| 1019 | }
|
|---|
| 1020 | return;
|
|---|
| 1021 | }
|
|---|
| 1022 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 1023 | G4cout << "Drawing style of viewer \"" << currentViewer->GetName()
|
|---|
| 1024 | << "\" set to " << vp.GetDrawingStyle()
|
|---|
| 1025 | << G4endl;
|
|---|
| 1026 | }
|
|---|
| 1027 | }
|
|---|
| 1028 |
|
|---|
| 1029 | else if (command == fpCommandTargetPoint) {
|
|---|
| 1030 | G4ThreeVector targetPoint =
|
|---|
| 1031 | fpCommandTargetPoint->GetNew3VectorValue(newValue);
|
|---|
| 1032 | const G4Point3D& standardTargetPoint =
|
|---|
| 1033 | currentViewer->GetSceneHandler()->GetScene()->GetStandardTargetPoint();
|
|---|
| 1034 | vp.SetCurrentTargetPoint(targetPoint - standardTargetPoint);
|
|---|
| 1035 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 1036 | G4cout << "Target point set to "
|
|---|
| 1037 | << fpCommandTargetPoint->ConvertToStringWithBestUnit
|
|---|
| 1038 | (targetPoint)
|
|---|
| 1039 | << "\n\"Current Target Point\" set to "
|
|---|
| 1040 | << fpCommandTargetPoint->ConvertToStringWithBestUnit
|
|---|
| 1041 | (vp.GetCurrentTargetPoint())
|
|---|
| 1042 | << "\n\"Standard Target Point\" is "
|
|---|
| 1043 | << fpCommandTargetPoint->ConvertToStringWithBestUnit
|
|---|
| 1044 | (standardTargetPoint)
|
|---|
| 1045 | << G4endl;
|
|---|
| 1046 | }
|
|---|
| 1047 | }
|
|---|
| 1048 |
|
|---|
| 1049 | else if (command == fpCommandUpThetaPhi) {
|
|---|
| 1050 | G4double theta, phi;
|
|---|
| 1051 | ConvertToDoublePair(newValue, theta, phi);
|
|---|
| 1052 | G4double x = std::sin (theta) * std::cos (phi);
|
|---|
| 1053 | G4double y = std::sin (theta) * std::sin (phi);
|
|---|
| 1054 | G4double z = std::cos (theta);
|
|---|
| 1055 | fUpVector = G4ThreeVector (x, y, z);
|
|---|
| 1056 | vp.SetUpVector(fUpVector);
|
|---|
| 1057 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 1058 | G4cout << "Up direction set to " << vp.GetUpVector() << G4endl;
|
|---|
| 1059 | }
|
|---|
| 1060 | }
|
|---|
| 1061 |
|
|---|
| 1062 | else if (command == fpCommandUpVector) {
|
|---|
| 1063 | fUpVector = G4UIcommand::ConvertTo3Vector(newValue).unit();
|
|---|
| 1064 | vp.SetUpVector(fUpVector);
|
|---|
| 1065 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 1066 | G4cout << "Up direction set to " << vp.GetUpVector() << G4endl;
|
|---|
| 1067 | }
|
|---|
| 1068 | }
|
|---|
| 1069 |
|
|---|
| 1070 | else if (command == fpCommandViewpointThetaPhi) {
|
|---|
| 1071 | G4double theta, phi;
|
|---|
| 1072 | ConvertToDoublePair(newValue, theta, phi);
|
|---|
| 1073 | G4double x = std::sin (theta) * std::cos (phi);
|
|---|
| 1074 | G4double y = std::sin (theta) * std::sin (phi);
|
|---|
| 1075 | G4double z = std::cos (theta);
|
|---|
| 1076 | fViewpointVector = G4ThreeVector (x, y, z);
|
|---|
| 1077 | vp.SetViewAndLights(fViewpointVector);
|
|---|
| 1078 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 1079 | G4cout << "Viewpoint direction set to "
|
|---|
| 1080 | << vp.GetViewpointDirection() << G4endl;
|
|---|
| 1081 | if (vp.GetLightsMoveWithCamera ()) {
|
|---|
| 1082 | G4cout << "Lightpoint direction set to "
|
|---|
| 1083 | << vp.GetActualLightpointDirection () << G4endl;
|
|---|
| 1084 | }
|
|---|
| 1085 | }
|
|---|
| 1086 | }
|
|---|
| 1087 |
|
|---|
| 1088 | else if (command == fpCommandViewpointVector) {
|
|---|
| 1089 | fViewpointVector = G4UIcommand::ConvertTo3Vector(newValue).unit();
|
|---|
| 1090 | vp.SetViewAndLights(fViewpointVector);
|
|---|
| 1091 | if (verbosity >= G4VisManager::confirmations) {
|
|---|
| 1092 | G4cout << "Viewpoint direction set to "
|
|---|
| 1093 | << vp.GetViewpointDirection() << G4endl;
|
|---|
| 1094 | if (vp.GetLightsMoveWithCamera ()) {
|
|---|
| 1095 | G4cout << "Lightpoint direction set to "
|
|---|
| 1096 | << vp.GetActualLightpointDirection () << G4endl;
|
|---|
| 1097 | }
|
|---|
| 1098 | }
|
|---|
| 1099 | }
|
|---|
| 1100 |
|
|---|
| 1101 | else {
|
|---|
| 1102 | if (verbosity >= G4VisManager::errors) {
|
|---|
| 1103 | G4cout <<
|
|---|
| 1104 | "ERROR: G4VisCommandsViewerSet::SetNewValue: unrecognised command."
|
|---|
| 1105 | << G4endl;
|
|---|
| 1106 | }
|
|---|
| 1107 | return;
|
|---|
| 1108 | }
|
|---|
| 1109 |
|
|---|
| 1110 | SetViewParameters(currentViewer,vp);
|
|---|
| 1111 | }
|
|---|