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;
190 return m_availableRasterMaps.value();
199 return &m_availableRasterMaps;
224 [[nodiscard]] QByteArray
geoJSON()
const {
return m_combinedGeoJSON.value();}
236 [[nodiscard]] QString
serverUrl() {
return m_tileServer.serverUrl();}
250 return m_terrainMapTiles;
356 [[nodiscard]] Q_INVOKABLE QList<GeoMaps::Waypoint>
nearbyWaypoints(
const QGeoCoordinate& position,
const QString& type);
380 void onAviationMapsChanged();
384 void onMBTILESChanged();
389 struct aviationDataCacheResult {
392 QByteArray combinedGeoJSON;
394 aviationDataCacheResult fillAviationDataCache(QStringList JSONFileNames,
Units::Distance airspaceAltitudeLimit,
bool hideGlidingSectors);
397 QRegularExpression specialChars{QStringLiteral(
"[^a-zA-Z0-9]")};
398 QHash<QString, QString> simplifySpecialChars_cache;
403 QString _currentBaseMapPath;
404 QString _currentTerrainMapPath;
407 TileServer m_tileServer;
410 QPointer<QTemporaryFile> m_styleFile;
415 QFuture<GeoMaps::GeoMapProvider::aviationDataCacheResult> _aviationDataCacheFuture;
416 QTimer _aviationDataCacheTimer;
421 QList<QSharedPointer<FileFormats::MBTILES>> m_baseMapVectorTiles;
422 QProperty<QList<QSharedPointer<FileFormats::MBTILES>>> m_baseMapRasterTiles;
423 QList<QSharedPointer<FileFormats::MBTILES>> m_terrainMapTiles;
425 QProperty<QStringList> m_availableRasterMaps;
426 QStringList computeAvailableRasterMaps();
428 QProperty<QString> m_currentRasterMap {u
"non-empty place holder"_s};
429 QPropertyNotifier m_currentRasterMapNotifier;
432 QList<Waypoint> _waypoints_;
433 QProperty<QList<Airspace>> m_airspaces;
436 QCache<qint64,QImage> terrainTileCache {6};
439 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.
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.
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.