File indexing completed on 2024-07-21 09:27:11

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_OSMWAY
0007 #define MARBLE_OSMWAY
0008 
0009 #include "OsmNode.h"
0010 #include "GeoDataBuilding.h"
0011 #include <osm/OsmPlacemarkData.h>
0012 #include <StyleBuilder.h>
0013 
0014 #include <QSet>
0015 #include <QString>
0016 
0017 namespace Marble {
0018 
0019 class GeoDataDocument;
0020 
0021 class OsmWay
0022 {
0023 public:
0024     OsmPlacemarkData & osmData();
0025     void addReference(qint64 id);
0026 
0027     const OsmPlacemarkData & osmData() const;
0028     const QVector<qint64> &references() const;
0029 
0030     GeoDataPlacemark* create(const OsmNodes &nodes, QSet<qint64> &usedNodes) const;
0031 
0032 private:
0033     bool isArea() const;
0034 
0035     static bool isAreaTag(const StyleBuilder::OsmTag &keyValue);
0036 
0037     bool isBuilding() const;
0038 
0039     static bool isBuildingTag(const StyleBuilder::OsmTag &keyValue);
0040 
0041     OsmPlacemarkData m_osmData;
0042     QVector<qint64> m_references;
0043 
0044     static QSet<StyleBuilder::OsmTag> s_areaTags;
0045     static QSet<StyleBuilder::OsmTag> s_buildingTags;
0046 
0047     QString extractBuildingName() const;
0048     double extractBuildingHeight() const;
0049     QVector<GeoDataBuilding::NamedEntry> extractNamedEntries() const;
0050 };
0051 
0052 typedef QHash<qint64,OsmWay> OsmWays;
0053 
0054 }
0055 
0056 #endif