![]() |
NDEVR
API Documentation
|
Stores Coordinate Projections See https://ndevr.org/coordinate-projection/. More...
Public Member Functions | |
| void | addProjection (const CoordinateProjection &projection) |
| Adds a coordinate projection to the manager. | |
| Buffer< UUID > | bestProjectionsLatLon (const Vertex< 2, fltp08 > &lat_lon) const |
| Returns a ranked list of projections suitable for a given latitude/longitude coordinate. | |
| UUID | bestUTMProjectionLatLon (const Vertex< 2, fltp08 > &lat_lon) const |
| Determines the best UTM projection for a given latitude/longitude coordinate. | |
| UUID | bestUTMProjectionMeters (const Vertex< 2, fltp08 > &northing_easting) const |
| Determines the best UTM projection for a given coordinate in meters. | |
| void | cleanup () |
| Removes unused or invalid entries and frees associated resources. | |
| Bounds< 2, fltp08 > | convertFromWGS84 (UUID from_id, const Bounds< 2, Angle< fltp08 > > &bounds) const |
| Converts 2D angle-based bounds from WGS 84 to the specified projection. | |
| Bounds< 2, fltp08 > | convertFromWGS84 (UUID from_id, const Bounds< 2, fltp08 > &bounds) const |
| Converts 2D bounds from WGS 84 to the specified projection. | |
| Bounds< 2, fltp08 > | convertFromWGS84 (UUID from_id, const Bounds< 3, fltp08 > &bounds) const |
| Converts 3D bounds from WGS 84 to the specified projection. | |
| Vertex< 3, fltp08 > | convertFromWGS84 (UUID from_id, const Vertex< 3, fltp08 > &location) const |
| Converts a 3D vertex from WGS 84 to the specified projection. | |
| Bounds< 2, fltp08 > | convertToWGS84 (UUID from_id, const Bounds< 2, fltp08 > &bounds) const |
| Converts 2D bounds from the specified projection to WGS 84 geographic coordinates. | |
| Bounds< 2, fltp08 > | convertToWGS84 (UUID from_id, const Bounds< 3, fltp08 > &bounds) const |
| Converts 3D bounds from the specified projection to WGS 84 geographic coordinates. | |
| Buffer< Vertex< 2, fltp08 > > | convertToWGS84 (UUID from_id, const Buffer< Vertex< 2, fltp08 > > &locations) const |
| Converts a buffer of 2D vertices from the specified projection to WGS 84. | |
| LineSegment< 2, fltp08 > | convertToWGS84 (UUID from_id, const LineSegment< 2, fltp08 > &segment) const |
| Converts a 2D line segment from the specified projection to WGS 84. | |
| Polyline< 2, fltp08, Vertex< 2, fltp08 > > | convertToWGS84 (UUID from_id, const Polyline< 2, fltp08, Vertex< 2, fltp08 > > &segment) const |
| Converts a 2D polyline from the specified projection to WGS 84. | |
| Vertex< 3, fltp08 > | convertToWGS84 (UUID from_id, const Vertex< 3, fltp08 > &location) const |
| Converts a 3D vertex from the specified projection to WGS 84. | |
| void | createUTMCoordinateProjections () |
| Creates and registers all standard UTM coordinate projections (zones 1-60, north and south). | |
| String | createWKTString (UUID id, const UnitManager &manager) const |
| Creates a Well-Known Text (WKT) string for the specified projection. | |
| const CoordinateProjection & | currentProjection () const |
| Returns the currently active coordinate projection. | |
| void | downloadAllProjections () |
| Downloads definitions for all known projections from the remote source. | |
| bool | downloadEPSGProjection (uint04 epsg_code, std::function< void(uint04 code, UUID projection)> finished_callback, bool force_download=false) |
| Downloads the projection definition for a specific EPSG code. | |
| UUID | epsgProjection (uint04 epsg_number) const |
| Returns the UUID of the projection with the given EPSG number. | |
| const CoordinateProjection & | get (UUID id) const |
| Returns the coordinate projection data for the given UUID. | |
| UUID | getProjection (const StringView &name) const |
| Looks up a projection UUID by its name. | |
| Buffer< UUID > | getProjections (const StringView &search_string=StringView()) const |
| Returns a list of projection UUIDs, optionally filtered by a search string. | |
| bool | hasDownloader () const |
| Checks whether a downloader function has been configured. | |
| bool | hasProjection (UUID projection_id) const |
| Checks whether a projection with the given UUID exists in the manager. | |
| void | invalidateConverterCache (UUID projection_id) |
| Invalidates any cached converter for the specified projection, forcing re-creation on next use. | |
| void | processJSON (CoordinateProjection &projection, JSONNode &json) |
| Parses a JSON node and populates the given projection. | |
| void | processWKT (CoordinateProjection &projection, Scanner &scan) |
| Parses a Well-Known Text (WKT) string and populates the given projection. | |
| const Dictionary< UUID, CoordinateProjection > & | projections () const |
| Returns a const reference to the dictionary of all stored projections. | |
| void | readCoordinateFile (File &file) |
| Reads coordinate projection definitions from the specified file. | |
| void | readDirectoryStructure (File &top_dir) |
| Reads coordinate projection definitions from a directory structure. | |
| void | readDirectoryStructure (File &top_dir, File &save_as) |
| Reads coordinate projection definitions from a directory structure and saves the consolidated result. | |
| void | setCoordinateFile (File &file) |
| Sets the file used for reading and writing coordinate projection data. | |
| void | setDownloader (std::function< void(const StringView &, std::function< void(const StringView &)>)> downloader) |
| Sets the download function used to retrieve remote projection data. | |
| void | setVerticalDatum (UUID projection_id, const String &authority, uint04 authority_number) |
| Sets the vertical datum for a given projection. | |
| CoordinateConverter * | wgs84Converter (UUID from_id) const |
| Retrieves or creates a converter from the specified projection to WGS 84. | |
| UUID | wgs84Projection () const |
| Returns the UUID of the WGS 84 geographic projection. | |
| ConstPointer< Unit > | wGS84Unit (UUID from_id) |
| Returns a unit that converts from the specified projection to WGS 84. | |
| ConstPointer< UnitOption > | wGS84UnitOption () |
| Returns a UnitOption representing conversion to WGS 84. | |
| void | writeCoordinateFile (File &file) const |
| Writes all stored coordinate projections to the specified file. | |
Static Public Member Functions | |
| static CoordinateProjection & | BestUTMProjectionInfo () |
| Returns a mutable reference to the CoordinateProjection info for the auto-selected best UTM projection. | |
| static CoordinateProjectionManager & | DefaultInstance () |
| Returns the singleton default instance of the CoordinateProjectionManager. | |
| static VerticalDatum | GetVerticalDatum (uint04 authority_number) |
| Returns the vertical datum matching the given authority number. | |
| static Buffer< VerticalDatum > | GetVerticalDatums () |
| Returns a list of all known vertical datums. | |
| static bool | HasEngine () |
| Checks whether a coordinate projection engine (e.g., PROJ) is available. | |
| static UUID | UseBestUTMProjectionID () |
| Returns a sentinel UUID indicating that the best UTM projection should be auto-selected. | |
Protected Member Functions | |
| ConstPointer< Unit > | unitFromString (const StringView &unit) |
| Looks up or creates a Unit from a string representation. | |
Protected Attributes | |
| File | m_coordinate_file |
| The file used for persistent coordinate projection storage. | |
| std::function< void(const StringView &, std::function< void(const StringView &)>)> | m_downloader |
| Callback used to download remote projection definitions. | |
| Dictionary< UUID, CoordinateProjection > | m_projections |
| Dictionary of all registered coordinate projections keyed by UUID. | |
| Dictionary< String, ConstPointer< Unit > > | m_units |
| Cache of parsed units keyed by their string names. | |
| Buffer< UUID > | m_utm_projections |
| List of UUIDs for the registered UTM projections. | |
| UUID | m_wgs84_id = Constant<UUID>::Invalid |
| Cached UUID of the WGS 84 projection. | |
| Dictionary< UUID, CoordinateConverter * > | m_wgs_84_converter |
| Cache of converters from various projections to WGS 84. | |
Stores Coordinate Projections See https://ndevr.org/coordinate-projection/.
Definition at line 95 of file CoordinateProjectionManager.h.
| void CoordinateProjectionManager::addProjection | ( | const CoordinateProjection & | projection | ) |
Adds a coordinate projection to the manager.
| [in] | projection | The coordinate projection to add. |
| Buffer< UUID > CoordinateProjectionManager::bestProjectionsLatLon | ( | const Vertex< 2, fltp08 > & | lat_lon | ) | const |
Returns a ranked list of projections suitable for a given latitude/longitude coordinate.
| [in] | lat_lon | The geographic coordinate as (latitude, longitude) in degrees. |
|
static |
Returns a mutable reference to the CoordinateProjection info for the auto-selected best UTM projection.
| UUID CoordinateProjectionManager::bestUTMProjectionLatLon | ( | const Vertex< 2, fltp08 > & | lat_lon | ) | const |
Determines the best UTM projection for a given latitude/longitude coordinate.
| [in] | lat_lon | The geographic coordinate as (latitude, longitude) in degrees. |
| UUID CoordinateProjectionManager::bestUTMProjectionMeters | ( | const Vertex< 2, fltp08 > & | northing_easting | ) | const |
Determines the best UTM projection for a given coordinate in meters.
| [in] | northing_easting | The coordinate in meters. |
| Bounds< 2, fltp08 > CoordinateProjectionManager::convertFromWGS84 | ( | UUID | from_id, |
| const Bounds< 2, Angle< fltp08 > > & | bounds ) const |
Converts 2D angle-based bounds from WGS 84 to the specified projection.
| [in] | from_id | The UUID of the target projection. |
| [in] | bounds | The 2D angle bounds in WGS 84. |
| Bounds< 2, fltp08 > CoordinateProjectionManager::convertFromWGS84 | ( | UUID | from_id, |
| const Bounds< 2, fltp08 > & | bounds ) const |
Converts 2D bounds from WGS 84 to the specified projection.
| [in] | from_id | The UUID of the target projection. |
| [in] | bounds | The 2D bounds in WGS 84 (latitude/longitude). |
| Bounds< 2, fltp08 > CoordinateProjectionManager::convertFromWGS84 | ( | UUID | from_id, |
| const Bounds< 3, fltp08 > & | bounds ) const |
Converts 3D bounds from WGS 84 to the specified projection.
| [in] | from_id | The UUID of the target projection. |
| [in] | bounds | The 3D bounds in WGS 84. |
| Vertex< 3, fltp08 > CoordinateProjectionManager::convertFromWGS84 | ( | UUID | from_id, |
| const Vertex< 3, fltp08 > & | location ) const |
Converts a 3D vertex from WGS 84 to the specified projection.
| [in] | from_id | The UUID of the target projection. |
| [in] | location | The 3D vertex in WGS 84 to convert. |
| Bounds< 2, fltp08 > CoordinateProjectionManager::convertToWGS84 | ( | UUID | from_id, |
| const Bounds< 2, fltp08 > & | bounds ) const |
Converts 2D bounds from the specified projection to WGS 84 geographic coordinates.
| [in] | from_id | The UUID of the source projection. |
| [in] | bounds | The 2D bounds to convert. |
| Bounds< 2, fltp08 > CoordinateProjectionManager::convertToWGS84 | ( | UUID | from_id, |
| const Bounds< 3, fltp08 > & | bounds ) const |
Converts 3D bounds from the specified projection to WGS 84 geographic coordinates.
| [in] | from_id | The UUID of the source projection. |
| [in] | bounds | The 3D bounds to convert. |
| Buffer< Vertex< 2, fltp08 > > CoordinateProjectionManager::convertToWGS84 | ( | UUID | from_id, |
| const Buffer< Vertex< 2, fltp08 > > & | locations ) const |
Converts a buffer of 2D vertices from the specified projection to WGS 84.
| [in] | from_id | The UUID of the source projection. |
| [in] | locations | The buffer of 2D vertices to convert. |
| LineSegment< 2, fltp08 > CoordinateProjectionManager::convertToWGS84 | ( | UUID | from_id, |
| const LineSegment< 2, fltp08 > & | segment ) const |
Converts a 2D line segment from the specified projection to WGS 84.
| [in] | from_id | The UUID of the source projection. |
| [in] | segment | The line segment to convert. |
| Polyline< 2, fltp08, Vertex< 2, fltp08 > > CoordinateProjectionManager::convertToWGS84 | ( | UUID | from_id, |
| const Polyline< 2, fltp08, Vertex< 2, fltp08 > > & | segment ) const |
Converts a 2D polyline from the specified projection to WGS 84.
| [in] | from_id | The UUID of the source projection. |
| [in] | segment | The polyline to convert. |
| Vertex< 3, fltp08 > CoordinateProjectionManager::convertToWGS84 | ( | UUID | from_id, |
| const Vertex< 3, fltp08 > & | location ) const |
Converts a 3D vertex from the specified projection to WGS 84.
| [in] | from_id | The UUID of the source projection. |
| [in] | location | The 3D vertex to convert. |
| String CoordinateProjectionManager::createWKTString | ( | UUID | id, |
| const UnitManager & | manager ) const |
Creates a Well-Known Text (WKT) string for the specified projection.
| [in] | id | The UUID of the projection. |
| [in] | manager | The UnitManager used for unit lookups during WKT generation. |
| const CoordinateProjection & CoordinateProjectionManager::currentProjection | ( | ) | const |
Returns the currently active coordinate projection.
|
static |
Returns the singleton default instance of the CoordinateProjectionManager.
| bool CoordinateProjectionManager::downloadEPSGProjection | ( | uint04 | epsg_code, |
| std::function< void(uint04 code, UUID projection)> | finished_callback, | ||
| bool | force_download = false ) |
Downloads the projection definition for a specific EPSG code.
| [in] | epsg_code | The EPSG code to download. |
| [in] | finished_callback | Called when the download completes, with the EPSG code and resulting projection UUID. |
| [in] | force_download | If true, re-downloads even if the projection already exists locally. |
| const CoordinateProjection & CoordinateProjectionManager::get | ( | UUID | id | ) | const |
Returns the coordinate projection data for the given UUID.
| [in] | id | The UUID of the projection to retrieve. |
| UUID CoordinateProjectionManager::getProjection | ( | const StringView & | name | ) | const |
| Buffer< UUID > CoordinateProjectionManager::getProjections | ( | const StringView & | search_string = StringView() | ) | const |
Returns a list of projection UUIDs, optionally filtered by a search string.
| [in] | search_string | An optional filter applied to projection names. |
|
static |
Returns the vertical datum matching the given authority number.
| [in] | authority_number | The authority code identifying the vertical datum. |
|
static |
Returns a list of all known vertical datums.
| bool CoordinateProjectionManager::hasDownloader | ( | ) | const |
Checks whether a downloader function has been configured.
|
static |
Checks whether a coordinate projection engine (e.g., PROJ) is available.
| bool CoordinateProjectionManager::hasProjection | ( | UUID | projection_id | ) | const |
| void CoordinateProjectionManager::invalidateConverterCache | ( | UUID | projection_id | ) |
Invalidates any cached converter for the specified projection, forcing re-creation on next use.
| [in] | projection_id | The UUID of the projection whose converter cache should be cleared. |
| void CoordinateProjectionManager::processJSON | ( | CoordinateProjection & | projection, |
| JSONNode & | json ) |
Parses a JSON node and populates the given projection.
| [in] | projection | The projection to populate with parsed JSON data. |
| [in] | json | The JSON node containing projection definition. |
| void CoordinateProjectionManager::processWKT | ( | CoordinateProjection & | projection, |
| Scanner & | scan ) |
Parses a Well-Known Text (WKT) string and populates the given projection.
| [in] | projection | The projection to populate with parsed WKT data. |
| [in] | scan | The scanner positioned at the WKT content. |
|
inline |
Returns a const reference to the dictionary of all stored projections.
Definition at line 345 of file CoordinateProjectionManager.h.
References m_projections.
| void CoordinateProjectionManager::readCoordinateFile | ( | File & | file | ) |
Reads coordinate projection definitions from the specified file.
| [in] | file | The file containing coordinate projection data. |
| void CoordinateProjectionManager::readDirectoryStructure | ( | File & | top_dir | ) |
Reads coordinate projection definitions from a directory structure.
| [in] | top_dir | The top-level directory to scan for projection files. |
Reads coordinate projection definitions from a directory structure and saves the consolidated result.
| [in] | top_dir | The top-level directory to scan for projection files. |
| [in] | save_as | The file to save the consolidated projection data to. |
| void CoordinateProjectionManager::setCoordinateFile | ( | File & | file | ) |
Sets the file used for reading and writing coordinate projection data.
| [in] | file | The file to use as the coordinate projection database. |
| void CoordinateProjectionManager::setDownloader | ( | std::function< void(const StringView &, std::function< void(const StringView &)>)> | downloader | ) |
Sets the download function used to retrieve remote projection data.
| [in] | downloader | A callable that takes a URL and a completion callback receiving the downloaded content. |
| void CoordinateProjectionManager::setVerticalDatum | ( | UUID | projection_id, |
| const String & | authority, | ||
| uint04 | authority_number ) |
Sets the vertical datum for a given projection.
| [in] | projection_id | The UUID of the projection to update. |
| [in] | authority | The authority name (e.g., "EPSG"). |
| [in] | authority_number | The authority code for the vertical datum. |
|
protected |
Looks up or creates a Unit from a string representation.
| [in] | unit | The string name of the unit. |
|
static |
| CoordinateConverter * CoordinateProjectionManager::wgs84Converter | ( | UUID | from_id | ) | const |
Retrieves or creates a converter from the specified projection to WGS 84.
| [in] | from_id | The UUID of the source projection. |
| UUID CoordinateProjectionManager::wgs84Projection | ( | ) | const |
| ConstPointer< Unit > CoordinateProjectionManager::wGS84Unit | ( | UUID | from_id | ) |
Returns a unit that converts from the specified projection to WGS 84.
| [in] | from_id | The UUID of the source projection. |
| ConstPointer< UnitOption > CoordinateProjectionManager::wGS84UnitOption | ( | ) |
Returns a UnitOption representing conversion to WGS 84.
| void CoordinateProjectionManager::writeCoordinateFile | ( | File & | file | ) | const |
Writes all stored coordinate projections to the specified file.
| [in] | file | The file to write coordinate projection data to. |