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  // LAS format:
64  // GPSTimeType bool
65  //
66  // RDB format:
67  // Title char
68  // UnitSymbol char
69  // Scale/Resolution double
70  // LowestPossibleValue double
71  // HighestPossibleValue double
72  // DefaultValue double
73  // InvalidValue double
74  // StorageClass unsigned
75  // CompressionOptions unsigned
76  //
77  // Shape format:
78  // Width unsigned
79  // Decimals unsigned
80  virtual bool getProperty(const char* name, bool &value) const = 0;
81  virtual bool getProperty(const char* name, unsigned &value) const = 0;
82  virtual bool getProperty(const char* name, long long &value) const = 0;
83  virtual bool getProperty(const char* name, double &value) const = 0;
84  virtual bool getProperty(const char* name, const char *&value) const = 0;
85 };
86 
88 
89 
90 class DM_API IFileHeader : public ObjectBase
91 {
92 protected:
93  virtual ~IFileHeader() {}
94 
95 public:
96  virtual long long getPointCount() const = 0;
97  virtual long long getLineCount() const = 0;
98  virtual long long getLinePointCount() const = 0;
99  virtual long long getPolygonCount() const = 0;
100  virtual long long getPolygonPointCount() const = 0;
101 
102  /// get the bounding box of the data set
103  virtual BoxHandle getBoundingBox() const = 0;
104 
105  /// The 'epsilon' of coordinates (e.g. coordinates with mm-precision: 0.001)
106  /// Relevant only for ASCII files.
107  virtual void getPrecision( double& precX, double& precY, double& precZ ) const = 0;
108 
109  /// The highest dimensionality of contained geometries (e.g. 0 for points)
110  virtual int getDim() const = 0;
111 
112  /// Get coordinate reference system as WKT string (can be empty)
113  virtual const char* getCRS() const = 0;
114  /// Get coordinate reference system type (enum if stored internally or a separate ".prj" file)
115  virtual CoordRefSys getCRSType() const = 0;
116 
117  /// Get the attribute layout of the data that will be returned by the import object
118  /**
119  The returned layout is merged from the provided layout during import object creation and the actual import attribute layout. For
120  import classes that provide configurable attribute import, the layout can only be access AFTER prepareForReading was called, since
121  there the actual data layout is typcially constructed.
122  */
123  virtual AddInfoLayoutHandle getDataLayout() const = 0;
124 
125  /// if the file format contains attribute information, the number of attribute can be accessed here
126  virtual uint32_t getAttributeCount() const = 0;
127  /// get the attribute object ( 0 <= idx < getAttributeCount() )
128  virtual const IFileAttribute& getAttribute(uint32_t idx) const = 0;
129 
130  //list of supported properties
131  // GDAL format:
132  // GridWidthX double
133  // GridWidthY double
134  // LAS format:
135  // MajorVersion unsigned
136  // MinorVersion unsigned
137  // PointRecordFormat unsigned
138  // RDB format:
139  // Pose double[16]
140 
141  virtual bool getProperty(const char* name, unsigned &value) const = 0;
142  virtual bool getProperty(const char* name, long long &value) const = 0;
143  virtual bool getProperty(const char* name, double &value) const = 0;
144  virtual bool getProperty(const char *name, const char *&value) const = 0;
145  virtual bool getProperty(const char* name, unsigned arrayCount, double *value) const = 0;
146 };
147 
149 
150 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:90
@ 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