OGS
BoostXmlGmlInterface.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
6#include <boost/property_tree/ptree_fwd.hpp>
7#include <map>
8#include <string>
9#include <vector>
10
13
14namespace GeoLib
15{
16class GEOObjects;
17class Point;
18class Polyline;
19class Surface;
20
21namespace IO
22{
23
25{
26public:
27 explicit BoostXmlGmlInterface(GeoLib::GEOObjects& geo_objs);
28 ~BoostXmlGmlInterface() override = default;
29
31 bool readFile(const std::string& fname) override;
32
33protected:
34 bool write() override;
35
36private:
38 void readPoints(BaseLib::ConfigTree const& pointsRoot,
39 std::vector<GeoLib::Point*>& points,
40 std::map<std::string, std::size_t>& pnt_names);
41
43 void readPolylines(BaseLib::ConfigTree const& polylinesRoot,
44 std::vector<GeoLib::Polyline*>& polylines,
45 std::vector<GeoLib::Point*> const& points,
46 const std::vector<std::size_t>& pnt_id_map,
47 std::map<std::string, std::size_t>& ply_names);
48
50 void readSurfaces(BaseLib::ConfigTree const& surfacesRoot,
51 std::vector<GeoLib::Surface*>& surfaces,
52 std::vector<GeoLib::Point*> const& points,
53 const std::vector<std::size_t>& pnt_id_map,
54 std::map<std::string, std::size_t>& sfc_names);
55
56 void addSurfacesToPropertyTree(boost::property_tree::ptree& geometry_set);
57 void addPolylinesToPropertyTree(boost::property_tree::ptree& geometry_set);
58
59 std::map<std::size_t, std::size_t> _idx_map;
61};
62
63} // end namespace IO
64} // end namespace GeoLib
Container class for geometric objects.
Definition GEOObjects.h:46
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)
Class Polyline consists mainly of a reference to a point vector and a vector that stores the indices ...
Definition Polyline.h:29
A Surface is represented by Triangles. It consists of a reference to a vector of (pointers to) points...
Base class for writing any information to and from XML files.