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;
53 {
54 public:
55 static DynamicPointer<CustomUnit> CustomLatLonUnit();
56 static constexpr const char* LatLonUnitName() { return "LatLonUnit"; }
57 };
58 template<class t_type>
59 class Resource;
60
62 {
63 public:
64 void setCoordinateFile(File& file);
65 void readCoordinateFile(File& file);
66 void writeCoordinateFile(File& file) const;
67 void readDirectoryStructure(File& top_dir, File& save_as);
68 void readDirectoryStructure(File& top_dir);
69 void addProjection(const CoordinateProjection& projection);
70 void createUTMCoordinateProjections();
71 void cleanup();
72 void processWKT(CoordinateProjection& projection, Scanner& scan);
73 void processJSON(CoordinateProjection& projection, JSONNode& json);
74 void setDownloader(std::function<void(const String&, std::function<void(const String&)>)> downloader);
75 bool hasDownloader() const;
76 void downloadAllProjections();
77 bool downloadEPSGProjection(uint04 epsg_code, std::function<void(uint04 code, UUID projection)> finished_callback, bool force_download = false);
78 UUID getProjection(const String& name) const;
79 UUID wgs84Projection() const;
80 Buffer<UUID> getProjections(const String& search_string = String()) const;
81 const CoordinateProjection& get(UUID id) const;
82 bool hasProjection(UUID projection_id) const;
83 UUID bestUTMProjectionLatLon(const Vertex<2, fltp08>& lat_lon) const;
84 Buffer<UUID> bestProjectionsLatLon(const Vertex<2, fltp08>& lat_lon) const;
85 UUID bestUTMProjectionMeters(const Vertex<2, fltp08>& lat_lon) const;
86 CoordinateConverter* wgs84Converter(UUID from_id) const;
87 Bounds<2, fltp08> convertToWGS84(UUID from_id, const Bounds<3, fltp08>& bounds) const;
88 Bounds<2, fltp08> convertFromWGS84(UUID from_id, const Bounds<2, Angle<fltp08>>& bounds) const;
89 Bounds<2, fltp08> convertFromWGS84(UUID from_id, const Bounds<2, fltp08>& bounds) const;
90 Bounds<2, fltp08> convertFromWGS84(UUID from_id, const Bounds<3, fltp08>& bounds) const;
91 Vertex<3, fltp08> convertToWGS84(UUID from_id, const Vertex<3, fltp08>& location) const;
92 Vertex<3, fltp08> convertFromWGS84(UUID from_id, const Vertex<3, fltp08>& location) const;
93 Buffer<Vertex<2, fltp08>> convertToWGS84(UUID from_id, const Buffer<Vertex<2, fltp08>>& locations) const;
94 LineSegment<2, fltp08> convertToWGS84(UUID from_id, const LineSegment<2, fltp08>& segment) const;
96 const Dictionary<UUID, CoordinateProjection>& projections() const { return m_projections; }
97 static CoordinateProjectionManager& DefaultInstance();
98 static bool HasEngine();
99 ConstPointer<Unit> wGS84Unit(UUID from_id);
100 ConstPointer<UnitOption> wGS84UnitOption();
101 String createWKTString(UUID id, const UnitManager& manager) const;
102 public:
103 static UUID UseBestUTMProjectionID();
104 static CoordinateProjection& BestUTMProjectionInfo();
105 protected:
106 ConstPointer<Unit> unitFromString(const String& unit);
107 protected:
108
111 std::function<void(const String&, std::function<void(const String&)>)> m_downloader;
113 mutable UUID m_wgs84_id = Constant<UUID>::NaN;
116 };
117}
118
119
120
121
#define NDEVR_DESIGN_API
Definition DLLInfo.h:77
Stores an angle in an optimized format.
Definition StringStream.h:352
A specification of upper and lower bounds in N-dimensions.
Definition Bounds.hpp:57
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
Definition GraphicsPipeline.h:42
Definition CoordinateConverter.h:39
Definition CoordinateProjectionManager.h:62
std::function< void(const String &, std::function< void(const String &)>)> m_downloader
Definition CoordinateProjectionManager.h:111
Dictionary< UUID, CoordinateProjection > m_projections
Definition CoordinateProjectionManager.h:112
Dictionary< UUID, CoordinateConverter * > m_wgs_84_converter
Definition CoordinateProjectionManager.h:109
const Dictionary< UUID, CoordinateProjection > & projections() const
Definition CoordinateProjectionManager.h:96
Dictionary< String, ConstPointer< Unit > > m_units
Definition CoordinateProjectionManager.h:114
Polyline< 2, fltp08, Vertex< 2, fltp08 > > convertToWGS84(UUID from_id, const Polyline< 2, fltp08, Vertex< 2, fltp08 > > &segment) const
Buffer< UUID > m_utm_projections
Definition CoordinateProjectionManager.h:110
File m_coordinate_file
Definition CoordinateProjectionManager.h:115
A program-defined unit that can be used for some specific task different from a program-wide unit.
Definition UnitManager.h:63
Definition Dictionary.h:48
Definition Pointer.hpp:303
Definition File.h:47
JavaScript Object Notation or JSON is an open - standard file format that uses human - readable text ...
Definition JSONParser.h:121
Definition CoordinateProjectionManager.h:53
static constexpr const char * LatLonUnitName()
Definition CoordinateProjectionManager.h:56
A line segment represented by two vertices, a start and end.
Definition Line.hpp:55
A polyline which stores vertex information for many points along a given path.
Definition CoordinateProjectionManager.h:44
Definition Scanner.h:41
Definition String.h:40
Definition UUID.h:66
Definition UnitManager.h:126
Definition UnitManager.h:12
A vertex.
Definition Vertex.hpp:54
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:120
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:181
Definition BaseValues.hpp:272
Definition CoordinateProjection.h:41