File indexing completed on 2024-05-19 03:53:14

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2016 Dennis Nienhüser <nienhueser@kde.org>
0004 //
0005 
0006 #ifndef MARBLE_OSMCONVERTER_H
0007 #define MARBLE_OSMCONVERTER_H
0008 
0009 #include <GeoDataCoordinates.h>
0010 
0011 namespace Marble
0012 {
0013 
0014 class GeoDataLineString;
0015 class GeoDataDocument;
0016 class GeoDataLinearRing;
0017 class GeoDataPolygon;
0018 class GeoDataPlacemark;
0019 class GeoDataFeature;
0020 class OsmPlacemarkData;
0021 
0022 class OsmConverter
0023 {
0024 public:
0025     typedef QPair<QString, QString> Tag;
0026     typedef QPair<GeoDataCoordinates, OsmPlacemarkData > Node;
0027     typedef QPair<const GeoDataLineString*, OsmPlacemarkData > Way;
0028     typedef QPair<const GeoDataFeature*, OsmPlacemarkData > Relation;
0029 
0030     using Nodes = QVector<Node>;
0031     using Tags = QVector<Tag>;
0032     using Ways = QVector<Way>;
0033     using Relations = QVector<Relation>;
0034 
0035     void read(const GeoDataDocument* document);
0036 
0037     const Nodes & nodes() const;
0038     const Ways & ways() const;
0039     const Relations &relations() const;
0040 
0041 private:
0042     Nodes m_nodes;
0043     Ways m_ways;
0044     Relations m_relations;
0045 
0046     void processLinearRing(GeoDataLinearRing *linearRing,
0047                            const OsmPlacemarkData& osmData);
0048     void processPolygon(GeoDataPolygon *polygon,
0049                         const OsmPlacemarkData& osmData,
0050                         GeoDataPlacemark* placemark);
0051 };
0052 
0053 }
0054 
0055 #endif
0056