VGM Version 5.3
Loading...
Searching...
No Matches
VExporter.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//
22
23#ifndef XML_VGM_V_EXPORTER_H
24#define XML_VGM_V_EXPORTER_H
25
26#include "XmlVGM/Maps.h"
27
28#include <fstream>
29#include <map>
30#include <set>
31#include <string>
32
33namespace VGM {
34class IElement;
35class IMaterial;
36class ISolid;
37class IFactory;
38class IVolume;
39} // namespace VGM
40
41namespace XmlVGM {
42
43typedef std::vector<double> ThreeVector;
44
45class IWriter;
46
48{
49 public:
50 typedef std::set<std::string, std::less<std::string> > StringSet;
51
52 public:
53 VExporter(const VGM::IFactory* factory, IWriter* writer);
54 // --> protected
55 // VExporter();
56 // VExporter(const VExporter& right);
57 virtual ~VExporter();
58
59 // methods
61 void GenerateXMLGeometry(const std::string& volumeName);
62
63 // set methods
64 void SetFileName(const std::string& fileName);
65 void SetDebug(int debug);
66 void SetNumWidth(int width);
67 void SetNumPrecision(int precision);
68
69 // get methods
70 std::string FileName() const;
71 int Debug() const;
72
73 protected:
74 VExporter();
75 VExporter(const VExporter& right);
76
77 // operators
78 VExporter& operator=(const VExporter& /*right*/);
79
80 // abstract methods
81 // specific to XML definition
82 //
85 virtual void GenerateGeometry(VGM::IVolume* volume) = 0;
86
87 // methods
88 //
89 void GeneratePositions(VGM::IVolume* volume);
90 void GenerateRotations(VGM::IVolume* volume);
92 void GenerateMaterials(VGM::IVolume* volume);
93 void GenerateMedia(VGM::IVolume* volume);
94 void GenerateSolids(VGM::IVolume* volume);
95
96 void ClearVolumeNames();
97
98 // static data members
99 static const std::string fgkUndefinedFileName; // default value of file name
100
101 // data members
102 //
103 const VGM::IFactory* fFactory; // VGM factory
104 IWriter* fWriter; // interface to XML writer
105 std::string fFileName; // output file name
106 StringSet fVolumeNames; // set of volume names
107 int fDebug; // debug level
108 Maps fMaps; // maps between XML elements and their names
109
110 private:
111 // methods
112 //
113 void ProcessPositions(VGM::IVolume* volume);
114 void ProcessPositionsInBoolean(VGM::ISolid* solid);
115 void ProcessPositionsInTessellated(VGM::ISolid* solid);
116 void ProcessPositionsInMultiUnion(VGM::ISolid* solid);
117
118 void ProcessRotations(VGM::IVolume* volume);
119 void ProcessRotationsInBoolean(VGM::ISolid* solid);
120 void ProcessRotationsInMultiUnion(VGM::ISolid* solid);
121
122 void ProcessMaterials(VGM::IVolume* volume);
123 void ProcessMedia(VGM::IVolume* volume);
124 void ProcessSolids(VGM::IVolume* volume);
125};
126} // namespace XmlVGM
127
128// inline methods
129
130inline void XmlVGM::VExporter::SetFileName(const std::string& fileName)
131{
132 fFileName = fileName;
133}
134
135inline void XmlVGM::VExporter::SetDebug(int debug)
136{
137 fDebug = debug;
138}
139
140inline std::string XmlVGM::VExporter::FileName() const
141{
142 return fFileName;
143}
144
145inline int XmlVGM::VExporter::Debug() const
146{
147 return fDebug;
148}
149
150#endif // XML_VGM_V_EXPORTER_H
The VGM interface to geometry factory providing functions for geometry construction and conversions.
Definition IFactory.h:50
The VGM interface to solids.
Definition ISolid.h:58
The VGM interface to volumes.
Definition IVolume.h:32
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
Class for generation of geometry data files in XML, the XML format is independent from the geometry o...
Definition VExporter.h:48
void GenerateXMLGeometry()
void GenerateMedia(VGM::IVolume *volume)
IWriter * fWriter
Definition VExporter.h:104
void GeneratePositions(VGM::IVolume *volume)
void SetNumPrecision(int precision)
void GenerateMaterials(VGM::IVolume *volume)
void SetNumWidth(int width)
const VGM::IFactory * fFactory
Definition VExporter.h:103
void SetFileName(const std::string &fileName)
Definition VExporter.h:130
VExporter & operator=(const VExporter &)
void GenerateRotations(VGM::IVolume *volume)
void SetDebug(int debug)
Definition VExporter.h:135
StringSet fVolumeNames
Definition VExporter.h:106
std::string fFileName
Definition VExporter.h:105
int Debug() const
Definition VExporter.h:145
std::string FileName() const
Definition VExporter.h:140
std::set< std::string, std::less< std::string > > StringSet
Definition VExporter.h:50
virtual void GenerateGeometry(VGM::IVolume *volume)=0
Generate XML geometry file for the geometry tree starting from the specified VGM volume.
void GenerateSolids(VGM::IVolume *volume)
static const std::string fgkUndefinedFileName
Definition VExporter.h:99
virtual ~VExporter()
Definition VExporter.cxx:91
VGM interfaces.
Definition VMedium.h:28
XmlVGM utilities.
std::vector< double > ThreeVector
Definition VExporter.h:43