IFileHeader.hpp
1 #ifndef DM_IO_FILE_HEADER_HPP_INCLUDED
2 #define DM_IO_FILE_HEADER_HPP_INCLUDED
3 
4 #ifdef _MSC_VER
5  #pragma once
6 #endif
7 
8 #include "DM/config.hpp"
9 #include "DM/AutoLink.hpp" //enable autolink
10 #include "DM/Handle.hpp"
11 #include "DM/ObjectBase.hpp"
12 #include "DM/IBox.hpp"
13 #include "DM/IAddInfoLayout.hpp"
14 
15 DM_NAMESPACE_BEGIN
16 
17 /// coordinate reference system type
18 namespace CoordRefSys {
19  enum Type {
20  none, ///< not definied/unset
21  internallyStored, ///< crs is stored internally
22  separatePrjFile ///< crs is stored in a separate prj file
23  };
24 }
25 
26 class DM_API IFileHeader : public ObjectBase
27 {
28 protected:
29  virtual ~IFileHeader() {}
30 
31 public:
32  virtual long long getPointCount() const = 0;
33  virtual long long getLineCount() const = 0;
34  virtual long long getLinePointCount() const = 0;
35  virtual long long getPolygonCount() const = 0;
36  virtual long long getPolygonPointCount() const = 0;
37 
38  /// get the bounding box of the data set
39  virtual BoxHandle getBoundingBox() const = 0;
40 
41  /// The 'epsilon' of coordinates (e.g. coordinates with mm-precision: 0.001)
42  /// Relevant only for ASCII files.
43  virtual void getPrecision( double& precX, double& precY, double& precZ ) const = 0;
44 
45  /// The highest dimensionality of contained geometries (e.g. 0 for points)
46  virtual int getDim() const = 0;
47 
48  /// Get coordinate reference system as WKT string (can be empty)
49  virtual const char* getCRS() const = 0;
50  /// Get coordinate reference system type (enum if stored internally or a separate ".prj" file)
51  virtual CoordRefSys::Type getCRSType() const = 0;
52 
53  /// Get the attributes (as addinfo layout) that can be retrieved when reading the corresponding file
54  virtual AddInfoLayoutHandle getImportLayout() const = 0;
55 
56  /// Get the attribute layout of the data that will be returned by the import object
57  /**
58  The returned layout is merged from the provided layout during import object creation and the actual import attribute layout. In case
59  no layout was provided during import creation (or the import class doesn't support this feature), the data and import layout are identical.
60  */
61  virtual AddInfoLayoutHandle getDataLayout() const = 0;
62 
63  //list of supported properties
64  // GDAL format:
65  // GridWidthX double
66  // GridWidthY double
67  // LAS format:
68  // MajorVersion unsigned
69  // MinorVersion unsigned
70  // PointRecordFormat unsigned
71 
72  virtual bool getPropetry(const char* name, unsigned &value) const = 0;
73  virtual bool getPropetry(const char* name, long long &value) const = 0;
74  virtual bool getPropetry(const char* name, double &value) const = 0;
75 };
76 
78 
79 DM_NAMESPACE_END
80 
81 
82 #endif //DM_IO_FILE_HEADER_HPP_INCLUDED