25#include <QGeoRectangle>
29#include <QStandardPaths>
30#include <QTemporaryFile>
34#include "GlobalObject.h"
35#include "TileServer.h"
37#include "fileFormats/MBTILES.h"
39using namespace Qt::Literals::StringLiterals;
199 return m_availableRasterMaps.value();
208 return &m_availableRasterMaps;
245 [[nodiscard]] QByteArray
geoJSON()
const {
return m_combinedGeoJSON.value();}
257 [[nodiscard]] QString
serverUrl() {
return m_tileServer.serverUrl();}
271 return m_terrainMapTiles;
377 [[nodiscard]] Q_INVOKABLE QList<GeoMaps::Waypoint>
nearbyWaypoints(
const QGeoCoordinate& position,
const QString& type);
401 void onAviationMapsChanged();
405 void onMBTILESChanged();
410 struct aviationDataCacheResult {
413 QByteArray combinedGeoJSON;
415 aviationDataCacheResult fillAviationDataCache(QStringList JSONFileNames,
Units::Distance airspaceAltitudeLimit,
bool hideGlidingSectors);
418 QRegularExpression specialChars{QStringLiteral(
"[^a-zA-Z0-9]")};
419 QHash<QString, QString> simplifySpecialChars_cache;
424 QString _currentBaseMapPath;
425 QString _currentTerrainMapPath;
428 TileServer m_tileServer;
431 QPointer<QTemporaryFile> m_styleFile;
436 QFuture<GeoMaps::GeoMapProvider::aviationDataCacheResult> _aviationDataCacheFuture;
437 QTimer _aviationDataCacheTimer;
442 QList<QSharedPointer<FileFormats::MBTILES>> m_baseMapVectorTiles;
443 QProperty<QList<QSharedPointer<FileFormats::MBTILES>>> m_baseMapRasterTiles;
444 QList<QSharedPointer<FileFormats::MBTILES>> m_terrainMapTiles;
446 QProperty<QStringList> m_availableRasterMaps;
447 QStringList computeAvailableRasterMaps();
449 QProperty<QString> m_currentRasterMap {u
"non-empty place holder"_s};
450 QPropertyNotifier m_currentRasterMapNotifier;
451 QProperty<int> m_currentRasterMapTileSize {512};
454 QList<Waypoint> _waypoints_;
455 QProperty<QList<Airspace>> m_airspaces;
458 QCache<qint64,QImage> terrainTileCache {6};
461 QString geoJSONCache {QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + u
"/aviationData.json"_s};
A very simple class that describes an airspace.
Provides geographic information.
QBindable< QString > bindableCurrentRasterMap() const
Getter function for the property with the same name.
QList< Waypoint > waypoints()
Getter function for the property with the same name.
Q_INVOKABLE QList< GeoMaps::Waypoint > nearbyWaypoints(const QGeoCoordinate &position, const QString &type)
void terrainMapTilesChanged()
Notification signal for the property with the same name.
QBindable< QList< GeoMaps::Airspace > > bindableAirspaces()
Getter function for the property with the same name.
QBindable< QByteArray > bindableGeoJSON()
Getter function for the property with the same name.
QList< QSharedPointer< FileFormats::MBTILES > > terrainMapTiles() const
Getter function for the property with the same name.
QBindable< QStringList > bindableAvailableRasterMaps() const
Getter function for the property with the same name.
QString serverUrl()
Getter function for the property with the same name.
QStringList availableRasterMaps
Available Raster Maps.
Q_INVOKABLE Waypoint findByID(const QString &icaoID)
QString currentRasterMap
Current Raster Map.
QString currentRasterMap() const
Getter function for the property with the same name.
static Q_INVOKABLE GeoMaps::Waypoint createWaypoint()
Create invalid waypoint.
~GeoMapProvider() override=default
Destructor.
Q_INVOKABLE QVariantList airspacesAtPosition(const QGeoCoordinate &position)
List of airspaces at a given position.
Q_INVOKABLE QVector< GeoMaps::Waypoint > filteredWaypoints(const QString &filter)
Waypoints containing a given substring.
static Q_INVOKABLE QByteArray emptyGeoJSON()
Create empty GeoJSON document.
QByteArray geoJSON
Union of all aviation maps in GeoJSON format.
void styleFileURLChanged()
Notification signal for the property with the same name.
Q_INVOKABLE Units::Distance terrainElevationAMSL(const QGeoCoordinate &coordinate)
Elevation of terrain at a given coordinate, above sea level.
QString serverUrl
URL under which this server is presently reachable.
GeoMapProvider(QObject *parent=nullptr)
Creates a new GeoMap provider.
void geoJSONChanged()
Notification signal for the property with the same name.
QBindable< int > bindableCurrentRasterMapTileSize() const
Getter function for the property with the same name.
QString styleFileURL()
Getter function for the property with the same name.
QString copyrightNotice
Copyright notice for the map.
QList< GeoMaps::Airspace > airspaces
Available Airspaces.
QByteArray geoJSON() const
Getter function for the property with the same name.
QList< GeoMaps::Waypoint > waypoints
Waypoints.
void serverUrlChanged()
Notification signal for the property with the same name.
QStringList availableRasterMaps() const
Getter function for the property with the same name.
void deferredInitialization() override
Non-constructor initialization.
int currentRasterMapTileSize
Current Raster Map Tile Size.
int currentRasterMapTileSize() const
Getter function for the property with the same name.
void waypointsChanged()
Notification signal for the property with the same name.
QString styleFileURL
URL where a style file for the base map can be retrieved.
void setCurrentRasterMap(const QString &mapName)
Setter function for the property with the same name.
QListQSharedPointer< FileFormats::MBTILES > terrainMapTiles
List of terrain map MBTILES.
Q_INVOKABLE GeoMaps::Waypoint closestWaypoint(QGeoCoordinate position, const QGeoCoordinate &distPosition)
Find closest waypoint to a given position.
static QString copyrightNotice()
Getter function for the property with the same name.
Waypoint, such as an airfield, a navaid station or a reporting point.
static Q_INVOKABLE GeoMaps::GeoMapProvider * geoMapProvider()
Pointer to appplication-wide static GeoMaps::GeoMapProvider instance.
GlobalObject(QObject *parent=nullptr)
Standard constructor.
Convenience class for distance computations.