/src/PROJ/include/proj/internal/io_internal.hpp
Line | Count | Source |
1 | | /****************************************************************************** |
2 | | * |
3 | | * Project: PROJ |
4 | | * Purpose: ISO19111:2019 implementation |
5 | | * Author: Even Rouault <even dot rouault at spatialys dot com> |
6 | | * |
7 | | ****************************************************************************** |
8 | | * Copyright (c) 2018, Even Rouault <even dot rouault at spatialys dot com> |
9 | | * |
10 | | * Permission is hereby granted, free of charge, to any person obtaining a |
11 | | * copy of this software and associated documentation files (the "Software"), |
12 | | * to deal in the Software without restriction, including without limitation |
13 | | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
14 | | * and/or sell copies of the Software, and to permit persons to whom the |
15 | | * Software is furnished to do so, subject to the following conditions: |
16 | | * |
17 | | * The above copyright notice and this permission notice shall be included |
18 | | * in all copies or substantial portions of the Software. |
19 | | * |
20 | | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
21 | | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
22 | | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
23 | | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
24 | | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
25 | | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
26 | | * DEALINGS IN THE SOFTWARE. |
27 | | ****************************************************************************/ |
28 | | |
29 | | #ifndef FROM_PROJ_CPP |
30 | | #error This file should only be included from a PROJ cpp file |
31 | | #endif |
32 | | |
33 | | #ifndef IO_INTERNAL_HH_INCLUDED |
34 | | #define IO_INTERNAL_HH_INCLUDED |
35 | | |
36 | | #include <string> |
37 | | #include <vector> |
38 | | |
39 | | #include "proj/io.hpp" |
40 | | #include "proj/util.hpp" |
41 | | |
42 | | //! @cond Doxygen_Suppress |
43 | | |
44 | | NS_PROJ_START |
45 | | |
46 | | namespace io { |
47 | | |
48 | | // --------------------------------------------------------------------------- |
49 | | |
50 | | class WKTConstants { |
51 | | public: |
52 | | // WKT1 |
53 | | static const std::string GEOCCS; |
54 | | static const std::string GEOGCS; |
55 | | static const std::string DATUM; // WKT2 preferred too |
56 | | static const std::string UNIT; |
57 | | static const std::string SPHEROID; |
58 | | static const std::string AXIS; // WKT2 too |
59 | | static const std::string PRIMEM; // WKT2 too |
60 | | static const std::string AUTHORITY; |
61 | | static const std::string PROJCS; |
62 | | static const std::string PROJECTION; |
63 | | static const std::string PARAMETER; // WKT2 too |
64 | | static const std::string VERT_CS; |
65 | | static const std::string VERTCS; // WKT1 ESRI |
66 | | static const std::string VERT_DATUM; |
67 | | static const std::string COMPD_CS; |
68 | | static const std::string TOWGS84; // WKT1 only |
69 | | static const std::string EXTENSION; // WKT1 only - GDAL specific |
70 | | static const std::string LOCAL_CS; // WKT1 only |
71 | | static const std::string LOCAL_DATUM; // WKT1 only |
72 | | static const std::string LINUNIT; // WKT1 ESRI (ArcGIS Pro >= 2.7) |
73 | | |
74 | | // WKT2 preferred |
75 | | static const std::string GEODCRS; |
76 | | static const std::string LENGTHUNIT; |
77 | | static const std::string ANGLEUNIT; |
78 | | static const std::string SCALEUNIT; |
79 | | static const std::string TIMEUNIT; |
80 | | static const std::string ELLIPSOID; |
81 | | // underscore, since there is a CS macro in Solaris system headers |
82 | | static const std::string CS_; |
83 | | static const std::string ID; |
84 | | static const std::string PROJCRS; |
85 | | static const std::string BASEGEODCRS; |
86 | | static const std::string MERIDIAN; |
87 | | static const std::string ORDER; |
88 | | static const std::string ANCHOR; |
89 | | static const std::string ANCHOREPOCH; // WKT2-2019 |
90 | | static const std::string CONVERSION; |
91 | | static const std::string METHOD; |
92 | | static const std::string REMARK; |
93 | | static const std::string GEOGCRS; // WKT2-2019 |
94 | | static const std::string BASEGEOGCRS; // WKT2-2019 |
95 | | static const std::string SCOPE; |
96 | | static const std::string AREA; |
97 | | static const std::string BBOX; |
98 | | static const std::string CITATION; |
99 | | static const std::string URI; |
100 | | static const std::string VERTCRS; |
101 | | static const std::string VDATUM; // WKT2 and WKT1 ESRI |
102 | | static const std::string COMPOUNDCRS; |
103 | | static const std::string PARAMETERFILE; |
104 | | static const std::string COORDINATEOPERATION; |
105 | | static const std::string SOURCECRS; |
106 | | static const std::string TARGETCRS; |
107 | | static const std::string INTERPOLATIONCRS; |
108 | | static const std::string OPERATIONACCURACY; |
109 | | static const std::string CONCATENATEDOPERATION; // WKT2-2019 |
110 | | static const std::string STEP; // WKT2-2019 |
111 | | static const std::string BOUNDCRS; |
112 | | static const std::string ABRIDGEDTRANSFORMATION; |
113 | | static const std::string DERIVINGCONVERSION; |
114 | | static const std::string TDATUM; |
115 | | static const std::string CALENDAR; // WKT2-2019 |
116 | | static const std::string TIMEORIGIN; |
117 | | static const std::string TIMECRS; |
118 | | static const std::string VERTICALEXTENT; |
119 | | static const std::string TIMEEXTENT; |
120 | | static const std::string USAGE; // WKT2-2019 |
121 | | static const std::string DYNAMIC; // WKT2-2019 |
122 | | static const std::string FRAMEEPOCH; // WKT2-2019 |
123 | | static const std::string MODEL; // WKT2-2019 |
124 | | static const std::string VELOCITYGRID; // WKT2-2019 |
125 | | static const std::string ENSEMBLE; // WKT2-2019 |
126 | | static const std::string MEMBER; // WKT2-2019 |
127 | | static const std::string ENSEMBLEACCURACY; // WKT2-2019 |
128 | | static const std::string DERIVEDPROJCRS; // WKT2-2019 |
129 | | static const std::string BASEPROJCRS; // WKT2-2019 |
130 | | static const std::string EDATUM; |
131 | | static const std::string ENGCRS; |
132 | | static const std::string PDATUM; |
133 | | static const std::string PARAMETRICCRS; |
134 | | static const std::string PARAMETRICUNIT; |
135 | | static const std::string BASEVERTCRS; |
136 | | static const std::string BASEENGCRS; |
137 | | static const std::string BASEPARAMCRS; |
138 | | static const std::string BASETIMECRS; |
139 | | static const std::string VERSION; |
140 | | static const std::string GEOIDMODEL; // WKT2-2019 |
141 | | static const std::string COORDINATEMETADATA; // WKT2-2019 |
142 | | static const std::string EPOCH; // WKT2-2019 |
143 | | static const std::string AXISMINVALUE; // WKT2-2019 |
144 | | static const std::string AXISMAXVALUE; // WKT2-2019 |
145 | | static const std::string RANGEMEANING; // WKT2-2019 |
146 | | static const std::string POINTMOTIONOPERATION; // WKT2-2019 |
147 | | |
148 | | // WKT2 alternate (longer or shorter) |
149 | | static const std::string GEODETICCRS; |
150 | | static const std::string GEODETICDATUM; |
151 | | static const std::string PROJECTEDCRS; |
152 | | static const std::string PRIMEMERIDIAN; |
153 | | static const std::string GEOGRAPHICCRS; // WKT2-2019 |
154 | | static const std::string TRF; // WKT2-2019 |
155 | | static const std::string VERTICALCRS; |
156 | | static const std::string VERTICALDATUM; |
157 | | static const std::string VRF; // WKT2-2019 |
158 | | static const std::string TIMEDATUM; |
159 | | static const std::string TEMPORALQUANTITY; |
160 | | static const std::string ENGINEERINGDATUM; |
161 | | static const std::string ENGINEERINGCRS; |
162 | | static const std::string PARAMETRICDATUM; |
163 | | |
164 | 31.6k | static const std::vector<std::string> &constants() { return constants_; } |
165 | | |
166 | | private: |
167 | | static std::vector<std::string> constants_; |
168 | | static const char *createAndAddToConstantList(const char *text); |
169 | | }; |
170 | | |
171 | | } // namespace io |
172 | | |
173 | | NS_PROJ_END |
174 | | |
175 | | // --------------------------------------------------------------------------- |
176 | | |
177 | | /** Auxiliary structure to PJ_CONTEXT storing C++ context stuff. */ |
178 | | struct PROJ_GCC_DLL projCppContext { |
179 | | private: |
180 | | NS_PROJ::io::DatabaseContextPtr databaseContext_{}; |
181 | | PJ_CONTEXT *ctx_ = nullptr; |
182 | | std::string dbPath_{}; |
183 | | std::vector<std::string> auxDbPaths_{}; |
184 | | |
185 | | projCppContext(const projCppContext &) = delete; |
186 | | projCppContext &operator=(const projCppContext &) = delete; |
187 | | |
188 | | public: |
189 | | std::string lastDbPath_{}; |
190 | | std::string lastDbMetadataItem_{}; |
191 | | std::string lastUOMName_{}; |
192 | | std::string lastGridFullName_{}; |
193 | | std::string lastGridPackageName_{}; |
194 | | std::string lastGridUrl_{}; |
195 | | |
196 | | static std::vector<std::string> toVector(const char *const *auxDbPaths); |
197 | | |
198 | | explicit projCppContext(PJ_CONTEXT *ctx, const char *dbPath = nullptr, |
199 | | const std::vector<std::string> &auxDbPaths = {}); |
200 | | |
201 | | projCppContext *clone(PJ_CONTEXT *ctx) const; |
202 | | |
203 | | // cppcheck-suppress functionStatic |
204 | 53.1k | inline const std::string &getDbPath() const { return dbPath_; } |
205 | | |
206 | | // cppcheck-suppress functionStatic |
207 | 53.1k | inline const std::vector<std::string> &getAuxDbPaths() const { |
208 | 53.1k | return auxDbPaths_; |
209 | 53.1k | } |
210 | | |
211 | | NS_PROJ::io::DatabaseContextNNPtr PROJ_FOR_TEST getDatabaseContext(); |
212 | | |
213 | 16.2k | void closeDb() { databaseContext_ = nullptr; } |
214 | | }; |
215 | | |
216 | | //! @endcond |
217 | | |
218 | | #endif // IO_INTERNAL_HH_INCLUDED |