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;
172 return m_availableRasterMaps.value();
181 return &m_availableRasterMaps;
212 [[nodiscard]] QString
serverUrl() {
return m_tileServer.serverUrl();}
226 return m_terrainMapTiles;
257 [[nodiscard]] Q_INVOKABLE QList<GeoMaps::Airspace>
airspaces();
267 [[nodiscard]] Q_INVOKABLE QVariantList
airspaces(
const QGeoCoordinate &position);
338 [[nodiscard]] Q_INVOKABLE QList<GeoMaps::Waypoint>
nearbyWaypoints(
const QGeoCoordinate& position,
const QString& type);
362 void onAviationMapsChanged();
366 void onMBTILESChanged();
371 void fillAviationDataCache(QStringList JSONFileNames,
Units::Distance airspaceAltitudeLimit,
bool hideGlidingSectors);
374 QRegularExpression specialChars{QStringLiteral(
"[^a-zA-Z0-9]")};
375 QHash<QString, QString> simplifySpecialChars_cache;
380 QString _currentBaseMapPath;
381 QString _currentTerrainMapPath;
387 QPointer<QTemporaryFile> m_styleFile;
392 QFuture<void> _aviationDataCacheFuture;
393 QTimer _aviationDataCacheTimer;
398 QList<QSharedPointer<FileFormats::MBTILES>> m_baseMapVectorTiles;
399 QProperty<QList<QSharedPointer<FileFormats::MBTILES>>> m_baseMapRasterTiles;
400 QList<QSharedPointer<FileFormats::MBTILES>> m_terrainMapTiles;
402 QProperty<QStringList> m_availableRasterMaps;
403 QStringList computeAvailableRasterMaps();
405 QProperty<QString> m_currentRasterMap {u
"non-empty place holder"_s};
406 QPropertyNotifier m_currentRasterMapNotifier;
411 QMutex m_aviationDataMutex;
412 QByteArray _combinedGeoJSON_;
413 QList<Waypoint> _waypoints_;
414 QList<Airspace> _airspaces_;
417 QCache<qint64,QImage> terrainTileCache {6};
420 QString geoJSONCache {QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + u
"/aviationData.json"_s};
Provides geographic information.
QBindable< QString > bindableCurrentRasterMap() const
Getter function for the property with the same name.
Q_INVOKABLE QVariantList airspaces(const QGeoCoordinate &position)
List of airspaces at a given location.
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.
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 QVector< GeoMaps::Waypoint > filteredWaypoints(const QString &filter)
Waypoints containing a given substring.
static Q_INVOKABLE QByteArray emptyGeoJSON()
Create empty GeoJSON document.
Q_INVOKABLE QList< GeoMaps::Airspace > airspaces()
List of all airspaces known to Enroute Flight Navigation.
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.
QString styleFileURL()
Getter function for the property with the same name.
QString copyrightNotice
Copyright notice for the map.
QList< GeoMaps::Waypoint > waypoints
Waypoints.
void serverUrlChanged()
Notification signal for the property with the same name.
void deferredInitialization() override
Non-constructor initialization.
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.
QByteArray geoJSON()
Getter function for the property with the same name.
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.
HTTP server for mapbox' MBTiles files.
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.