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;
209 return m_availableRasterMaps.value();
218 return &m_availableRasterMaps;
255 [[nodiscard]] QByteArray
geoJSON()
const {
return m_combinedGeoJSON.value();}
267 [[nodiscard]] QStringList
oversizedMaps()
const {
return m_oversizedMaps.value();}
279 [[nodiscard]] QString
serverUrl() {
return m_tileServer.serverUrl();}
293 return m_terrainMapTiles;
399 [[nodiscard]] Q_INVOKABLE QList<GeoMaps::Waypoint>
nearbyWaypoints(
const QGeoCoordinate& position,
const QString& type);
426 void onAviationMapsChanged();
430 void onMBTILESChanged();
435 struct aviationDataCacheResult {
438 QByteArray combinedGeoJSON;
440 aviationDataCacheResult fillAviationDataCache(QStringList JSONFileNames,
bool hideGlidingSectors);
443 QRegularExpression specialChars{QStringLiteral(
"[^a-zA-Z0-9]")};
444 QHash<QString, QString> simplifySpecialChars_cache;
449 QString _currentBaseMapPath;
450 QString _currentTerrainMapPath;
453 TileServer m_tileServer;
456 QPointer<QTemporaryFile> m_styleFile;
461 QFuture<GeoMaps::GeoMapProvider::aviationDataCacheResult> _aviationDataCacheFuture;
462 QTimer _aviationDataCacheTimer;
467 QList<QSharedPointer<FileFormats::MBTILES>> m_baseMapVectorTiles;
468 QProperty<QList<QSharedPointer<FileFormats::MBTILES>>> m_baseMapRasterTiles;
469 QList<QSharedPointer<FileFormats::MBTILES>> m_terrainMapTiles;
471 QProperty<QStringList> m_availableRasterMaps;
472 QStringList computeAvailableRasterMaps();
474 QProperty<QString> m_currentRasterMap {u
"non-empty place holder"_s};
475 QPropertyNotifier m_currentRasterMapNotifier;
476 QProperty<int> m_currentRasterMapTileSize {512};
479 QList<Waypoint> _waypoints_;
480 QProperty<QList<Airspace>> m_airspaces;
486 static constexpr qint64 maxAviationMapFileSize = 50*1024*1024;
487 static constexpr qint64 maxGeoJSONCacheSize = 150*1024*1024;
491 QCache<qint64,QImage> terrainTileCache {6};
494 QString geoJSONCache {QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + u
"/aviationData.json"_s};
A very simple class that describes an airspace.
Provides geographic information.
~GeoMapProvider() override
Destructor.
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.
void oversizedMapsChanged()
Notification signal for the property with the same name.
QStringList oversizedMaps() const
Getter function 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.
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.
QBindable< QStringList > bindableOversizedMaps()
Getter function for the property with the same name.
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.
QStringList oversizedMaps
Names of installed aviation maps that are too large to load.
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.