Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:40

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 // Generic model messenges. 
0028 //
0029 // Jane Tinslay March 2006
0030 //
0031 #ifndef G4MODELCOMMANDST_HH
0032 #define G4MODELCOMMANDST_HH
0033 
0034 #include "G4ModelApplyCommandsT.hh"
0035 #include "G4Polymarker.hh"
0036 #include "G4UIdirectory.hh"
0037 #include <sstream>
0038 
0039 ////////////////////////////////////////////////////////////////////////
0040 // Set parameter colour
0041 template <typename M>
0042 class G4ModelCmdSetStringColour : public G4ModelCmdApplyStringColour<M> {
0043 
0044 public: // With description
0045 
0046   G4ModelCmdSetStringColour(M* model, const G4String& placement, 
0047                 const G4String& cmdName="set")
0048     :G4ModelCmdApplyStringColour<M>(model, placement, cmdName) {}
0049   
0050   virtual ~G4ModelCmdSetStringColour() {}
0051 
0052 protected:
0053 
0054   virtual void Apply(const G4String& param, const G4Colour& colour) {
0055     G4VModelCommand<M>::Model()->Set(param, colour);
0056   }
0057 
0058 };
0059 
0060 ////////////////////////////////////////////////////////////////////////
0061 // Set default colour
0062 template <typename M>
0063 class G4ModelCmdSetDefaultColour : public G4ModelCmdApplyColour<M> {
0064 
0065 public: // With description
0066 
0067   G4ModelCmdSetDefaultColour(M* model, const G4String& placement, 
0068                  const G4String& cmdName="setDefault")
0069     :G4ModelCmdApplyColour<M>(model, placement, cmdName) {}
0070   
0071   virtual ~G4ModelCmdSetDefaultColour() {}
0072 
0073 protected:
0074 
0075   virtual void Apply(const G4Colour& colour) {
0076     G4VModelCommand<M>::Model()->SetDefault(colour);
0077   }
0078   
0079 };
0080 
0081 ////////////////////////////////////////////////////////////////////////
0082 // Add string command
0083 template <typename M>
0084 class G4ModelCmdAddString : public G4ModelCmdApplyString<M> {
0085 
0086 public: // With description
0087 
0088   G4ModelCmdAddString(M* model, const G4String& placement,
0089               const G4String& cmdName="add")
0090     :G4ModelCmdApplyString<M>(model, placement, cmdName) 
0091   {
0092     G4ModelCmdApplyString<M>::Command()->SetGuidance("Add command");
0093   }
0094 
0095   virtual ~G4ModelCmdAddString() {}
0096 
0097 protected:
0098   
0099   virtual void Apply(const G4String& newValue) {
0100     G4VModelCommand<M>::Model()->Add(newValue);
0101   }
0102   
0103 };
0104 
0105 ////////////////////////////////////////////////////////////////////////
0106 //Add integer command
0107 template <typename M>
0108 class G4ModelCmdAddInt : public G4ModelCmdApplyInteger<M> {
0109 
0110 public: // With description
0111 
0112   G4ModelCmdAddInt(M* model, const G4String& placement,
0113            const G4String& cmdName="add")
0114   :G4ModelCmdApplyInteger<M>(model, placement, cmdName)
0115   {
0116     G4ModelCmdApplyInteger<M>::Command()->SetGuidance("Add command");    
0117   }
0118   
0119   virtual ~G4ModelCmdAddInt() {}
0120 
0121 protected:
0122 
0123   virtual void Apply(const G4int& newValue) {
0124     G4VModelCommand<M>::Model()->Add(newValue);
0125   }
0126   
0127 };
0128 
0129 ////////////////////////////////////////////////////////////////////////
0130 // Invert command
0131 template <typename M>
0132 class G4ModelCmdInvert : public G4ModelCmdApplyBool<M> {
0133   
0134 public: // With description
0135   
0136   G4ModelCmdInvert(M* model, const G4String& placement,
0137            const G4String& cmdName="invert")
0138     :G4ModelCmdApplyBool<M>(model, placement, cmdName)
0139   {
0140     G4ModelCmdApplyBool<M>::Command()->SetGuidance("Invert command");
0141   }
0142 
0143   virtual ~G4ModelCmdInvert() {}
0144 
0145 protected:
0146 
0147   virtual void Apply(const G4bool& newValue) {
0148     G4VModelCommand<M>::Model()->SetInvert(newValue);
0149   }
0150 
0151 };
0152 
0153 ////////////////////////////////////////////////////////////////////////
0154 // Active command
0155 template <typename M>
0156 class G4ModelCmdActive : public G4ModelCmdApplyBool<M> {
0157 
0158 public: // With description
0159 
0160   G4ModelCmdActive(M* model, const G4String& placement,
0161            const G4String& cmdName="active")
0162     :G4ModelCmdApplyBool<M>(model, placement, cmdName)
0163   {
0164     G4ModelCmdApplyBool<M>::Command()->SetGuidance("Active command");
0165   }
0166   
0167   virtual ~G4ModelCmdActive() {}
0168 
0169 protected:
0170 
0171   virtual void Apply(const G4bool& newValue) {
0172     G4VModelCommand<M>::Model()->SetActive(newValue);
0173   }
0174 
0175 };
0176 
0177 ////////////////////////////////////////////////////////////////////////
0178 // Verbose command
0179 template <typename M>
0180 class G4ModelCmdVerbose : public G4ModelCmdApplyBool<M> {
0181 
0182 public: // With description
0183 
0184   G4ModelCmdVerbose(M* model, const G4String& placement,
0185             const G4String& cmdName="verbose")
0186     :G4ModelCmdApplyBool<M>(model, placement, cmdName)
0187   {
0188     G4ModelCmdApplyBool<M>::Command()->SetGuidance("Verbose command");
0189   }
0190 
0191   virtual ~G4ModelCmdVerbose() {}
0192 
0193 protected:
0194 
0195   virtual void Apply(const G4bool& newValue) {
0196     G4VModelCommand<M>::Model()->SetVerbose(newValue);
0197   }
0198 
0199 };
0200 
0201 ////////////////////////////////////////////////////////////////////////
0202 // Reset command
0203 template <typename M>
0204 class G4ModelCmdReset : public G4ModelCmdApplyNull<M> {
0205 
0206 public: // With description
0207 
0208   G4ModelCmdReset(M* model, const G4String& placement,
0209                 const G4String& cmdName="reset") 
0210     :G4ModelCmdApplyNull<M>(model, placement, cmdName)
0211   {
0212     G4ModelCmdApplyNull<M>::Command()->SetGuidance("Reset command");    
0213   }
0214   
0215   virtual ~G4ModelCmdReset() {}
0216   
0217 protected:
0218 
0219   virtual void Apply() {
0220     G4VModelCommand<M>::Model()->Reset();
0221   }
0222  
0223 };
0224 
0225 ////////////////////////////////////////////////////////////////////////
0226 // Set auxiliary points colour command
0227 template <typename M>
0228 class G4ModelCmdSetAuxPtsColour : public G4ModelCmdApplyColour<M> {
0229   
0230 public:
0231 
0232   G4ModelCmdSetAuxPtsColour(M* model, const G4String& placement,
0233                 const G4String& cmdName="setAuxPtsColour") 
0234     :G4ModelCmdApplyColour<M>(model, placement, cmdName) {}
0235 
0236 protected:
0237 
0238   void Apply(const G4Colour& colour) {
0239     G4VModelCommand<M>::Model()->SetAuxPtsColour(colour);
0240   }
0241   
0242 };
0243 
0244 ////////////////////////////////////////////////////////////////////////
0245 // Set set points colour command
0246 template <typename M>
0247 class G4ModelCmdSetStepPtsColour : public G4ModelCmdApplyColour<M> {
0248   
0249 public:
0250 
0251   G4ModelCmdSetStepPtsColour(M* model, const G4String& placement,
0252                  const G4String& cmdName="setStepPtsColour")
0253     :G4ModelCmdApplyColour<M>(model, placement, cmdName) {}
0254 
0255 protected:
0256   
0257   void Apply(const G4Colour& colour) {
0258     G4VModelCommand<M>::Model()->SetStepPtsColour(colour);
0259   }
0260   
0261 };
0262 
0263 ////////////////////////////////////////////////////////////////////////
0264 // Set draw line command
0265 template <typename M>
0266 class G4ModelCmdSetDrawLine : public G4ModelCmdApplyBool<M> {
0267   
0268 public:
0269 
0270   G4ModelCmdSetDrawLine(M* model, const G4String& placement,
0271             const G4String& cmdName="setDrawLine")    
0272     :G4ModelCmdApplyBool<M>(model, placement, cmdName)
0273   {
0274     G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set draw line command");
0275   }
0276   
0277 protected:
0278 
0279   void Apply(const G4bool& myBool) {
0280     G4VModelCommand<M>::Model()->SetDrawLine(myBool);
0281   }
0282   
0283 };
0284 
0285 ////////////////////////////////////////////////////////////////////////
0286 // Set line visibility command
0287 template <typename M>
0288 class G4ModelCmdSetLineVisible : public G4ModelCmdApplyBool<M> {
0289   
0290 public:
0291 
0292   G4ModelCmdSetLineVisible(M* model, const G4String& placement,
0293                const G4String& cmdName="setLineVisible") 
0294     :G4ModelCmdApplyBool<M>(model, placement, cmdName)
0295   {
0296     G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set line visibility command");
0297   }
0298   
0299 protected:
0300 
0301    void Apply(const G4bool& myBool) {
0302      G4VModelCommand<M>::Model()->SetLineVisible(myBool);
0303   }
0304   
0305 };
0306 
0307 ////////////////////////////////////////////////////////////////////////
0308 // Set draw auxiliary points command
0309 template <typename M>
0310 class G4ModelCmdSetDrawAuxPts : public G4ModelCmdApplyBool<M> {
0311   
0312 public:
0313 
0314   G4ModelCmdSetDrawAuxPts(M* model, const G4String& placement,
0315               const G4String& cmdName="setDrawAuxPts")
0316     :G4ModelCmdApplyBool<M>(model, placement, cmdName)
0317   {
0318     G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set draw auxiliary points command");
0319   }
0320   
0321 protected:
0322 
0323    void Apply(const G4bool& myBool) {
0324      G4VModelCommand<M>::Model()->SetDrawAuxPts(myBool);
0325   }
0326   
0327 };
0328 
0329 ////////////////////////////////////////////////////////////////////////
0330 // Set auxiliary points visibility
0331 template <typename M>
0332 class G4ModelCmdSetAuxPtsVisible : public G4ModelCmdApplyBool<M> {
0333   
0334 public:
0335 
0336   G4ModelCmdSetAuxPtsVisible(M* model, const G4String& placement,
0337                  const G4String& cmdName="setAuxPtsVisible")
0338     :G4ModelCmdApplyBool<M>(model, placement, cmdName)
0339   {
0340     G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set auxiliary points visibility command");
0341   }
0342   
0343 protected:
0344 
0345    void Apply(const G4bool& myBool) {
0346      G4VModelCommand<M>::Model()->SetAuxPtsVisible(myBool);
0347   }
0348   
0349 };
0350 
0351 ////////////////////////////////////////////////////////////////////////
0352 // Set draw step points command
0353 template <typename M>
0354 class G4ModelCmdSetDrawStepPts : public G4ModelCmdApplyBool<M> {
0355   
0356 public:
0357 
0358   G4ModelCmdSetDrawStepPts(M* model, const G4String& placement,
0359                const G4String& cmdName="setDrawStepPts")
0360     :G4ModelCmdApplyBool<M>(model, placement, cmdName)
0361   {
0362     G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set draw step points command");
0363   }
0364   
0365 protected:
0366   
0367    void Apply(const G4bool& myBool) {
0368      G4VModelCommand<M>::Model()->SetDrawStepPts(myBool);
0369   }
0370   
0371 };
0372 
0373 ////////////////////////////////////////////////////////////////////////
0374 // Set step points visible command
0375 template <typename M>
0376 class G4ModelCmdSetStepPtsVisible : public G4ModelCmdApplyBool<M> {
0377   
0378 public:
0379 
0380   G4ModelCmdSetStepPtsVisible(M* model, const G4String& placement,
0381                   const G4String& cmdName="setStepPtsVisible")
0382     :G4ModelCmdApplyBool<M>(model, placement, cmdName)
0383   {
0384     G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set step points visible command");
0385   }
0386   
0387 protected:
0388 
0389    void Apply(const G4bool& myBool) {
0390      G4VModelCommand<M>::Model()->SetStepPtsVisible(myBool);
0391   }
0392   
0393 };
0394 
0395 ////////////////////////////////////////////////////////////////////////
0396 // Set auxiliary points size command
0397 template <typename M>
0398 class G4ModelCmdSetAuxPtsSize : public G4ModelCmdApplyString<M> {
0399   
0400 public:
0401 
0402   G4ModelCmdSetAuxPtsSize(M* model, const G4String& placement,
0403                const G4String& cmdName="setAuxPtsSize")
0404     :G4ModelCmdApplyString<M>(model, placement, cmdName)
0405   {
0406     G4ModelCmdApplyString<M>::Command()->SetGuidance("Set auxiliary points size command");
0407   }
0408   
0409 protected:
0410 
0411    void Apply(const G4String& sizeString) {
0412      std::istringstream iss(sizeString);
0413      G4double size;
0414      G4String unit;
0415      iss >> size >> unit;
0416      if (G4VModelCommand<M>::Model()->GetAuxPtsSizeType() == G4VMarker::world)
0417        {
0418      G4double myDouble = G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(sizeString);
0419      G4VModelCommand<M>::Model()->SetAuxPtsSize(myDouble);
0420        }
0421      else  // none or screen
0422        {
0423      G4VModelCommand<M>::Model()->SetAuxPtsSize(size);
0424        }
0425    }
0426   
0427 };
0428 
0429 ////////////////////////////////////////////////////////////////////////
0430 // Set step points size command
0431 template <typename M>
0432 class G4ModelCmdSetStepPtsSize : public G4ModelCmdApplyString<M> {
0433   
0434 public:
0435 
0436   G4ModelCmdSetStepPtsSize(M* model, const G4String& placement,
0437                const G4String& cmdName="setStepPtsSize")
0438     :G4ModelCmdApplyString<M>(model, placement, cmdName)
0439   {
0440     G4ModelCmdApplyString<M>::Command()->SetGuidance("Set step points size command");
0441   }
0442   
0443 protected:
0444 
0445    void Apply(const G4String& sizeString) {
0446      std::istringstream iss(sizeString);
0447      G4double size;
0448      G4String unit;
0449      iss >> size >> unit;
0450      if (G4VModelCommand<M>::Model()->GetStepPtsSizeType() == G4VMarker::world)
0451        {
0452      G4double myDouble = G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(sizeString);
0453      G4VModelCommand<M>::Model()->SetStepPtsSize(myDouble);
0454        }
0455      else  // none or screen
0456        {
0457      G4VModelCommand<M>::Model()->SetStepPtsSize(size);
0458        }
0459    }
0460   
0461 };
0462 
0463 ////////////////////////////////////////////////////////////////////////
0464 // Set step points type command
0465 template <typename M>
0466 class G4ModelCmdSetStepPtsType : public G4ModelCmdApplyString<M> {
0467   
0468 public:
0469 
0470   G4ModelCmdSetStepPtsType(M* model, const G4String& placement,
0471                const G4String& cmdName="setStepPtsType")
0472     :G4ModelCmdApplyString<M>(model, placement, cmdName)
0473   {
0474     G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
0475     cmd->SetGuidance("Set step points type.");
0476     cmd->SetCandidates("dots circles squares");
0477   }
0478   
0479 protected:
0480 
0481   void Apply(const G4String& type) {
0482     G4Polymarker::MarkerType myType;
0483     
0484     if (type == "dots") {myType = G4Polymarker::dots;}
0485     else if (type == "circles") {myType = G4Polymarker::circles;}
0486     else if (type == "squares") {myType = G4Polymarker::squares;}
0487     else {
0488       G4ExceptionDescription ed;
0489       ed << "Invalid argument. See command guidance for options.";
0490       G4Exception
0491     ("G4ModelCmdSetStepPtsType::Apply",
0492      "modeling0109", JustWarning, ed);
0493       return;
0494     }
0495     G4VModelCommand<M>::Model()->SetStepPtsType(myType);
0496   }
0497   
0498 };
0499 
0500 ////////////////////////////////////////////////////////////////////////
0501 // Set auxiliary points type command
0502 template <typename M>
0503 class G4ModelCmdSetAuxPtsType : public G4ModelCmdApplyString<M> {
0504   
0505 public:
0506   
0507   G4ModelCmdSetAuxPtsType(M* model, const G4String& placement,
0508               const G4String& cmdName="setAuxPtsType")
0509     :G4ModelCmdApplyString<M>(model, placement, cmdName)
0510   {
0511     G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
0512 
0513     cmd->SetGuidance("Set auxiliary points type.");
0514     cmd->SetCandidates("dots circles squares");
0515   }
0516   
0517 protected:
0518   
0519   void Apply(const G4String& type) {
0520     G4Polymarker::MarkerType myType;
0521     
0522     if (type == "dots") {myType = G4Polymarker::dots;}
0523     else if (type == "circles") {myType = G4Polymarker::circles;}
0524     else if (type == "squares") {myType = G4Polymarker::squares;}
0525     else {
0526       G4ExceptionDescription ed;
0527       ed << "Invalid argument. See command guidance for options.";
0528       G4Exception
0529     ("G4ModelCmdSetAuxPtsType::Apply",
0530      "modeling0110", JustWarning, ed);
0531       return;
0532     }
0533     
0534     G4VModelCommand<M>::Model()->SetAuxPtsType(myType);
0535   }
0536   
0537 };
0538 
0539 ////////////////////////////////////////////////////////////////////////
0540 // Set step points size type command
0541 template <typename M>
0542 class G4ModelCmdSetStepPtsSizeType : public G4ModelCmdApplyString<M> {
0543   
0544 public:
0545 
0546   G4ModelCmdSetStepPtsSizeType(M* model, const G4String& placement,
0547                 const G4String& cmdName="setStepPtsSizeType")
0548     :G4ModelCmdApplyString<M>(model, placement, cmdName)
0549   {
0550     G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
0551     cmd->SetGuidance("Set step size type.");
0552     cmd->SetCandidates("none world screen");
0553   }
0554   
0555 protected:
0556 
0557   void Apply(const G4String& type) {
0558     G4VMarker::SizeType mySizeType;
0559     
0560     if (type == "none") {mySizeType = G4VMarker::none;}
0561     else if (type == "world") {mySizeType = G4VMarker::world;}
0562     else if (type == "screen") {mySizeType = G4VMarker::screen;}
0563     else {
0564       G4ExceptionDescription ed;
0565       ed << "Invalid argument. See command guidance for options.";
0566       G4Exception
0567     ("G4ModelCmdSetStepPtsSizeType::Apply",
0568      "modeling0111", JustWarning, ed);
0569       return;
0570     }
0571     G4VModelCommand<M>::Model()->SetStepPtsSizeType(mySizeType);
0572   }
0573   
0574 };
0575 
0576 ////////////////////////////////////////////////////////////////////////
0577 // Set auxiliary points size type command
0578 template <typename M>
0579 class G4ModelCmdSetAuxPtsSizeType : public G4ModelCmdApplyString<M> {
0580   
0581 public:
0582 
0583   G4ModelCmdSetAuxPtsSizeType(M* model, const G4String& placement,
0584                    const G4String& cmdName="setAuxPtsSizeType")
0585     :G4ModelCmdApplyString<M>(model, placement, cmdName)
0586   {
0587     G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
0588     cmd->SetGuidance("Set auxiliary size type.");
0589     cmd->SetCandidates("none world screen");
0590   }
0591   
0592 protected:
0593 
0594   void Apply(const G4String& type) {
0595     G4VMarker::SizeType mySizeType;
0596     
0597     if (type == "none") {mySizeType = G4VMarker::none;}
0598     else if (type == "world") {mySizeType = G4VMarker::world;}
0599     else if (type == "screen") {mySizeType = G4VMarker::screen;}
0600     else {
0601       G4ExceptionDescription ed;
0602       ed << "Invalid argument. See command guidance for options.";
0603       G4Exception
0604     ("G4ModelCmdSetAuxPtsSizeType::Apply",
0605      "modeling0112", JustWarning, ed);
0606       return;
0607     }
0608     G4VModelCommand<M>::Model()->SetAuxPtsSizeType(mySizeType);
0609   }
0610   
0611 };
0612 
0613 ////////////////////////////////////////////////////////////////////////
0614 // Set step points fill style command
0615 template <typename M>
0616 class G4ModelCmdSetStepPtsFillStyle : public G4ModelCmdApplyString<M> {
0617   
0618 public:
0619 
0620   G4ModelCmdSetStepPtsFillStyle(M* model, const G4String& placement,
0621                 const G4String& cmdName="setStepPtsFillStyle")
0622     :G4ModelCmdApplyString<M>(model, placement, cmdName)
0623   {
0624     G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
0625     cmd->SetGuidance("Set step fill style type.");
0626     cmd->SetCandidates("noFill hashed filled");
0627   }
0628   
0629 protected:
0630 
0631   void Apply(const G4String& type) {
0632     G4VMarker::FillStyle myFillStyle;
0633     
0634     if (type == "noFill") {myFillStyle = G4VMarker::noFill;}
0635     else if (type == "hashed") {myFillStyle = G4VMarker::hashed;}
0636     else if (type == "filled") {myFillStyle = G4VMarker::filled;}
0637     else {
0638       G4ExceptionDescription ed;
0639       ed << "Invalid argument. See command guidance for options.";
0640       G4Exception
0641     ("G4ModelCmdSetStepPtsFillStyle::Apply",
0642      "modeling0113", JustWarning, ed);
0643       return;
0644     }
0645     G4VModelCommand<M>::Model()->SetStepPtsFillStyle(myFillStyle);
0646   }
0647   
0648 };
0649 
0650 ////////////////////////////////////////////////////////////////////////
0651 // Set auxiliary points fill style command
0652 template <typename M>
0653 class G4ModelCmdSetAuxPtsFillStyle : public G4ModelCmdApplyString<M> {
0654   
0655 public:
0656 
0657   G4ModelCmdSetAuxPtsFillStyle(M* model, const G4String& placement,
0658                    const G4String& cmdName="setAuxPtsFillStyle")
0659     :G4ModelCmdApplyString<M>(model, placement, cmdName)
0660   {
0661     G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
0662     cmd->SetGuidance("Set auxiliary fill style.");
0663     cmd->SetCandidates("noFill hashed filled");
0664   }
0665   
0666 protected:
0667 
0668   void Apply(const G4String& type) {
0669     G4VMarker::FillStyle myFillStyle;
0670     
0671     if (type == "noFill") {myFillStyle = G4VMarker::noFill;}
0672     else if (type == "hashed") {myFillStyle = G4VMarker::hashed;}
0673     else if (type == "filled") {myFillStyle = G4VMarker::filled;}
0674     else {
0675       G4ExceptionDescription ed;
0676       ed << "Invalid argument. See command guidance for options.";
0677       G4Exception
0678     ("G4ModelCmdSetAuxPtsFillStyle::Apply",
0679      "modeling0114", JustWarning, ed);
0680       return;
0681     }
0682     G4VModelCommand<M>::Model()->SetAuxPtsFillStyle(myFillStyle);
0683   }
0684   
0685 };
0686 
0687 ////////////////////////////////////////////////////////////////////////
0688 // SetLineWidth command
0689 template <typename M>
0690 class G4ModelCmdSetLineWidth : public G4ModelCmdApplyDouble<M> {
0691 
0692 public:
0693 
0694   G4ModelCmdSetLineWidth(M* model, const G4String& placement,
0695                          const G4String& cmdName="""setLineWidth")
0696   :G4ModelCmdApplyDouble<M>(model, placement, cmdName){}
0697 
0698 protected:
0699 
0700   void Apply(const G4double& width) {
0701     G4VModelCommand<M>::Model()->SetLineWidth(width);
0702   }
0703 
0704 };
0705 
0706 ////////////////////////////////////////////////////////////////////////
0707 // SetLineColour command
0708 template <typename M>
0709 class G4ModelCmdSetLineColour : public G4ModelCmdApplyColour<M> {
0710 
0711 public:
0712 
0713   G4ModelCmdSetLineColour(M* model, const G4String& placement,
0714                           const G4String& cmdName="""setLineColour")
0715   :G4ModelCmdApplyColour<M>(model, placement, cmdName){}
0716 
0717 protected:
0718 
0719   void Apply(const G4Colour& colour) {
0720     G4VModelCommand<M>::Model()->SetLineColour(colour);
0721   }
0722 
0723 };
0724 
0725 ////////////////////////////////////////////////////////////////////////
0726 // Set time slice interval command
0727 template <typename M>
0728 class G4ModelCmdSetTimeSliceInterval : public G4ModelCmdApplyDoubleAndUnit<M> {
0729 
0730 public:
0731 
0732   G4ModelCmdSetTimeSliceInterval(M* model, const G4String& placement,
0733                  const G4String& cmdName = "setTimeSliceInterval")
0734     :G4ModelCmdApplyDoubleAndUnit<M>(model, placement, cmdName)
0735   {
0736     G4UIcmdWithADoubleAndUnit* cmd = G4ModelCmdApplyDoubleAndUnit<M>::Command();
0737     cmd->SetGuidance
0738       ("Set time slice interval.  Give unit, e.g., \"0.1 ns\"");
0739     cmd->SetUnitCategory("Time");
0740   }
0741 
0742 protected:
0743 
0744    void Apply(const G4double& myDouble) {
0745      G4VModelCommand<M>::Model()->SetTimeSliceInterval(myDouble);
0746   }
0747 
0748 };
0749 
0750 ////////////////////////////////////////////////////////////////////////
0751 // Create context directory command
0752 template <typename M>
0753 class G4ModelCmdCreateContextDir : public G4UImessenger {
0754   
0755 public:
0756 
0757   G4ModelCmdCreateContextDir(M* model, const G4String& placement) 
0758   {
0759     G4String title = placement+"/"+model->Name()+"/";
0760     cmd = new G4UIdirectory(title);
0761     
0762     cmd->SetGuidance("Commands for default configuration");
0763   }
0764 
0765   virtual ~G4ModelCmdCreateContextDir() {
0766     delete cmd;
0767   }
0768 
0769 protected:
0770 
0771   G4UIdirectory* cmd;
0772   
0773 };
0774 
0775 ////////////////////////////////////////////////////////////////////////
0776 // Draw command
0777 template <typename M>
0778 class G4ModelCmdDraw : public G4ModelCmdApplyBool<M> {
0779 
0780 public: // With description
0781 
0782   G4ModelCmdDraw(M* model, const G4String& placement,
0783          const G4String& cmdName="draw")
0784     :G4ModelCmdApplyBool<M>(model, placement, cmdName)
0785   {
0786     G4ModelCmdApplyBool<M>::Command()->SetGuidance("Draw command");
0787   }
0788 
0789   virtual ~G4ModelCmdDraw() {}
0790 
0791 protected:
0792 
0793   virtual void Apply(const G4bool& newValue) {
0794     if (newValue) G4VModelCommand<M>::Model()->Draw();
0795   }
0796 
0797 };
0798 
0799 ////////////////////////////////////////////////////////////////////////
0800 // Set interval
0801 template <typename M>
0802 class G4ModelCmdAddInterval : public G4ModelCmdApplyString<M> {
0803 
0804 public: // With description
0805 
0806   G4ModelCmdAddInterval(M* model, const G4String& placement, 
0807             const G4String& cmdName="addInterval")
0808     :G4ModelCmdApplyString<M>(model, placement, cmdName) 
0809   {
0810     G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
0811     cmd->SetGuidance("Set interval.");
0812   }
0813   
0814   virtual ~G4ModelCmdAddInterval() {}
0815 
0816 protected:
0817 
0818   virtual void Apply(const G4String& param) {
0819     G4VModelCommand<M>::Model()->AddInterval(param);
0820 
0821   }
0822 };
0823 
0824 ////////////////////////////////////////////////////////////////////////
0825 // Set value
0826 template <typename M>
0827 class G4ModelCmdAddValue : public G4ModelCmdApplyString<M> {
0828 
0829 public: // With description
0830 
0831   G4ModelCmdAddValue(M* model, const G4String& placement, 
0832              const G4String& cmdName="addValue")
0833     :G4ModelCmdApplyString<M>(model, placement, cmdName) 
0834   {
0835     G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
0836     cmd->SetGuidance("Set value.");
0837   }
0838   
0839   virtual ~G4ModelCmdAddValue() {}
0840 protected:
0841 
0842   virtual void Apply(const G4String& param) {
0843     G4VModelCommand<M>::Model()->AddValue(param);
0844   }
0845 };
0846 
0847 ////////////////////////////////////////////////////////////////////////
0848 // Set string command
0849 template <typename M>
0850 class G4ModelCmdSetString : public G4ModelCmdApplyString<M> {
0851 
0852 public: // With description
0853 
0854   G4ModelCmdSetString(M* model, const G4String& placement, 
0855               const G4String& cmdName="set")
0856     :G4ModelCmdApplyString<M>(model, placement, cmdName) 
0857   {
0858     G4ModelCmdApplyString<M>::Command()->SetGuidance("Set command");
0859   }
0860 
0861   virtual ~G4ModelCmdSetString() {}
0862 
0863 protected:
0864   
0865   virtual void Apply(const G4String& newValue) {
0866     G4VModelCommand<M>::Model()->Set(newValue);
0867   }
0868   
0869 };
0870 
0871 #endif