Debian Codegraph @

src/lasclasses/FileReaderLas.h

raw symbols SCIP
1 /**********************************************************************
2 FileReaderLas.h: class to read LAS files using liblas API library
3 Author(s): [email protected]
4 Copyright (C) 2016-2020 European Union (Joint Research Centre)
5
6 This file is part of jiplib.
7
8 jiplib is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 jiplib is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with jiplib. If not, see <https://www.gnu.org/licenses/>.
20 ***********************************************************************/
21 #ifndef _IMGREADERLAS_H_
22 #define _IMGREADERLAS_H_
23
24 #include <string>
25 #include <vector>
26 #include "liblas/liblas.hpp"
27
28 //--------------------------------------------------------------------------
29 class LastReturnFilter: public liblas::FilterI
30 {
31 public:
32 LastReturnFilter();
33 bool filter(const liblas::Point& point);
34
35 private:
36 LastReturnFilter(LastReturnFilter const& other);
37 LastReturnFilter& operator=(LastReturnFilter const& rhs);
38 };
39
40 class FileReaderLas
41 {
42 public:
43 FileReaderLas(void);
44 FileReaderLas(const std::string& filename);
45 ~FileReaderLas(void);
46 void open(const std::string& filename);
47 void close(void);
48 liblas::Header const& getHeader() const;
49 bool isCompressed() const;
50 unsigned long int getPointCount() const;
51 void las2ascii(const std::string& filename, bool verbose=false) const;
52 template<typename T> liblas::Bounds<T> getExtent() const {return getHeader().GetExtent();};
53 void getExtent(double& ulx, double& uly, double& lrx, double& lry) const;
54 double getMinZ() const;
55 double getMaxZ() const;
56 liblas::Reader* getReader(){return m_reader;};
57 void resetReader(){m_reader->Reset();};
58 void setFilter(std::vector<liblas::FilterPtr> const& filters);
59 bool const& readNextPoint(){return(m_reader->ReadNextPoint());};
60 bool const& readNextPoint(liblas::Point& thePoint);
61 liblas::Point const& getPoint(){return m_reader->GetPoint();};
62 liblas::Point const& readPointAt(std::size_t n){m_reader->ReadPointAt(n);return m_reader->GetPoint();};
63 // void addBoundsFilter(double ulx, double uly, double lrx, double lry);
64 void addReturnsFilter(std::vector<unsigned short> const& returns);
65 void addClassFilter(std::vector<unsigned short> const& classes);
66 void setFilters(const std::vector<liblas::FilterPtr>& filters){m_filters=filters;setFilters();};
67 void setFilters(){m_reader->SetFilters(m_filters);};
68 protected:
69 void setCodec(const std::string& filename);
70 std::string m_filename;
71 std::ifstream *m_ifstream;
72 liblas::Reader* m_reader;
73 std::vector<liblas::FilterPtr> m_filters;
74 };
75
76 #endif // _IMGREADERLAS_H_