Geant4 Cross Reference |
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 28 // /vis/scene commands - John Allison 9th August 1998 29 // Michael Kelsey 31 Jan 2019 -- Add new command for electric field 30 31 #ifndef G4VISCOMMANDSSCENEADD_HH 32 #define G4VISCOMMANDSSCENEADD_HH 33 34 #include "G4VisCommandsScene.hh" 35 36 class G4UIcmdWithoutParameter; 37 class G4UIcmdWithAString; 38 class G4UIcmdWithAnInteger; 39 40 #include "G4Transform3D.hh" 41 #include "G4VisAttributes.hh" 42 #include "G4Polyline.hh" 43 #include "G4Text.hh" 44 #include "G4Timer.hh" 45 46 class G4VisCommandSceneAddArrow: public G4VVisCommandScene { 47 public: 48 G4VisCommandSceneAddArrow (); 49 virtual ~G4VisCommandSceneAddArrow (); 50 G4String GetCurrentValue (G4UIcommand* command); 51 void SetNewValue (G4UIcommand* command, G4String newValue); 52 private: 53 G4VisCommandSceneAddArrow (const G4VisCommandSceneAddArrow&); 54 G4VisCommandSceneAddArrow& operator = (const G4VisCommandSceneAddArrow&); 55 G4UIcommand* fpCommand; 56 }; 57 58 class G4VisCommandSceneAddArrow2D: public G4VVisCommandScene { 59 public: 60 G4VisCommandSceneAddArrow2D (); 61 virtual ~G4VisCommandSceneAddArrow2D (); 62 G4String GetCurrentValue (G4UIcommand* command); 63 void SetNewValue (G4UIcommand* command, G4String newValue); 64 private: 65 G4VisCommandSceneAddArrow2D (const G4VisCommandSceneAddArrow2D&); 66 G4VisCommandSceneAddArrow2D& operator = (const G4VisCommandSceneAddArrow2D&); 67 struct Arrow2D { 68 Arrow2D(G4double x1, G4double y1, 69 G4double x2, G4double y2, 70 G4double width, const G4Colour& colour); 71 void operator()(G4VGraphicsScene&, const G4ModelingParameters* fpMp); 72 G4Polyline fShaftPolyline; 73 G4Polyline fHeadPolyline; 74 G4double fWidth; 75 G4Colour fColour; 76 }; 77 G4UIcommand* fpCommand; 78 }; 79 80 class G4VisCommandSceneAddAxes: public G4VVisCommandScene { 81 public: 82 G4VisCommandSceneAddAxes (); 83 virtual ~G4VisCommandSceneAddAxes (); 84 G4String GetCurrentValue (G4UIcommand* command); 85 void SetNewValue (G4UIcommand* command, G4String newValue); 86 private: 87 G4VisCommandSceneAddAxes (const G4VisCommandSceneAddAxes&); 88 G4VisCommandSceneAddAxes& operator = (const G4VisCommandSceneAddAxes&); 89 G4UIcommand* fpCommand; 90 }; 91 92 class G4VisCommandSceneAddDate: public G4VVisCommandScene { 93 public: 94 G4VisCommandSceneAddDate (); 95 virtual ~G4VisCommandSceneAddDate (); 96 G4String GetCurrentValue (G4UIcommand* command); 97 void SetNewValue (G4UIcommand* command, G4String newValue); 98 private: 99 G4VisCommandSceneAddDate (const G4VisCommandSceneAddDate&); 100 G4VisCommandSceneAddDate& operator = (const G4VisCommandSceneAddDate&); 101 struct Date { 102 Date 103 (G4VisManager* vm, G4int size, 104 G4double x, G4double y, G4Text::Layout layout, 105 const G4String& date): 106 fpVisManager(vm), fSize(size), 107 fX(x), fY(y), fLayout(layout), fDate(date) {} 108 void operator()(G4VGraphicsScene&, const G4ModelingParameters*); 109 G4VisManager* fpVisManager; 110 G4Timer fTimer; 111 G4int fSize; 112 G4double fX, fY; 113 G4Text::Layout fLayout; 114 G4String fDate; 115 }; 116 G4UIcommand* fpCommand; 117 }; 118 119 class G4VisCommandSceneAddDigis: public G4VVisCommandScene { 120 public: 121 G4VisCommandSceneAddDigis (); 122 virtual ~G4VisCommandSceneAddDigis (); 123 G4String GetCurrentValue (G4UIcommand* command); 124 void SetNewValue (G4UIcommand* command, G4String newValue); 125 private: 126 G4VisCommandSceneAddDigis (const G4VisCommandSceneAddDigis&); 127 G4VisCommandSceneAddDigis& operator = (const G4VisCommandSceneAddDigis&); 128 G4UIcmdWithoutParameter* fpCommand; 129 }; 130 131 class G4VisCommandSceneAddEventID: public G4VVisCommandScene { 132 public: 133 G4VisCommandSceneAddEventID (); 134 virtual ~G4VisCommandSceneAddEventID (); 135 G4String GetCurrentValue (G4UIcommand* command); 136 void SetNewValue (G4UIcommand* command, G4String newValue); 137 private: 138 G4VisCommandSceneAddEventID (const G4VisCommandSceneAddEventID&); 139 G4VisCommandSceneAddEventID& operator = (const G4VisCommandSceneAddEventID&); 140 enum ForWhat {forEndOfEvent, forEndOfRun}; 141 struct EventID { 142 EventID(ForWhat w, G4VisManager* vm, G4int size, 143 G4double x, G4double y, G4Text::Layout layout): 144 fForWhat(w), fpVisManager(vm), fSize(size), 145 fX(x), fY(y), fLayout(layout) {} 146 void operator()(G4VGraphicsScene&, const G4ModelingParameters*); 147 ForWhat fForWhat; 148 G4VisManager* fpVisManager; 149 G4int fSize; 150 G4double fX, fY; 151 G4Text::Layout fLayout; 152 }; 153 G4UIcommand* fpCommand; 154 }; 155 156 class G4VisCommandSceneAddExtent: public G4VVisCommandScene { 157 public: 158 G4VisCommandSceneAddExtent (); 159 virtual ~G4VisCommandSceneAddExtent (); 160 G4String GetCurrentValue (G4UIcommand* command); 161 void SetNewValue (G4UIcommand* command, G4String newValue); 162 private: 163 G4VisCommandSceneAddExtent (const G4VisCommandSceneAddExtent&); 164 G4VisCommandSceneAddExtent& operator = (const G4VisCommandSceneAddExtent&); 165 struct Extent { 166 Extent(G4double xmin, G4double xmax, 167 G4double ymin, G4double ymax, 168 G4double zmin, G4double zmax); 169 void operator()(G4VGraphicsScene&, const G4ModelingParameters*); 170 G4VisExtent fExtent; 171 }; 172 G4UIcommand* fpCommand; 173 }; 174 175 class G4VisCommandSceneAddElectricField: public G4VVisCommandScene { 176 public: 177 G4VisCommandSceneAddElectricField (); 178 virtual ~G4VisCommandSceneAddElectricField (); 179 G4String GetCurrentValue (G4UIcommand* command); 180 void SetNewValue (G4UIcommand* command, G4String newValue); 181 private: 182 G4VisCommandSceneAddElectricField (const G4VisCommandSceneAddElectricField&); 183 G4VisCommandSceneAddElectricField& operator = (const G4VisCommandSceneAddElectricField&); 184 G4UIcommand* fpCommand; 185 }; 186 187 class G4VisCommandSceneAddFrame: public G4VVisCommandScene { 188 public: 189 G4VisCommandSceneAddFrame (); 190 virtual ~G4VisCommandSceneAddFrame (); 191 G4String GetCurrentValue (G4UIcommand* command); 192 void SetNewValue (G4UIcommand* command, G4String newValue); 193 private: 194 G4VisCommandSceneAddFrame (const G4VisCommandSceneAddFrame&); 195 G4VisCommandSceneAddFrame& operator = (const G4VisCommandSceneAddFrame&); 196 struct Frame { 197 Frame(G4double size, G4double width, const G4Colour& colour): 198 fSize(size), fWidth(width), fColour(colour) {} 199 void operator()(G4VGraphicsScene&, const G4ModelingParameters*); 200 G4double fSize; 201 G4double fWidth; 202 G4Colour fColour; 203 }; 204 G4UIcommand* fpCommand; 205 }; 206 207 class G4VisCommandSceneAddGPS: public G4VVisCommandScene { 208 public: 209 G4VisCommandSceneAddGPS (); 210 virtual ~G4VisCommandSceneAddGPS (); 211 G4String GetCurrentValue (G4UIcommand* command); 212 void SetNewValue (G4UIcommand* command, G4String newValue); 213 private: 214 G4VisCommandSceneAddGPS (const G4VisCommandSceneAddGPS&); 215 G4VisCommandSceneAddGPS& operator = (const G4VisCommandSceneAddGPS&); 216 G4UIcommand* fpCommand; 217 }; 218 219 class G4VisCommandSceneAddGhosts: public G4VVisCommandScene { 220 public: 221 G4VisCommandSceneAddGhosts (); 222 virtual ~G4VisCommandSceneAddGhosts (); 223 G4String GetCurrentValue (G4UIcommand* command); 224 void SetNewValue (G4UIcommand* command, G4String newValue); 225 private: 226 G4VisCommandSceneAddGhosts (const G4VisCommandSceneAddGhosts&); 227 G4VisCommandSceneAddGhosts& operator = 228 (const G4VisCommandSceneAddGhosts&); 229 G4UIcmdWithAString* fpCommand; 230 }; 231 232 class G4VisCommandSceneAddHits: public G4VVisCommandScene { 233 public: 234 G4VisCommandSceneAddHits (); 235 virtual ~G4VisCommandSceneAddHits (); 236 G4String GetCurrentValue (G4UIcommand* command); 237 void SetNewValue (G4UIcommand* command, G4String newValue); 238 private: 239 G4VisCommandSceneAddHits (const G4VisCommandSceneAddHits&); 240 G4VisCommandSceneAddHits& operator = (const G4VisCommandSceneAddHits&); 241 G4UIcmdWithoutParameter* fpCommand; 242 }; 243 244 class G4VisCommandSceneAddLine: public G4VVisCommandScene { 245 public: 246 G4VisCommandSceneAddLine (); 247 virtual ~G4VisCommandSceneAddLine (); 248 G4String GetCurrentValue (G4UIcommand* command); 249 void SetNewValue (G4UIcommand* command, G4String newValue); 250 private: 251 G4VisCommandSceneAddLine (const G4VisCommandSceneAddLine&); 252 G4VisCommandSceneAddLine& operator = (const G4VisCommandSceneAddLine&); 253 struct Line { 254 Line(G4double x1, G4double y1, G4double z1, 255 G4double x2, G4double y2, G4double z2, 256 G4double width, const G4Colour& colour); 257 void operator()(G4VGraphicsScene&, const G4ModelingParameters*); 258 G4Polyline fPolyline; 259 G4double fWidth; 260 G4Colour fColour; 261 }; 262 G4UIcommand* fpCommand; 263 }; 264 265 class G4VisCommandSceneAddLine2D: public G4VVisCommandScene { 266 public: 267 G4VisCommandSceneAddLine2D (); 268 virtual ~G4VisCommandSceneAddLine2D (); 269 G4String GetCurrentValue (G4UIcommand* command); 270 void SetNewValue (G4UIcommand* command, G4String newValue); 271 private: 272 G4VisCommandSceneAddLine2D (const G4VisCommandSceneAddLine2D&); 273 G4VisCommandSceneAddLine2D& operator = (const G4VisCommandSceneAddLine2D&); 274 struct Line2D { 275 Line2D(G4double x1, G4double y1, 276 G4double x2, G4double y2, 277 G4double width, const G4Colour& colour); 278 void operator()(G4VGraphicsScene&, const G4ModelingParameters*); 279 G4Polyline fPolyline; 280 G4double fWidth; 281 G4Colour fColour; 282 }; 283 G4UIcommand* fpCommand; 284 }; 285 286 class G4VisCommandSceneAddLocalAxes: public G4VVisCommandScene { 287 public: 288 G4VisCommandSceneAddLocalAxes (); 289 virtual ~G4VisCommandSceneAddLocalAxes (); 290 G4String GetCurrentValue (G4UIcommand* command); 291 void SetNewValue (G4UIcommand* command, G4String newValue); 292 private: 293 G4VisCommandSceneAddLocalAxes (const G4VisCommandSceneAddLocalAxes&); 294 G4VisCommandSceneAddLocalAxes& operator = (const G4VisCommandSceneAddLocalAxes&); 295 G4UIcommand* fpCommand; 296 }; 297 298 class G4VisCommandSceneAddLogicalVolume: public G4VVisCommandScene { 299 public: 300 G4VisCommandSceneAddLogicalVolume (); 301 virtual ~G4VisCommandSceneAddLogicalVolume (); 302 G4String GetCurrentValue (G4UIcommand* command); 303 void SetNewValue (G4UIcommand* command, G4String newValue); 304 private: 305 G4VisCommandSceneAddLogicalVolume (const G4VisCommandSceneAddLogicalVolume&); 306 G4VisCommandSceneAddLogicalVolume& operator = 307 (const G4VisCommandSceneAddLogicalVolume&); 308 G4UIcommand* fpCommand; 309 }; 310 311 class G4VisCommandSceneAddLogo: public G4VVisCommandScene { 312 public: 313 G4VisCommandSceneAddLogo (); 314 virtual ~G4VisCommandSceneAddLogo (); 315 G4String GetCurrentValue (G4UIcommand* command); 316 void SetNewValue (G4UIcommand* command, G4String newValue); 317 private: 318 G4VisCommandSceneAddLogo (const G4VisCommandSceneAddLogo&); 319 G4VisCommandSceneAddLogo& operator = (const G4VisCommandSceneAddLogo&); 320 // Direction of outward-facing normal to front face of logo. 321 enum Direction {X, minusX, Y, minusY, Z, minusZ}; 322 struct G4Logo { 323 G4Logo(G4double height, const G4VisAttributes&, const G4Transform3D&); 324 ~G4Logo(); 325 void operator()(G4VGraphicsScene&, const G4ModelingParameters*); 326 private: 327 G4Polyhedron *fpG, *fp4; 328 }; 329 G4UIcommand* fpCommand; 330 }; 331 332 class G4VisCommandSceneAddLogo2D: public G4VVisCommandScene { 333 public: 334 G4VisCommandSceneAddLogo2D (); 335 virtual ~G4VisCommandSceneAddLogo2D (); 336 G4String GetCurrentValue (G4UIcommand* command); 337 void SetNewValue (G4UIcommand* command, G4String newValue); 338 private: 339 G4VisCommandSceneAddLogo2D (const G4VisCommandSceneAddLogo2D&); 340 G4VisCommandSceneAddLogo2D& operator = (const G4VisCommandSceneAddLogo2D&); 341 struct Logo2D { 342 Logo2D 343 (G4VisManager* vm, G4int size, 344 G4double x, G4double y, G4Text::Layout layout): 345 fpVisManager(vm), fSize(size), 346 fX(x), fY(y), fLayout(layout) {} 347 void operator()(G4VGraphicsScene&, const G4ModelingParameters*); 348 G4VisManager* fpVisManager; 349 G4int fSize; 350 G4double fX, fY; 351 G4Text::Layout fLayout; 352 }; 353 G4UIcommand* fpCommand; 354 }; 355 356 class G4VisCommandSceneAddMagneticField: public G4VVisCommandScene { 357 public: 358 G4VisCommandSceneAddMagneticField (); 359 virtual ~G4VisCommandSceneAddMagneticField (); 360 G4String GetCurrentValue (G4UIcommand* command); 361 void SetNewValue (G4UIcommand* command, G4String newValue); 362 private: 363 G4VisCommandSceneAddMagneticField (const G4VisCommandSceneAddMagneticField&); 364 G4VisCommandSceneAddMagneticField& operator = (const G4VisCommandSceneAddMagneticField&); 365 G4UIcommand* fpCommand; 366 }; 367 368 class G4VisCommandSceneAddPSHits: public G4VVisCommandScene { 369 public: 370 G4VisCommandSceneAddPSHits (); 371 virtual ~G4VisCommandSceneAddPSHits (); 372 G4String GetCurrentValue (G4UIcommand* command); 373 void SetNewValue (G4UIcommand* command, G4String newValue); 374 private: 375 G4VisCommandSceneAddPSHits (const G4VisCommandSceneAddPSHits&); 376 G4VisCommandSceneAddPSHits& operator = (const G4VisCommandSceneAddPSHits&); 377 G4UIcmdWithAString* fpCommand; 378 }; 379 380 class G4VisCommandSceneAddScale: public G4VVisCommandScene { 381 public: 382 G4VisCommandSceneAddScale (); 383 virtual ~G4VisCommandSceneAddScale (); 384 G4String GetCurrentValue (G4UIcommand* command); 385 void SetNewValue (G4UIcommand* command, G4String newValue); 386 private: 387 G4VisCommandSceneAddScale (const G4VisCommandSceneAddScale&); 388 G4VisCommandSceneAddScale& operator = (const G4VisCommandSceneAddScale&); 389 struct Scale { 390 enum Direction {x, y, z}; 391 Scale (const G4VisAttributes& visAttribs, 392 G4double length, const G4Transform3D&, 393 const G4String& annotation, G4double annotationSize, 394 const G4Colour& annotationColour 395 ); 396 // This creates a representation of annotated line in the specified 397 // direction with tick marks at the end. If autoPlacing is true it 398 // is required to be centred at the front, right, bottom corner of 399 // the world space, comfortably outside the existing bounding 400 // box/sphere so that existing objects do not obscure it. Otherwise 401 // it is required to be drawn with mid-point at (xmid, ymid, zmid). 402 // Annotation size is size of text labels in pixels. 403 // 404 // The auto placing algorithm might be: 405 // x = xmin + (1 + comfort) * (xmax - xmin) 406 // y = ymin - comfort * (ymax - ymin) 407 // z = zmin + (1 + comfort) * (zmax - zmin) 408 // if direction == x then (x - length,y,z) to (x,y,z) 409 // if direction == y then (x,y,z) to (x,y + length,z) 410 // if direction == z then (x,y,z - length) to (x,y,z) 411 ~Scale(); 412 void operator()(G4VGraphicsScene&,const G4ModelingParameters*); 413 private: 414 G4VisAttributes fVisAtts; 415 G4Polyline fScaleLine, fTick11, fTick12, fTick21, fTick22; 416 G4Text fText; 417 }; 418 G4UIcommand* fpCommand; 419 }; 420 421 class G4VisCommandSceneAddText: public G4VVisCommandScene { 422 public: 423 G4VisCommandSceneAddText (); 424 virtual ~G4VisCommandSceneAddText (); 425 G4String GetCurrentValue (G4UIcommand* command); 426 void SetNewValue (G4UIcommand* command, G4String newValue); 427 private: 428 G4VisCommandSceneAddText (const G4VisCommandSceneAddText&); 429 G4VisCommandSceneAddText& operator = (const G4VisCommandSceneAddText&); 430 G4UIcommand* fpCommand; 431 }; 432 433 class G4VisCommandSceneAddText2D: public G4VVisCommandScene { 434 public: 435 G4VisCommandSceneAddText2D (); 436 virtual ~G4VisCommandSceneAddText2D (); 437 G4String GetCurrentValue (G4UIcommand* command); 438 void SetNewValue (G4UIcommand* command, G4String newValue); 439 private: 440 G4VisCommandSceneAddText2D (const G4VisCommandSceneAddText2D&); 441 G4VisCommandSceneAddText2D& operator = (const G4VisCommandSceneAddText2D&); 442 struct G4Text2D { 443 G4Text2D(const G4Text&); 444 void operator()(G4VGraphicsScene&, const G4ModelingParameters*); 445 private: 446 G4Text fText; 447 }; 448 G4UIcommand* fpCommand; 449 }; 450 451 class G4VisCommandSceneAddTrajectories: public G4VVisCommandScene { 452 public: 453 G4VisCommandSceneAddTrajectories (); 454 virtual ~G4VisCommandSceneAddTrajectories (); 455 G4String GetCurrentValue (G4UIcommand* command); 456 void SetNewValue (G4UIcommand* command, G4String newValue); 457 private: 458 G4VisCommandSceneAddTrajectories (const G4VisCommandSceneAddTrajectories&); 459 G4VisCommandSceneAddTrajectories& operator = 460 (const G4VisCommandSceneAddTrajectories&); 461 G4UIcmdWithAString* fpCommand; 462 }; 463 464 class G4VisCommandSceneAddUserAction: public G4VVisCommandScene { 465 public: 466 G4VisCommandSceneAddUserAction (); 467 virtual ~G4VisCommandSceneAddUserAction (); 468 G4String GetCurrentValue (G4UIcommand* command); 469 void SetNewValue (G4UIcommand* command, G4String newValue); 470 private: 471 G4VisCommandSceneAddUserAction (const G4VisCommandSceneAddUserAction&); 472 G4VisCommandSceneAddUserAction& operator = (const G4VisCommandSceneAddUserAction&); 473 enum ActionType {runDuration, endOfEvent, endOfRun}; 474 void AddVisAction(const G4String& name,G4VUserVisAction*, 475 G4Scene*,ActionType,G4VisManager::Verbosity); 476 G4UIcmdWithAString* fpCommand; 477 }; 478 479 class G4VisCommandSceneAddVolume: public G4VVisCommandScene { 480 public: 481 G4VisCommandSceneAddVolume (); 482 virtual ~G4VisCommandSceneAddVolume (); 483 G4String GetCurrentValue (G4UIcommand* command); 484 void SetNewValue (G4UIcommand* command, G4String newValue); 485 private: 486 G4VisCommandSceneAddVolume (const G4VisCommandSceneAddVolume&); 487 G4VisCommandSceneAddVolume& operator = (const G4VisCommandSceneAddVolume&); 488 G4UIcommand* fpCommand; 489 }; 490 491 class G4VisCommandSceneAddPlotter: public G4VVisCommandScene { 492 public: 493 G4VisCommandSceneAddPlotter (); 494 virtual ~G4VisCommandSceneAddPlotter (); 495 G4String GetCurrentValue (G4UIcommand* command); 496 void SetNewValue (G4UIcommand* command, G4String newValue); 497 private: 498 G4VisCommandSceneAddPlotter (const G4VisCommandSceneAddPlotter&); 499 G4VisCommandSceneAddPlotter& operator = (const G4VisCommandSceneAddPlotter&); 500 G4UIcommand* fpCommand; 501 }; 502 503 #endif 504