KOSMIndoorMap

mapdata.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_MAPDATA_H
8#define KOSMINDOORMAP_MAPDATA_H
9
10#include "kosmindoormap_export.h"
11
12#include <KOSM/Datatypes>
13#include <KOSM/Element>
14
15#include <QMetaType>
16
17#include <map>
18#include <memory>
19#include <vector>
20
21class QPointF;
22class QTimeZone;
23
24namespace KOSMIndoorMap {
25
26/** A floor level. */
27class KOSMINDOORMAP_EXPORT MapLevel
28{
29public:
30 explicit MapLevel(int level = 0);
31 ~MapLevel();
32
33 bool operator<(const MapLevel &other) const;
34 bool operator==(const MapLevel &other) const;
35
36 bool hasName() const;
37 QString name() const;
38 void setName(const QString &name);
39
40 bool isFullLevel() const;
41 /** In case this is not a full level, this returns the numeric values of the full levels above/below. */
42 int fullLevelBelow() const;
43 int fullLevelAbove() const;
44
45 int numericLevel() const;
46
47private:
48 int m_level = 0;
49 QString m_levelName;
50};
51}
52
53Q_DECLARE_METATYPE(KOSMIndoorMap::MapLevel)
54
55namespace KOSMIndoorMap {
56class MapDataPrivate;
57
58/** Raw OSM map data, separated by levels. */
59class KOSMINDOORMAP_EXPORT MapData
60{
61 Q_GADGET
62 /** Center position of the bounding box for QML usage (longitude/latitude, in degree). */
63 Q_PROPERTY(QPointF center READ center)
64 /** Radius from the bounding box center encompassing the entire bounding box, in meters.
65 * Useful for circular search queries.
66 */
67 Q_PROPERTY(float radius READ radius)
68
69 Q_PROPERTY(QString regionCode READ regionCode)
70 Q_PROPERTY(QString timeZone READ timeZoneId)
71public:
72 explicit MapData();
73 MapData(const MapData&);
75 ~MapData();
76
77 MapData& operator=(const MapData&);
78 MapData& operator=(MapData&&);
79
80 bool isEmpty() const;
81 bool operator==(const MapData &other) const;
82
83 const OSM::DataSet& dataSet() const;
84 OSM::DataSet& dataSet();
85 void setDataSet(OSM::DataSet &&dataSet);
86
87 OSM::BoundingBox boundingBox() const;
88 void setBoundingBox(OSM::BoundingBox bbox);
89
90 const std::map<MapLevel, std::vector<OSM::Element>>& levelMap() const;
91
92 QPointF center() const;
93 float radius() const;
94
95 /** ISO 3166-1/2 region or country code of the area covered by this map data. */
96 QString regionCode() const;
97 void setRegionCode(const QString &regionCode);
98
99 /** Timezone the are covered by this map data is in. */
100 QTimeZone timeZone() const;
101 void setTimeZone(const QTimeZone &tz);
102
103private:
104 void processElements();
105 void addElement(int level, OSM::Element e, bool isDependentElement);
106 QString levelName(OSM::Element e);
107 void filterLevels();
108
109 QString timeZoneId() const;
110
111 std::shared_ptr<MapDataPrivate> d;
112};
113
114}
115
116Q_DECLARE_METATYPE(KOSMIndoorMap::MapData)
117
118#endif // KOSMINDOORMAP_MAPDATA_H
Raw OSM map data, separated by levels.
Definition mapdata.h:60
A floor level.
Definition mapdata.h:28
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 Mon Nov 18 2024 12:17:55 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.