KOSMIndoorMap

platform.h
1/*
2 SPDX-FileCopyrightText: 2020 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KOSMINDOORMAP_PLATFORM_H
8#define KOSMINDOORMAP_PLATFORM_H
9
10#include "kosmindoormap_export.h"
11
12#include <QExplicitlySharedDataPointer>
13#include <QMetaType>
14#include <QStringList>
15
16#include <vector>
17
18namespace OSM {
19class Coordinate;
20class DataSet;
21class Element;
22}
23
24namespace KOSMIndoorMap {
25
26class PlatformSectionPrivate;
27
28/** A railway platform section. */
29class KOSMINDOORMAP_EXPORT PlatformSection
30{
31public:
32 explicit PlatformSection();
36 PlatformSection& operator=(const PlatformSection&);
37 PlatformSection& operator=(PlatformSection&&);
38
39 /** Platform section has enough data to work with. */
40 bool isValid() const;
41
42 /** Platform section name. */
43 QString name() const;
44 void setName(const QString &name);
45 /** Platform section position. */
46 OSM::Element position() const;
47 void setPosition(const OSM::Element &position);
48
49private:
51};
52
53class PlatformPrivate;
54
55/** A railway platform/track. */
56class KOSMINDOORMAP_EXPORT Platform {
57 Q_GADGET
58 Q_PROPERTY(QString name READ name WRITE setName)
59 Q_PROPERTY(Mode mode READ mode WRITE setMode)
60 Q_PROPERTY(QString ifopt READ ifopt WRITE setIfopt)
61public:
62 explicit Platform();
63 Platform(const Platform&);
65 ~Platform();
66 Platform& operator=(const Platform&);
67 Platform& operator=(Platform&&);
68
69 /** Platform has enough data to work with. */
70 bool isValid() const;
71
72 /** User-visible name of the platform. */
73 QString name() const;
74 void setName(const QString &name);
75
76 /** Floor level. */
77 int level() const;
78 bool hasLevel() const;
79 void setLevel(int level);
80
81 /** A singular position for this platform (typically the stop position).
82 * This can be useful for positining views or labels.
83 */
84 OSM::Coordinate position() const;
85 OSM::Element stopPoint() const;
86 void setStopPoint(OSM::Element stop);
87
88 /** The platform edge path. */
89 OSM::Element edge() const;
90 void setEdge(OSM::Element edge);
91
92 /** The platform area.
93 * This is often shared between multiple tracks.
94 */
95 OSM::Element area() const;
96 void setArea(OSM::Element area);
97
98 /** The (railway) track this platform is serving. */
99 const std::vector<OSM::Element>& track() const;
100 void setTrack(std::vector<OSM::Element> &&track);
101 std::vector<OSM::Element>&& takeTrack();
102
103 /** Platform sections. */
104 const std::vector<PlatformSection>& sections() const;
105 void setSections(std::vector<PlatformSection> &&sections);
106 std::vector<PlatformSection>&& takeSections();
107
108 /** Transportation mode served by a platform. */
109 enum Mode {
110 Unknown,
111 Rail,
112 LightRail,
113 Subway,
114 Tram,
115 Monorail,
116 Bus,
117 };
118 Q_ENUM(Mode)
119 Mode mode() const;
120 void setMode(Mode mode);
121
122 /** IFOPT identifier */
123 QString ifopt() const;
124 void setIfopt(const QString &ifopt);
125
126 /** Names of public transport lines stopping at this platform. */
127 QStringList lines() const;
128 void setLines(QStringList &&lines);
129 QStringList&& takeLines();
130
131 /** Checks if two instances refer to the same platform. */
132 static bool isSame(const Platform &lhs, const Platform &rhs, const OSM::DataSet &dataSet);
133 /** Merge two platform objects. */
134 static Platform merge(const Platform &lhs, const Platform &rhs, const OSM::DataSet &dataSet);
135
136 /** Checks if @p name is a plausible name for a platform. */
137 static bool isPlausibleName(const QString &name);
138 /** Returns the preferred platform name given two possible alternatives. */
139 static QString preferredName(const QString &lhs, const QString &rhs);
140
141private:
142 friend class PlatformPrivate;
144};
145
146}
147
148Q_DECLARE_METATYPE(KOSMIndoorMap::Platform)
149
150#endif // KOSMINDOORMAP_PLATFORM_H
A railway platform section.
Definition platform.h:30
A railway platform/track.
Definition platform.h:56
Mode
Transportation mode served by a platform.
Definition platform.h:109
Coordinate, stored as 1e7 * degree to avoid floating point precision issues, and offset to unsigned v...
Definition datatypes.h:37
A set of nodes, ways and relations.
Definition datatypes.h:340
A reference to any of OSM::Node/OSM::Way/OSM::Relation.
Definition element.h:24
void stop(Ekos::AlignState mode)
OSM-based multi-floor indoor maps for buildings.
Low-level types and functions to work with raw OSM data as efficiently as possible.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:20:03 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.