// // ******************************************************************** // * License and Disclaimer * // * * // * The Geant4 software is copyright of the Copyright Holders of * // * the Geant4 Collaboration. It is provided under the terms and * // * conditions of the Geant4 Software License, included in the file * // * LICENSE and available at http://cern.ch/geant4/license . These * // * include a list of copyright holders. * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. Please see the license in the file LICENSE and URL above * // * for the full disclaimer and the limitation of liability. * // * * // * This code implementation is the result of the scientific and * // * technical work of the GEANT4 collaboration. * // * By using, copying, modifying or distributing the software (or * // * any work based on the software) you agree to acknowledge its * // * use in resulting scientific publications, and indicate your * // * acceptance of all terms of the Geant4 Software license. * // ******************************************************************** // // $Id: G4ModelCommandsT.hh,v 1.7 2006/06/29 21:30:24 gunter Exp $ // GEANT4 tag $Name: geant4-08-01 $ // // Generic model messenges. // // Jane Tinslay March 2006 // #ifndef G4MODELCOMMANDST_HH #define G4MODELCOMMANDST_HH #include "G4ModelApplyCommandsT.hh" #include "G4Polymarker.hh" #include "G4UIdirectory.hh" #include //////////////////////////////////////////////////////////////////////// // Set parameter colour template class G4ModelCmdSetStringColour : public G4ModelCmdApplyStringColour { public: // With description G4ModelCmdSetStringColour(M* model, const G4String& placement) :G4ModelCmdApplyStringColour(model, placement, "set") {} virtual ~G4ModelCmdSetStringColour() {} protected: virtual void Apply(const G4String& param, const G4Colour& colour) { G4VModelCommand::Model()->Set(param, colour); } }; //////////////////////////////////////////////////////////////////////// // Set default colour template class G4ModelCmdSetDefaultColour : public G4ModelCmdApplyColour { public: // With description G4ModelCmdSetDefaultColour(M* model, const G4String& placement) :G4ModelCmdApplyColour(model, placement, "setDefault") {} virtual ~G4ModelCmdSetDefaultColour() {} protected: virtual void Apply(const G4Colour& colour) { G4VModelCommand::Model()->SetDefault(colour); } }; //////////////////////////////////////////////////////////////////////// // Add string command template class G4ModelCmdAddString : public G4ModelCmdApplyString { public: // With description G4ModelCmdAddString(M* model, const G4String& placement) :G4ModelCmdApplyString(model, placement, "add") { G4ModelCmdApplyString::Command()->SetGuidance("Add command"); } virtual ~G4ModelCmdAddString() {} protected: virtual void Apply(const G4String& newValue) { G4VModelCommand::Model()->Add(newValue); } }; //////////////////////////////////////////////////////////////////////// //Add integer command template class G4ModelCmdAddInt : public G4ModelCmdApplyInteger { public: // With description G4ModelCmdAddInt(M* model, const G4String& placement) :G4ModelCmdApplyInteger(model, placement, "add") { G4ModelCmdApplyInteger::Command()->SetGuidance("Add command"); } virtual ~G4ModelCmdAddInt() {} protected: virtual void Apply(const G4int& newValue) { G4VModelCommand::Model()->Add(newValue); } }; //////////////////////////////////////////////////////////////////////// // Invert command template class G4ModelCmdInvert : public G4ModelCmdApplyBool { public: // With description G4ModelCmdInvert(M* model, const G4String& placement) :G4ModelCmdApplyBool(model, placement, "invert") { G4ModelCmdApplyBool::Command()->SetGuidance("Invert command"); } virtual ~G4ModelCmdInvert() {} protected: virtual void Apply(const G4bool& newValue) { G4VModelCommand::Model()->SetInvert(newValue); } }; //////////////////////////////////////////////////////////////////////// // Active command template class G4ModelCmdActive : public G4ModelCmdApplyBool { public: // With description G4ModelCmdActive(M* model, const G4String& placement) :G4ModelCmdApplyBool(model, placement, "active") { G4ModelCmdApplyBool::Command()->SetGuidance("Active command"); } virtual ~G4ModelCmdActive() {} protected: virtual void Apply(const G4bool& newValue) { G4VModelCommand::Model()->SetActive(newValue); } }; //////////////////////////////////////////////////////////////////////// // Verbose command template class G4ModelCmdVerbose : public G4ModelCmdApplyBool { public: // With description G4ModelCmdVerbose(M* model, const G4String& placement) :G4ModelCmdApplyBool(model, placement, "verbose") { G4ModelCmdApplyBool::Command()->SetGuidance("Verbose command"); } virtual ~G4ModelCmdVerbose() {} protected: virtual void Apply(const G4bool& newValue) { G4VModelCommand::Model()->SetVerbose(newValue); } }; //////////////////////////////////////////////////////////////////////// // Reset command template class G4ModelCmdReset : public G4ModelCmdApplyNull { public: // With description G4ModelCmdReset(M* model, const G4String& placement) :G4ModelCmdApplyNull(model, placement, "reset") { G4ModelCmdApplyNull::Command()->SetGuidance("Reset command"); } virtual ~G4ModelCmdReset() {} protected: virtual void Apply() { G4VModelCommand::Model()->Reset(); } }; //////////////////////////////////////////////////////////////////////// // Set auxiliary points colour command template class G4ModelCmdSetAuxPtsColour : public G4ModelCmdApplyColour { public: G4ModelCmdSetAuxPtsColour(M* model, const G4String& placement) :G4ModelCmdApplyColour(model, placement, "setAuxPtsColour") {} protected: void Apply(const G4Colour& colour) { G4VModelCommand::Model()->SetAuxPtsColour(colour); } }; //////////////////////////////////////////////////////////////////////// // Set set points colour command template class G4ModelCmdSetStepPtsColour : public G4ModelCmdApplyColour { public: G4ModelCmdSetStepPtsColour(M* model, const G4String& placement) :G4ModelCmdApplyColour(model, placement, "setStepPtsColour") {} protected: void Apply(const G4Colour& colour) { G4VModelCommand::Model()->SetStepPtsColour(colour); } }; //////////////////////////////////////////////////////////////////////// // Set draw line command template class G4ModelCmdSetDrawLine : public G4ModelCmdApplyBool { public: G4ModelCmdSetDrawLine(M* model, const G4String& placement) :G4ModelCmdApplyBool(model, placement, "setDrawLine") { G4ModelCmdApplyBool::Command()->SetGuidance("Set draw line command"); } protected: void Apply(const G4bool& myBool) { G4VModelCommand::Model()->SetDrawLine(myBool); } }; //////////////////////////////////////////////////////////////////////// // Set line visibility command template class G4ModelCmdSetLineVisible : public G4ModelCmdApplyBool { public: G4ModelCmdSetLineVisible(M* model, const G4String& placement) :G4ModelCmdApplyBool(model, placement, "setLineVisible") { G4ModelCmdApplyBool::Command()->SetGuidance("Set line visibility command"); } protected: void Apply(const G4bool& myBool) { G4VModelCommand::Model()->SetLineVisible(myBool); } }; //////////////////////////////////////////////////////////////////////// // Set draw auxiliary points command template class G4ModelCmdSetDrawAuxPts : public G4ModelCmdApplyBool { public: G4ModelCmdSetDrawAuxPts(M* model, const G4String& placement) :G4ModelCmdApplyBool(model, placement, "setDrawAuxPts") { G4ModelCmdApplyBool::Command()->SetGuidance("Set draw auxiliary points command"); } protected: void Apply(const G4bool& myBool) { G4VModelCommand::Model()->SetDrawAuxPts(myBool); } }; //////////////////////////////////////////////////////////////////////// // Set auxiliary points visibility template class G4ModelCmdSetAuxPtsVisible : public G4ModelCmdApplyBool { public: G4ModelCmdSetAuxPtsVisible(M* model, const G4String& placement) :G4ModelCmdApplyBool(model, placement, "setAuxPtsVisible") { G4ModelCmdApplyBool::Command()->SetGuidance("Set auxiliary points visibility command"); } protected: void Apply(const G4bool& myBool) { G4VModelCommand::Model()->SetAuxPtsVisible(myBool); } }; //////////////////////////////////////////////////////////////////////// // Set draw step points command template class G4ModelCmdSetDrawStepPts : public G4ModelCmdApplyBool { public: G4ModelCmdSetDrawStepPts(M* model, const G4String& placement) :G4ModelCmdApplyBool(model, placement, "setDrawStepPts") { G4ModelCmdApplyBool::Command()->SetGuidance("Set draw step points command"); } protected: void Apply(const G4bool& myBool) { G4VModelCommand::Model()->SetDrawStepPts(myBool); } }; //////////////////////////////////////////////////////////////////////// // Set step points visible command template class G4ModelCmdSetStepPtsVisible : public G4ModelCmdApplyBool { public: G4ModelCmdSetStepPtsVisible(M* model, const G4String& placement) :G4ModelCmdApplyBool(model, placement, "setStepPtsVisible") { G4ModelCmdApplyBool::Command()->SetGuidance("Set step points colour command"); } protected: void Apply(const G4bool& myBool) { G4VModelCommand::Model()->SetStepPtsVisible(myBool); } }; //////////////////////////////////////////////////////////////////////// // Set auxiliary points size command template class G4ModelCmdSetAuxPtsSize : public G4ModelCmdApplyDouble { public: G4ModelCmdSetAuxPtsSize(M* model, const G4String& placement) :G4ModelCmdApplyDouble(model, placement, "setAuxPtsSize") { G4ModelCmdApplyDouble::Command()->SetGuidance("Set auxiliary points size command"); } protected: void Apply(const G4double& myDouble) { G4VModelCommand::Model()->SetAuxPtsSize(myDouble); } }; //////////////////////////////////////////////////////////////////////// // Set step points size command template class G4ModelCmdSetStepPtsSize : public G4ModelCmdApplyDouble { public: G4ModelCmdSetStepPtsSize(M* model, const G4String& placement) :G4ModelCmdApplyDouble(model, placement, "setStepPtsSize") { G4ModelCmdApplyDouble::Command()->SetGuidance("Set step points colour command"); } protected: void Apply(const G4double& myDouble) { G4VModelCommand::Model()->SetStepPtsSize(myDouble); } }; //////////////////////////////////////////////////////////////////////// // Set step points type command template class G4ModelCmdSetStepPtsType : public G4ModelCmdApplyString { public: G4ModelCmdSetStepPtsType(M* model, const G4String& placement) :G4ModelCmdApplyString(model, placement, "setStepPtsType") { G4UIcmdWithAString* cmd = G4ModelCmdApplyString::Command(); cmd->SetGuidance("Set step points type."); cmd->SetCandidates("dots circles squares"); } protected: void Apply(const G4String& type) { G4Polymarker::MarkerType myType; if (type == "dots") {myType = G4Polymarker::dots;} else if (type == "circles") {myType = G4Polymarker::circles;} else if (type == "squares") {myType = G4Polymarker::squares;} else { std::ostringstream o; o << "Invalid argument. See command guidance for options."; G4Exception ("G4ModelCmdSetStepPtsType::Apply", "InvalidArgument", JustWarning, o.str().c_str()); return; } G4VModelCommand::Model()->SetStepPtsType(myType); } }; //////////////////////////////////////////////////////////////////////// // Set auxiliary points type command template class G4ModelCmdSetAuxPtsType : public G4ModelCmdApplyString { public: G4ModelCmdSetAuxPtsType(M* model, const G4String& placement) :G4ModelCmdApplyString(model, placement, "setAuxPtsType") { G4UIcmdWithAString* cmd = G4ModelCmdApplyString::Command(); cmd->SetGuidance("Set auxiliary points type."); cmd->SetCandidates("dots circles squares"); } protected: void Apply(const G4String& type) { G4Polymarker::MarkerType myType; if (type == "dots") {myType = G4Polymarker::dots;} else if (type == "circles") {myType = G4Polymarker::circles;} else if (type == "squares") {myType = G4Polymarker::squares;} else { std::ostringstream o; o << "Invalid argument. See command guidance for options."; G4Exception ("G4ModelCmdSetAuxPtsType::Apply", "InvalidArgument", JustWarning, o.str().c_str()); return; } G4VModelCommand::Model()->SetAuxPtsType(myType); } }; //////////////////////////////////////////////////////////////////////// // Set step points fill style command template class G4ModelCmdSetStepPtsFillStyle : public G4ModelCmdApplyString { public: G4ModelCmdSetStepPtsFillStyle(M* model, const G4String& placement) :G4ModelCmdApplyString(model, placement, "setStepPtsFillStyle") { G4UIcmdWithAString* cmd = G4ModelCmdApplyString::Command(); cmd->SetGuidance("Set step fill style type."); cmd->SetCandidates("noFill hashed filled"); } protected: void Apply(const G4String& type) { G4VMarker::FillStyle myFillStyle; if (type == "noFill") {myFillStyle = G4VMarker::noFill;} else if (type == "hashed") {myFillStyle = G4VMarker::hashed;} else if (type == "filled") {myFillStyle = G4VMarker::filled;} else { std::ostringstream o; o << "Invalid argument. See command guidance for options."; G4Exception ("G4ModelCmdSetStepPtsFillStyle::Apply", "InvalidArgument", JustWarning, o.str().c_str()); return; } G4VModelCommand::Model()->SetStepPtsFillStyle(myFillStyle); } }; //////////////////////////////////////////////////////////////////////// // Set auxiliary points fill style command template class G4ModelCmdSetAuxPtsFillStyle : public G4ModelCmdApplyString { public: G4ModelCmdSetAuxPtsFillStyle(M* model, const G4String& placement) :G4ModelCmdApplyString(model, placement, "setAuxPtsFillStyle") { G4UIcmdWithAString* cmd = G4ModelCmdApplyString::Command(); cmd->SetGuidance("Set auxiliary fill style."); cmd->SetCandidates("noFill hashed filled"); } protected: void Apply(const G4String& type) { G4VMarker::FillStyle myFillStyle; if (type == "noFill") {myFillStyle = G4VMarker::noFill;} else if (type == "hashed") {myFillStyle = G4VMarker::hashed;} else if (type == "filled") {myFillStyle = G4VMarker::filled;} else { std::ostringstream o; o << "Invalid argument. See command guidance for options."; G4Exception ("G4ModelCmdSetAuxPtsFillStyle::Apply", "InvalidArgument", JustWarning, o.str().c_str()); return; } G4VModelCommand::Model()->SetAuxPtsFillStyle(myFillStyle); } }; //////////////////////////////////////////////////////////////////////// // SetLineColour command template class G4ModelCmdSetLineColour : public G4ModelCmdApplyColour { public: G4ModelCmdSetLineColour(M* model, const G4String& placement) :G4ModelCmdApplyColour(model, placement, "setLineColour") {} protected: void Apply(const G4Colour& colour) { G4VModelCommand::Model()->SetLineColour(colour); } }; //////////////////////////////////////////////////////////////////////// // Create context directory command template class G4ModelCmdCreateContextDir : public G4UImessenger { public: G4ModelCmdCreateContextDir(M* model, const G4String& placement) { G4String title = placement+"/"+model->Name()+"/"; cmd = new G4UIdirectory(title); cmd->SetGuidance("Commands for default configuration"); } virtual ~G4ModelCmdCreateContextDir() { delete cmd; } protected: G4UIdirectory* cmd; }; #endif