API Documentation
Loading...
Searching...
No Matches
CoordinateProjectionManager.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Design
28File: CoordinateProjectionManager
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/CoordinateProjection.h>
35#include <NDEVR/Dictionary.h>
36#include <NDEVR/String.h>
37#include <NDEVR/Pointer.h>
38#include <NDEVR/File.h>
39#include <NDEVR/UUID.h>
40#include <functional>
41namespace NDEVR
42{
43 template<uint01 t_dims, class t_type, class t_vertex>
44 class Polyline;
45 class File;
47 class UnitOption;
48 class CustomUnit;
49 class Scanner;
50 class JSONNode;
51 class UnitManager;
52
53 /**--------------------------------------------------------------------------------------------------
54 \brief A specific unit that can convert between coordinate projections
55 **/
57 {
58 public:
60 static constexpr const char* LatLonUnitName() { return "LatLonUnit"; }
61 };
62 template<class t_type>
63 class Resource;
64
65 /**--------------------------------------------------------------------------------------------------
66 \brief Stores Coordinate Projections
67 See https://ndevr.org/coordinate-projection/
68 **/
70 {
71 public:
74 void writeCoordinateFile(File& file) const;
75 void readDirectoryStructure(File& top_dir, File& save_as);
77 void addProjection(const CoordinateProjection& projection);
79 void cleanup();
80 void processWKT(CoordinateProjection& projection, Scanner& scan);
81 void processJSON(CoordinateProjection& projection, JSONNode& json);
82 void setDownloader(std::function<void(const String&, std::function<void(const String&)>)> downloader);
83 bool hasDownloader() const;
85 bool downloadEPSGProjection(uint04 epsg_code, std::function<void(uint04 code, UUID projection)> finished_callback, bool force_download = false);
86 UUID getProjection(const String& name) const;
88 Buffer<UUID> getProjections(const String& search_string = String()) const;
89 const CoordinateProjection& get(UUID id) const;
90 bool hasProjection(UUID projection_id) const;
96 Bounds<2, fltp08> convertFromWGS84(UUID from_id, const Bounds<2, Angle<fltp08>>& bounds) const;
99 Vertex<3, fltp08> convertToWGS84(UUID from_id, const Vertex<3, fltp08>& location) const;
104 const Dictionary<UUID, CoordinateProjection>& projections() const { return m_projections; }
106 static bool HasEngine();
109 String createWKTString(UUID id, const UnitManager& manager) const;
110 public:
113 protected:
115 protected:
116
119 std::function<void(const String&, std::function<void(const String&)>)> m_downloader;
121 mutable UUID m_wgs84_id = Constant<UUID>::Invalid;
124 };
125}
126
127
128
129
#define NDEVR_DESIGN_API
Definition DLLInfo.h:55
The primary angle storage class for this API. Stores an angle in an optimized format.
Definition StringStream.h:540
A specification of upper and lower bounds in N-dimensions.
Definition Bounds.hpp:52
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
Provides a constant, unmodifiable pointer that has shared ownership of a dynamically allocated object...
Definition GraphicsPipeline.h:42
Stores different projections and then converts data from one projection into another.
Definition CoordinateConverter.h:44
Stores Coordinate Projections See https://ndevr.org/coordinate-projection/.
Definition CoordinateProjectionManager.h:70
static CoordinateProjectionManager & DefaultInstance()
UUID bestUTMProjectionLatLon(const Vertex< 2, fltp08 > &lat_lon) const
Buffer< Vertex< 2, fltp08 > > convertToWGS84(UUID from_id, const Buffer< Vertex< 2, fltp08 > > &locations) const
void setDownloader(std::function< void(const String &, std::function< void(const String &)>)> downloader)
void addProjection(const CoordinateProjection &projection)
CoordinateConverter * wgs84Converter(UUID from_id) const
bool downloadEPSGProjection(uint04 epsg_code, std::function< void(uint04 code, UUID projection)> finished_callback, bool force_download=false)
std::function< void(const String &, std::function< void(const String &)>)> m_downloader
Definition CoordinateProjectionManager.h:119
Bounds< 2, fltp08 > convertFromWGS84(UUID from_id, const Bounds< 3, fltp08 > &bounds) const
ConstPointer< Unit > unitFromString(const String &unit)
Dictionary< UUID, CoordinateProjection > m_projections
Definition CoordinateProjectionManager.h:120
void readDirectoryStructure(File &top_dir, File &save_as)
Vertex< 3, fltp08 > convertFromWGS84(UUID from_id, const Vertex< 3, fltp08 > &location) const
void writeCoordinateFile(File &file) const
Dictionary< UUID, CoordinateConverter * > m_wgs_84_converter
Definition CoordinateProjectionManager.h:117
ConstPointer< UnitOption > wGS84UnitOption()
LineSegment< 2, fltp08 > convertToWGS84(UUID from_id, const LineSegment< 2, fltp08 > &segment) const
Vertex< 3, fltp08 > convertToWGS84(UUID from_id, const Vertex< 3, fltp08 > &location) const
UUID bestUTMProjectionMeters(const Vertex< 2, fltp08 > &lat_lon) const
String createWKTString(UUID id, const UnitManager &manager) const
Bounds< 2, fltp08 > convertToWGS84(UUID from_id, const Bounds< 3, fltp08 > &bounds) const
bool hasProjection(UUID projection_id) const
void readDirectoryStructure(File &top_dir)
void processWKT(CoordinateProjection &projection, Scanner &scan)
UUID getProjection(const String &name) const
Bounds< 2, fltp08 > convertFromWGS84(UUID from_id, const Bounds< 2, fltp08 > &bounds) const
const Dictionary< UUID, CoordinateProjection > & projections() const
Definition CoordinateProjectionManager.h:104
ConstPointer< Unit > wGS84Unit(UUID from_id)
const CoordinateProjection & get(UUID id) const
Dictionary< String, ConstPointer< Unit > > m_units
Definition CoordinateProjectionManager.h:122
Polyline< 2, fltp08, Vertex< 2, fltp08 > > convertToWGS84(UUID from_id, const Polyline< 2, fltp08, Vertex< 2, fltp08 > > &segment) const
Buffer< UUID > bestProjectionsLatLon(const Vertex< 2, fltp08 > &lat_lon) const
static CoordinateProjection & BestUTMProjectionInfo()
Bounds< 2, fltp08 > convertFromWGS84(UUID from_id, const Bounds< 2, Angle< fltp08 > > &bounds) const
Buffer< UUID > m_utm_projections
Definition CoordinateProjectionManager.h:118
Buffer< UUID > getProjections(const String &search_string=String()) const
File m_coordinate_file
Definition CoordinateProjectionManager.h:123
void processJSON(CoordinateProjection &projection, JSONNode &json)
A program-defined unit that can be used for some specific task different from a program-wide unit.
Definition UnitManager.h:76
A hash-based key-value store, useful for quick associative lookups. Key features include:
Definition Dictionary.h:61
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Definition Pointer.hpp:320
Logic for reading or writing to a file as well as navigating filesystems.
Definition File.h:48
JavaScript Object Notation or JSON is an open - standard file format that uses human - readable text ...
Definition JSONParser.h:60
A specific unit that can convert between coordinate projections.
Definition CoordinateProjectionManager.h:57
static constexpr const char * LatLonUnitName()
Definition CoordinateProjectionManager.h:60
static DynamicPointer< CustomUnit > CustomLatLonUnit()
A line segment represented by two vertices, a start and end.
Definition Line.hpp:49
A polyline which stores vertex information for many points along a given path.
Definition CoordinateProjectionManager.h:44
Contains methods for easily reading objects in an ascii stream.
Definition Scanner.h:45
The core String class for the NDEVR API.
Definition String.h:69
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:60
Handles a grouping of units that can describe any number of data categories.
Definition UnitManager.h:143
A definition of how to describe a particular set of data to a custom category of unit.
Definition UnitManager.h:17
A vertex or point. A specific type of Vector used primarily for spacial location information.
Definition Vertex.hpp:48
Definition ACIColor.h:37
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:149
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
Definition BaseValues.hpp:233
Basic data about a particular coordinate projection. See https://ndevr.org/coordinate-projection/.
Definition CoordinateProjection.h:44