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