Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4TrajectoryModelFactories.cc
Go to the documentation of this file.
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 // $Id: G4TrajectoryModelFactories.cc 98766 2016-08-09 14:17:17Z gcosmo $
27 //
28 // Jane Tinslay, John Allison, Joseph Perl October 2005
29 
31 #include "G4ModelCommandsT.hh"
32 #include "G4ModelCommandUtils.hh"
40 #include "G4VisTrajContext.hh"
41 
42 // Draw by attribute
44  :G4VModelFactory<G4VTrajectoryModel>("drawByAttribute")
45 {}
46 
48 
49 ModelAndMessengers
51 {
52  Messengers messengers;
53 
54  // Create default context and model
55  G4VisTrajContext* context = new G4VisTrajContext("default");
56 
58 
59  // Create messengers for default context configuration
60  G4ModelCommandUtils::AddContextMsgrs(context, messengers, placement+"/"+name);
61 
62  messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryDrawByAttribute>(model, placement));
63  messengers.push_back(new G4ModelCmdSetString<G4TrajectoryDrawByAttribute>(model, placement, "setAttribute"));
64  messengers.push_back(new G4ModelCmdAddIntervalContext<G4TrajectoryDrawByAttribute>(model, placement, "addInterval"));
65  messengers.push_back(new G4ModelCmdAddValueContext<G4TrajectoryDrawByAttribute>(model, placement, "addValue"));
66 
67  return ModelAndMessengers(model, messengers);
68 }
69 
72 {}
73 
75 
76 ModelAndMessengers
78 {
79  Messengers messengers;
80 
81  // Create default context and model
82  G4VisTrajContext* context = new G4VisTrajContext("default");
84 
85  // Create messengers for default context configuration
86  G4ModelCommandUtils::AddContextMsgrs(context, messengers, placement+"/"+name);
87 
88  // Verbose command
89  messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryGenericDrawer>(model, placement));
90 
91  return ModelAndMessengers(model, messengers);
92 }
93 
94 // drawByCharge
96  :G4VModelFactory<G4VTrajectoryModel>("drawByCharge")
97 {}
98 
100 
101 ModelAndMessengers
103 {
104  Messengers messengers;
105 
106  // Create default context and model
107  G4VisTrajContext* context = new G4VisTrajContext("default");
109 
110  // Create messengers for default context configuration
111  G4ModelCommandUtils::AddContextMsgrs(context, messengers, placement+"/"+name);
112 
113  // Create messengers for drawer
114  messengers.push_back(new G4ModelCmdSetStringColour<G4TrajectoryDrawByCharge>(model, placement));
115  messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryDrawByCharge>(model, placement));
116 
117  return ModelAndMessengers(model, messengers);
118 }
119 
120 //Draw by particle ID
122  :G4VModelFactory<G4VTrajectoryModel>("drawByParticleID")
123 {}
124 
126 
127 ModelAndMessengers
129 {
130  Messengers messengers;
131 
132  // Create default context and model
133  G4VisTrajContext* context = new G4VisTrajContext("default");
135 
136  // Create messengers for default context configuration
137  G4ModelCommandUtils::AddContextMsgrs(context, messengers, placement+"/"+name);
138 
139  // Create messengers for drawer
140  messengers.push_back(new G4ModelCmdSetStringColour<G4TrajectoryDrawByParticleID>(model, placement));
141  messengers.push_back(new G4ModelCmdSetDefaultColour<G4TrajectoryDrawByParticleID>(model, placement));
142  messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryDrawByParticleID>(model, placement));
143 
144  return ModelAndMessengers(model, messengers);
145 }
146 
147 //Draw by origin volume
149 :G4VModelFactory<G4VTrajectoryModel>("drawByOriginVolume")
150 {}
151 
153 
154 ModelAndMessengers
156 {
157  Messengers messengers;
158 
159  // Create default context and model
160  G4VisTrajContext* context = new G4VisTrajContext("default");
162 
163  // Create messengers for default context configuration
164  G4ModelCommandUtils::AddContextMsgrs(context, messengers, placement+"/"+name);
165 
166  // Create messengers for drawer
167  messengers.push_back(new G4ModelCmdSetStringColour<G4TrajectoryDrawByOriginVolume>(model, placement));
168  messengers.push_back(new G4ModelCmdSetDefaultColour<G4TrajectoryDrawByOriginVolume>(model, placement));
169  messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryDrawByOriginVolume>(model, placement));
170 
171  return ModelAndMessengers(model, messengers);
172 }
173 
174 //Draw by encountered volume
176 :G4VModelFactory<G4VTrajectoryModel>("drawByEncounteredVolume")
177 {}
178 
180 
181 ModelAndMessengers
183 {
184  Messengers messengers;
185 
186  // Create default context and model
187  G4VisTrajContext* context = new G4VisTrajContext("default");
189 
190  // Create messengers for default context configuration
191  G4ModelCommandUtils::AddContextMsgrs(context, messengers, placement+"/"+name);
192 
193  // Create messengers for drawer
194  messengers.push_back(new G4ModelCmdSetStringColour<G4TrajectoryDrawByEncounteredVolume>(model, placement));
195  messengers.push_back(new G4ModelCmdSetDefaultColour<G4TrajectoryDrawByEncounteredVolume>(model, placement));
196  messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryDrawByEncounteredVolume>(model, placement));
197 
198  return ModelAndMessengers(model, messengers);
199 }
std::vector< G4UImessenger * > Messengers
const XML_Char * name
Definition: expat.h:151
ModelAndMessengers Create(const G4String &placement, const G4String &name)
void AddContextMsgrs(G4VisTrajContext *context, std::vector< G4UImessenger * > &messengers, const G4String &placement)
ModelAndMessengers Create(const G4String &placement, const G4String &name)
std::pair< T *, Messengers > ModelAndMessengers
const XML_Char * context
Definition: expat.h:434
ModelAndMessengers Create(const G4String &placement, const G4String &name)
ModelAndMessengers Create(const G4String &placement, const G4String &name)
ModelAndMessengers Create(const G4String &placement, const G4String &name)
ModelAndMessengers Create(const G4String &placement, const G4String &name)
const XML_Char XML_Content * model
Definition: expat.h:151