G4TrajectoryModelFactories.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 // $Id$
00027 //
00028 // Jane Tinslay, John Allison, Joseph Perl October 2005
00029 
00030 #include "G4ModelCompoundCommandsT.hh"
00031 #include "G4ModelCommandsT.hh"
00032 #include "G4ModelCommandUtils.hh"
00033 #include "G4TrajectoryDrawByAttribute.hh"
00034 #include "G4TrajectoryDrawByCharge.hh"
00035 #include "G4TrajectoryDrawByOriginVolume.hh"
00036 #include "G4TrajectoryDrawByParticleID.hh"
00037 #include "G4TrajectoryGenericDrawer.hh"
00038 #include "G4TrajectoryModelFactories.hh"
00039 #include "G4VisTrajContext.hh"
00040 
00041 // Draw by attribute
00042 G4TrajectoryDrawByAttributeFactory::G4TrajectoryDrawByAttributeFactory()
00043   :G4VModelFactory<G4VTrajectoryModel>("drawByAttribute") 
00044 {}
00045 
00046 G4TrajectoryDrawByAttributeFactory::~G4TrajectoryDrawByAttributeFactory() {}
00047 
00048 ModelAndMessengers
00049 G4TrajectoryDrawByAttributeFactory::Create(const G4String& placement, const G4String& name)
00050 {
00051   Messengers messengers;
00052   
00053   // Create default context and model 
00054   G4VisTrajContext* context = new G4VisTrajContext("default");
00055 
00056   G4TrajectoryDrawByAttribute* model = new G4TrajectoryDrawByAttribute(name, context);
00057 
00058   // Create messengers for default context configuration
00059   G4ModelCommandUtils::AddContextMsgrs(context, messengers, placement+"/"+name);
00060 
00061   messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryDrawByAttribute>(model, placement));
00062   messengers.push_back(new G4ModelCmdSetString<G4TrajectoryDrawByAttribute>(model, placement, "setAttribute"));
00063   messengers.push_back(new G4ModelCmdAddIntervalContext<G4TrajectoryDrawByAttribute>(model, placement, "addInterval"));
00064   messengers.push_back(new G4ModelCmdAddValueContext<G4TrajectoryDrawByAttribute>(model, placement, "addValue"));
00065 
00066   return ModelAndMessengers(model, messengers);
00067 }
00068 
00069 G4TrajectoryGenericDrawerFactory::G4TrajectoryGenericDrawerFactory()
00070   :G4VModelFactory<G4VTrajectoryModel>("generic") 
00071 {}
00072 
00073 G4TrajectoryGenericDrawerFactory::~G4TrajectoryGenericDrawerFactory() {}
00074 
00075 ModelAndMessengers
00076 G4TrajectoryGenericDrawerFactory::Create(const G4String& placement, const G4String& name)
00077 {
00078   Messengers messengers;
00079   
00080   // Create default context and model 
00081   G4VisTrajContext* context = new G4VisTrajContext("default");
00082   G4TrajectoryGenericDrawer* model = new G4TrajectoryGenericDrawer(name, context);
00083 
00084   // Create messengers for default context configuration
00085   G4ModelCommandUtils::AddContextMsgrs(context, messengers, placement+"/"+name);
00086   
00087   // Verbose command
00088   messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryGenericDrawer>(model, placement));
00089 
00090   return ModelAndMessengers(model, messengers);
00091 }
00092 
00093 // drawByCharge
00094 G4TrajectoryDrawByChargeFactory::G4TrajectoryDrawByChargeFactory()
00095   :G4VModelFactory<G4VTrajectoryModel>("drawByCharge") 
00096 {}
00097 
00098 G4TrajectoryDrawByChargeFactory::~G4TrajectoryDrawByChargeFactory() {}
00099 
00100 ModelAndMessengers
00101 G4TrajectoryDrawByChargeFactory::Create(const G4String& placement, const G4String& name)
00102 {
00103   Messengers messengers;
00104   
00105   // Create default context and model 
00106   G4VisTrajContext* context = new G4VisTrajContext("default");
00107   G4TrajectoryDrawByCharge* model = new G4TrajectoryDrawByCharge(name, context);
00108 
00109   // Create messengers for default context configuration
00110   G4ModelCommandUtils::AddContextMsgrs(context, messengers, placement+"/"+name);
00111   
00112   // Create messengers for drawer
00113   messengers.push_back(new G4ModelCmdSetStringColour<G4TrajectoryDrawByCharge>(model, placement));
00114   messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryDrawByCharge>(model, placement));
00115 
00116   return ModelAndMessengers(model, messengers);
00117 }
00118 
00119 //Draw by particle ID
00120 G4TrajectoryDrawByParticleIDFactory::G4TrajectoryDrawByParticleIDFactory()
00121   :G4VModelFactory<G4VTrajectoryModel>("drawByParticleID") 
00122 {}
00123 
00124 G4TrajectoryDrawByParticleIDFactory::~G4TrajectoryDrawByParticleIDFactory() {}
00125 
00126 ModelAndMessengers
00127 G4TrajectoryDrawByParticleIDFactory::Create(const G4String& placement, const G4String& name)
00128 {
00129   Messengers messengers;
00130 
00131   // Create default context and model
00132   G4VisTrajContext* context = new G4VisTrajContext("default");
00133   G4TrajectoryDrawByParticleID* model = new G4TrajectoryDrawByParticleID(name, context);
00134 
00135   // Create messengers for default context configuration
00136   G4ModelCommandUtils::AddContextMsgrs(context, messengers, placement+"/"+name);
00137 
00138   // Create messengers for drawer
00139   messengers.push_back(new G4ModelCmdSetStringColour<G4TrajectoryDrawByParticleID>(model, placement));
00140   messengers.push_back(new G4ModelCmdSetDefaultColour<G4TrajectoryDrawByParticleID>(model, placement));
00141   messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryDrawByParticleID>(model, placement));
00142 
00143   return ModelAndMessengers(model, messengers);
00144 }
00145 
00146 //Draw by origin volume
00147 G4TrajectoryDrawByOriginVolumeFactory::G4TrajectoryDrawByOriginVolumeFactory()
00148   :G4VModelFactory<G4VTrajectoryModel>("drawByOriginVolume") 
00149 {}
00150 
00151 G4TrajectoryDrawByOriginVolumeFactory::~G4TrajectoryDrawByOriginVolumeFactory() {}
00152 
00153 ModelAndMessengers
00154 G4TrajectoryDrawByOriginVolumeFactory::Create(const G4String& placement, const G4String& name)
00155 {
00156   Messengers messengers;
00157 
00158   // Create default context and model
00159   G4VisTrajContext* context = new G4VisTrajContext("default"); 
00160   G4TrajectoryDrawByOriginVolume* model = new G4TrajectoryDrawByOriginVolume(name, context);
00161   
00162   // Create messengers for default context configuration
00163   G4ModelCommandUtils::AddContextMsgrs(context, messengers, placement+"/"+name);
00164 
00165   // Create messengers for drawer
00166   messengers.push_back(new G4ModelCmdSetStringColour<G4TrajectoryDrawByOriginVolume>(model, placement));
00167   messengers.push_back(new G4ModelCmdSetDefaultColour<G4TrajectoryDrawByOriginVolume>(model, placement));
00168   messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryDrawByOriginVolume>(model, placement));
00169 
00170   return ModelAndMessengers(model, messengers);
00171 }

Generated on Mon May 27 17:50:02 2013 for Geant4 by  doxygen 1.4.7