[834] | 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 | // $Id: G4ModelCommandsT.hh,v 1.12 2006/11/01 10:34:03 allison Exp $ |
---|
[850] | 27 | // GEANT4 tag $Name: HEAD $ |
---|
[834] | 28 | // |
---|
| 29 | // Generic model messenges. |
---|
| 30 | // |
---|
| 31 | // Jane Tinslay March 2006 |
---|
| 32 | // |
---|
| 33 | #ifndef G4MODELCOMMANDST_HH |
---|
| 34 | #define G4MODELCOMMANDST_HH |
---|
| 35 | |
---|
| 36 | #include "G4ModelApplyCommandsT.hh" |
---|
| 37 | #include "G4Polymarker.hh" |
---|
| 38 | #include "G4UIdirectory.hh" |
---|
| 39 | #include <sstream> |
---|
| 40 | |
---|
| 41 | //////////////////////////////////////////////////////////////////////// |
---|
| 42 | // Set parameter colour |
---|
| 43 | template <typename M> |
---|
| 44 | class G4ModelCmdSetStringColour : public G4ModelCmdApplyStringColour<M> { |
---|
| 45 | |
---|
| 46 | public: // With description |
---|
| 47 | |
---|
| 48 | G4ModelCmdSetStringColour(M* model, const G4String& placement, |
---|
| 49 | const G4String& cmdName="set") |
---|
| 50 | :G4ModelCmdApplyStringColour<M>(model, placement, cmdName) {} |
---|
| 51 | |
---|
| 52 | virtual ~G4ModelCmdSetStringColour() {} |
---|
| 53 | |
---|
| 54 | protected: |
---|
| 55 | |
---|
| 56 | virtual void Apply(const G4String& param, const G4Colour& colour) { |
---|
| 57 | G4VModelCommand<M>::Model()->Set(param, colour); |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | }; |
---|
| 61 | |
---|
| 62 | //////////////////////////////////////////////////////////////////////// |
---|
| 63 | // Set default colour |
---|
| 64 | template <typename M> |
---|
| 65 | class G4ModelCmdSetDefaultColour : public G4ModelCmdApplyColour<M> { |
---|
| 66 | |
---|
| 67 | public: // With description |
---|
| 68 | |
---|
| 69 | G4ModelCmdSetDefaultColour(M* model, const G4String& placement, |
---|
| 70 | const G4String& cmdName="setDefault") |
---|
| 71 | :G4ModelCmdApplyColour<M>(model, placement, cmdName) {} |
---|
| 72 | |
---|
| 73 | virtual ~G4ModelCmdSetDefaultColour() {} |
---|
| 74 | |
---|
| 75 | protected: |
---|
| 76 | |
---|
| 77 | virtual void Apply(const G4Colour& colour) { |
---|
| 78 | G4VModelCommand<M>::Model()->SetDefault(colour); |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | }; |
---|
| 82 | |
---|
| 83 | //////////////////////////////////////////////////////////////////////// |
---|
| 84 | // Add string command |
---|
| 85 | template <typename M> |
---|
| 86 | class G4ModelCmdAddString : public G4ModelCmdApplyString<M> { |
---|
| 87 | |
---|
| 88 | public: // With description |
---|
| 89 | |
---|
| 90 | G4ModelCmdAddString(M* model, const G4String& placement, |
---|
| 91 | const G4String& cmdName="add") |
---|
| 92 | :G4ModelCmdApplyString<M>(model, placement, cmdName) |
---|
| 93 | { |
---|
| 94 | G4ModelCmdApplyString<M>::Command()->SetGuidance("Add command"); |
---|
| 95 | } |
---|
| 96 | |
---|
| 97 | virtual ~G4ModelCmdAddString() {} |
---|
| 98 | |
---|
| 99 | protected: |
---|
| 100 | |
---|
| 101 | virtual void Apply(const G4String& newValue) { |
---|
| 102 | G4VModelCommand<M>::Model()->Add(newValue); |
---|
| 103 | } |
---|
| 104 | |
---|
| 105 | }; |
---|
| 106 | |
---|
| 107 | //////////////////////////////////////////////////////////////////////// |
---|
| 108 | //Add integer command |
---|
| 109 | template <typename M> |
---|
| 110 | class G4ModelCmdAddInt : public G4ModelCmdApplyInteger<M> { |
---|
| 111 | |
---|
| 112 | public: // With description |
---|
| 113 | |
---|
| 114 | G4ModelCmdAddInt(M* model, const G4String& placement, |
---|
| 115 | const G4String& cmdName="add") |
---|
| 116 | :G4ModelCmdApplyInteger<M>(model, placement, cmdName) |
---|
| 117 | { |
---|
| 118 | G4ModelCmdApplyInteger<M>::Command()->SetGuidance("Add command"); |
---|
| 119 | } |
---|
| 120 | |
---|
| 121 | virtual ~G4ModelCmdAddInt() {} |
---|
| 122 | |
---|
| 123 | protected: |
---|
| 124 | |
---|
| 125 | virtual void Apply(const G4int& newValue) { |
---|
| 126 | G4VModelCommand<M>::Model()->Add(newValue); |
---|
| 127 | } |
---|
| 128 | |
---|
| 129 | }; |
---|
| 130 | |
---|
| 131 | //////////////////////////////////////////////////////////////////////// |
---|
| 132 | // Invert command |
---|
| 133 | template <typename M> |
---|
| 134 | class G4ModelCmdInvert : public G4ModelCmdApplyBool<M> { |
---|
| 135 | |
---|
| 136 | public: // With description |
---|
| 137 | |
---|
| 138 | G4ModelCmdInvert(M* model, const G4String& placement, |
---|
| 139 | const G4String& cmdName="invert") |
---|
| 140 | :G4ModelCmdApplyBool<M>(model, placement, cmdName) |
---|
| 141 | { |
---|
| 142 | G4ModelCmdApplyBool<M>::Command()->SetGuidance("Invert command"); |
---|
| 143 | } |
---|
| 144 | |
---|
| 145 | virtual ~G4ModelCmdInvert() {} |
---|
| 146 | |
---|
| 147 | protected: |
---|
| 148 | |
---|
| 149 | virtual void Apply(const G4bool& newValue) { |
---|
| 150 | G4VModelCommand<M>::Model()->SetInvert(newValue); |
---|
| 151 | } |
---|
| 152 | |
---|
| 153 | }; |
---|
| 154 | |
---|
| 155 | //////////////////////////////////////////////////////////////////////// |
---|
| 156 | // Active command |
---|
| 157 | template <typename M> |
---|
| 158 | class G4ModelCmdActive : public G4ModelCmdApplyBool<M> { |
---|
| 159 | |
---|
| 160 | public: // With description |
---|
| 161 | |
---|
| 162 | G4ModelCmdActive(M* model, const G4String& placement, |
---|
| 163 | const G4String& cmdName="active") |
---|
| 164 | :G4ModelCmdApplyBool<M>(model, placement, cmdName) |
---|
| 165 | { |
---|
| 166 | G4ModelCmdApplyBool<M>::Command()->SetGuidance("Active command"); |
---|
| 167 | } |
---|
| 168 | |
---|
| 169 | virtual ~G4ModelCmdActive() {} |
---|
| 170 | |
---|
| 171 | protected: |
---|
| 172 | |
---|
| 173 | virtual void Apply(const G4bool& newValue) { |
---|
| 174 | G4VModelCommand<M>::Model()->SetActive(newValue); |
---|
| 175 | } |
---|
| 176 | |
---|
| 177 | }; |
---|
| 178 | |
---|
| 179 | //////////////////////////////////////////////////////////////////////// |
---|
| 180 | // Verbose command |
---|
| 181 | template <typename M> |
---|
| 182 | class G4ModelCmdVerbose : public G4ModelCmdApplyBool<M> { |
---|
| 183 | |
---|
| 184 | public: // With description |
---|
| 185 | |
---|
| 186 | G4ModelCmdVerbose(M* model, const G4String& placement, |
---|
| 187 | const G4String& cmdName="verbose") |
---|
| 188 | :G4ModelCmdApplyBool<M>(model, placement, cmdName) |
---|
| 189 | { |
---|
| 190 | G4ModelCmdApplyBool<M>::Command()->SetGuidance("Verbose command"); |
---|
| 191 | } |
---|
| 192 | |
---|
| 193 | virtual ~G4ModelCmdVerbose() {} |
---|
| 194 | |
---|
| 195 | protected: |
---|
| 196 | |
---|
| 197 | virtual void Apply(const G4bool& newValue) { |
---|
| 198 | G4VModelCommand<M>::Model()->SetVerbose(newValue); |
---|
| 199 | } |
---|
| 200 | |
---|
| 201 | }; |
---|
| 202 | |
---|
| 203 | //////////////////////////////////////////////////////////////////////// |
---|
| 204 | // Reset command |
---|
| 205 | template <typename M> |
---|
| 206 | class G4ModelCmdReset : public G4ModelCmdApplyNull<M> { |
---|
| 207 | |
---|
| 208 | public: // With description |
---|
| 209 | |
---|
| 210 | G4ModelCmdReset(M* model, const G4String& placement, |
---|
| 211 | const G4String& cmdName="reset") |
---|
| 212 | :G4ModelCmdApplyNull<M>(model, placement, cmdName) |
---|
| 213 | { |
---|
| 214 | G4ModelCmdApplyNull<M>::Command()->SetGuidance("Reset command"); |
---|
| 215 | } |
---|
| 216 | |
---|
| 217 | virtual ~G4ModelCmdReset() {} |
---|
| 218 | |
---|
| 219 | protected: |
---|
| 220 | |
---|
| 221 | virtual void Apply() { |
---|
| 222 | G4VModelCommand<M>::Model()->Reset(); |
---|
| 223 | } |
---|
| 224 | |
---|
| 225 | }; |
---|
| 226 | |
---|
| 227 | //////////////////////////////////////////////////////////////////////// |
---|
| 228 | // Set auxiliary points colour command |
---|
| 229 | template <typename M> |
---|
| 230 | class G4ModelCmdSetAuxPtsColour : public G4ModelCmdApplyColour<M> { |
---|
| 231 | |
---|
| 232 | public: |
---|
| 233 | |
---|
| 234 | G4ModelCmdSetAuxPtsColour(M* model, const G4String& placement, |
---|
| 235 | const G4String& cmdName="setAuxPtsColour") |
---|
| 236 | :G4ModelCmdApplyColour<M>(model, placement, cmdName) {} |
---|
| 237 | |
---|
| 238 | protected: |
---|
| 239 | |
---|
| 240 | void Apply(const G4Colour& colour) { |
---|
| 241 | G4VModelCommand<M>::Model()->SetAuxPtsColour(colour); |
---|
| 242 | } |
---|
| 243 | |
---|
| 244 | }; |
---|
| 245 | |
---|
| 246 | //////////////////////////////////////////////////////////////////////// |
---|
| 247 | // Set set points colour command |
---|
| 248 | template <typename M> |
---|
| 249 | class G4ModelCmdSetStepPtsColour : public G4ModelCmdApplyColour<M> { |
---|
| 250 | |
---|
| 251 | public: |
---|
| 252 | |
---|
| 253 | G4ModelCmdSetStepPtsColour(M* model, const G4String& placement, |
---|
| 254 | const G4String& cmdName="setStepPtsColour") |
---|
| 255 | :G4ModelCmdApplyColour<M>(model, placement, cmdName) {} |
---|
| 256 | |
---|
| 257 | protected: |
---|
| 258 | |
---|
| 259 | void Apply(const G4Colour& colour) { |
---|
| 260 | G4VModelCommand<M>::Model()->SetStepPtsColour(colour); |
---|
| 261 | } |
---|
| 262 | |
---|
| 263 | }; |
---|
| 264 | |
---|
| 265 | //////////////////////////////////////////////////////////////////////// |
---|
| 266 | // Set draw line command |
---|
| 267 | template <typename M> |
---|
| 268 | class G4ModelCmdSetDrawLine : public G4ModelCmdApplyBool<M> { |
---|
| 269 | |
---|
| 270 | public: |
---|
| 271 | |
---|
| 272 | G4ModelCmdSetDrawLine(M* model, const G4String& placement, |
---|
| 273 | const G4String& cmdName="setDrawLine") |
---|
| 274 | :G4ModelCmdApplyBool<M>(model, placement, cmdName) |
---|
| 275 | { |
---|
| 276 | G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set draw line command"); |
---|
| 277 | } |
---|
| 278 | |
---|
| 279 | protected: |
---|
| 280 | |
---|
| 281 | void Apply(const G4bool& myBool) { |
---|
| 282 | G4VModelCommand<M>::Model()->SetDrawLine(myBool); |
---|
| 283 | } |
---|
| 284 | |
---|
| 285 | }; |
---|
| 286 | |
---|
| 287 | //////////////////////////////////////////////////////////////////////// |
---|
| 288 | // Set line visibility command |
---|
| 289 | template <typename M> |
---|
| 290 | class G4ModelCmdSetLineVisible : public G4ModelCmdApplyBool<M> { |
---|
| 291 | |
---|
| 292 | public: |
---|
| 293 | |
---|
| 294 | G4ModelCmdSetLineVisible(M* model, const G4String& placement, |
---|
| 295 | const G4String& cmdName="setLineVisible") |
---|
| 296 | :G4ModelCmdApplyBool<M>(model, placement, cmdName) |
---|
| 297 | { |
---|
| 298 | G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set line visibility command"); |
---|
| 299 | } |
---|
| 300 | |
---|
| 301 | protected: |
---|
| 302 | |
---|
| 303 | void Apply(const G4bool& myBool) { |
---|
| 304 | G4VModelCommand<M>::Model()->SetLineVisible(myBool); |
---|
| 305 | } |
---|
| 306 | |
---|
| 307 | }; |
---|
| 308 | |
---|
| 309 | //////////////////////////////////////////////////////////////////////// |
---|
| 310 | // Set draw auxiliary points command |
---|
| 311 | template <typename M> |
---|
| 312 | class G4ModelCmdSetDrawAuxPts : public G4ModelCmdApplyBool<M> { |
---|
| 313 | |
---|
| 314 | public: |
---|
| 315 | |
---|
| 316 | G4ModelCmdSetDrawAuxPts(M* model, const G4String& placement, |
---|
| 317 | const G4String& cmdName="setDrawAuxPts") |
---|
| 318 | :G4ModelCmdApplyBool<M>(model, placement, cmdName) |
---|
| 319 | { |
---|
| 320 | G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set draw auxiliary points command"); |
---|
| 321 | } |
---|
| 322 | |
---|
| 323 | protected: |
---|
| 324 | |
---|
| 325 | void Apply(const G4bool& myBool) { |
---|
| 326 | G4VModelCommand<M>::Model()->SetDrawAuxPts(myBool); |
---|
| 327 | } |
---|
| 328 | |
---|
| 329 | }; |
---|
| 330 | |
---|
| 331 | //////////////////////////////////////////////////////////////////////// |
---|
| 332 | // Set auxiliary points visibility |
---|
| 333 | template <typename M> |
---|
| 334 | class G4ModelCmdSetAuxPtsVisible : public G4ModelCmdApplyBool<M> { |
---|
| 335 | |
---|
| 336 | public: |
---|
| 337 | |
---|
| 338 | G4ModelCmdSetAuxPtsVisible(M* model, const G4String& placement, |
---|
| 339 | const G4String& cmdName="setAuxPtsVisible") |
---|
| 340 | :G4ModelCmdApplyBool<M>(model, placement, cmdName) |
---|
| 341 | { |
---|
| 342 | G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set auxiliary points visibility command"); |
---|
| 343 | } |
---|
| 344 | |
---|
| 345 | protected: |
---|
| 346 | |
---|
| 347 | void Apply(const G4bool& myBool) { |
---|
| 348 | G4VModelCommand<M>::Model()->SetAuxPtsVisible(myBool); |
---|
| 349 | } |
---|
| 350 | |
---|
| 351 | }; |
---|
| 352 | |
---|
| 353 | //////////////////////////////////////////////////////////////////////// |
---|
| 354 | // Set draw step points command |
---|
| 355 | template <typename M> |
---|
| 356 | class G4ModelCmdSetDrawStepPts : public G4ModelCmdApplyBool<M> { |
---|
| 357 | |
---|
| 358 | public: |
---|
| 359 | |
---|
| 360 | G4ModelCmdSetDrawStepPts(M* model, const G4String& placement, |
---|
| 361 | const G4String& cmdName="setDrawStepPts") |
---|
| 362 | :G4ModelCmdApplyBool<M>(model, placement, cmdName) |
---|
| 363 | { |
---|
| 364 | G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set draw step points command"); |
---|
| 365 | } |
---|
| 366 | |
---|
| 367 | protected: |
---|
| 368 | |
---|
| 369 | void Apply(const G4bool& myBool) { |
---|
| 370 | G4VModelCommand<M>::Model()->SetDrawStepPts(myBool); |
---|
| 371 | } |
---|
| 372 | |
---|
| 373 | }; |
---|
| 374 | |
---|
| 375 | //////////////////////////////////////////////////////////////////////// |
---|
| 376 | // Set step points visible command |
---|
| 377 | template <typename M> |
---|
| 378 | class G4ModelCmdSetStepPtsVisible : public G4ModelCmdApplyBool<M> { |
---|
| 379 | |
---|
| 380 | public: |
---|
| 381 | |
---|
| 382 | G4ModelCmdSetStepPtsVisible(M* model, const G4String& placement, |
---|
| 383 | const G4String& cmdName="setStepPtsVisible") |
---|
| 384 | :G4ModelCmdApplyBool<M>(model, placement, cmdName) |
---|
| 385 | { |
---|
| 386 | G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set step points visible command"); |
---|
| 387 | } |
---|
| 388 | |
---|
| 389 | protected: |
---|
| 390 | |
---|
| 391 | void Apply(const G4bool& myBool) { |
---|
| 392 | G4VModelCommand<M>::Model()->SetStepPtsVisible(myBool); |
---|
| 393 | } |
---|
| 394 | |
---|
| 395 | }; |
---|
| 396 | |
---|
| 397 | //////////////////////////////////////////////////////////////////////// |
---|
| 398 | // Set auxiliary points size command |
---|
| 399 | template <typename M> |
---|
| 400 | class G4ModelCmdSetAuxPtsSize : public G4ModelCmdApplyDouble<M> { |
---|
| 401 | |
---|
| 402 | public: |
---|
| 403 | |
---|
| 404 | G4ModelCmdSetAuxPtsSize(M* model, const G4String& placement, |
---|
| 405 | const G4String& cmdName="setAuxPtsSize") |
---|
| 406 | :G4ModelCmdApplyDouble<M>(model, placement, cmdName) |
---|
| 407 | { |
---|
| 408 | G4ModelCmdApplyDouble<M>::Command()->SetGuidance("Set auxiliary points size command"); |
---|
| 409 | } |
---|
| 410 | |
---|
| 411 | protected: |
---|
| 412 | |
---|
| 413 | void Apply(const G4double& myDouble) { |
---|
| 414 | G4VModelCommand<M>::Model()->SetAuxPtsSize(myDouble); |
---|
| 415 | } |
---|
| 416 | |
---|
| 417 | }; |
---|
| 418 | |
---|
| 419 | //////////////////////////////////////////////////////////////////////// |
---|
| 420 | // Set step points size command |
---|
| 421 | template <typename M> |
---|
| 422 | class G4ModelCmdSetStepPtsSize : public G4ModelCmdApplyDouble<M> { |
---|
| 423 | |
---|
| 424 | public: |
---|
| 425 | |
---|
| 426 | G4ModelCmdSetStepPtsSize(M* model, const G4String& placement, |
---|
| 427 | const G4String& cmdName="setStepPtsSize") |
---|
| 428 | :G4ModelCmdApplyDouble<M>(model, placement, cmdName) |
---|
| 429 | { |
---|
| 430 | G4ModelCmdApplyDouble<M>::Command()->SetGuidance("Set step points size command"); |
---|
| 431 | } |
---|
| 432 | |
---|
| 433 | protected: |
---|
| 434 | |
---|
| 435 | void Apply(const G4double& myDouble) { |
---|
| 436 | G4VModelCommand<M>::Model()->SetStepPtsSize(myDouble); |
---|
| 437 | } |
---|
| 438 | |
---|
| 439 | }; |
---|
| 440 | |
---|
| 441 | //////////////////////////////////////////////////////////////////////// |
---|
| 442 | // Set step points type command |
---|
| 443 | template <typename M> |
---|
| 444 | class G4ModelCmdSetStepPtsType : public G4ModelCmdApplyString<M> { |
---|
| 445 | |
---|
| 446 | public: |
---|
| 447 | |
---|
| 448 | G4ModelCmdSetStepPtsType(M* model, const G4String& placement, |
---|
| 449 | const G4String& cmdName="setStepPtsType") |
---|
| 450 | :G4ModelCmdApplyString<M>(model, placement, cmdName) |
---|
| 451 | { |
---|
| 452 | G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command(); |
---|
| 453 | cmd->SetGuidance("Set step points type."); |
---|
| 454 | cmd->SetCandidates("dots circles squares"); |
---|
| 455 | } |
---|
| 456 | |
---|
| 457 | protected: |
---|
| 458 | |
---|
| 459 | void Apply(const G4String& type) { |
---|
| 460 | G4Polymarker::MarkerType myType; |
---|
| 461 | |
---|
| 462 | if (type == "dots") {myType = G4Polymarker::dots;} |
---|
| 463 | else if (type == "circles") {myType = G4Polymarker::circles;} |
---|
| 464 | else if (type == "squares") {myType = G4Polymarker::squares;} |
---|
| 465 | else { |
---|
| 466 | std::ostringstream o; |
---|
| 467 | o << "Invalid argument. See command guidance for options."; |
---|
| 468 | G4Exception |
---|
| 469 | ("G4ModelCmdSetStepPtsType::Apply", |
---|
| 470 | "InvalidArgument", JustWarning, o.str().c_str()); |
---|
| 471 | return; |
---|
| 472 | } |
---|
| 473 | G4VModelCommand<M>::Model()->SetStepPtsType(myType); |
---|
| 474 | } |
---|
| 475 | |
---|
| 476 | }; |
---|
| 477 | |
---|
| 478 | //////////////////////////////////////////////////////////////////////// |
---|
| 479 | // Set auxiliary points type command |
---|
| 480 | template <typename M> |
---|
| 481 | class G4ModelCmdSetAuxPtsType : public G4ModelCmdApplyString<M> { |
---|
| 482 | |
---|
| 483 | public: |
---|
| 484 | |
---|
| 485 | G4ModelCmdSetAuxPtsType(M* model, const G4String& placement, |
---|
| 486 | const G4String& cmdName="setAuxPtsType") |
---|
| 487 | :G4ModelCmdApplyString<M>(model, placement, cmdName) |
---|
| 488 | { |
---|
| 489 | G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command(); |
---|
| 490 | |
---|
| 491 | cmd->SetGuidance("Set auxiliary points type."); |
---|
| 492 | cmd->SetCandidates("dots circles squares"); |
---|
| 493 | } |
---|
| 494 | |
---|
| 495 | protected: |
---|
| 496 | |
---|
| 497 | void Apply(const G4String& type) { |
---|
| 498 | G4Polymarker::MarkerType myType; |
---|
| 499 | |
---|
| 500 | if (type == "dots") {myType = G4Polymarker::dots;} |
---|
| 501 | else if (type == "circles") {myType = G4Polymarker::circles;} |
---|
| 502 | else if (type == "squares") {myType = G4Polymarker::squares;} |
---|
| 503 | else { |
---|
| 504 | std::ostringstream o; |
---|
| 505 | o << "Invalid argument. See command guidance for options."; |
---|
| 506 | G4Exception |
---|
| 507 | ("G4ModelCmdSetAuxPtsType::Apply", |
---|
| 508 | "InvalidArgument", JustWarning, o.str().c_str()); |
---|
| 509 | return; |
---|
| 510 | } |
---|
| 511 | |
---|
| 512 | G4VModelCommand<M>::Model()->SetAuxPtsType(myType); |
---|
| 513 | } |
---|
| 514 | |
---|
| 515 | }; |
---|
| 516 | |
---|
| 517 | //////////////////////////////////////////////////////////////////////// |
---|
| 518 | // Set step points fill style command |
---|
| 519 | template <typename M> |
---|
| 520 | class G4ModelCmdSetStepPtsFillStyle : public G4ModelCmdApplyString<M> { |
---|
| 521 | |
---|
| 522 | public: |
---|
| 523 | |
---|
| 524 | G4ModelCmdSetStepPtsFillStyle(M* model, const G4String& placement, |
---|
| 525 | const G4String& cmdName="setStepPtsFillStyle") |
---|
| 526 | :G4ModelCmdApplyString<M>(model, placement, cmdName) |
---|
| 527 | { |
---|
| 528 | G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command(); |
---|
| 529 | cmd->SetGuidance("Set step fill style type."); |
---|
| 530 | cmd->SetCandidates("noFill hashed filled"); |
---|
| 531 | } |
---|
| 532 | |
---|
| 533 | protected: |
---|
| 534 | |
---|
| 535 | void Apply(const G4String& type) { |
---|
| 536 | G4VMarker::FillStyle myFillStyle; |
---|
| 537 | |
---|
| 538 | if (type == "noFill") {myFillStyle = G4VMarker::noFill;} |
---|
| 539 | else if (type == "hashed") {myFillStyle = G4VMarker::hashed;} |
---|
| 540 | else if (type == "filled") {myFillStyle = G4VMarker::filled;} |
---|
| 541 | else { |
---|
| 542 | std::ostringstream o; |
---|
| 543 | o << "Invalid argument. See command guidance for options."; |
---|
| 544 | G4Exception |
---|
| 545 | ("G4ModelCmdSetStepPtsFillStyle::Apply", |
---|
| 546 | "InvalidArgument", JustWarning, o.str().c_str()); |
---|
| 547 | return; |
---|
| 548 | } |
---|
| 549 | G4VModelCommand<M>::Model()->SetStepPtsFillStyle(myFillStyle); |
---|
| 550 | } |
---|
| 551 | |
---|
| 552 | }; |
---|
| 553 | |
---|
| 554 | //////////////////////////////////////////////////////////////////////// |
---|
| 555 | // Set auxiliary points fill style command |
---|
| 556 | template <typename M> |
---|
| 557 | class G4ModelCmdSetAuxPtsFillStyle : public G4ModelCmdApplyString<M> { |
---|
| 558 | |
---|
| 559 | public: |
---|
| 560 | |
---|
| 561 | G4ModelCmdSetAuxPtsFillStyle(M* model, const G4String& placement, |
---|
| 562 | const G4String& cmdName="setAuxPtsFillStyle") |
---|
| 563 | :G4ModelCmdApplyString<M>(model, placement, cmdName) |
---|
| 564 | { |
---|
| 565 | G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command(); |
---|
| 566 | cmd->SetGuidance("Set auxiliary fill style."); |
---|
| 567 | cmd->SetCandidates("noFill hashed filled"); |
---|
| 568 | } |
---|
| 569 | |
---|
| 570 | protected: |
---|
| 571 | |
---|
| 572 | void Apply(const G4String& type) { |
---|
| 573 | G4VMarker::FillStyle myFillStyle; |
---|
| 574 | |
---|
| 575 | if (type == "noFill") {myFillStyle = G4VMarker::noFill;} |
---|
| 576 | else if (type == "hashed") {myFillStyle = G4VMarker::hashed;} |
---|
| 577 | else if (type == "filled") {myFillStyle = G4VMarker::filled;} |
---|
| 578 | else { |
---|
| 579 | std::ostringstream o; |
---|
| 580 | o << "Invalid argument. See command guidance for options."; |
---|
| 581 | G4Exception |
---|
| 582 | ("G4ModelCmdSetAuxPtsFillStyle::Apply", |
---|
| 583 | "InvalidArgument", JustWarning, o.str().c_str()); |
---|
| 584 | return; |
---|
| 585 | } |
---|
| 586 | G4VModelCommand<M>::Model()->SetAuxPtsFillStyle(myFillStyle); |
---|
| 587 | } |
---|
| 588 | |
---|
| 589 | }; |
---|
| 590 | |
---|
| 591 | //////////////////////////////////////////////////////////////////////// |
---|
| 592 | // SetLineColour command |
---|
| 593 | template <typename M> |
---|
| 594 | class G4ModelCmdSetLineColour : public G4ModelCmdApplyColour<M> { |
---|
| 595 | |
---|
| 596 | public: |
---|
| 597 | |
---|
| 598 | G4ModelCmdSetLineColour(M* model, const G4String& placement, |
---|
| 599 | const G4String& cmdName="""setLineColour") |
---|
| 600 | :G4ModelCmdApplyColour<M>(model, placement, cmdName){} |
---|
| 601 | |
---|
| 602 | protected: |
---|
| 603 | |
---|
| 604 | void Apply(const G4Colour& colour) { |
---|
| 605 | G4VModelCommand<M>::Model()->SetLineColour(colour); |
---|
| 606 | } |
---|
| 607 | |
---|
| 608 | }; |
---|
| 609 | |
---|
| 610 | //////////////////////////////////////////////////////////////////////// |
---|
| 611 | // Set time slice interval command |
---|
| 612 | template <typename M> |
---|
| 613 | class G4ModelCmdSetTimeSliceInterval : public G4ModelCmdApplyDoubleAndUnit<M> { |
---|
| 614 | |
---|
| 615 | public: |
---|
| 616 | |
---|
| 617 | G4ModelCmdSetTimeSliceInterval(M* model, const G4String& placement, |
---|
| 618 | const G4String& cmdName = "setTimeSliceInterval") |
---|
| 619 | :G4ModelCmdApplyDoubleAndUnit<M>(model, placement, cmdName) |
---|
| 620 | { |
---|
| 621 | G4UIcmdWithADoubleAndUnit* cmd = G4ModelCmdApplyDoubleAndUnit<M>::Command(); |
---|
| 622 | cmd->SetGuidance |
---|
| 623 | ("Set time slice interval. Give unit, e.g., \"0.1 ns\""); |
---|
| 624 | cmd->SetUnitCategory("Time"); |
---|
| 625 | } |
---|
| 626 | |
---|
| 627 | protected: |
---|
| 628 | |
---|
| 629 | void Apply(const G4double& myDouble) { |
---|
| 630 | G4VModelCommand<M>::Model()->SetTimeSliceInterval(myDouble); |
---|
| 631 | } |
---|
| 632 | |
---|
| 633 | }; |
---|
| 634 | |
---|
| 635 | //////////////////////////////////////////////////////////////////////// |
---|
| 636 | // Create context directory command |
---|
| 637 | template <typename M> |
---|
| 638 | class G4ModelCmdCreateContextDir : public G4UImessenger { |
---|
| 639 | |
---|
| 640 | public: |
---|
| 641 | |
---|
| 642 | G4ModelCmdCreateContextDir(M* model, const G4String& placement) |
---|
| 643 | { |
---|
| 644 | G4String title = placement+"/"+model->Name()+"/"; |
---|
| 645 | cmd = new G4UIdirectory(title); |
---|
| 646 | |
---|
| 647 | cmd->SetGuidance("Commands for default configuration"); |
---|
| 648 | } |
---|
| 649 | |
---|
| 650 | virtual ~G4ModelCmdCreateContextDir() { |
---|
| 651 | delete cmd; |
---|
| 652 | } |
---|
| 653 | |
---|
| 654 | protected: |
---|
| 655 | |
---|
| 656 | G4UIdirectory* cmd; |
---|
| 657 | |
---|
| 658 | }; |
---|
| 659 | |
---|
| 660 | //////////////////////////////////////////////////////////////////////// |
---|
| 661 | // Draw command |
---|
| 662 | template <typename M> |
---|
| 663 | class G4ModelCmdDraw : public G4ModelCmdApplyBool<M> { |
---|
| 664 | |
---|
| 665 | public: // With description |
---|
| 666 | |
---|
| 667 | G4ModelCmdDraw(M* model, const G4String& placement, |
---|
| 668 | const G4String& cmdName="draw") |
---|
| 669 | :G4ModelCmdApplyBool<M>(model, placement, cmdName) |
---|
| 670 | { |
---|
| 671 | G4ModelCmdApplyBool<M>::Command()->SetGuidance("Draw command"); |
---|
| 672 | } |
---|
| 673 | |
---|
| 674 | virtual ~G4ModelCmdDraw() {} |
---|
| 675 | |
---|
| 676 | protected: |
---|
| 677 | |
---|
| 678 | virtual void Apply(const G4bool& newValue) { |
---|
| 679 | if (newValue) G4VModelCommand<M>::Model()->Draw(); |
---|
| 680 | } |
---|
| 681 | |
---|
| 682 | }; |
---|
| 683 | |
---|
| 684 | //////////////////////////////////////////////////////////////////////// |
---|
| 685 | // Set interval |
---|
| 686 | template <typename M> |
---|
| 687 | class G4ModelCmdAddInterval : public G4ModelCmdApplyString<M> { |
---|
| 688 | |
---|
| 689 | public: // With description |
---|
| 690 | |
---|
| 691 | G4ModelCmdAddInterval(M* model, const G4String& placement, |
---|
| 692 | const G4String& cmdName="addInterval") |
---|
| 693 | :G4ModelCmdApplyString<M>(model, placement, cmdName) |
---|
| 694 | { |
---|
| 695 | G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command(); |
---|
| 696 | cmd->SetGuidance("Set interval."); |
---|
| 697 | } |
---|
| 698 | |
---|
| 699 | virtual ~G4ModelCmdAddInterval() {} |
---|
| 700 | |
---|
| 701 | protected: |
---|
| 702 | |
---|
| 703 | virtual void Apply(const G4String& param) { |
---|
| 704 | G4VModelCommand<M>::Model()->AddInterval(param); |
---|
| 705 | |
---|
| 706 | } |
---|
| 707 | }; |
---|
| 708 | |
---|
| 709 | //////////////////////////////////////////////////////////////////////// |
---|
| 710 | // Set value |
---|
| 711 | template <typename M> |
---|
| 712 | class G4ModelCmdAddValue : public G4ModelCmdApplyString<M> { |
---|
| 713 | |
---|
| 714 | public: // With description |
---|
| 715 | |
---|
| 716 | G4ModelCmdAddValue(M* model, const G4String& placement, |
---|
| 717 | const G4String& cmdName="addValue") |
---|
| 718 | :G4ModelCmdApplyString<M>(model, placement, cmdName) |
---|
| 719 | { |
---|
| 720 | G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command(); |
---|
| 721 | cmd->SetGuidance("Set value."); |
---|
| 722 | } |
---|
| 723 | |
---|
| 724 | virtual ~G4ModelCmdAddValue() {} |
---|
| 725 | protected: |
---|
| 726 | |
---|
| 727 | virtual void Apply(const G4String& param) { |
---|
| 728 | G4VModelCommand<M>::Model()->AddValue(param); |
---|
| 729 | |
---|
| 730 | } |
---|
| 731 | }; |
---|
| 732 | |
---|
| 733 | //////////////////////////////////////////////////////////////////////// |
---|
| 734 | // Set string command |
---|
| 735 | template <typename M> |
---|
| 736 | class G4ModelCmdSetString : public G4ModelCmdApplyString<M> { |
---|
| 737 | |
---|
| 738 | public: // With description |
---|
| 739 | |
---|
| 740 | G4ModelCmdSetString(M* model, const G4String& placement, |
---|
| 741 | const G4String& cmdName="set") |
---|
| 742 | :G4ModelCmdApplyString<M>(model, placement, cmdName) |
---|
| 743 | { |
---|
| 744 | G4ModelCmdApplyString<M>::Command()->SetGuidance("Set command"); |
---|
| 745 | } |
---|
| 746 | |
---|
| 747 | virtual ~G4ModelCmdSetString() {} |
---|
| 748 | |
---|
| 749 | protected: |
---|
| 750 | |
---|
| 751 | virtual void Apply(const G4String& newValue) { |
---|
| 752 | G4VModelCommand<M>::Model()->Set(newValue); |
---|
| 753 | } |
---|
| 754 | |
---|
| 755 | }; |
---|
| 756 | |
---|
| 757 | #endif |
---|