ICRS.hpp
1 #pragma once
2 
3 #include "DM/config.hpp"
4 #include "DM/Handle.hpp"
5 #include "DM/Log.hpp"
6 
7 DM_NAMESPACE_BEGIN
8 
9 enum struct CRSCompareMode
10 {
11  strict = 0,
12  ignoreAxisOrder = 1,
13  ignoreVerticalCRS = 2,
14  maxTolerance = 3
15 };
16 
17 constexpr CRSCompareMode operator| (const CRSCompareMode &left, const CRSCompareMode &right)
18 {
19  return static_cast<CRSCompareMode>(static_cast<int>(left) | static_cast<int>(right));
20 }
21 
22 
23 /// Interface for coordinate reference system
24 class DM_API ICRS : public ObjectBase
25 {
26 public:
27  static void set_default_unification(bool flag); // activated or deactivated automatic unification for all wkt strings
28  static void set_default_compare_mode(CRSCompareMode mode); // set default comparision mode
29  static void set_default_accept_invalid_wkts(bool accept); // set default flag for accepting invalid wkts
30 
31  // create functions will not throw exception but rather return an no object in case of error
32  static ICRS* New(LogFn logFn = 0) noexcept; //create empty
33  static ICRS* NewFromWKT(const char* wktStr, LogFn logFn = 0) noexcept; //create object from wkt string
34  static ICRS* NewFromWKT(const char* wktStr, bool acceptInvalidWkt, bool unify, LogFn logFn = 0) noexcept; //create object from wkt string and unify
35  static ICRS* NewFromEPSG(int epsg, LogFn logFn = 0) noexcept; //create object from epsg code
36  static ICRS* NewFromEPSG(const char* epsgCode, LogFn logFn = 0) noexcept; //create object from epsg code (as string)
37 
38 
39 protected:
40  virtual ~ICRS() {}
41 
42 public:
43  virtual bool empty() const = 0;
44  virtual bool valid() const = 0;
45 
46  virtual bool leftHanded() const = 0;
47 
48  virtual int getEPSGCode() const = 0;
49  virtual const char* wkt() const = 0;
50 
51  virtual const char* sourceWKT() const = 0;
52  virtual const char* exportWKT() const = 0;
53 
54  virtual bool unify() = 0;
55 
56  virtual bool equal(const ICRS &other) const = 0;
57  virtual bool equal(const ICRS &other, CRSCompareMode mod) const = 0;
58 
59  virtual ICRS* stripVerticalComponent() const = 0;
60 
61  virtual void test_code(int) const = 0;
62 };
63 
65 
66 DM_NAMESPACE_END
bool equal(const IAddInfoLayout &l1, const IAddInfoLayout &l2)
check if the 'viewed' content of two layouts is the same
Interface for coordinate reference system.
Definition: ICRS.hpp:24
Smart pointer class using reference counting with support for DM objects (see ObjectBase)
Definition: Handle.hpp:75
Definition: M/c++_api/inc/DM/ObjectBase.hpp:8