OGS
BoostXmlGmlInterface.h
Go to the documentation of this file.
1 
15 #pragma once
16 
17 #include <map>
18 #include <string>
19 #include <vector>
20 
21 
22 #include "BaseLib/ConfigTree.h"
24 
25 namespace GeoLib
26 {
27 class GEOObjects;
28 class Point;
29 class Polyline;
30 class Surface;
31 
32 namespace IO
33 {
34 
36 {
37 public:
38  explicit BoostXmlGmlInterface(GeoLib::GEOObjects& geo_objs);
39  ~BoostXmlGmlInterface() override = default;
40 
42  bool readFile(const std::string& fname) override;
43 
44 protected:
46  bool write() override;
47 
48 private:
50  void readPoints ( BaseLib::ConfigTree const& pointsRoot,
51  std::vector<GeoLib::Point*>& points,
52  std::map<std::string, std::size_t>& pnt_names);
53 
55  void readPolylines ( BaseLib::ConfigTree const& polylinesRoot,
56  std::vector<GeoLib::Polyline*>& polylines,
57  std::vector<GeoLib::Point*> const& points,
58  const std::vector<std::size_t>& pnt_id_map,
59  std::map<std::string, std::size_t>& ply_names);
60 
62  void readSurfaces ( BaseLib::ConfigTree const& surfacesRoot,
63  std::vector<GeoLib::Surface*>& surfaces,
64  std::vector<GeoLib::Point*> const& points,
65  const std::vector<std::size_t>& pnt_id_map,
66  std::map<std::string, std::size_t>& sfc_names);
67 
70 
71  std::map<std::size_t, std::size_t> _idx_map;
73 };
74 
75 } // end namespace IO
76 } // end namespace GeoLib
Definition of the XMLInterface class.
boost::property_tree::ptree PTree
The tree being wrapped by this class.
Definition: ConfigTree.h:241
Container class for geometric objects.
Definition: GEOObjects.h:61
bool write() override
Required method for writing geometry. This is not implemented here, use the Qt class for writing.
void readPolylines(BaseLib::ConfigTree const &polylinesRoot, std::vector< GeoLib::Polyline * > &polylines, std::vector< GeoLib::Point * > const &points, const std::vector< std::size_t > &pnt_id_map, std::map< std::string, std::size_t > &ply_names)
Reads GeoLib::Polyline-objects from an xml-file.
~BoostXmlGmlInterface() override=default
void addPolylinesToPropertyTree(BaseLib::ConfigTree::PTree &geometry_set)
void readPoints(BaseLib::ConfigTree const &pointsRoot, std::vector< GeoLib::Point * > &points, std::map< std::string, std::size_t > &pnt_names)
Reads GeoLib::Point-objects from an xml-file.
void readSurfaces(BaseLib::ConfigTree const &surfacesRoot, std::vector< GeoLib::Surface * > &surfaces, std::vector< GeoLib::Point * > const &points, const std::vector< std::size_t > &pnt_id_map, std::map< std::string, std::size_t > &sfc_names)
Reads GeoLib::Surface-objects from an xml-file.
void addSurfacesToPropertyTree(BaseLib::ConfigTree::PTree &geometry_set)
bool readFile(const std::string &fname) override
Reads an xml-file containing OGS geometry.
std::map< std::size_t, std::size_t > _idx_map
BoostXmlGmlInterface(GeoLib::GEOObjects &geo_objs)
TemplateElement< PointRule1 > Point
Definition: Point.h:20
Base class for writing any information to and from XML files.
Definition: XMLInterface.h:29