1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2016 Dennis Nienhüser <nienhueser@kde.org>
4 //
5 
6 #ifndef MARBLE_OSMCONVERTER_H
7 #define MARBLE_OSMCONVERTER_H
8 
9 #include <GeoDataCoordinates.h>
10 
11 namespace Marble
12 {
13 
14 class GeoDataLineString;
15 class GeoDataDocument;
16 class GeoDataLinearRing;
17 class GeoDataPolygon;
18 class GeoDataPlacemark;
19 class GeoDataFeature;
20 class OsmPlacemarkData;
21 
22 class OsmConverter
23 {
24 public:
25     typedef QPair<QString, QString> Tag;
26     typedef QPair<GeoDataCoordinates, OsmPlacemarkData > Node;
27     typedef QPair<const GeoDataLineString*, OsmPlacemarkData > Way;
28     typedef QPair<const GeoDataFeature*, OsmPlacemarkData > Relation;
29 
30     using Nodes = QVector<Node>;
31     using Tags = QVector<Tag>;
32     using Ways = QVector<Way>;
33     using Relations = QVector<Relation>;
34 
35     void read(const GeoDataDocument* document);
36 
37     const Nodes & nodes() const;
38     const Ways & ways() const;
39     const Relations &relations() const;
40 
41 private:
42     Nodes m_nodes;
43     Ways m_ways;
44     Relations m_relations;
45 
46     void processLinearRing(GeoDataLinearRing *linearRing,
47                            const OsmPlacemarkData& osmData);
48     void processPolygon(GeoDataPolygon *polygon,
49                         const OsmPlacemarkData& osmData,
50                         GeoDataPlacemark* placemark);
51 };
52 
53 }
54 
55 #endif
56 
57