source: trunk/source/visualization/modeling/src/G4TrajectoryModelFactories.cc@ 1092

Last change on this file since 1092 was 954, checked in by garnier, 17 years ago

remise a jour

File size: 7.2 KB
RevLine 
[834]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,v 1.7 2006/09/12 18:53:03 tinslay Exp $
[954]27// GEANT4 tag $Name: $
[834]28//
29// Jane Tinslay, John Allison, Joseph Perl October 2005
30
31#include "G4ModelCompoundCommandsT.hh"
32#include "G4ModelCommandsT.hh"
33#include "G4ModelCommandUtils.hh"
34#include "G4TrajectoryDrawByAttribute.hh"
35#include "G4TrajectoryDrawByCharge.hh"
36#include "G4TrajectoryDrawByOriginVolume.hh"
37#include "G4TrajectoryDrawByParticleID.hh"
38#include "G4TrajectoryGenericDrawer.hh"
39#include "G4TrajectoryModelFactories.hh"
40#include "G4VisTrajContext.hh"
41
42// Draw by attribute
43G4TrajectoryDrawByAttributeFactory::G4TrajectoryDrawByAttributeFactory()
44 :G4VModelFactory<G4VTrajectoryModel>("drawByAttribute")
45{}
46
47G4TrajectoryDrawByAttributeFactory::~G4TrajectoryDrawByAttributeFactory() {}
48
49ModelAndMessengers
50G4TrajectoryDrawByAttributeFactory::Create(const G4String& placement, const G4String& name)
51{
52 Messengers messengers;
53
54 // Create default context and model
55 G4VisTrajContext* context = new G4VisTrajContext("default");
56
57 G4TrajectoryDrawByAttribute* model = new G4TrajectoryDrawByAttribute(name, context);
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
70G4TrajectoryGenericDrawerFactory::G4TrajectoryGenericDrawerFactory()
71 :G4VModelFactory<G4VTrajectoryModel>("generic")
72{}
73
74G4TrajectoryGenericDrawerFactory::~G4TrajectoryGenericDrawerFactory() {}
75
76ModelAndMessengers
77G4TrajectoryGenericDrawerFactory::Create(const G4String& placement, const G4String& name)
78{
79 Messengers messengers;
80
81 // Create default context and model
82 G4VisTrajContext* context = new G4VisTrajContext("default");
83 G4TrajectoryGenericDrawer* model = new G4TrajectoryGenericDrawer(name, context);
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
95G4TrajectoryDrawByChargeFactory::G4TrajectoryDrawByChargeFactory()
96 :G4VModelFactory<G4VTrajectoryModel>("drawByCharge")
97{}
98
99G4TrajectoryDrawByChargeFactory::~G4TrajectoryDrawByChargeFactory() {}
100
101ModelAndMessengers
102G4TrajectoryDrawByChargeFactory::Create(const G4String& placement, const G4String& name)
103{
104 Messengers messengers;
105
106 // Create default context and model
107 G4VisTrajContext* context = new G4VisTrajContext("default");
108 G4TrajectoryDrawByCharge* model = new G4TrajectoryDrawByCharge(name, context);
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
121G4TrajectoryDrawByParticleIDFactory::G4TrajectoryDrawByParticleIDFactory()
122 :G4VModelFactory<G4VTrajectoryModel>("drawByParticleID")
123{}
124
125G4TrajectoryDrawByParticleIDFactory::~G4TrajectoryDrawByParticleIDFactory() {}
126
127ModelAndMessengers
128G4TrajectoryDrawByParticleIDFactory::Create(const G4String& placement, const G4String& name)
129{
130 Messengers messengers;
131
132 // Create default context and model
133 G4VisTrajContext* context = new G4VisTrajContext("default");
134 G4TrajectoryDrawByParticleID* model = new G4TrajectoryDrawByParticleID(name, context);
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
148G4TrajectoryDrawByOriginVolumeFactory::G4TrajectoryDrawByOriginVolumeFactory()
149 :G4VModelFactory<G4VTrajectoryModel>("drawByOriginVolume")
150{}
151
152G4TrajectoryDrawByOriginVolumeFactory::~G4TrajectoryDrawByOriginVolumeFactory() {}
153
154ModelAndMessengers
155G4TrajectoryDrawByOriginVolumeFactory::Create(const G4String& placement, const G4String& name)
156{
157 Messengers messengers;
158
159 // Create default context and model
160 G4VisTrajContext* context = new G4VisTrajContext("default");
161 G4TrajectoryDrawByOriginVolume* model = new G4TrajectoryDrawByOriginVolume(name, context);
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}
Note: See TracBrowser for help on using the repository browser.