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] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  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 //
 27 // Jane Tinslay, John Allison, Joseph Perl October 2005
 28 //
 29 // Class Description:
 30 // Templated list manager commands which control list manager listing and
 31 // selection.
 32 // Class Description - End:
 33 
 34 #ifndef G4VISCOMMANDLISTMANAGER_HH
 35 #define G4VISCOMMANDLISTMANAGER_HH
 36 
 37 #include "G4UImessenger.hh"
 38 #include "G4String.hh"
 39 #include "G4UIcmdWithAString.hh"
 40 #include "G4UIcommand.hh"
 41 
 42 template <typename Manager>
 43 class G4VisCommandListManagerList : public G4UImessenger {
 44 
 45 public: // With description
 46 
 47   G4VisCommandListManagerList(Manager*, const G4String& placement);
 48   // Input list manager and command placement
 49 
 50   virtual ~G4VisCommandListManagerList();
 51 
 52   G4String GetCurrentValue(G4UIcommand*);
 53   void SetNewValue(G4UIcommand* command, G4String newValue);
 54 
 55   G4String Placement() const;
 56 
 57 private:
 58 
 59   // Data members
 60   Manager* fpManager;
 61   G4String fPlacement;
 62 
 63   G4UIcmdWithAString* fpCommand;
 64 
 65 };
 66 
 67 // List command
 68 template <typename Manager>
 69 G4VisCommandListManagerList<Manager>::G4VisCommandListManagerList(Manager* manager, const G4String& placement)
 70   :fpManager(manager)
 71   ,fPlacement(placement)
 72 {  
 73   G4String command = Placement()+"/list";
 74   
 75   fpCommand = new G4UIcmdWithAString(command, this);      
 76   fpCommand->SetGuidance("List objects registered with list manager");
 77   fpCommand->SetParameterName("name", true);       
 78 }
 79 
 80 template <typename Manager>
 81 G4VisCommandListManagerList<Manager>::~G4VisCommandListManagerList()
 82 {
 83   delete fpCommand;
 84 }
 85 
 86 template <typename Manager>
 87 G4String
 88 G4VisCommandListManagerList<Manager>::Placement() const
 89 {
 90   return fPlacement;
 91 }
 92 
 93 template <typename Manager>
 94 G4String 
 95 G4VisCommandListManagerList<Manager>::GetCurrentValue(G4UIcommand*) 
 96 {
 97   return "";
 98 }
 99 
100 template <typename Manager>
101 void G4VisCommandListManagerList<Manager>::SetNewValue(G4UIcommand*, G4String name) 
102 {
103   G4cout<<"Listing models available in "<<Placement()<<G4endl;
104 
105   assert (0 != fpManager);
106   fpManager->Print(G4cout, name);
107 }    
108 
109 //Select command
110 template <typename Manager>
111 class G4VisCommandListManagerSelect : public G4UImessenger {
112 
113 public: // With description
114 
115   G4VisCommandListManagerSelect(Manager*, const G4String& placement);
116   // Input list manager and command placement
117 
118   virtual ~G4VisCommandListManagerSelect();
119 
120   G4String GetCurrentValue(G4UIcommand*);
121   void SetNewValue (G4UIcommand* command, G4String newValue);
122 
123 private:
124 
125   Manager* fpManager;
126   G4String fPlacement;
127 
128   G4UIcmdWithAString* fpCommand;
129 
130 };
131 
132 template <typename Manager>
133 G4VisCommandListManagerSelect<Manager>::G4VisCommandListManagerSelect(Manager* manager, const G4String& placement)
134   :fpManager(manager)
135   ,fPlacement(placement)
136 {  
137   G4String command = placement+"/select";
138   G4String guidance = "Select created object";
139  
140   fpCommand = new G4UIcmdWithAString(command, this);      
141   fpCommand->SetGuidance(guidance);
142   fpCommand->SetParameterName("name", false);       
143 }
144 
145 template <typename Manager>
146 G4VisCommandListManagerSelect<Manager>::~G4VisCommandListManagerSelect()
147 {
148   delete fpCommand;
149 }
150 
151 template <typename Manager>
152 G4String 
153 G4VisCommandListManagerSelect<Manager>::GetCurrentValue(G4UIcommand*) 
154 {
155   return "";
156 }
157 
158 template <typename Manager>
159 void G4VisCommandListManagerSelect<Manager>::SetNewValue(G4UIcommand*, G4String name) 
160 {
161   assert (0 != fpManager);
162   fpManager->SetCurrent(name);
163 }    
164 
165 // Mode command
166 template <typename Manager>
167 class G4VisCommandManagerMode : public G4UImessenger {
168 
169 public: // With description
170 
171   G4VisCommandManagerMode(Manager*, const G4String& placement);
172 
173   virtual ~G4VisCommandManagerMode();
174 
175   G4String GetCurrentValue(G4UIcommand*);
176   void SetNewValue (G4UIcommand* command, G4String newValue);
177 
178 private:
179 
180   Manager* fpManager;
181   G4String fPlacement;
182 
183   G4UIcmdWithAString* fpCommand;
184 
185 };
186 template <typename Manager>
187 G4VisCommandManagerMode<Manager>::G4VisCommandManagerMode(Manager* manager, const G4String& placement)
188   :fpManager(manager)
189   ,fPlacement(placement)
190 {  
191   G4String command = fPlacement+"/mode";
192   
193   fpCommand = new G4UIcmdWithAString(command, this);      
194   fpCommand->SetGuidance("Set mode of operation");
195   fpCommand->SetParameterName("mode", false);       
196   fpCommand->SetCandidates("soft hard");       
197 }
198 
199 template <typename Manager>
200 G4VisCommandManagerMode<Manager>::~G4VisCommandManagerMode()
201 {
202   delete fpCommand;
203 }
204 
205 template <typename Manager>
206 G4String 
207 G4VisCommandManagerMode<Manager>::GetCurrentValue(G4UIcommand*) 
208 {
209   return "";
210 }
211 
212 template <typename Manager>
213 void G4VisCommandManagerMode<Manager>::SetNewValue(G4UIcommand*, G4String name) 
214 {
215   assert (0 != fpManager);
216   fpManager->SetMode(name);
217   G4VVisManager* visManager = G4VVisManager::GetConcreteInstance();
218   if (visManager) visManager->NotifyHandlers();
219 }    
220 
221 #endif
222