Geant4_10
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 66373 2012-12-18 09:41:34Z gcosmo $
27 //
28 // Jane Tinslay, John Allison, Joseph Perl October 2005
29 
31 #include "G4ModelCommandsT.hh"
32 #include "G4ModelCommandUtils.hh"
39 #include "G4VisTrajContext.hh"
40 
41 // Draw by attribute
43  :G4VModelFactory<G4VTrajectoryModel>("drawByAttribute")
44 {}
45 
47 
48 ModelAndMessengers
50 {
51  Messengers messengers;
52 
53  // Create default context and model
54  G4VisTrajContext* context = new G4VisTrajContext("default");
55 
57 
58  // Create messengers for default context configuration
59  G4ModelCommandUtils::AddContextMsgrs(context, messengers, placement+"/"+name);
60 
61  messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryDrawByAttribute>(model, placement));
62  messengers.push_back(new G4ModelCmdSetString<G4TrajectoryDrawByAttribute>(model, placement, "setAttribute"));
63  messengers.push_back(new G4ModelCmdAddIntervalContext<G4TrajectoryDrawByAttribute>(model, placement, "addInterval"));
64  messengers.push_back(new G4ModelCmdAddValueContext<G4TrajectoryDrawByAttribute>(model, placement, "addValue"));
65 
66  return ModelAndMessengers(model, messengers);
67 }
68 
71 {}
72 
74 
75 ModelAndMessengers
77 {
78  Messengers messengers;
79 
80  // Create default context and model
81  G4VisTrajContext* context = new G4VisTrajContext("default");
83 
84  // Create messengers for default context configuration
85  G4ModelCommandUtils::AddContextMsgrs(context, messengers, placement+"/"+name);
86 
87  // Verbose command
88  messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryGenericDrawer>(model, placement));
89 
90  return ModelAndMessengers(model, messengers);
91 }
92 
93 // drawByCharge
95  :G4VModelFactory<G4VTrajectoryModel>("drawByCharge")
96 {}
97 
99 
100 ModelAndMessengers
102 {
103  Messengers messengers;
104 
105  // Create default context and model
106  G4VisTrajContext* context = new G4VisTrajContext("default");
108 
109  // Create messengers for default context configuration
110  G4ModelCommandUtils::AddContextMsgrs(context, messengers, placement+"/"+name);
111 
112  // Create messengers for drawer
113  messengers.push_back(new G4ModelCmdSetStringColour<G4TrajectoryDrawByCharge>(model, placement));
114  messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryDrawByCharge>(model, placement));
115 
116  return ModelAndMessengers(model, messengers);
117 }
118 
119 //Draw by particle ID
121  :G4VModelFactory<G4VTrajectoryModel>("drawByParticleID")
122 {}
123 
125 
126 ModelAndMessengers
128 {
129  Messengers messengers;
130 
131  // Create default context and model
132  G4VisTrajContext* context = new G4VisTrajContext("default");
134 
135  // Create messengers for default context configuration
136  G4ModelCommandUtils::AddContextMsgrs(context, messengers, placement+"/"+name);
137 
138  // Create messengers for drawer
139  messengers.push_back(new G4ModelCmdSetStringColour<G4TrajectoryDrawByParticleID>(model, placement));
140  messengers.push_back(new G4ModelCmdSetDefaultColour<G4TrajectoryDrawByParticleID>(model, placement));
141  messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryDrawByParticleID>(model, placement));
142 
143  return ModelAndMessengers(model, messengers);
144 }
145 
146 //Draw by origin volume
148  :G4VModelFactory<G4VTrajectoryModel>("drawByOriginVolume")
149 {}
150 
152 
153 ModelAndMessengers
155 {
156  Messengers messengers;
157 
158  // Create default context and model
159  G4VisTrajContext* context = new G4VisTrajContext("default");
161 
162  // Create messengers for default context configuration
163  G4ModelCommandUtils::AddContextMsgrs(context, messengers, placement+"/"+name);
164 
165  // Create messengers for drawer
166  messengers.push_back(new G4ModelCmdSetStringColour<G4TrajectoryDrawByOriginVolume>(model, placement));
167  messengers.push_back(new G4ModelCmdSetDefaultColour<G4TrajectoryDrawByOriginVolume>(model, placement));
168  messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryDrawByOriginVolume>(model, placement));
169 
170  return ModelAndMessengers(model, messengers);
171 }
std::vector< G4UImessenger * > Messengers
ModelAndMessengers Create(const G4String &placement, const G4String &name)
const XML_Char * name
Definition: expat.h:151
void AddContextMsgrs(G4VisTrajContext *context, std::vector< G4UImessenger * > &messengers, const G4String &placement)
ModelAndMessengers Create(const G4String &placement, const G4String &name)
const XML_Char XML_Content * model
Definition: expat.h:151
const XML_Char * context
Definition: expat.h:434
std::pair< T *, Messengers > ModelAndMessengers
ModelAndMessengers Create(const G4String &placement, const G4String &name)
ModelAndMessengers Create(const G4String &placement, const G4String &name)
ModelAndMessengers Create(const G4String &placement, const G4String &name)