G4ModelCommandsT.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 // $Id$
00027 //
00028 // Generic model messenges. 
00029 //
00030 // Jane Tinslay March 2006
00031 //
00032 #ifndef G4MODELCOMMANDST_HH
00033 #define G4MODELCOMMANDST_HH
00034 
00035 #include "G4ModelApplyCommandsT.hh"
00036 #include "G4Polymarker.hh"
00037 #include "G4UIdirectory.hh"
00038 #include <sstream>
00039 
00041 // Set parameter colour
00042 template <typename M>
00043 class G4ModelCmdSetStringColour : public G4ModelCmdApplyStringColour<M> {
00044 
00045 public: // With description
00046 
00047   G4ModelCmdSetStringColour(M* model, const G4String& placement, 
00048                             const G4String& cmdName="set")
00049     :G4ModelCmdApplyStringColour<M>(model, placement, cmdName) {}
00050   
00051   virtual ~G4ModelCmdSetStringColour() {}
00052 
00053 protected:
00054 
00055   virtual void Apply(const G4String& param, const G4Colour& colour) {
00056     G4VModelCommand<M>::Model()->Set(param, colour);
00057   }
00058 
00059 };
00060 
00062 // Set default colour
00063 template <typename M>
00064 class G4ModelCmdSetDefaultColour : public G4ModelCmdApplyColour<M> {
00065 
00066 public: // With description
00067 
00068   G4ModelCmdSetDefaultColour(M* model, const G4String& placement, 
00069                              const G4String& cmdName="setDefault")
00070     :G4ModelCmdApplyColour<M>(model, placement, cmdName) {}
00071   
00072   virtual ~G4ModelCmdSetDefaultColour() {}
00073 
00074 protected:
00075 
00076   virtual void Apply(const G4Colour& colour) {
00077     G4VModelCommand<M>::Model()->SetDefault(colour);
00078   }
00079   
00080 };
00081 
00083 // Add string command
00084 template <typename M>
00085 class G4ModelCmdAddString : public G4ModelCmdApplyString<M> {
00086 
00087 public: // With description
00088 
00089   G4ModelCmdAddString(M* model, const G4String& placement,
00090                       const G4String& cmdName="add")
00091     :G4ModelCmdApplyString<M>(model, placement, cmdName) 
00092   {
00093     G4ModelCmdApplyString<M>::Command()->SetGuidance("Add command");
00094   }
00095 
00096   virtual ~G4ModelCmdAddString() {}
00097 
00098 protected:
00099   
00100   virtual void Apply(const G4String& newValue) {
00101     G4VModelCommand<M>::Model()->Add(newValue);
00102   }
00103   
00104 };
00105 
00107 //Add integer command
00108 template <typename M>
00109 class G4ModelCmdAddInt : public G4ModelCmdApplyInteger<M> {
00110 
00111 public: // With description
00112 
00113   G4ModelCmdAddInt(M* model, const G4String& placement,
00114                    const G4String& cmdName="add")
00115   :G4ModelCmdApplyInteger<M>(model, placement, cmdName)
00116   {
00117     G4ModelCmdApplyInteger<M>::Command()->SetGuidance("Add command");    
00118   }
00119   
00120   virtual ~G4ModelCmdAddInt() {}
00121 
00122 protected:
00123 
00124   virtual void Apply(const G4int& newValue) {
00125     G4VModelCommand<M>::Model()->Add(newValue);
00126   }
00127   
00128 };
00129 
00131 // Invert command
00132 template <typename M>
00133 class G4ModelCmdInvert : public G4ModelCmdApplyBool<M> {
00134   
00135 public: // With description
00136   
00137   G4ModelCmdInvert(M* model, const G4String& placement,
00138                    const G4String& cmdName="invert")
00139     :G4ModelCmdApplyBool<M>(model, placement, cmdName)
00140   {
00141     G4ModelCmdApplyBool<M>::Command()->SetGuidance("Invert command");
00142   }
00143 
00144   virtual ~G4ModelCmdInvert() {}
00145 
00146 protected:
00147 
00148   virtual void Apply(const G4bool& newValue) {
00149     G4VModelCommand<M>::Model()->SetInvert(newValue);
00150   }
00151 
00152 };
00153 
00155 // Active command
00156 template <typename M>
00157 class G4ModelCmdActive : public G4ModelCmdApplyBool<M> {
00158 
00159 public: // With description
00160 
00161   G4ModelCmdActive(M* model, const G4String& placement,
00162                    const G4String& cmdName="active")
00163     :G4ModelCmdApplyBool<M>(model, placement, cmdName)
00164   {
00165     G4ModelCmdApplyBool<M>::Command()->SetGuidance("Active command");
00166   }
00167   
00168   virtual ~G4ModelCmdActive() {}
00169 
00170 protected:
00171 
00172   virtual void Apply(const G4bool& newValue) {
00173     G4VModelCommand<M>::Model()->SetActive(newValue);
00174   }
00175 
00176 };
00177 
00179 // Verbose command
00180 template <typename M>
00181 class G4ModelCmdVerbose : public G4ModelCmdApplyBool<M> {
00182 
00183 public: // With description
00184 
00185   G4ModelCmdVerbose(M* model, const G4String& placement,
00186                     const G4String& cmdName="verbose")
00187     :G4ModelCmdApplyBool<M>(model, placement, cmdName)
00188   {
00189     G4ModelCmdApplyBool<M>::Command()->SetGuidance("Verbose command");
00190   }
00191 
00192   virtual ~G4ModelCmdVerbose() {}
00193 
00194 protected:
00195 
00196   virtual void Apply(const G4bool& newValue) {
00197     G4VModelCommand<M>::Model()->SetVerbose(newValue);
00198   }
00199 
00200 };
00201 
00203 // Reset command
00204 template <typename M>
00205 class G4ModelCmdReset : public G4ModelCmdApplyNull<M> {
00206 
00207 public: // With description
00208 
00209   G4ModelCmdReset(M* model, const G4String& placement,
00210                             const G4String& cmdName="reset") 
00211     :G4ModelCmdApplyNull<M>(model, placement, cmdName)
00212   {
00213     G4ModelCmdApplyNull<M>::Command()->SetGuidance("Reset command");    
00214   }
00215   
00216   virtual ~G4ModelCmdReset() {}
00217   
00218 protected:
00219 
00220   virtual void Apply() {
00221     G4VModelCommand<M>::Model()->Reset();
00222   }
00223  
00224 };
00225 
00227 // Set auxiliary points colour command
00228 template <typename M>
00229 class G4ModelCmdSetAuxPtsColour : public G4ModelCmdApplyColour<M> {
00230   
00231 public:
00232 
00233   G4ModelCmdSetAuxPtsColour(M* model, const G4String& placement,
00234                             const G4String& cmdName="setAuxPtsColour") 
00235     :G4ModelCmdApplyColour<M>(model, placement, cmdName) {}
00236 
00237 protected:
00238 
00239   void Apply(const G4Colour& colour) {
00240     G4VModelCommand<M>::Model()->SetAuxPtsColour(colour);
00241   }
00242   
00243 };
00244 
00246 // Set set points colour command
00247 template <typename M>
00248 class G4ModelCmdSetStepPtsColour : public G4ModelCmdApplyColour<M> {
00249   
00250 public:
00251 
00252   G4ModelCmdSetStepPtsColour(M* model, const G4String& placement,
00253                              const G4String& cmdName="setStepPtsColour")
00254     :G4ModelCmdApplyColour<M>(model, placement, cmdName) {}
00255 
00256 protected:
00257   
00258   void Apply(const G4Colour& colour) {
00259     G4VModelCommand<M>::Model()->SetStepPtsColour(colour);
00260   }
00261   
00262 };
00263 
00265 // Set draw line command
00266 template <typename M>
00267 class G4ModelCmdSetDrawLine : public G4ModelCmdApplyBool<M> {
00268   
00269 public:
00270 
00271   G4ModelCmdSetDrawLine(M* model, const G4String& placement,
00272                         const G4String& cmdName="setDrawLine")    
00273     :G4ModelCmdApplyBool<M>(model, placement, cmdName)
00274   {
00275     G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set draw line command");
00276   }
00277   
00278 protected:
00279 
00280   void Apply(const G4bool& myBool) {
00281     G4VModelCommand<M>::Model()->SetDrawLine(myBool);
00282   }
00283   
00284 };
00285 
00287 // Set line visibility command
00288 template <typename M>
00289 class G4ModelCmdSetLineVisible : public G4ModelCmdApplyBool<M> {
00290   
00291 public:
00292 
00293   G4ModelCmdSetLineVisible(M* model, const G4String& placement,
00294                            const G4String& cmdName="setLineVisible") 
00295     :G4ModelCmdApplyBool<M>(model, placement, cmdName)
00296   {
00297     G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set line visibility command");
00298   }
00299   
00300 protected:
00301 
00302    void Apply(const G4bool& myBool) {
00303      G4VModelCommand<M>::Model()->SetLineVisible(myBool);
00304   }
00305   
00306 };
00307 
00309 // Set draw auxiliary points command
00310 template <typename M>
00311 class G4ModelCmdSetDrawAuxPts : public G4ModelCmdApplyBool<M> {
00312   
00313 public:
00314 
00315   G4ModelCmdSetDrawAuxPts(M* model, const G4String& placement,
00316                           const G4String& cmdName="setDrawAuxPts")
00317     :G4ModelCmdApplyBool<M>(model, placement, cmdName)
00318   {
00319     G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set draw auxiliary points command");
00320   }
00321   
00322 protected:
00323 
00324    void Apply(const G4bool& myBool) {
00325      G4VModelCommand<M>::Model()->SetDrawAuxPts(myBool);
00326   }
00327   
00328 };
00329 
00331 // Set auxiliary points visibility
00332 template <typename M>
00333 class G4ModelCmdSetAuxPtsVisible : public G4ModelCmdApplyBool<M> {
00334   
00335 public:
00336 
00337   G4ModelCmdSetAuxPtsVisible(M* model, const G4String& placement,
00338                              const G4String& cmdName="setAuxPtsVisible")
00339     :G4ModelCmdApplyBool<M>(model, placement, cmdName)
00340   {
00341     G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set auxiliary points visibility command");
00342   }
00343   
00344 protected:
00345 
00346    void Apply(const G4bool& myBool) {
00347      G4VModelCommand<M>::Model()->SetAuxPtsVisible(myBool);
00348   }
00349   
00350 };
00351 
00353 // Set draw step points command
00354 template <typename M>
00355 class G4ModelCmdSetDrawStepPts : public G4ModelCmdApplyBool<M> {
00356   
00357 public:
00358 
00359   G4ModelCmdSetDrawStepPts(M* model, const G4String& placement,
00360                            const G4String& cmdName="setDrawStepPts")
00361     :G4ModelCmdApplyBool<M>(model, placement, cmdName)
00362   {
00363     G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set draw step points command");
00364   }
00365   
00366 protected:
00367   
00368    void Apply(const G4bool& myBool) {
00369      G4VModelCommand<M>::Model()->SetDrawStepPts(myBool);
00370   }
00371   
00372 };
00373 
00375 // Set step points visible command
00376 template <typename M>
00377 class G4ModelCmdSetStepPtsVisible : public G4ModelCmdApplyBool<M> {
00378   
00379 public:
00380 
00381   G4ModelCmdSetStepPtsVisible(M* model, const G4String& placement,
00382                               const G4String& cmdName="setStepPtsVisible")
00383     :G4ModelCmdApplyBool<M>(model, placement, cmdName)
00384   {
00385     G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set step points visible command");
00386   }
00387   
00388 protected:
00389 
00390    void Apply(const G4bool& myBool) {
00391      G4VModelCommand<M>::Model()->SetStepPtsVisible(myBool);
00392   }
00393   
00394 };
00395 
00397 // Set auxiliary points size command
00398 template <typename M>
00399 class G4ModelCmdSetAuxPtsSize : public G4ModelCmdApplyString<M> {
00400   
00401 public:
00402 
00403   G4ModelCmdSetAuxPtsSize(M* model, const G4String& placement,
00404                            const G4String& cmdName="setAuxPtsSize")
00405     :G4ModelCmdApplyString<M>(model, placement, cmdName)
00406   {
00407     G4ModelCmdApplyString<M>::Command()->SetGuidance("Set auxiliary points size command");
00408   }
00409   
00410 protected:
00411 
00412    void Apply(const G4String& sizeString) {
00413      std::istringstream iss(sizeString);
00414      G4double size;
00415      G4String unit;
00416      iss >> size >> unit;
00417      if (G4VModelCommand<M>::Model()->GetAuxPtsSizeType() == G4VMarker::world)
00418        {
00419          G4double myDouble = G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(sizeString);
00420          G4VModelCommand<M>::Model()->SetAuxPtsSize(myDouble);
00421        }
00422      else  // none or screen
00423        {
00424          G4VModelCommand<M>::Model()->SetAuxPtsSize(size);
00425        }
00426    }
00427   
00428 };
00429 
00431 // Set step points size command
00432 template <typename M>
00433 class G4ModelCmdSetStepPtsSize : public G4ModelCmdApplyString<M> {
00434   
00435 public:
00436 
00437   G4ModelCmdSetStepPtsSize(M* model, const G4String& placement,
00438                            const G4String& cmdName="setStepPtsSize")
00439     :G4ModelCmdApplyString<M>(model, placement, cmdName)
00440   {
00441     G4ModelCmdApplyString<M>::Command()->SetGuidance("Set step points size command");
00442   }
00443   
00444 protected:
00445 
00446    void Apply(const G4String& sizeString) {
00447      std::istringstream iss(sizeString);
00448      G4double size;
00449      G4String unit;
00450      iss >> size >> unit;
00451      if (G4VModelCommand<M>::Model()->GetStepPtsSizeType() == G4VMarker::world)
00452        {
00453          G4double myDouble = G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(sizeString);
00454          G4VModelCommand<M>::Model()->SetStepPtsSize(myDouble);
00455        }
00456      else  // none or screen
00457        {
00458          G4VModelCommand<M>::Model()->SetStepPtsSize(size);
00459        }
00460    }
00461   
00462 };
00463 
00465 // Set step points type command
00466 template <typename M>
00467 class G4ModelCmdSetStepPtsType : public G4ModelCmdApplyString<M> {
00468   
00469 public:
00470 
00471   G4ModelCmdSetStepPtsType(M* model, const G4String& placement,
00472                            const G4String& cmdName="setStepPtsType")
00473     :G4ModelCmdApplyString<M>(model, placement, cmdName)
00474   {
00475     G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
00476     cmd->SetGuidance("Set step points type.");
00477     cmd->SetCandidates("dots circles squares");
00478   }
00479   
00480 protected:
00481 
00482   void Apply(const G4String& type) {
00483     G4Polymarker::MarkerType myType;
00484     
00485     if (type == "dots") {myType = G4Polymarker::dots;}
00486     else if (type == "circles") {myType = G4Polymarker::circles;}
00487     else if (type == "squares") {myType = G4Polymarker::squares;}
00488     else {
00489       G4ExceptionDescription ed;
00490       ed << "Invalid argument. See command guidance for options.";
00491       G4Exception
00492         ("G4ModelCmdSetStepPtsType::Apply",
00493          "modeling0109", JustWarning, ed);
00494       return;
00495     }
00496     G4VModelCommand<M>::Model()->SetStepPtsType(myType);
00497   }
00498   
00499 };
00500 
00502 // Set auxiliary points type command
00503 template <typename M>
00504 class G4ModelCmdSetAuxPtsType : public G4ModelCmdApplyString<M> {
00505   
00506 public:
00507   
00508   G4ModelCmdSetAuxPtsType(M* model, const G4String& placement,
00509                           const G4String& cmdName="setAuxPtsType")
00510     :G4ModelCmdApplyString<M>(model, placement, cmdName)
00511   {
00512     G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
00513 
00514     cmd->SetGuidance("Set auxiliary points type.");
00515     cmd->SetCandidates("dots circles squares");
00516   }
00517   
00518 protected:
00519   
00520   void Apply(const G4String& type) {
00521     G4Polymarker::MarkerType myType;
00522     
00523     if (type == "dots") {myType = G4Polymarker::dots;}
00524     else if (type == "circles") {myType = G4Polymarker::circles;}
00525     else if (type == "squares") {myType = G4Polymarker::squares;}
00526     else {
00527       G4ExceptionDescription ed;
00528       ed << "Invalid argument. See command guidance for options.";
00529       G4Exception
00530         ("G4ModelCmdSetAuxPtsType::Apply",
00531          "modeling0110", JustWarning, ed);
00532       return;
00533     }
00534     
00535     G4VModelCommand<M>::Model()->SetAuxPtsType(myType);
00536   }
00537   
00538 };
00539 
00541 // Set step points size type command
00542 template <typename M>
00543 class G4ModelCmdSetStepPtsSizeType : public G4ModelCmdApplyString<M> {
00544   
00545 public:
00546 
00547   G4ModelCmdSetStepPtsSizeType(M* model, const G4String& placement,
00548                                 const G4String& cmdName="setStepPtsSizeType")
00549     :G4ModelCmdApplyString<M>(model, placement, cmdName)
00550   {
00551     G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
00552     cmd->SetGuidance("Set step size type.");
00553     cmd->SetCandidates("none world screen");
00554   }
00555   
00556 protected:
00557 
00558   void Apply(const G4String& type) {
00559     G4VMarker::SizeType mySizeType;
00560     
00561     if (type == "none") {mySizeType = G4VMarker::none;}
00562     else if (type == "world") {mySizeType = G4VMarker::world;}
00563     else if (type == "screen") {mySizeType = G4VMarker::screen;}
00564     else {
00565       G4ExceptionDescription ed;
00566       ed << "Invalid argument. See command guidance for options.";
00567       G4Exception
00568         ("G4ModelCmdSetStepPtsSizeType::Apply",
00569          "modeling0111", JustWarning, ed);
00570       return;
00571     }
00572     G4VModelCommand<M>::Model()->SetStepPtsSizeType(mySizeType);
00573   }
00574   
00575 };
00576 
00578 // Set auxiliary points size type command
00579 template <typename M>
00580 class G4ModelCmdSetAuxPtsSizeType : public G4ModelCmdApplyString<M> {
00581   
00582 public:
00583 
00584   G4ModelCmdSetAuxPtsSizeType(M* model, const G4String& placement,
00585                                const G4String& cmdName="setAuxPtsSizeType")
00586     :G4ModelCmdApplyString<M>(model, placement, cmdName)
00587   {
00588     G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
00589     cmd->SetGuidance("Set auxiliary size type.");
00590     cmd->SetCandidates("none world screen");
00591   }
00592   
00593 protected:
00594 
00595   void Apply(const G4String& type) {
00596     G4VMarker::SizeType mySizeType;
00597     
00598     if (type == "none") {mySizeType = G4VMarker::none;}
00599     else if (type == "world") {mySizeType = G4VMarker::world;}
00600     else if (type == "screen") {mySizeType = G4VMarker::screen;}
00601     else {
00602       G4ExceptionDescription ed;
00603       ed << "Invalid argument. See command guidance for options.";
00604       G4Exception
00605         ("G4ModelCmdSetAuxPtsSizeType::Apply",
00606          "modeling0112", JustWarning, ed);
00607       return;
00608     }
00609     G4VModelCommand<M>::Model()->SetAuxPtsSizeType(mySizeType);
00610   }
00611   
00612 };
00613 
00615 // Set step points fill style command
00616 template <typename M>
00617 class G4ModelCmdSetStepPtsFillStyle : public G4ModelCmdApplyString<M> {
00618   
00619 public:
00620 
00621   G4ModelCmdSetStepPtsFillStyle(M* model, const G4String& placement,
00622                                 const G4String& cmdName="setStepPtsFillStyle")
00623     :G4ModelCmdApplyString<M>(model, placement, cmdName)
00624   {
00625     G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
00626     cmd->SetGuidance("Set step fill style type.");
00627     cmd->SetCandidates("noFill hashed filled");
00628   }
00629   
00630 protected:
00631 
00632   void Apply(const G4String& type) {
00633     G4VMarker::FillStyle myFillStyle;
00634     
00635     if (type == "noFill") {myFillStyle = G4VMarker::noFill;}
00636     else if (type == "hashed") {myFillStyle = G4VMarker::hashed;}
00637     else if (type == "filled") {myFillStyle = G4VMarker::filled;}
00638     else {
00639       G4ExceptionDescription ed;
00640       ed << "Invalid argument. See command guidance for options.";
00641       G4Exception
00642         ("G4ModelCmdSetStepPtsFillStyle::Apply",
00643          "modeling0113", JustWarning, ed);
00644       return;
00645     }
00646     G4VModelCommand<M>::Model()->SetStepPtsFillStyle(myFillStyle);
00647   }
00648   
00649 };
00650 
00652 // Set auxiliary points fill style command
00653 template <typename M>
00654 class G4ModelCmdSetAuxPtsFillStyle : public G4ModelCmdApplyString<M> {
00655   
00656 public:
00657 
00658   G4ModelCmdSetAuxPtsFillStyle(M* model, const G4String& placement,
00659                                const G4String& cmdName="setAuxPtsFillStyle")
00660     :G4ModelCmdApplyString<M>(model, placement, cmdName)
00661   {
00662     G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
00663     cmd->SetGuidance("Set auxiliary fill style.");
00664     cmd->SetCandidates("noFill hashed filled");
00665   }
00666   
00667 protected:
00668 
00669   void Apply(const G4String& type) {
00670     G4VMarker::FillStyle myFillStyle;
00671     
00672     if (type == "noFill") {myFillStyle = G4VMarker::noFill;}
00673     else if (type == "hashed") {myFillStyle = G4VMarker::hashed;}
00674     else if (type == "filled") {myFillStyle = G4VMarker::filled;}
00675     else {
00676       G4ExceptionDescription ed;
00677       ed << "Invalid argument. See command guidance for options.";
00678       G4Exception
00679         ("G4ModelCmdSetAuxPtsFillStyle::Apply",
00680          "modeling0114", JustWarning, ed);
00681       return;
00682     }
00683     G4VModelCommand<M>::Model()->SetAuxPtsFillStyle(myFillStyle);
00684   }
00685   
00686 };
00687 
00689 // SetLineColour command
00690 template <typename M>
00691 class G4ModelCmdSetLineColour : public G4ModelCmdApplyColour<M> {
00692   
00693 public:
00694 
00695   G4ModelCmdSetLineColour(M* model, const G4String& placement,
00696                           const G4String& cmdName="""setLineColour")
00697     :G4ModelCmdApplyColour<M>(model, placement, cmdName){}
00698   
00699 protected:
00700 
00701   void Apply(const G4Colour& colour) {
00702     G4VModelCommand<M>::Model()->SetLineColour(colour);
00703   }
00704   
00705 };
00706 
00708 // Set time slice interval command
00709 template <typename M>
00710 class G4ModelCmdSetTimeSliceInterval : public G4ModelCmdApplyDoubleAndUnit<M> {
00711 
00712 public:
00713 
00714   G4ModelCmdSetTimeSliceInterval(M* model, const G4String& placement,
00715                                  const G4String& cmdName = "setTimeSliceInterval")
00716     :G4ModelCmdApplyDoubleAndUnit<M>(model, placement, cmdName)
00717   {
00718     G4UIcmdWithADoubleAndUnit* cmd = G4ModelCmdApplyDoubleAndUnit<M>::Command();
00719     cmd->SetGuidance
00720       ("Set time slice interval.  Give unit, e.g., \"0.1 ns\"");
00721     cmd->SetUnitCategory("Time");
00722   }
00723 
00724 protected:
00725 
00726    void Apply(const G4double& myDouble) {
00727      G4VModelCommand<M>::Model()->SetTimeSliceInterval(myDouble);
00728   }
00729 
00730 };
00731 
00733 // Create context directory command
00734 template <typename M>
00735 class G4ModelCmdCreateContextDir : public G4UImessenger {
00736   
00737 public:
00738 
00739   G4ModelCmdCreateContextDir(M* model, const G4String& placement) 
00740   {
00741     G4String title = placement+"/"+model->Name()+"/";
00742     cmd = new G4UIdirectory(title);
00743     
00744     cmd->SetGuidance("Commands for default configuration");
00745   }
00746 
00747   virtual ~G4ModelCmdCreateContextDir() {
00748     delete cmd;
00749   }
00750 
00751 protected:
00752 
00753   G4UIdirectory* cmd;
00754   
00755 };
00756 
00758 // Draw command
00759 template <typename M>
00760 class G4ModelCmdDraw : public G4ModelCmdApplyBool<M> {
00761 
00762 public: // With description
00763 
00764   G4ModelCmdDraw(M* model, const G4String& placement,
00765                  const G4String& cmdName="draw")
00766     :G4ModelCmdApplyBool<M>(model, placement, cmdName)
00767   {
00768     G4ModelCmdApplyBool<M>::Command()->SetGuidance("Draw command");
00769   }
00770 
00771   virtual ~G4ModelCmdDraw() {}
00772 
00773 protected:
00774 
00775   virtual void Apply(const G4bool& newValue) {
00776     if (newValue) G4VModelCommand<M>::Model()->Draw();
00777   }
00778 
00779 };
00780 
00782 // Set interval
00783 template <typename M>
00784 class G4ModelCmdAddInterval : public G4ModelCmdApplyString<M> {
00785 
00786 public: // With description
00787 
00788   G4ModelCmdAddInterval(M* model, const G4String& placement, 
00789                         const G4String& cmdName="addInterval")
00790     :G4ModelCmdApplyString<M>(model, placement, cmdName) 
00791   {
00792     G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
00793     cmd->SetGuidance("Set interval.");
00794   }
00795   
00796   virtual ~G4ModelCmdAddInterval() {}
00797 
00798 protected:
00799 
00800   virtual void Apply(const G4String& param) {
00801     G4VModelCommand<M>::Model()->AddInterval(param);
00802 
00803   }
00804 };
00805 
00807 // Set value
00808 template <typename M>
00809 class G4ModelCmdAddValue : public G4ModelCmdApplyString<M> {
00810 
00811 public: // With description
00812 
00813   G4ModelCmdAddValue(M* model, const G4String& placement, 
00814                      const G4String& cmdName="addValue")
00815     :G4ModelCmdApplyString<M>(model, placement, cmdName) 
00816   {
00817     G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
00818     cmd->SetGuidance("Set value.");
00819   }
00820   
00821   virtual ~G4ModelCmdAddValue() {}
00822 protected:
00823 
00824   virtual void Apply(const G4String& param) {
00825     G4VModelCommand<M>::Model()->AddValue(param);
00826 
00827   }
00828 };
00829 
00831 // Set string command
00832 template <typename M>
00833 class G4ModelCmdSetString : public G4ModelCmdApplyString<M> {
00834 
00835 public: // With description
00836 
00837   G4ModelCmdSetString(M* model, const G4String& placement, 
00838                       const G4String& cmdName="set")
00839     :G4ModelCmdApplyString<M>(model, placement, cmdName) 
00840   {
00841     G4ModelCmdApplyString<M>::Command()->SetGuidance("Set command");
00842   }
00843 
00844   virtual ~G4ModelCmdSetString() {}
00845 
00846 protected:
00847   
00848   virtual void Apply(const G4String& newValue) {
00849     G4VModelCommand<M>::Model()->Set(newValue);
00850   }
00851   
00852 };
00853 
00854 #endif      

Generated on Mon May 27 17:48:52 2013 for Geant4 by  doxygen 1.4.7