VGM Version 5.3
Loading...
Searching...
No Matches
Maps.h
Go to the documentation of this file.
1// $Id$
2
3// -----------------------------------------------------------------------
4// The XmlVGM 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//
20
21#ifndef XML_VGM_MAPS_H
22#define XML_VGM_MAPS_H
23
26
27#include <map>
28#include <string>
29
30namespace VGM {
31class IElement;
32class IIsotope;
33class IMaterial;
34class IMedium;
35} // namespace VGM
36
37namespace XmlVGM {
38
39class IWriter;
40
41class Maps
42{
43 public:
44 typedef std::map<VGM::ThreeVector, std::string, std::less<VGM::ThreeVector> >
46 typedef std::multimap<VGM::ThreeVector, const VGM::IIsotope*,
47 std::less<VGM::ThreeVector> >
49 typedef std::multimap<VGM::ThreeVector, const VGM::IElement*,
50 std::less<VGM::ThreeVector> >
52 typedef std::map<std::string, const VGM::IMaterial*, std::less<std::string> >
54 typedef std::map<std::string, const VGM::IMedium*, std::less<std::string> >
56
57 public:
58 Maps(double numPrecision, double angleUnit, double lengthUnit);
59 // --> protected
60 // Maps();
61 // Maps(const Maps& right);
62 virtual ~Maps();
63
64 // methods
65 std::string AddPosition(const VGM::Transform& transform);
66 std::string AddRotation(const VGM::Transform& transform);
67 std::string AddBooleanPosition();
68 std::string AddBooleanRotation();
69 const VGM::IIsotope* AddIsotope(const VGM::IIsotope* isotope);
70 const VGM::IElement* AddElement(const VGM::IElement* element);
71 const VGM::IMaterial* AddMaterial(const VGM::IMaterial* material);
72 const VGM::IMedium* AddMedium(const VGM::IMedium* medium);
73
74 std::string FindPositionName(const VGM::Transform& transform) const;
75 std::string FindRotationName(const VGM::Transform& transform) const;
76
77 void WriteAllPositions(IWriter* writer);
78 void WriteAllRotations(IWriter* writer);
79 void WriteAllIsotopes(IWriter* writer);
80 void WriteAllElements(IWriter* writer);
81 void WriteAllMaterials(IWriter* writer);
82 void WriteAllMedia(IWriter* writer);
84
85 void SetNumPrecision(double precision);
86
87 void ClearAllMaps();
88
89 protected:
90 Maps();
91 Maps(const Maps& right);
92
93 // operators
94 Maps& operator=(const Maps& /*right*/);
95
96 private:
97 // methods
98 //
99 void CutName(std::string& name) const;
100 double Round2(double number) const;
101 VGM::ThreeVector PurifyAngles(const VGM::ThreeVector& rotation) const;
102
103 // data members
104 //
105 double fNumPrecision; // numerical precision
106 double fAngleUnit; // angle unit
107 double fLengthUnit; // length unit
108
109 ThreeVectorMap fPositions; // map between positions and their XML names
110 ThreeVectorMap fRotations; // map between rotations and their XML names
111 IsotopeMap fIsotopes; // map of isotopes
112 ElementMap fElements; // map of elements
113 MaterialMap fMaterials; // map of materials
114 MediumMap fMedia; // map of media
115 int fNofBoolPositions; // number of positions in Boolean solids
116 int fNofBoolRotations; // number of rotations in Boolean solids
117};
118
119} // namespace XmlVGM
120
121inline void XmlVGM::Maps::SetNumPrecision(double precision)
122{
123 fNumPrecision = precision;
124}
125
126#endif // XML_VGM_MAPS_H
The VGM interface to elements.
Definition IElement.h:34
The VGM interface to elements.
Definition IIsotope.h:28
The VGM interface to materials.
Definition IMaterial.h:44
The VGM interface to tracking medium.
Definition IMedium.h:31
The interface for the XML writer that writes VGM geometry objects to XML:
Definition IWriter.h:43
Utility class for mapping XML element values to their names within the XML exporter precision.
Definition Maps.h:42
void ClearAllMaps()
Definition Maps.cxx:471
const VGM::IElement * AddElement(const VGM::IElement *element)
Definition Maps.cxx:288
void WriteAllRotations(IWriter *writer)
Definition Maps.cxx:411
std::string AddBooleanPosition()
Definition Maps.cxx:236
const VGM::IMaterial * AddMaterial(const VGM::IMaterial *material)
Definition Maps.cxx:314
void WriteAllPositions(IWriter *writer)
Definition Maps.cxx:401
std::string FindPositionName(const VGM::Transform &transform) const
Definition Maps.cxx:348
void WriteAllMedia(IWriter *writer)
Definition Maps.cxx:451
void SetNumPrecision(double precision)
Definition Maps.h:121
Maps & operator=(const Maps &)
Definition Maps.cxx:104
std::multimap< VGM::ThreeVector, const VGM::IIsotope *, std::less< VGM::ThreeVector > > IsotopeMap
Definition Maps.h:48
void WriteAllMediaFromMaterials(IWriter *writer)
Definition Maps.cxx:461
std::string FindRotationName(const VGM::Transform &transform) const
Definition Maps.cxx:373
std::string AddPosition(const VGM::Transform &transform)
Definition Maps.cxx:172
const VGM::IIsotope * AddIsotope(const VGM::IIsotope *isotope)
Definition Maps.cxx:262
std::string AddRotation(const VGM::Transform &transform)
Definition Maps.cxx:203
std::map< VGM::ThreeVector, std::string, std::less< VGM::ThreeVector > > ThreeVectorMap
Definition Maps.h:45
void WriteAllIsotopes(IWriter *writer)
Definition Maps.cxx:421
std::multimap< VGM::ThreeVector, const VGM::IElement *, std::less< VGM::ThreeVector > > ElementMap
Definition Maps.h:51
std::string AddBooleanRotation()
Definition Maps.cxx:249
const VGM::IMedium * AddMedium(const VGM::IMedium *medium)
Definition Maps.cxx:331
void WriteAllMaterials(IWriter *writer)
Definition Maps.cxx:441
std::map< std::string, const VGM::IMedium *, std::less< std::string > > MediumMap
Definition Maps.h:55
void WriteAllElements(IWriter *writer)
Definition Maps.cxx:431
std::map< std::string, const VGM::IMaterial *, std::less< std::string > > MaterialMap
Definition Maps.h:53
virtual ~Maps()
Definition Maps.cxx:94
VGM interfaces.
Definition VMedium.h:28
std::vector< double > Transform
Definition Transform.h:40
std::vector< double > ThreeVector
Definition ThreeVector.h:27
XmlVGM utilities.