NDEVR
API Documentation
MercatorImageManager.h
1#pragma once
2#include "DLLInfo.h"
3#include <NDEVR/SoftwareService.h>
4#include <NDEVR/Bounds.h>
5#include <NDEVR/String.h>
6#include <NDEVR/UUID.h>
7#include <NDEVR/Pointer.h>
8#include <NDEVR/RGBColor.h>
9#include <NDEVR/LogPtr.h>
10namespace NDEVR
11{
12 class InfoPipe;
25
59
63 {
66
71
72 RGBColor pen = Constant<RGBColor>::Invalid;
73 RGBColor brush = Constant<RGBColor>::Invalid;
74 bool is_on = true;
75
76 };
77
80 struct NDEVR_DESIGN_API WebMercatorTile
81 {
83 enum class DPI : uint04
84 {
85 e_low = 1
86 , e_high = 2
87 , e_auto
88 };
89
91 enum class Resolution : uint04
92 {
93 e_low_256 = 1,
94 e_high_512 = 2,
95 };
96
99
108
112 UUID getUUID(UUID parent_id) const;
113
118
124
125
126 };
127
144
146
150 class NDEVR_DESIGN_API WebMercatorTileService
151 {
152 public:
154 virtual ~WebMercatorTileService() = default;
155
160 virtual String getUrl(WebMercatorTile tile, const MercatorImageRequest& request) const = 0;
161
166 virtual UUID getUUID(WebMercatorTile tile, const MercatorImageRequest& request) const = 0;
167
171
175
186 };
187
238
262
263 class MercatorProcessThread;
264
269 class NDEVR_DESIGN_API MercatorImageManager : public SoftwareService
270 {
271 public:
274
279 virtual bool postRequest(const MercatorImageRequest& request, std::function<void(const MercatorImage&)> finished_callback) = 0;
280
284 virtual bool postRequest(const AerialImageRequest& request);
285
289 virtual void setDevicePixelRatio(fltp08) {};
290
293 [[nodiscard]] static MercatorImageManager* PrimaryManager() { return s_manager; }
294
299 protected:
303 protected:
305 };
306
307 template class NDEVR_DESIGN_API StringStream<AerialImageMode>;
308}
A specification of upper and lower bounds in N-dimensions.
Definition Bounds.hpp:54
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
Provides a constant, unmodifiable pointer that has shared ownership of a dynamically allocated object...
Definition Pointer.hpp:276
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Definition Pointer.hpp:356
A light-weight base class for Log that allows processes to update, without the need for additional in...
A light-weight wrapper that will be a no-op if there is not a valid log reference,...
MercatorImageManager()
Constructor.
static MercatorImageManager * s_manager
Singleton pointer to the primary manager.
virtual bool postRequest(const AerialImageRequest &request)
Posts a high-level aerial image request for asynchronous processing.
virtual DynamicPointer< WebMercatorTileService > defaultService(AerialImageMode mode) const =0
Returns the default tile service for the given aerial image mode.
static void SetPrimaryManager(MercatorImageManager *manager)
Sets the singleton primary manager instance.
virtual bool postRequest(const MercatorImageRequest &request, std::function< void(const MercatorImage &)> finished_callback)=0
Posts a Mercator tile image request for asynchronous processing.
static MercatorImageManager * PrimaryManager()
Returns the singleton primary MercatorImageManager instance.
virtual void setDevicePixelRatio(fltp08)
Sets the device pixel ratio used for DPI calculations.
Represents a color in the RGB space with optional alpha transparency.
Definition RGBColor.h:57
Base interface for services that extend or modify software behavior through modules.
Logic for reading or writing to a string or a user friendly, TranslatedString.
The core String class for the NDEVR API.
Definition String.h:95
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:61
A fixed-size array with N dimensions used as the basis for geometric and mathematical types.
Definition Vector.hpp:62
virtual UUID getUUID(WebMercatorTile tile, const MercatorImageRequest &request) const =0
Generates a unique identifier for the given tile and request combination.
WebMercatorTileService(const WebMercatorTileService &other)=default
Copy constructor.
WebMercatorTileService()=default
Default constructor.
WebMercatorTileService & operator=(WebMercatorTileService &&other)=default
Move assignment operator.
WebMercatorTileService(WebMercatorTileService &&other)=default
Move constructor.
virtual Buffer< WebMercatorTile::DPI > getSupportedDPIs() const =0
Returns the list of DPI settings supported by this service.
virtual String getUrl(WebMercatorTile tile, const MercatorImageRequest &request) const =0
Builds the URL used to fetch the specified tile image.
WebMercatorTileService & operator=(const WebMercatorTileService &other)=default
Copy assignment operator.
virtual Buffer< WebMercatorTile::Resolution > getSupportedResolutions() const =0
Returns the list of tile resolutions supported by this service.
virtual ~WebMercatorTileService()=default
Virtual destructor.
The primary namespace for the NDEVR SDK.
ArialFeatureList
Contains a list of common features that may be provided by Aerial tile services.
@ e_poi_place_of_worship
Place of worship points of interest.
@ e_poi_government
Government points of interest.
@ e_administrative
Administrative boundaries.
@ e_road_highway
Highway road features.
@ e_landscape
General landscape features.
@ e_road_arterial
Arterial road features.
@ e_poi_school
School points of interest.
@ e_feature_list_size
Sentinel value; total number of feature types.
@ e_poi_attraction
Tourist attraction points of interest.
@ e_poi_park
Park points of interest.
@ e_water
Water body features.
@ e_transit
General transit features.
@ e_administrative_land_parcel
Land parcel boundaries.
@ e_poi_sports_complex
Sports complex points of interest.
@ e_transit_station
Transit station features.
@ e_administrative_country
Country-level administrative boundaries.
@ e_landscape_man_made
Man-made landscape features.
@ e_poi_medical
Medical facility points of interest.
@ e_transit_line
Transit line features.
@ e_road
General road features.
@ e_administrative_neighborhood
Neighborhood-level administrative boundaries.
@ e_administrative_province
Province-level administrative boundaries.
@ e_administrative_locality
Locality-level administrative boundaries.
@ e_poi_business
Business points of interest.
@ e_road_local
Local road features.
@ e_poi
Points of interest (general).
@ e_landscape_natural
Natural landscape features.
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.
@ e_google_hybrid
Google hybrid (satellite + road labels) view.
@ e_google_terrain
Google terrain map view.
@ e_google_road
Google road map view.
@ e_aerial_image_mode_size
Sentinel value; always last.
@ e_open_maps
OpenStreetMap tile imagery.
@ e_google_satellite
Google satellite imagery.
@ e_high
Quality: SIFT features, vocabulary-tree matching, full-resolution MVS.
constexpr t_to cast(const Angle< t_from > &value)
Casts an Angle from one backing type to another.
Definition Angle.h:408
Contains the information for requesting a 2D top-down view of a geographic location to be used with a...
AerialImageRequest()
Default constructor.
UUID request_id
Unique identifier for this request.
MercatorImageRequest convertToWebRequest(const DynamicPointer< WebMercatorTileService > &service) const
Converts this high-level aerial request into a MercatorImageRequest.
Bounds< 2, fltp08 > bounds
Geographic bounds for the request.
UUID projection_id
Projection identifier for coordinate conversion.
Vector< 2, uint04 > pixel_size
Desired output image size in pixels.
LogPtr log
Log pipe for status and error messages.
AerialImageMode image_mode
The type of aerial imagery to fetch.
std::function< void(const MercatorImage &generated_image)> finished_callback
Callback invoked when the image is ready.
Allows the user to specify a color theme for a Aerial image request.
ArialColorTheme()
Default constructor.
RGBColor brush
Fill color for the feature.
RGBColor pen
Stroke/outline color for the feature.
static RGBColor DefaultColor(ArialFeatureList item)
Returns the default color for the given aerial feature.
bool is_on
Whether this feature is enabled in the theme.
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
Contains the information for requesting a 2D top-down view of a geographic location to be used with a...
UUID request_id
Unique identifier for this request.
WebMercatorTile::DPI dpi
Requested DPI setting.
bool include_labels
Whether to include text labels on tiles.
ArialColorTheme color_theme[cast< uint04 >(ArialFeatureList::e_feature_list_size)]
Per-feature color theme array.
LogPtr log
Log pipe for status and error messages.
fltp08 getScaleFactor() const
Returns a scale factor derived from the DPI and resolution settings.
void setBrushToDefault()
Resets all feature brush colors to their defaults.
WebMercatorTile::DPI getDPI() const
Returns the effective DPI setting for this request.
MercatorImageRequest()
Default constructor.
WebMercatorTile::Resolution getResolution() const
Returns the tile resolution appropriate for this request.
ConstPointer< WebMercatorTileService > service
The tile service used for this request.
Vector< 2, uint04 > size
Desired output image size in pixels.
MercatorImageRequest(const ConstPointer< WebMercatorTileService > &service, Bounds< 2, fltp08 > bounds, Vector< 2, uint04 > size, WebMercatorTile::DPI dpi=WebMercatorTile::DPI::e_auto)
Constructs a request from a tile service, geographic bounds, image size, and DPI.
String generated_image
Path or identifier for the generated composite image.
Bounds< 2, fltp08 > bounds_wgs84
Geographic bounding box in WGS-84 coordinates.
UUID getUUID() const
Computes a UUID that uniquely identifies this request based on its parameters.
Information output from a specific Aerial Tile request.
Bounds< 2, fltp08 > wgs_84_bounds
Geographic bounds of the image in WGS-84 coordinates.
bool success
Whether the image was fetched successfully.
String image_id
String identifier for the fetched image.
UUID request_id
UUID matching the originating request.
void * raw_image
Pointer to the raw image data (NOTE: ownership semantics unclear).
Vector< 2, fltp08 > pixelToLatLon(Vector< 2, uint04 > pixel) const
Converts a pixel coordinate within the image to a WGS-84 lat/lon position.
A Web Mercator map tile descriptor containing coordinates, zoom level, and display settings.
Resolution
Pixel resolution of a single map tile.
DPI
Dots-per-inch setting for tile rendering.
@ e_low
Standard (1x) DPI.
@ e_auto
Automatically select DPI based on device.
String language
Language code for tile labels (e.g. "en").
WebMercatorTile(uint04 x, uint04 y, uint04 zoom, Resolution resolution, DPI dpi, bool include_labels)
Constructs a tile with explicit coordinates and display settings.
WebMercatorTile()
Default constructor.
uint04 zoom
Map zoom level.
Vector< 2, uint04 > tile
Tile column (X) and row (Y) indices.
UUID getUUID(UUID parent_id) const
Generates a deterministic UUID for this tile relative to a parent identifier.
static uint04 convertResolutionToPixels(Resolution resolution)
Converts a Resolution enum value to its pixel dimension.
Resolution resolution
Pixel resolution of the tile.
DPI dpi
DPI setting for tile rendering.