1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2017 Dennis Nienhüser <nienhueser@kde.org>
4 
5 #ifndef MARBLE_GEODATARELATION_H
6 #define MARBLE_GEODATARELATION_H
7 
8 #include "GeoDataCoordinates.h"
9 #include "GeoDataPlacemark.h"
10 
11 #include "geodata_export.h"
12 
13 namespace Marble
14 {
15 class GeoDataRelationPrivate;
16 enum class OsmType;
17 
18 class GEODATA_EXPORT GeoDataRelation: public GeoDataFeature
19 {
20 public:
21     enum RelationType {
22         UnknownType = 0,
23         RouteRoad = 1 << 1,
24         RouteDetour = 1 << 2,
25         RouteFerry = 1 << 3,
26         RouteTrain = 1 << 4,
27         RouteSubway = 1 << 5,
28         RouteTram = 1 << 6,
29         RouteBus = 1 << 7,
30         RouteTrolleyBus = 1 << 8,
31         RouteBicycle = 1 << 9,
32         RouteMountainbike = 1 << 10,
33         RouteFoot = 1 << 11,
34         RouteHiking = 1 << 12,
35         RouteHorse = 1 << 13,
36         RouteInlineSkates = 1 << 14,
37         RouteSkiDownhill = 1 << 15,
38         RouteSkiNordic = 1 << 16,
39         RouteSkitour = 1 << 17,
40         RouteSled = 1 << 18
41     };
42 
43     Q_DECLARE_FLAGS(RelationTypes, RelationType)
44 
45     GeoDataRelation();
46     ~GeoDataRelation() override;
47     GeoDataRelation(const GeoDataRelation &other);
48     GeoDataRelation & operator=(GeoDataRelation other);
49     bool operator<(const GeoDataRelation &other) const;
50 
51     const char* nodeType() const override;
52     GeoDataFeature * clone() const override;
53 
54     void addMember(const GeoDataFeature* feature, qint64 id, OsmType type, const QString &role);
55     QSet<const GeoDataFeature*> members() const;
56 
57     OsmPlacemarkData &osmData();
58     const OsmPlacemarkData &osmData() const;
59 
60     RelationType relationType() const;
61     QSet<qint64> memberIds() const;
62     bool containsAnyOf(const QSet<qint64> &memberIds) const;
63 
64 private:
65     GeoDataRelationPrivate* d_ptr;
66     Q_DECLARE_PRIVATE(GeoDataRelation)
67 
68 };
69 
70 }
71 
72 #endif
73