IFileHeader.hpp
1 #pragma once
2 
3 #include "DM/config.hpp"
4 #include "DM/AutoLink.hpp" //enable autolink
5 #include "DM/Handle.hpp"
6 #include "DM/ObjectBase.hpp"
7 #include "DM/IBox.hpp"
8 #include "DM/IAddInfoLayout.hpp"
9 
10 #include <memory>
11 
12 DM_NAMESPACE_BEGIN
13 
14 /// coordinate reference system type
15 enum struct CoordRefSys
16 {
17  none, ///< not definied/unset
18  internallyStored, ///< crs is stored internally
19  separatePrjFile ///< crs is stored in a separate prj file
20 };
21 
22 enum struct RDBCoordSystem
23 {
24  proj, ///< application/project coordinate system (cartesian coordinates) -> default
25  ecef, ///< earth-centered earth-fixed coordinate system (cartesian coordinates)
26  scs, ///< sensor coordinate system
27  map, ///< map coordinate system (not necessarily available)
28  default_ = proj
29 };
30 
31 /// interface for describung attributs of geometry objects
32 class DM_API IFileAttribute : public ObjectBase
33 {
34 protected:
35  virtual ~IFileAttribute() {}
36 
37 public:
38  virtual const char* getName() const = 0;
39  virtual const char* getDescription() const = 0;
40  virtual uint32_t getElementCount() const = 0; ///< number of elements (typically 1)
41  virtual ColumnType getType() const = 0;
42 
43  virtual double getScale() const = 0;
44  virtual double getOffset() const = 0;
45 
46  virtual bool hasInvalidValue() const = 0;
47  virtual double getInvalidValue() const = 0;
48 
49  /// get the index of attribute within the data layout
50  /**
51  For import classes that provide configurable attribute import, the layout index can only be access AFTER prepareForReading was called,
52  since the actual data layout and the corresponding indices are typcially constructed/collected there.
53  */
54  virtual int32_t getDataLayoutIndex() const = 0;
55 
56  //list of supported properties
57  // ODM/LAS format:
58  // HasMinimumValue bool
59  // MinimumValue double
60  // HasMaximumValue bool
61  // MaximumValue double
62  //
63  // RDB format:
64  // Title char
65  // UnitSymbol char
66  // Scale/Resolution double
67  // LowestPossibleValue double
68  // HighestPossibleValue double
69  // DefaultValue double
70  // InvalidValue double
71  // StorageClass unsigned
72  // CompressionOptions unsigned
73  //
74  // Shape format:
75  // Width unsigned
76  // Decimals unsigned
77  virtual bool getProperty(const char* name, bool &value) const = 0;
78  virtual bool getProperty(const char* name, unsigned &value) const = 0;
79  virtual bool getProperty(const char* name, long long &value) const = 0;
80  virtual bool getProperty(const char* name, double &value) const = 0;
81  virtual bool getProperty(const char* name, const char *&value) const = 0;
82 
83  virtual uint32_t getPropertyCount() const = 0;
84  virtual const char* getPropertyName(uint32_t idx) const = 0;
85  virtual ColumnType getPropertyType(uint32_t idx) const = 0;
86  virtual ColumnType getPropertyType(const char* name) const = 0;
87 };
88 
90 
91 
92 class DM_API IFileHeader : public ObjectBase
93 {
94 protected:
95  virtual ~IFileHeader() {}
96 
97 public:
98  virtual long long getPointCount() const = 0;
99  virtual long long getLineCount() const = 0;
100  virtual long long getLinePointCount() const = 0;
101  virtual long long getPolygonCount() const = 0;
102  virtual long long getPolygonPointCount() const = 0;
103 
104  /// get the bounding box of the data set
105  virtual BoxHandle getBoundingBox() const = 0;
106 
107  /// The 'epsilon' of coordinates (e.g. coordinates with mm-precision: 0.001)
108  /// Relevant only for ASCII files.
109  virtual void getPrecision( double& precX, double& precY, double& precZ ) const = 0;
110 
111  /// The highest dimensionality of contained geometries (e.g. 0 for points)
112  virtual int getDim() const = 0;
113 
114  /// Get coordinate reference system as WKT string (can be empty)
115  virtual const char* getCRS() const = 0;
116  /// Get coordinate reference system type (enum if stored internally or a separate ".prj" file)
117  virtual CoordRefSys getCRSType() const = 0;
118 
119  /// Get the attribute layout of the data that will be returned by the import object
120  /**
121  The returned layout is merged from the provided layout during import object creation and the actual import attribute layout. For
122  import classes that provide configurable attribute import, the layout can only be access AFTER prepareForReading was called, since
123  there the actual data layout is typcially constructed.
124  */
125  virtual AddInfoLayoutHandle getDataLayout() const = 0;
126 
127  /// if the file format contains attribute information, the number of attribute can be accessed here
128  virtual uint32_t getAttributeCount() const = 0;
129  /// get the attribute object ( 0 <= idx < getAttributeCount() )
130  virtual const IFileAttribute& getAttribute(uint32_t idx) const = 0;
131 
132  virtual uint32_t getAttributePropertyCount() const = 0;
133  virtual const char* getAttributePropertyName(uint32_t idx) const = 0;
134  virtual ColumnType getAttributePropertyType(uint32_t idx) const = 0;
135  virtual ColumnType getAttributePropertyType(const char* name) const = 0;
136 
137 
138  //list of supported properties
139  // GDAL format:
140  // GridWidthX double
141  // GridWidthY double
142  // GridSizeX double
143  // GridSizeY double
144  //
145  // LAS format:
146  // MajorVersion unsigned
147  // MinorVersion unsigned
148  // PointRecordFormat unsigned
149  // GPSTimeAdjusted bool
150  // GPSTimeOffset double
151  //
152  // RDB format:
153  // Pose double[16]
154 
155  virtual bool getProperty(const char* name, unsigned &value) const = 0;
156  virtual bool getProperty(const char* name, long long &value) const = 0;
157  virtual bool getProperty(const char* name, double &value) const = 0;
158  virtual bool getProperty(const char* name, bool& value) const = 0;
159  virtual bool getProperty(const char *name, const char *&value) const = 0;
160  virtual bool getProperty(const char* name, unsigned &arrayCount, const double*& value) const = 0;
161 
162  virtual uint32_t getPropertyCount() const = 0;
163  virtual const char* getPropertyName(uint32_t idx) const = 0;
164  virtual ColumnType getPropertyType(uint32_t idx) const = 0;
165  virtual ColumnType getPropertyType(const char* name) const = 0;
166 };
167 
169 
170 DM_NAMESPACE_END
@ scs
sensor coordinate system
@ ecef
earth-centered earth-fixed coordinate system (cartesian coordinates)
interface for describung attributs of geometry objects
Definition: IFileHeader.hpp:32
Definition: Handle.hpp:427
ColumnType
Supported attribute type.
Definition: ColumnTypes.hpp:8
RDBCoordSystem
Definition: IFileHeader.hpp:22
Definition: IFileHeader.hpp:92
@ internallyStored
crs is stored internally
@ proj
application/project coordinate system (cartesian coordinates) -> default
Smart pointer class using reference counting with support for DM objects (see ObjectBase)
Definition: Handle.hpp:75
@ separatePrjFile
crs is stored in a separate prj file
Definition: M/c++_api/inc/DM/ObjectBase.hpp:8
@ map
map coordinate system (not necessarily available)
const DM_API char * getName(DataFormat type)
Convert DataFormat as textual representation.
CoordRefSys
coordinate reference system type
Definition: IFileHeader.hpp:15