File indexing completed on 2025-01-18 09:59:23
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 #ifndef G4VISCOMMANDLISTMANAGER_HH
0035 #define G4VISCOMMANDLISTMANAGER_HH
0036
0037 #include "G4UImessenger.hh"
0038 #include "G4String.hh"
0039 #include "G4UIcmdWithAString.hh"
0040 #include "G4UIcommand.hh"
0041
0042 template <typename Manager>
0043 class G4VisCommandListManagerList : public G4UImessenger {
0044
0045 public:
0046
0047 G4VisCommandListManagerList(Manager*, const G4String& placement);
0048
0049
0050 virtual ~G4VisCommandListManagerList();
0051
0052 G4String GetCurrentValue(G4UIcommand*);
0053 void SetNewValue(G4UIcommand* command, G4String newValue);
0054
0055 G4String Placement() const;
0056
0057 private:
0058
0059
0060 Manager* fpManager;
0061 G4String fPlacement;
0062
0063 G4UIcmdWithAString* fpCommand;
0064
0065 };
0066
0067
0068 template <typename Manager>
0069 G4VisCommandListManagerList<Manager>::G4VisCommandListManagerList(Manager* manager, const G4String& placement)
0070 :fpManager(manager)
0071 ,fPlacement(placement)
0072 {
0073 G4String command = Placement()+"/list";
0074
0075 fpCommand = new G4UIcmdWithAString(command, this);
0076 fpCommand->SetGuidance("List objects registered with list manager");
0077 fpCommand->SetParameterName("name", true);
0078 }
0079
0080 template <typename Manager>
0081 G4VisCommandListManagerList<Manager>::~G4VisCommandListManagerList()
0082 {
0083 delete fpCommand;
0084 }
0085
0086 template <typename Manager>
0087 G4String
0088 G4VisCommandListManagerList<Manager>::Placement() const
0089 {
0090 return fPlacement;
0091 }
0092
0093 template <typename Manager>
0094 G4String
0095 G4VisCommandListManagerList<Manager>::GetCurrentValue(G4UIcommand*)
0096 {
0097 return "";
0098 }
0099
0100 template <typename Manager>
0101 void G4VisCommandListManagerList<Manager>::SetNewValue(G4UIcommand*, G4String name)
0102 {
0103 G4cout<<"Listing models available in "<<Placement()<<G4endl;
0104
0105 assert (0 != fpManager);
0106 fpManager->Print(G4cout, name);
0107 }
0108
0109
0110 template <typename Manager>
0111 class G4VisCommandListManagerSelect : public G4UImessenger {
0112
0113 public:
0114
0115 G4VisCommandListManagerSelect(Manager*, const G4String& placement);
0116
0117
0118 virtual ~G4VisCommandListManagerSelect();
0119
0120 G4String GetCurrentValue(G4UIcommand*);
0121 void SetNewValue (G4UIcommand* command, G4String newValue);
0122
0123 private:
0124
0125 Manager* fpManager;
0126 G4String fPlacement;
0127
0128 G4UIcmdWithAString* fpCommand;
0129
0130 };
0131
0132 template <typename Manager>
0133 G4VisCommandListManagerSelect<Manager>::G4VisCommandListManagerSelect(Manager* manager, const G4String& placement)
0134 :fpManager(manager)
0135 ,fPlacement(placement)
0136 {
0137 G4String command = placement+"/select";
0138 G4String guidance = "Select created object";
0139
0140 fpCommand = new G4UIcmdWithAString(command, this);
0141 fpCommand->SetGuidance(guidance);
0142 fpCommand->SetParameterName("name", false);
0143 }
0144
0145 template <typename Manager>
0146 G4VisCommandListManagerSelect<Manager>::~G4VisCommandListManagerSelect()
0147 {
0148 delete fpCommand;
0149 }
0150
0151 template <typename Manager>
0152 G4String
0153 G4VisCommandListManagerSelect<Manager>::GetCurrentValue(G4UIcommand*)
0154 {
0155 return "";
0156 }
0157
0158 template <typename Manager>
0159 void G4VisCommandListManagerSelect<Manager>::SetNewValue(G4UIcommand*, G4String name)
0160 {
0161 assert (0 != fpManager);
0162 fpManager->SetCurrent(name);
0163 }
0164
0165
0166 template <typename Manager>
0167 class G4VisCommandManagerMode : public G4UImessenger {
0168
0169 public:
0170
0171 G4VisCommandManagerMode(Manager*, const G4String& placement);
0172
0173 virtual ~G4VisCommandManagerMode();
0174
0175 G4String GetCurrentValue(G4UIcommand*);
0176 void SetNewValue (G4UIcommand* command, G4String newValue);
0177
0178 private:
0179
0180 Manager* fpManager;
0181 G4String fPlacement;
0182
0183 G4UIcmdWithAString* fpCommand;
0184
0185 };
0186 template <typename Manager>
0187 G4VisCommandManagerMode<Manager>::G4VisCommandManagerMode(Manager* manager, const G4String& placement)
0188 :fpManager(manager)
0189 ,fPlacement(placement)
0190 {
0191 G4String command = fPlacement+"/mode";
0192
0193 fpCommand = new G4UIcmdWithAString(command, this);
0194 fpCommand->SetGuidance("Set mode of operation");
0195 fpCommand->SetParameterName("mode", false);
0196 fpCommand->SetCandidates("soft hard");
0197 }
0198
0199 template <typename Manager>
0200 G4VisCommandManagerMode<Manager>::~G4VisCommandManagerMode()
0201 {
0202 delete fpCommand;
0203 }
0204
0205 template <typename Manager>
0206 G4String
0207 G4VisCommandManagerMode<Manager>::GetCurrentValue(G4UIcommand*)
0208 {
0209 return "";
0210 }
0211
0212 template <typename Manager>
0213 void G4VisCommandManagerMode<Manager>::SetNewValue(G4UIcommand*, G4String name)
0214 {
0215 assert (0 != fpManager);
0216 fpManager->SetMode(name);
0217 G4VVisManager* visManager = G4VVisManager::GetConcreteInstance();
0218 if (visManager) visManager->NotifyHandlers();
0219 }
0220
0221 #endif