File indexing completed on 2025-01-05 03:59:29
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2015 Dennis Nienhüser <nienhueser@kde.org> 0004 // 0005 0006 #ifndef MARBLE_OSMRELATION 0007 #define MARBLE_OSMRELATION 0008 0009 #include <QString> 0010 #include <QXmlStreamAttributes> 0011 #include <QSet> 0012 0013 #include "OsmNode.h" 0014 #include "OsmWay.h" 0015 #include "OsmPlacemarkData.h" 0016 #include "GeoDataLinearRing.h" 0017 0018 namespace Marble { 0019 0020 class GeoDataDocument; 0021 0022 class OsmRelation 0023 { 0024 public: 0025 OsmPlacemarkData & osmData(); 0026 void parseMember(const QXmlStreamAttributes &attributes); 0027 void addMember(qint64 reference, const QString &role, const QString &type); 0028 void createMultipolygon(GeoDataDocument* document, OsmWays &ways, const OsmNodes &nodes, QSet<qint64> &usedNodes, QSet<qint64> &usedWays) const; 0029 void createRelation(GeoDataDocument* document, const QHash<qint64, GeoDataPlacemark*>& wayPlacemarks) const; 0030 0031 const OsmPlacemarkData & osmData() const; 0032 0033 private: 0034 typedef QPair<GeoDataLinearRing, OsmPlacemarkData> OsmRing; 0035 using OsmRings = QVector<OsmRing>; 0036 0037 struct OsmMember 0038 { 0039 QString type; 0040 QString role; 0041 qint64 reference; 0042 0043 OsmMember(); 0044 }; 0045 0046 OsmRings rings(const QStringList &roles, const OsmWays &ways, const OsmNodes &nodes, QSet<qint64> &usedNodes, QSet<qint64> &usedWays) const; 0047 0048 OsmPlacemarkData m_osmData; 0049 QVector<OsmMember> m_members; 0050 }; 0051 0052 typedef QHash<qint64,OsmRelation> OsmRelations; 0053 0054 } 0055 0056 #endif