VGM Version 5.3
Loading...
Searching...
No Matches
VFactory.h
Go to the documentation of this file.
1// $Id$
2
3// -----------------------------------------------------------------------
4// The BaseVGM package of the Virtual Geometry Model
5// Copyright (C) 2007, Ivana Hrivnacova
6// All rights reserved.
7//
8// For the licensing terms see vgm/LICENSE.
9// Contact: ivana@ipno.in2p3.fr
10// -----------------------------------------------------------------------
11
13//
21
22#ifndef BASE_VGM_V_FACTORY_H
23#define BASE_VGM_V_FACTORY_H
24
26
27#include <map>
28
29namespace VGM {
30class ISolid;
31class IBooleanSolid;
32class IDisplacedSolid;
33class IMultiUnion;
34class IScaledSolid;
35class IVolume;
36class IPlacement;
37class IMaterialFactory;
38} // namespace VGM
39
40namespace BaseVGM {
41
42class VFactory : public virtual VGM::IFactory
43{
44 public:
45 VFactory(const std::string& name, VGM::IMaterialFactory* materialFactory);
46 virtual ~VFactory();
47
48 //
49 // methods
50 //
51
52 virtual std::string Name() const;
53 virtual const VGM::SolidStore& Solids() const;
54 virtual const VGM::VolumeStore& Volumes() const;
56
57 virtual bool Export(VGM::IFactory* factory) const;
58
59 virtual void PrintSolids() const;
60 virtual void PrintVolumes() const;
61
62 virtual void SetDebug(int debug);
63 virtual int Debug() const;
64
65 virtual void SetIgnore(
66 bool ignore, double dummyBoxDimensions = VGM::kDefaultDummyBoxDimensions);
67 virtual bool Ignore() const;
68
69 virtual void SetDummyBoxDimensions(double value);
70 virtual double DummyBoxDimensions() const;
71
72 virtual void SetBestMatch(bool value);
73 virtual bool BestMatch() const;
74
75 protected:
76 VFactory();
77 VFactory(const VFactory& rhs);
78
79 virtual void SetSingleMode(bool singleMode);
80 virtual bool SingleMode() const;
81
82 virtual VGM::SolidStore& SolidStore();
84
85 private:
86 // types
87 typedef std::map<VGM::IVolume*, VGM::IVolume*> VolumeMap;
88
89 // methods
90 VGM::ISolid* ExportSolid(VGM::ISolid* solid, VGM::IFactory* factory) const;
91 VGM::ISolid* ExportBooleanSolid(
92 VGM::IBooleanSolid* solid, VGM::IFactory* factory) const;
93 VGM::ISolid* ExportDisplacedSolid(
94 VGM::IDisplacedSolid* solid, VGM::IFactory* factory) const;
95 VGM::ISolid* ExportScaledSolid(
96 VGM::IScaledSolid* solid, VGM::IFactory* factory) const;
97 VGM::ISolid* ExportMultiUnion(
98 VGM::IMultiUnion* solid, VGM::IFactory* factory) const;
99 VolumeMap* ExportVolumeStore(VGM::IFactory* factory) const;
100
101 VGM::IPlacement* ExportSimplePlacement(VGM::IPlacement* placement,
102 VGM::IFactory* factory, VolumeMap* volumeMap) const;
103 VGM::IPlacement* ExportMultiplePlacement(VGM::IPlacement* placement,
104 VGM::IFactory* factory, VolumeMap* volumeMap) const;
105 VGM::IPlacement* ExportParameterisedPlacement(VGM::IPlacement* placement,
106 VGM::IFactory* factory, VolumeMap* volumeMap) const;
107 void ExportPlacements(VGM::IFactory* factory, VolumeMap* map) const;
108
109 VGM::Transform Identity() const;
110
111 // data members
112 int fDebug;
113 bool fIgnore;
114 bool fBestMatch;
115 bool fSingleMode;
116 double fDummyBoxDimensions;
117 std::string fName;
118 VGM::SolidStore fSolids;
119 VGM::VolumeStore fVolumes;
120 VGM::IMaterialFactory* fMaterialFactory;
121};
122
123} // namespace BaseVGM
124
125// inline functions
126
127inline std::string BaseVGM::VFactory::Name() const { return fName; }
128
130{
131 return fSolids;
132}
133
135{
136 return fVolumes;
137}
138
140{
141 return fMaterialFactory;
142}
143
145{
147 return fSolids;
148}
149
151{
153 return fVolumes;
154}
155
156inline int BaseVGM::VFactory::Debug() const { return fDebug; }
157
158inline bool BaseVGM::VFactory::Ignore() const { return fIgnore; }
159
161{
162 fDummyBoxDimensions = value;
163}
164
166{
167 return fDummyBoxDimensions;
168}
169
170inline void BaseVGM::VFactory::SetBestMatch(bool bestMatch)
171{
172 fBestMatch = bestMatch;
173}
174
175inline bool BaseVGM::VFactory::BestMatch() const { return fBestMatch; }
176
177inline void BaseVGM::VFactory::SetSingleMode(bool singleMode)
178{
179 fSingleMode = singleMode;
180}
181
182inline bool BaseVGM::VFactory::SingleMode() const { return fSingleMode; }
183
184#endif // BASE_VGM_V_FACTORY_H
The abstract base class to geometry factory.
Definition VFactory.h:43
virtual bool Export(VGM::IFactory *factory) const
Export geometry to the specified factory.
Definition VFactory.cxx:673
virtual const VGM::SolidStore & Solids() const
Return the store of solids.
Definition VFactory.h:129
virtual bool SingleMode() const
Return the single mode option.
Definition VFactory.h:182
virtual const VGM::VolumeStore & Volumes() const
Return the store of volumes.
Definition VFactory.h:134
virtual void PrintSolids() const
Print all solids.
Definition VFactory.cxx:713
virtual void SetSingleMode(bool singleMode)
Set single mode option.
Definition VFactory.h:177
virtual VGM::IMaterialFactory * MaterialFactory() const
Return the associated material factory.
Definition VFactory.h:139
virtual void PrintVolumes() const
Print all volumes.
Definition VFactory.cxx:728
virtual bool BestMatch() const
Return the single mode option.
Definition VFactory.h:175
virtual ~VFactory()
Definition VFactory.cxx:111
virtual bool Ignore() const
Return the ignore option.
Definition VFactory.h:158
virtual void SetDebug(int debug)
Set the debug level.
Definition VFactory.cxx:743
virtual VGM::SolidStore & SolidStore()
Definition VFactory.h:144
virtual void SetDummyBoxDimensions(double value)
Set the dimensions in mm of a dummy box replacing the unsupported shapes if the 'ignore' option is ac...
Definition VFactory.h:160
virtual void SetBestMatch(bool value)
Set best match option.
Definition VFactory.h:170
virtual int Debug() const
Return the debug level.
Definition VFactory.h:156
virtual double DummyBoxDimensions() const
Return the ignore option.
Definition VFactory.h:165
virtual void SetIgnore(bool ignore, double dummyBoxDimensions=VGM::kDefaultDummyBoxDimensions)
Set ignoring of unsupported features.
Definition VFactory.cxx:753
virtual std::string Name() const
Return the name of this factory.
Definition VFactory.h:127
virtual VGM::VolumeStore & VolumeStore()
Definition VFactory.h:150
The VGM interface to Boolean solids.
The VGM interface to displaced solids.
The VGM interface to geometry factory providing functions for geometry construction and conversions.
Definition IFactory.h:50
The VGM interface to material factory providing functions for material conversions.
The VGM interface to Boolean solids.
Definition IMultiUnion.h:31
The VGM interface to positions of volumes.
Definition IPlacement.h:44
The VGM interface to Boolean solids.
The VGM interface to solids.
Definition ISolid.h:58
BaseVGM utilities.
Definition utilities.h:23
VGM interfaces.
Definition VMedium.h:28
std::vector< double > Transform
Definition Transform.h:40
constexpr double kDefaultDummyBoxDimensions
The default value for the dimensions in mm of a dummy box replacing the unsupported shapes if the 'ig...
Definition IFactory.h:47
std::vector< IVolume * > VolumeStore
Definition IFactory.h:43
std::vector< ISolid * > SolidStore
Definition IFactory.h:42