KOSMIndoorMap

overlaysource.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_OVERLAYSOURCE_H
8#define KOSMINDOORMAP_OVERLAYSOURCE_H
9
10#include "kosmindoormap_export.h"
11
12#include <KOSM/Element>
13
14#include <QObject>
15#include <QPointer>
16
17#include <functional>
18
20
21namespace KOSMIndoorMap {
22
23class AbstractOverlaySourcePrivate;
24
25/** A source for overlay elements, drawn on top of the static map data. */
26class KOSMINDOORMAP_EXPORT AbstractOverlaySource : public QObject
27{
28 Q_OBJECT
29public:
30 virtual ~AbstractOverlaySource();
31
32 /** Iteration interface with floor level filtering. */
33 virtual void forEach(int floorLevel, const std::function<void(OSM::Element, int)> &func) const = 0;
34
35 /** Adds hidden elements to @param elems. */
36 virtual void hiddenElements(std::vector<OSM::Element> &elems) const;
37
38Q_SIGNALS:
39 /** Trigger map re-rendering when the source changes. */
40 void update();
41
42 /** Trigger style re-compilation.
43 * This is needed for example when the source added new tag keys that the map data
44 * didn't previously contain (and thus would be optimized out of the style).
45 */
46 void reset();
47
48protected:
49 explicit AbstractOverlaySource(QObject *parent);
50 explicit AbstractOverlaySource(AbstractOverlaySourcePrivate *dd, QObject *parent);
51 std::unique_ptr<AbstractOverlaySourcePrivate> d_ptr;
52 Q_DECLARE_PRIVATE(AbstractOverlaySource)
53};
54
55class ModelOverlaySourcePrivate;
56
57/** A source for overlay elements, based on a QAbstractItemModel as input. */
58class KOSMINDOORMAP_EXPORT ModelOverlaySource : public AbstractOverlaySource
59{
60 Q_OBJECT
61public:
62 explicit ModelOverlaySource(QAbstractItemModel *model, QObject *parent = nullptr);
64
65 /** Iteration interface with floor level filtering. */
66 void forEach(int floorLevel, const std::function<void(OSM::Element, int)> &func) const override;
67
68 /** Adds hidden elements to @param elems. */
69 void hiddenElements(std::vector<OSM::Element> &elems) const override;
70
71private:
72 Q_DECLARE_PRIVATE(ModelOverlaySource)
73};
74
75}
76
77#endif // KOSMINDOORMAP_OVERLAYSOURCE_H
A source for overlay elements, drawn on top of the static map data.
void reset()
Trigger style re-compilation.
void update()
Trigger map re-rendering when the source changes.
virtual void forEach(int floorLevel, const std::function< void(OSM::Element, int)> &func) const =0
Iteration interface with floor level filtering.
A source for overlay elements, based on a QAbstractItemModel as input.
A reference to any of OSM::Node/OSM::Way/OSM::Relation.
Definition element.h:24
OSM-based multi-floor indoor maps for buildings.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:53:52 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.