OGS
BoostXmlGmlInterface.h
Go to the documentation of this file.
1
15#pragma once
16
17#include <boost/property_tree/ptree_fwd.hpp>
18#include <map>
19#include <string>
20#include <vector>
21
24
25namespace GeoLib
26{
27class GEOObjects;
28class Point;
29class Polyline;
30class Surface;
31
32namespace IO
33{
34
36{
37public:
38 explicit BoostXmlGmlInterface(GeoLib::GEOObjects& geo_objs);
39 ~BoostXmlGmlInterface() override = default;
40
42 bool readFile(const std::string& fname) override;
43
44protected:
45 bool write() override;
46
47private:
49 void readPoints(BaseLib::ConfigTree const& pointsRoot,
50 std::vector<GeoLib::Point*>& points,
51 std::map<std::string, std::size_t>& pnt_names);
52
54 void readPolylines(BaseLib::ConfigTree const& polylinesRoot,
55 std::vector<GeoLib::Polyline*>& polylines,
56 std::vector<GeoLib::Point*> const& points,
57 const std::vector<std::size_t>& pnt_id_map,
58 std::map<std::string, std::size_t>& ply_names);
59
61 void readSurfaces(BaseLib::ConfigTree const& surfacesRoot,
62 std::vector<GeoLib::Surface*>& surfaces,
63 std::vector<GeoLib::Point*> const& points,
64 const std::vector<std::size_t>& pnt_id_map,
65 std::map<std::string, std::size_t>& sfc_names);
66
67 void addSurfacesToPropertyTree(boost::property_tree::ptree& geometry_set);
68 void addPolylinesToPropertyTree(boost::property_tree::ptree& geometry_set);
69
70 std::map<std::size_t, std::size_t> _idx_map;
72};
73
74} // end namespace IO
75} // end namespace GeoLib
Definition of the XMLInterface class.
Container class for geometric objects.
Definition GEOObjects.h:57
bool write() override
Writes the object to the internal stream. This method must be implemented by a subclass....
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.
void addPolylinesToPropertyTree(boost::property_tree::ptree &geometry_set)
~BoostXmlGmlInterface() override=default
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.
bool readFile(const std::string &fname) override
Reads an xml-file containing OGS geometry.
void addSurfacesToPropertyTree(boost::property_tree::ptree &geometry_set)
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.