OGS
XmlGmlInterface.h
Go to the documentation of this file.
1
15#pragma once
16
17#include <QString>
18
21
22#include "GeoLib/GEOObjects.h"
23
24namespace GeoLib
25{
26namespace IO
27{
28
34{
35public:
36 explicit XmlGmlInterface(GeoLib::GEOObjects& geo_objs);
37
39 int readFile(const QString& fileName) override;
40
41 bool readFile(std::string const& fname) override
42 {
43 return readFile(QString(fname.c_str())) != 0;
44 }
45
46protected:
47 bool write() override;
48
49private:
51 void readPoints(const QDomNode& pointsRoot,
52 std::vector<GeoLib::Point*>& points,
53 std::map<std::string, std::size_t>* pnt_names);
54
56 void readPolylines(const QDomNode& polylinesRoot,
57 std::vector<GeoLib::Polyline*>& polylines,
58 std::vector<GeoLib::Point*> const& points,
59 const std::vector<std::size_t>& pnt_id_map,
61
63 void readSurfaces(const QDomNode& surfacesRoot,
64 std::vector<GeoLib::Surface*>& surfaces,
65 std::vector<GeoLib::Point*> const& points,
66 const std::vector<std::size_t>& pnt_id_map,
68
70 std::map<std::size_t, std::size_t> _idx_map;
71};
72
73} // end namespace IO
74} // namespace GeoLib
Definition of the GEOObjects class.
Definition of the XMLInterface class.
Container class for geometric objects.
Definition GEOObjects.h:57
Reads and writes GeoObjects to and from XML files.
void readPoints(const QDomNode &pointsRoot, std::vector< GeoLib::Point * > &points, std::map< std::string, std::size_t > *pnt_names)
Reads GeoLib::Point-objects from an xml-file.
std::map< std::size_t, std::size_t > _idx_map
bool write() override
Writes the object to the internal stream. This method must be implemented by a subclass....
GeoLib::GEOObjects & _geo_objs
void readSurfaces(const QDomNode &surfacesRoot, std::vector< GeoLib::Surface * > &surfaces, std::vector< GeoLib::Point * > const &points, const std::vector< std::size_t > &pnt_id_map, GeoLib::SurfaceVec::NameIdMap &sfc_names)
Reads GeoLib::Surface-objects from an xml-file.
void readPolylines(const QDomNode &polylinesRoot, std::vector< GeoLib::Polyline * > &polylines, std::vector< GeoLib::Point * > const &points, const std::vector< std::size_t > &pnt_id_map, GeoLib::PolylineVec::NameIdMap &ply_names)
Reads GeoLib::Polyline-objects from an xml-file.
bool readFile(std::string const &fname) override
XmlGmlInterface(GeoLib::GEOObjects &geo_objs)
int readFile(const QString &fileName) override
Reads an xml-file containing geometric object definitions into the GEOObjects used in the constructor...
std::map< std::string, std::size_t > NameIdMap
Definition TemplateVec.h:41
Base class for writing any information to and from XML files.