KOSMIndoorMap

maploader.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_MAPLOADER_H
8#define KOSMINDOORMAP_MAPLOADER_H
9
10#include "kosmindoormap_export.h"
11
12#include <QObject>
13
14#include <memory>
15
16namespace OSM {
17class BoundingBox;
18}
19
20/** OSM-based multi-floor indoor maps for buildings. */
21namespace KOSMIndoorMap {
22
23class MapData;
24class MapLoaderPrivate;
25class Tile;
26
27/** Loader for OSM data for a single station or airport. */
28class KOSMINDOORMAP_EXPORT MapLoader : public QObject
29{
30 Q_OBJECT
31 /** Indicates we are downloading content. Use for progress display. */
32 Q_PROPERTY(bool isLoading READ isLoading NOTIFY isLoadingChanged)
33public:
34 explicit MapLoader(QObject *parent = nullptr);
35 ~MapLoader();
36
37 /** Load a single O5M or OSM PBF file. */
38 Q_INVOKABLE void loadFromFile(const QString &fileName);
39 /** Load map for the given coordinates.
40 * This can involve online access.
41 */
42 Q_INVOKABLE void loadForCoordinate(double lat, double lon);
43 /** Same as the above, but ensureing the requested data is cached until @p ttl. */
44 void loadForCoordinate(double lat, double lon, const QDateTime &ttl);
45
46 /** Load map data for the given bounding box, without applying the boundary search. */
47 void loadForBoundingBox(OSM::BoundingBox box);
48 /** Load map data for the given tile. */
49 void loadForTile(Tile tile);
50
51 /** Take out the completely loaded result.
52 * Do this before loading the next map with the same loader.
53 */
54 MapData&& takeData();
55
56 bool isLoading() const;
57
58 bool hasError() const;
59 QString errorMessage() const;
60
61Q_SIGNALS:
62 /** Emitted when the requested data has been loaded. */
63 void done();
64 void isLoadingChanged();
65
66private:
67 void downloadTiles();
68 void downloadFinished();
69 void downloadFailed(Tile tile, const QString &errorMessage);
70 void loadTiles();
71 Tile makeTile(uint32_t x, uint32_t y) const;
72
73 std::unique_ptr<MapLoaderPrivate> d;
74};
75
76}
77
78#endif // KOSMINDOORMAP_MAPLOADER_H
Raw OSM map data, separated by levels.
Definition mapdata.h:60
Loader for OSM data for a single station or airport.
Definition maploader.h:29
void done()
Emitted when the requested data has been loaded.
Bounding box, ie.
Definition datatypes.h:95
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.