DataFormat.hpp
1 #ifndef DM_IO_DATA_FORMAT_HPP_INCLUDED
2 #define DM_IO_DATA_FORMAT_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 
11 DM_NAMESPACE_BEGIN
12 
13 namespace DataFormat {
14 
15  //list of known data formats
16  enum Type {
17  null = 0,
18 
19  hpgl,
20  zwifi,
21  zwifiak,
22  dxf,
23  alk,
24  sicad,
25  phodat,
26  hlb,
27 
28  wnp, ///< scop winput format (ascii)
29  bwnp, ///< scop winput format (binary)
30  aig,
31  xyz,
32  bxyz,
33  xyzslp,
34  ktb,
35  nwp,
36  blt,
37  spo,
38  vestra,
39  ort,
40 
41  rdh,
42  dsm,
43  agr,
44  dted,
45  dted0,
46  dted1,
47  dted2,
48  vrml,
49  dgmb,
50  mlt,
51  raw,
52  vic,
53  osg,
54  dem,
55  sdts,
56  srtm,
57  ehdr,
58  envi,
59  ers,
60  gsag,
61  gsbg,
62  eimg,
63  ingr,
64  pds,
65  hdf4,
66  hdf5,
67  gdal, ///< GDAL raster file format
68 
69  pyr,
70  jpg,
71  pix,
72  tif,
73  tiledtif,
74  lzwtif,
75  tiledlzwtif,
76 
77  stp,
78  cmf,
79  cmd,
80 
81  xml,
82  csv, ///< comma separated value format
83  atf,
84  las,
85  fwf,
86  sdw,
87  sdc,
88 
89  stl,
90  citygrid,
91  shp,
92  reb,
93  msh,
94  _2dm,
95  ucd,
96  odm,
97  ofd, ///< OPALS format definition (xml file)
98  trj, ///< trajectory fromat (ascii)
99  btrj, ///< trajectory fromat (binary)
100  pof, ///< Riegl binary Trajectory Format
101 
102  gptin, ///< generic panorama tin
103 
104  count // must always be the last enumerator in the list !!
105  };
106 
107  /// \brief tries to recognise the file format by its content
108  DM_API Type recognise(const char *filename);
109  DM_API Type recognise(const char *filename, int &ascii);
110 
111  /// \brief convert an extension to a file formtat
112  /// \param[in] extension file extension (e.g. ".tif")
113  /// \param[in] carray pointer to the first element of a c-array of dataformat elements
114  /// \param[in] cout number of elements
115  DM_API Type ext2Format(const char* extension, Type *carray, size_t count);
116 
117  /// Convert DataFormat as textial representation
118  class DM_API getName {
119  struct Impl;
120  public:
121  getName(Type type);
122  getName(const getName &ref);
123  ~getName();
124 
125  operator const char *() const;
126  protected:
127  Impl* pimpl_;
128  Type type_;
129  };
130 
131  /// Get the default extension of the DataFormat (z.b. '.las', '.odm', etc.)
132  class DM_API getDefaultExtension {
133  struct Impl;
134  public:
135  getDefaultExtension(Type type);
138 
139  operator const char *() const;
140  protected:
141  Impl* pimpl_;
142  Type type_;
143  };
144 
145 }
146 
147 namespace Endianness
148 {
149  enum Type { big, little, native };
150 }
151 
152 
153 DM_NAMESPACE_END
154 
155 #endif //DM_IO_IMPORT_BASE_HPP_INCLUDED