File indexing completed on 2024-05-12 03:50:17

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2017 Dennis Nienhüser <nienhueser@kde.org>
0004 
0005 #ifndef MARBLE_GEODATARELATION_H
0006 #define MARBLE_GEODATARELATION_H
0007 
0008 #include "GeoDataCoordinates.h"
0009 #include "GeoDataPlacemark.h"
0010 
0011 #include "geodata_export.h"
0012 
0013 namespace Marble
0014 {
0015 class GeoDataRelationPrivate;
0016 enum class OsmType;
0017 
0018 class GEODATA_EXPORT GeoDataRelation: public GeoDataFeature
0019 {
0020 public:
0021     enum RelationType {
0022         UnknownType = 0,
0023         RouteRoad = 1 << 1,
0024         RouteDetour = 1 << 2,
0025         RouteFerry = 1 << 3,
0026         RouteTrain = 1 << 4,
0027         RouteSubway = 1 << 5,
0028         RouteTram = 1 << 6,
0029         RouteBus = 1 << 7,
0030         RouteTrolleyBus = 1 << 8,
0031         RouteBicycle = 1 << 9,
0032         RouteMountainbike = 1 << 10,
0033         RouteFoot = 1 << 11,
0034         RouteHiking = 1 << 12,
0035         RouteHorse = 1 << 13,
0036         RouteInlineSkates = 1 << 14,
0037         RouteSkiDownhill = 1 << 15,
0038         RouteSkiNordic = 1 << 16,
0039         RouteSkitour = 1 << 17,
0040         RouteSled = 1 << 18
0041     };
0042 
0043     Q_DECLARE_FLAGS(RelationTypes, RelationType)
0044 
0045     GeoDataRelation();
0046     ~GeoDataRelation() override;
0047     GeoDataRelation(const GeoDataRelation &other);
0048     GeoDataRelation & operator=(GeoDataRelation other);
0049     bool operator<(const GeoDataRelation &other) const;
0050 
0051     const char* nodeType() const override;
0052     GeoDataFeature * clone() const override;
0053 
0054     void addMember(const GeoDataFeature* feature, qint64 id, OsmType type, const QString &role);
0055     QSet<const GeoDataFeature*> members() const;
0056 
0057     OsmPlacemarkData &osmData();
0058     const OsmPlacemarkData &osmData() const;
0059 
0060     RelationType relationType() const;
0061     QSet<qint64> memberIds() const;
0062     bool containsAnyOf(const QSet<qint64> &memberIds) const;
0063 
0064 private:
0065     GeoDataRelationPrivate* d_ptr;
0066     Q_DECLARE_PRIVATE(GeoDataRelation)
0067 
0068 };
0069 
0070 }
0071 
0072 #endif