KOSMIndoorMap

locationqueryoverlayproxymodel.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_LOCATIONQUERYOVERLAYPROXYMODEL_H
8#define KOSMINDOORMAP_LOCATIONQUERYOVERLAYPROXYMODEL_H
9
10#include <QAbstractItemModel>
11#include <qqmlregistration.h>
12
13#include <KOSMIndoorMap/MapData>
14
15namespace OSM {
16class Element;
17class Node;
18}
19
20namespace KOSMIndoorMap {
21
22/** Adapts a KPublicTransport::LocationQueryModel to be compatible with a KOSMIndoorMap::OverlaySource.
23 */
25{
27 Q_PROPERTY(KOSMIndoorMap::MapData mapData READ mapData WRITE setMapData NOTIFY mapDataChanged)
28 Q_PROPERTY(QObject* sourceModel READ sourceModel WRITE setSourceModel NOTIFY sourceModelChanged)
29 QML_ELEMENT
30
31public:
34
35 MapData mapData() const;
36 void setMapData(const MapData &data);
37
38 QObject *sourceModel() const;
39 void setSourceModel(QObject *sourceModel);
40
41 enum Role {
42 ElementRole = Qt::UserRole,
43 LevelRole,
44 HiddenElementRole,
45 };
46 Q_ENUM(Role)
47
48 int rowCount(const QModelIndex &parent = {}) const override;
49 QVariant data(const QModelIndex & index, int role) const override;
50 QHash<int, QByteArray> roleNames() const override;
51
53 void mapDataChanged();
54 void sourceModelChanged();
55
56private:
57 struct Info {
58 OSM::Node overlayNode;
59 OSM::Element sourceElement;
60 };
61
62 void initialize();
63 Info nodeForRow(int row) const;
64
65 struct {
66 OSM::TagKey name;
67 OSM::TagKey amenity;
68 OSM::TagKey capacity;
69 OSM::TagKey realtimeAvailable;
70 OSM::TagKey network;
71 OSM::TagKey mxoid;
72 OSM::TagKey remainingRange;
73 OSM::TagKey vehicle;
74 OSM::TagKey addr_street;
75 OSM::TagKey addr_city;
76 OSM::TagKey addr_postcode;
77 } m_tagKeys;
78 OSM::TagKey m_realtimeAvailableTagKeys[5];
79
80 std::vector<Info> m_nodes;
81 MapData m_data;
82 QAbstractItemModel *m_sourceModel = nullptr;
83};
84
85}
86
87#endif // KOSMINDOORMAP_LOCATIONQUERYOVERLAYPROXYMODEL_H
Adapts a KPublicTransport::LocationQueryModel to be compatible with a KOSMIndoorMap::OverlaySource.
Raw OSM map data, separated by levels.
Definition mapdata.h:60
A reference to any of OSM::Node/OSM::Way/OSM::Relation.
Definition element.h:24
An OSM node.
Definition datatypes.h:204
A key of an OSM tag.
Definition datatypes.h:179
OSM-based multi-floor indoor maps for buildings.
Low-level types and functions to work with raw OSM data as efficiently as possible.
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const override
Q_ENUM(...)
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
QObject * parent() const const
UserRole
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.