liblas.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 #ifndef LIBLAS_HPP_INCLUDED
00046 #define LIBLAS_HPP_INCLUDED
00047
00048
00049 #include <liblas/detail/fwd.hpp>
00050
00051 #include <boost/array.hpp>
00052 #include <boost/concept_check.hpp>
00053 #include <boost/cstdint.hpp>
00054 #include <boost/shared_ptr.hpp>
00055
00056 #include <fstream>
00057 #include <string>
00058
00059 typedef boost::shared_ptr< liblas::Header > HeaderPtr;
00060 typedef boost::shared_ptr< liblas::Point > PointPtr;
00061 typedef boost::shared_ptr< liblas::TransformI > TransformPtr;
00062
00070 namespace liblas
00071 {
00072
00081 inline bool Open(std::ifstream& ifs, std::string const& filename)
00082 {
00083 ifs.open(filename.c_str(), std::ios::in | std::ios::binary);
00084 return ifs.is_open();
00085 }
00086
00095 inline bool Create(std::ofstream& ofs, std::string const& filename)
00096 {
00097 ofs.open(filename.c_str(), std::ios::out | std::ios::binary);
00098 return ofs.is_open();
00099 }
00100
00102 inline bool IsGDALEnabled()
00103 {
00104 #ifdef HAVE_GDAL
00105 return true;
00106 #else
00107 return false;
00108 #endif
00109 }
00110
00112 inline bool IsLibGeoTIFFEnabled()
00113 {
00114 #ifdef HAVE_LIBGEOTIFF
00115 return true;
00116 #else
00117 return false;
00118 #endif
00119 }
00120
00122 inline bool IsLibSpatialIndexEnabled()
00123 {
00124 #ifdef HAVE_SPATIALINDEX
00125 return true;
00126 #else
00127 return false;
00128 #endif
00129 }
00130
00132 enum FormatVersion
00133 {
00134 eVersionMajorMin = 1,
00135 eVersionMajorMax = 1,
00136 eVersionMinorMin = 0,
00137 eVersionMinorMax = 3
00138 };
00139
00141 enum PointFormatName
00142 {
00143 ePointFormat0 = 0,
00144 ePointFormat1 = 1,
00145 ePointFormat2 = 2,
00146 ePointFormat3 = 3,
00147 ePointFormat4 = 4,
00148 ePointFormat5 = 5,
00149 ePointFormatUnknown = -99
00150 };
00151
00153 enum PointSize
00154 {
00155 ePointSize0 = 20,
00156 ePointSize1 = 28,
00157 ePointSize2 = 26,
00158 ePointSize3 = 34
00159
00160 };
00161
00162
00163 class ReaderI
00164 {
00165 public:
00166
00167 virtual HeaderPtr ReadHeader() = 0;
00168 virtual PointPtr ReadNextPoint(HeaderPtr header) = 0;
00169 virtual Point const& ReadPointAt(std::size_t n, HeaderPtr header) = 0;
00170 virtual void Seek(std::size_t n, HeaderPtr header) = 0;
00171
00172 virtual void Reset(HeaderPtr header) = 0;
00173
00174 virtual std::istream& GetStream() const = 0;
00175
00176 virtual ~ReaderI() {};
00177 };
00178
00179 class WriterI
00180 {
00181 public:
00182
00183 virtual Header const& WriteHeader(const Header& header) = 0;
00184 virtual void UpdateHeader(const Header& header) = 0;
00185 virtual void WritePoint(const Point& point, const Header& header) = 0;
00186
00187 virtual std::ostream& GetStream() const = 0;
00188
00189 virtual ~WriterI() {};
00190
00191 };
00192
00194 class FilterI
00195 {
00196 public:
00197
00200 enum FilterType
00201 {
00202 eExclusion = 0,
00203 eInclusion = 1
00204 };
00205
00206 virtual bool filter(const Point& point) = 0;
00207
00208 void SetType(FilterType t) {m_type = t;}
00209 FilterType GetType() const {return m_type; }
00210
00211 virtual ~FilterI() {};
00212
00213 FilterI(FilterType t) : m_type(t) {}
00214
00215 private:
00216
00217 FilterI(FilterI const& other);
00218 FilterI& operator=(FilterI const& rhs);
00219
00220 FilterType m_type;
00221
00222
00223 };
00224
00226 class TransformI
00227 {
00228 public:
00229
00230 virtual bool transform(Point& point) = 0;
00231 virtual ~TransformI() {};
00232
00233 };
00234
00235 }
00236
00237 #endif // LIBLAS_HPP_INCLUDED