1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
|
/******************************************************************************
*
* Project: PROJ
* Purpose: ISO19111:2019 implementation
* Author: Even Rouault <even dot rouault at spatialys dot com>
*
******************************************************************************
* Copyright (c) 2018, Even Rouault <even dot rouault at spatialys dot com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
****************************************************************************/
#ifndef METADATA_HH_INCLUDED
#define METADATA_HH_INCLUDED
#include <memory>
#include <string>
#include <vector>
#include "io.hpp"
#include "util.hpp"
NS_PROJ_START
namespace common {
class UnitOfMeasure;
using UnitOfMeasurePtr = std::shared_ptr<UnitOfMeasure>;
using UnitOfMeasureNNPtr = util::nn<UnitOfMeasurePtr>;
class IdentifiedObject;
} // namespace common
/** osgeo.proj.metadata namespace
*
* \brief Common classes from \ref ISO_19115 standard
*/
namespace metadata {
// ---------------------------------------------------------------------------
/** \brief Standardized resource reference.
*
* Local names are names which are directly accessible to and maintained by a
* NameSpace within which they are local, indicated by the scope.
*
* \remark Simplified version of [Citation]
* (http://www.geoapi.org/3.0/javadoc/org/opengis/metadata/citation/Citation.html)
* from \ref GeoAPI
*/
class PROJ_GCC_DLL Citation : public util::BaseObject {
public:
PROJ_DLL explicit Citation(const std::string &titleIn);
//! @cond Doxygen_Suppress
PROJ_DLL Citation();
PROJ_DLL Citation(const Citation &other);
PROJ_DLL ~Citation();
//! @endcond
PROJ_DLL const util::optional<std::string> &title() PROJ_PURE_DECL;
protected:
PROJ_FRIEND_OPTIONAL(Citation);
PROJ_INTERNAL Citation &operator=(const Citation &other);
private:
PROJ_OPAQUE_PRIVATE_DATA
};
// ---------------------------------------------------------------------------
class GeographicExtent;
/** Shared pointer of GeographicExtent. */
using GeographicExtentPtr = std::shared_ptr<GeographicExtent>;
/** Non-null shared pointer of GeographicExtent. */
using GeographicExtentNNPtr = util::nn<GeographicExtentPtr>;
/** \brief Base interface for geographic area of the dataset.
*
* \remark Simplified version of [GeographicExtent]
* (http://www.geoapi.org/3.0/javadoc/org/opengis/metadata/extent/GeographicExtent.html)
* from \ref GeoAPI
*/
class PROJ_GCC_DLL GeographicExtent : public util::BaseObject,
public util::IComparable {
public:
//! @cond Doxygen_Suppress
PROJ_DLL ~GeographicExtent() override;
//! @endcond
// GeoAPI has a getInclusion() method. We assume that it is included for our
// use
//! @cond Doxygen_Suppress
PROJ_INTERNAL bool _isEquivalentTo(
const util::IComparable *other,
util::IComparable::Criterion criterion =
util::IComparable::Criterion::STRICT) const override = 0;
//! @endcond
/** \brief Returns whether this extent contains the other one. */
PROJ_DLL virtual bool
contains(const GeographicExtentNNPtr &other) const = 0;
/** \brief Returns whether this extent intersects the other one. */
PROJ_DLL virtual bool
intersects(const GeographicExtentNNPtr &other) const = 0;
/** \brief Returns the intersection of this extent with another one. */
PROJ_DLL virtual GeographicExtentPtr
intersection(const GeographicExtentNNPtr &other) const = 0;
protected:
PROJ_INTERNAL GeographicExtent();
private:
PROJ_OPAQUE_PRIVATE_DATA
};
// ---------------------------------------------------------------------------
class GeographicBoundingBox;
/** Shared pointer of GeographicBoundingBox. */
using GeographicBoundingBoxPtr = std::shared_ptr<GeographicBoundingBox>;
/** Non-null shared pointer of GeographicBoundingBox. */
using GeographicBoundingBoxNNPtr = util::nn<GeographicBoundingBoxPtr>;
/** \brief Geographic position of the dataset.
*
* This is only an approximate so specifying the co-ordinate reference system is
* unnecessary.
*
* \remark Implements [GeographicBoundingBox]
* (http://www.geoapi.org/3.0/javadoc/org/opengis/metadata/extent/GeographicBoundingBox.html)
* from \ref GeoAPI
*/
class PROJ_GCC_DLL GeographicBoundingBox : public GeographicExtent {
public:
//! @cond Doxygen_Suppress
PROJ_DLL ~GeographicBoundingBox() override;
//! @endcond
PROJ_DLL double westBoundLongitude() PROJ_PURE_DECL;
PROJ_DLL double southBoundLatitude() PROJ_PURE_DECL;
PROJ_DLL double eastBoundLongitude() PROJ_PURE_DECL;
PROJ_DLL double northBoundLatitude() PROJ_PURE_DECL;
PROJ_DLL static GeographicBoundingBoxNNPtr
create(double west, double south, double east, double north);
//! @cond Doxygen_Suppress
PROJ_INTERNAL bool
_isEquivalentTo(const util::IComparable *other,
util::IComparable::Criterion criterion =
util::IComparable::Criterion::STRICT) const override;
//! @endcond
PROJ_INTERNAL bool
contains(const GeographicExtentNNPtr &other) const override;
PROJ_INTERNAL bool
intersects(const GeographicExtentNNPtr &other) const override;
PROJ_INTERNAL GeographicExtentPtr
intersection(const GeographicExtentNNPtr &other) const override;
protected:
PROJ_INTERNAL GeographicBoundingBox(double west, double south, double east,
double north);
INLINED_MAKE_SHARED
private:
PROJ_OPAQUE_PRIVATE_DATA
};
// ---------------------------------------------------------------------------
class TemporalExtent;
/** Shared pointer of TemporalExtent. */
using TemporalExtentPtr = std::shared_ptr<TemporalExtent>;
/** Non-null shared pointer of TemporalExtent. */
using TemporalExtentNNPtr = util::nn<TemporalExtentPtr>;
/** \brief Time period covered by the content of the dataset.
*
* \remark Simplified version of [TemporalExtent]
* (http://www.geoapi.org/3.0/javadoc/org/opengis/metadata/extent/TemporalExtent.html)
* from \ref GeoAPI
*/
class PROJ_GCC_DLL TemporalExtent : public util::BaseObject,
public util::IComparable {
public:
//! @cond Doxygen_Suppress
PROJ_DLL ~TemporalExtent() override;
//! @endcond
PROJ_DLL const std::string &start() PROJ_PURE_DECL;
PROJ_DLL const std::string &stop() PROJ_PURE_DECL;
PROJ_DLL static TemporalExtentNNPtr create(const std::string &start,
const std::string &stop);
//! @cond Doxygen_Suppress
PROJ_INTERNAL bool
_isEquivalentTo(const util::IComparable *other,
util::IComparable::Criterion criterion =
util::IComparable::Criterion::STRICT) const override;
//! @endcond
PROJ_DLL bool contains(const TemporalExtentNNPtr &other) const;
PROJ_DLL bool intersects(const TemporalExtentNNPtr &other) const;
protected:
PROJ_INTERNAL TemporalExtent(const std::string &start,
const std::string &stop);
INLINED_MAKE_SHARED
private:
PROJ_OPAQUE_PRIVATE_DATA
};
// ---------------------------------------------------------------------------
class VerticalExtent;
/** Shared pointer of VerticalExtent. */
using VerticalExtentPtr = std::shared_ptr<VerticalExtent>;
/** Non-null shared pointer of VerticalExtent. */
using VerticalExtentNNPtr = util::nn<VerticalExtentPtr>;
/** \brief Vertical domain of dataset.
*
* \remark Simplified version of [VerticalExtent]
* (http://www.geoapi.org/3.0/javadoc/org/opengis/metadata/extent/VerticalExtent.html)
* from \ref GeoAPI
*/
class PROJ_GCC_DLL VerticalExtent : public util::BaseObject,
public util::IComparable {
public:
//! @cond Doxygen_Suppress
PROJ_DLL ~VerticalExtent() override;
//! @endcond
PROJ_DLL double minimumValue() PROJ_PURE_DECL;
PROJ_DLL double maximumValue() PROJ_PURE_DECL;
PROJ_DLL common::UnitOfMeasureNNPtr &unit() PROJ_PURE_DECL;
PROJ_DLL static VerticalExtentNNPtr
create(double minimumValue, double maximumValue,
const common::UnitOfMeasureNNPtr &unitIn);
//! @cond Doxygen_Suppress
PROJ_INTERNAL bool
_isEquivalentTo(const util::IComparable *other,
util::IComparable::Criterion criterion =
util::IComparable::Criterion::STRICT) const override;
//! @endcond
PROJ_DLL bool contains(const VerticalExtentNNPtr &other) const;
PROJ_DLL bool intersects(const VerticalExtentNNPtr &other) const;
protected:
PROJ_INTERNAL VerticalExtent(double minimumValue, double maximumValue,
const common::UnitOfMeasureNNPtr &unitIn);
INLINED_MAKE_SHARED
private:
PROJ_OPAQUE_PRIVATE_DATA
};
// ---------------------------------------------------------------------------
class Extent;
/** Shared pointer of Extent. */
using ExtentPtr = std::shared_ptr<Extent>;
/** Non-null shared pointer of Extent. */
using ExtentNNPtr = util::nn<ExtentPtr>;
/** \brief Information about spatial, vertical, and temporal extent.
*
* \remark Simplified version of [Extent]
* (http://www.geoapi.org/3.0/javadoc/org/opengis/metadata/extent/Extent.html)
* from \ref GeoAPI
*/
class PROJ_GCC_DLL Extent : public util::BaseObject, public util::IComparable {
public:
//! @cond Doxygen_Suppress
PROJ_DLL Extent(const Extent &other);
PROJ_DLL ~Extent() override;
//! @endcond
PROJ_DLL const util::optional<std::string> &description() PROJ_PURE_DECL;
PROJ_DLL const std::vector<GeographicExtentNNPtr> &
geographicElements() PROJ_PURE_DECL;
PROJ_DLL const std::vector<TemporalExtentNNPtr> &
temporalElements() PROJ_PURE_DECL;
PROJ_DLL const std::vector<VerticalExtentNNPtr> &
verticalElements() PROJ_PURE_DECL;
PROJ_DLL static ExtentNNPtr
create(const util::optional<std::string> &descriptionIn,
const std::vector<GeographicExtentNNPtr> &geographicElementsIn,
const std::vector<VerticalExtentNNPtr> &verticalElementsIn,
const std::vector<TemporalExtentNNPtr> &temporalElementsIn);
PROJ_DLL static ExtentNNPtr
createFromBBOX(double west, double south, double east, double north,
const util::optional<std::string> &descriptionIn =
util::optional<std::string>());
//! @cond Doxygen_Suppress
PROJ_INTERNAL bool
_isEquivalentTo(const util::IComparable *other,
util::IComparable::Criterion criterion =
util::IComparable::Criterion::STRICT) const override;
//! @endcond
PROJ_DLL bool contains(const ExtentNNPtr &other) const;
PROJ_DLL bool intersects(const ExtentNNPtr &other) const;
PROJ_DLL ExtentPtr intersection(const ExtentNNPtr &other) const;
PROJ_DLL static const ExtentNNPtr WORLD;
protected:
PROJ_INTERNAL Extent();
INLINED_MAKE_SHARED
private:
PROJ_OPAQUE_PRIVATE_DATA
Extent &operator=(const Extent &other) = delete;
};
// ---------------------------------------------------------------------------
class Identifier;
/** Shared pointer of Identifier. */
using IdentifierPtr = std::shared_ptr<Identifier>;
/** Non-null shared pointer of Identifier. */
using IdentifierNNPtr = util::nn<IdentifierPtr>;
/** \brief Value uniquely identifying an object within a namespace.
*
* \remark Implements Identifier as described in \ref ISO_19111_2019 but which
* originates from \ref ISO_19115
*/
class PROJ_GCC_DLL Identifier : public util::BaseObject,
public io::IWKTExportable,
public io::IJSONExportable {
public:
//! @cond Doxygen_Suppress
PROJ_DLL Identifier(const Identifier &other);
PROJ_DLL ~Identifier() override;
//! @endcond
PROJ_DLL static IdentifierNNPtr
create(const std::string &codeIn = std::string(),
const util::PropertyMap &properties =
util::PropertyMap()); // throw(InvalidValueTypeException)
PROJ_DLL static const std::string AUTHORITY_KEY;
PROJ_DLL static const std::string CODE_KEY;
PROJ_DLL static const std::string CODESPACE_KEY;
PROJ_DLL static const std::string VERSION_KEY;
PROJ_DLL static const std::string DESCRIPTION_KEY;
PROJ_DLL static const std::string URI_KEY;
PROJ_DLL static const std::string EPSG;
PROJ_DLL static const std::string OGC;
PROJ_DLL const util::optional<Citation> &authority() PROJ_PURE_DECL;
PROJ_DLL const std::string &code() PROJ_PURE_DECL;
PROJ_DLL const util::optional<std::string> &codeSpace() PROJ_PURE_DECL;
PROJ_DLL const util::optional<std::string> &version() PROJ_PURE_DECL;
PROJ_DLL const util::optional<std::string> &description() PROJ_PURE_DECL;
PROJ_DLL const util::optional<std::string> &uri() PROJ_PURE_DECL;
PROJ_DLL static bool isEquivalentName(const char *a,
const char *b) noexcept;
PROJ_PRIVATE :
//! @cond Doxygen_Suppress
PROJ_INTERNAL static std::string
canonicalizeName(const std::string &str);
PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter)
const override; // throw(io::FormattingException)
PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter)
const override; // throw(io::FormattingException)
//! @endcond
protected:
PROJ_INTERNAL explicit Identifier(const std::string &codeIn,
const util::PropertyMap &properties);
PROJ_INTERNAL explicit Identifier();
PROJ_FRIEND_OPTIONAL(Identifier);
INLINED_MAKE_SHARED
Identifier &operator=(const Identifier &other) = delete;
PROJ_FRIEND(common::IdentifiedObject);
PROJ_INTERNAL static IdentifierNNPtr
createFromDescription(const std::string &descriptionIn);
private:
PROJ_OPAQUE_PRIVATE_DATA
};
// ---------------------------------------------------------------------------
class PositionalAccuracy;
/** Shared pointer of PositionalAccuracy. */
using PositionalAccuracyPtr = std::shared_ptr<PositionalAccuracy>;
/** Non-null shared pointer of PositionalAccuracy. */
using PositionalAccuracyNNPtr = util::nn<PositionalAccuracyPtr>;
/** \brief Accuracy of the position of features.
*
* \remark Simplified version of [PositionalAccuracy]
* (http://www.geoapi.org/3.0/javadoc/org/opengis/metadata/quality/PositionalAccuracy.html)
* from \ref GeoAPI, which originates from \ref ISO_19115
*/
class PROJ_GCC_DLL PositionalAccuracy : public util::BaseObject {
public:
//! @cond Doxygen_Suppress
PROJ_DLL ~PositionalAccuracy() override;
//! @endcond
PROJ_DLL const std::string &value() PROJ_PURE_DECL;
PROJ_DLL static PositionalAccuracyNNPtr create(const std::string &valueIn);
protected:
PROJ_INTERNAL explicit PositionalAccuracy(const std::string &valueIn);
INLINED_MAKE_SHARED
private:
PROJ_OPAQUE_PRIVATE_DATA
PositionalAccuracy(const PositionalAccuracy &other) = delete;
PositionalAccuracy &operator=(const PositionalAccuracy &other) = delete;
};
} // namespace metadata
NS_PROJ_END
#endif // METADATA_HH_INCLUDED
|