33#include <NDEVR/ProgressInfo.h>
34#include <NDEVR/MercatorImageManager.h>
35#include <NDEVR/Pointer.h>
36#include <NDEVR/QueueBuffer.h>
37#include <NDEVR/Dictionary.h>
38#include <NDEVR/UUID.h>
40class QNetworkAccessManager;
126 OpenStreetMapWebMercatorTileService() =
default;
127 virtual ~OpenStreetMapWebMercatorTileService() =
default;
128 OpenStreetMapWebMercatorTileService(
const OpenStreetMapWebMercatorTileService& other) =
default;
129 OpenStreetMapWebMercatorTileService(OpenStreetMapWebMercatorTileService&& other) =
default;
130 OpenStreetMapWebMercatorTileService& operator=(
const OpenStreetMapWebMercatorTileService& other) =
default;
131 OpenStreetMapWebMercatorTileService& operator=(OpenStreetMapWebMercatorTileService&& other) =
default;
302 friend class MercatorProcessThread;
303#if NDEVR_SUPPORTS_THREADING
A specification of upper and lower bounds in N-dimensions.
The equivelent of std::vector but with a bit more control.
A hash-based key-value store, useful for quick associative lookups.
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Provides coordinate conversion utilities between EPSG:4326 (WGS84) and tile coordinates.
TileLocation
Specifies a position within a map tile.
fltp08 tile_x_to_EPSG4326_lon_deg(uint04 x, uint04 z, TileLocation location, fltp08 scale_factor=1.0) const
Converts a tile X coordinate to longitude in degrees.
static uint01 CalcZoom(Bounds< 2, fltp08 > lat_long_bounds_wgs84_dd, Vector< 2, uint04 > size)
Calculates the optimal zoom level for a geographic bounds and pixel size.
static EPSG4326TileHelper & DefaultHelper()
Returns the singleton helper instance.
fltp08 tile_y_to_EPSG4326_lat_deg(uint04 y, uint04 z, TileLocation location, fltp08 scale_factor=1.0) const
Converts a tile Y coordinate to latitude in degrees.
static fltp08 EPSG4326(uint01 dim, fltp08 lon_deg, uint01 z, fltp08 scale_factor=1.0)
Converts a geographic coordinate to tile space.
fltp08 tile_x_to_EPSG4326_lon_deg(uint04 x, uint04 z, fltp08 percent_x, fltp08 scale_factor=1.0) const
Converts a tile X coordinate to longitude using a fractional position.
static Bounds< 2, fltp08 > TileSpace(Bounds< 2, fltp08 > lat_long_bounds, Vector< 2, uint04 > size, fltp08 scale_factor=1.0)
Computes the tile space bounds for a geographic bounding box.
fltp08 tile_y_to_EPSG4326_lat_deg(uint04 y, uint04 z, fltp08 percent_y, fltp08 scale_factor=1.0) const
Converts a tile Y coordinate to latitude using a fractional position.
Buffer< WebMercatorTile::DPI > getSupportedDPIs() const final override
Returns the DPI values supported by this service.
String getUrl(WebMercatorTile tile, const MercatorImageRequest &request) const final override
Builds the URL for fetching a specific tile.
GoogleLayer
The available Google Maps layer types.
@ e_satellite
Satellite imagery.
@ e_hybrid
Satellite imagery with road overlay.
UUID getUUID(WebMercatorTile tile, const MercatorImageRequest &request) const final override
Returns a unique identifier for a specific tile request.
GoogleWebMercatorTileService(GoogleLayer layer)
Constructs a Google tile service for the specified layer.
Buffer< WebMercatorTile::Resolution > getSupportedResolutions() const final override
Returns the tile resolutions supported by this service.
GoogleLayer m_layer
The active Google Maps layer.
static uint04 URLFeatureCode(ArialFeatureList item)
Returns the URL feature code for an aerial feature list item.
void buildSecrets(WebMercatorTile tile, String &secret_1, String &secret_2) const
Builds authentication secret strings for a tile request.
String m_secret
The authentication secret for tile requests.
MercatorImageManager()
Constructor.
void setDevicePixelRatio(fltp08 device_pixel_ratio) override
Sets the device pixel ratio for high-DPI displays.
static MercatorWebImageManager & DefaultManager()
Returns the singleton default manager instance.
bool hasPendingRequest(const UUID &id) const
Checks whether a request with the given ID is pending.
void executePendingRequest(const UUID &id)
Executes the next pending tile request for the given ID.
bool getTile(const WebMercatorTileRequest &request)
Fetches a single map tile.
void finish(bool success, const MercatorImageRequest &request, std::function< void(const MercatorImage &)> finished_callback)
Handles completion of a full image composition.
static void Initialize()
Initializes the global tile services and network manager.
ProgressInfo m_progress
Tracks progress of ongoing tile fetch operations.
virtual bool postRequest(const MercatorImageRequest &request, std::function< void(const MercatorImage &)> finished_callback) override
Posts an image request with a completion callback.
bool getImage(const AerialImageRequest &request)
Fetches a composed image for the given aerial request.
virtual bool postRequest(const AerialImageRequest &request) override
Posts an aerial image request.
fltp08 devicePixelRatio() const
Returns the current device pixel ratio.
MercatorProcessThread * m_thread
The background processing thread for tile requests.
UUID m_wgs_84
The WGS84 coordinate system UUID.
void finish(const String &id, const WebMercatorTileRequest &request)
Handles completion of a single tile fetch.
Dictionary< UUID, UUID > m_image_get_id
Maps image request IDs to tile service IDs.
fltp08 m_device_pixel_ratio
The device pixel ratio for high-DPI rendering.
Dictionary< UUID, QImage > m_image_buffers
Partially composed tile images per request ID.
bool getImage(const MercatorImageRequest &request, std::function< void(const MercatorImage &)> finished_callback)
Fetches a composed image from tiles with a completion callback.
QNetworkAccessManager * m_network_manager
The Qt network access manager for HTTP requests.
Dictionary< UUID, QueueBuffer< WebMercatorTileRequest > > m_pending_web_requests
Queued tile requests per request ID.
DynamicPointer< WebMercatorTileService > defaultService(AerialImageMode mode) const override
Returns the default tile service for the given aerial image mode.
MercatorWebImageManager()
Constructs the MercatorWebImageManager.
Buffer< WebMercatorTile::DPI > getSupportedDPIs() const final override
Returns the DPI values supported by this service.
Buffer< WebMercatorTile::Resolution > getSupportedResolutions() const final override
Returns the tile resolutions supported by this service.
String getUrl(WebMercatorTile tile, const MercatorImageRequest &request) const final override
Builds the URL for fetching a specific tile.
UUID getUUID(WebMercatorTile tile, const MercatorImageRequest &request) const final override
Returns a unique identifier for a specific tile request.
Used with InfoPipe to signal that the system will be using progress.
The core String class for the NDEVR API.
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
A fixed-size array with N dimensions used as the basis for geometric and mathematical types.
WebMercatorTileService()=default
Default constructor.
The primary namespace for the NDEVR SDK.
ArialFeatureList
Contains a list of common features that may be provided by Aerial tile services.
@ e_center
Center text both horizontally and vertically.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
double fltp08
Defines an alias representing an 8 byte floating-point number.
AerialImageMode
enum specifying what type of image to fetch.
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Contains the information for requesting a 2D top-down view of a geographic location to be used with a...
Contains the information for requesting a 2D top-down view of a geographic location to be used with a...
Information output from a specific Aerial Tile request.
Contains the reply data from a Web Mercator tile fetch request.
Vector< 2, uint04 > tile_location
The tile grid location.
QImage image
The fetched tile image.
bool success
Whether the tile fetch was successful.
Encapsulates a request for a single Web Mercator map tile.
WebMercatorTileRequest(MercatorImageRequest request, WebMercatorTile tile)
Constructs a tile request from an image request and tile identifier.
MercatorImageRequest request
The parent image request parameters.
WebMercatorTileRequest()
Default constructor.
WebMercatorTile tile
The tile coordinates and zoom level.
std::function< void(WebMercatorTileReply &reply)> finished_callback
Callback invoked when the tile fetch completes.
A Web Mercator map tile descriptor containing coordinates, zoom level, and display settings.