KOSMIndoorMap

maploader.h
1 /*
2  SPDX-FileCopyrightText: 2020 Volker Krause <[email protected]>
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 
16 /** OSM-based multi-floor indoor maps for buildings. */
17 namespace KOSMIndoorMap {
18 
19 class MapData;
20 class MapLoaderPrivate;
21 class Tile;
22 
23 /** Loader for OSM data for a single station or airport. */
24 class KOSMINDOORMAP_EXPORT MapLoader : public QObject
25 {
26  Q_OBJECT
27  /** Indicates we are downloading content. Use for progress display. */
28  Q_PROPERTY(bool isLoading READ isLoading NOTIFY isLoadingChanged)
29 public:
30  explicit MapLoader(QObject *parent = nullptr);
31  ~MapLoader();
32 
33  /** Load a single O5M or OSM PBF file. */
34  Q_INVOKABLE void loadFromFile(const QString &fileName);
35  /** Load map for the given coordinates.
36  * This can involve online access.
37  */
38  Q_INVOKABLE void loadForCoordinate(double lat, double lon);
39  /** Same as the above, but ensureing the requested data is cached until @p ttl. */
40  void loadForCoordinate(double lat, double lon, const QDateTime &ttl);
41 
42  /** Take out the completely loaded result.
43  * Do this before loading the next map with the same loader.
44  */
45  MapData&& takeData();
46 
47  bool isLoading() const;
48 
49  bool hasError() const;
50  QString errorMessage() const;
51 
52 Q_SIGNALS:
53  /** Emitted when the requested data has been loaded. */
54  void done();
55  void isLoadingChanged();
56 
57 private:
58  void downloadTiles();
59  void downloadFinished();
60  void downloadFailed(Tile tile, const QString &errorMessage);
61  void loadTiles();
62  Tile makeTile(uint32_t x, uint32_t y) const;
63 
64  std::unique_ptr<MapLoaderPrivate> d;
65 };
66 
67 }
68 
69 #endif // KOSMINDOORMAP_MAPLOADER_H
OSM-based multi-floor indoor maps for buildings.
Loader for OSM data for a single station or airport.
Definition: maploader.h:24
Raw OSM map data, separated by levels.
Definition: mapdata.h:59
KCALUTILS_EXPORT QString errorMessage(const KCalendarCore::Exception &exception)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Oct 23 2021 23:03:45 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.