libLAS API Reference  1.8.1
utility.hpp
Go to the documentation of this file.
1 /******************************************************************************
2  * $Id$
3  *
4  * Project: libLAS - http://liblas.org - A BSD library for LAS format data.
5  * Purpose: LAS filter class
6  * Author: Howard Butler, hobu.inc@gmail.com
7  *
8  ******************************************************************************
9  * Copyright (c) 2010, Howard Butler
10  *
11  * All rights reserved.
12  *
13  * Redistribution and use in source and binary forms, with or without
14  * modification, are permitted provided that the following
15  * conditions are met:
16  *
17  * * Redistributions of source code must retain the above copyright
18  * notice, this list of conditions and the following disclaimer.
19  * * Redistributions in binary form must reproduce the above copyright
20  * notice, this list of conditions and the following disclaimer in
21  * the documentation and/or other materials provided
22  * with the distribution.
23  * * Neither the name of the Martin Isenburg or Iowa Department
24  * of Natural Resources nor the names of its contributors may be
25  * used to endorse or promote products derived from this software
26  * without specific prior written permission.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
35  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
36  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
37  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
38  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
39  * OF SUCH DAMAGE.
40  ****************************************************************************/
41 
42 #ifndef LIBLAS_LASSUMMARY_HPP_INCLUDED
43 #define LIBLAS_LASSUMMARY_HPP_INCLUDED
44 
45 #include <liblas/header.hpp>
46 #include <liblas/point.hpp>
47 #include <liblas/detail/fwd.hpp>
48 #include <liblas/external/property_tree/ptree.hpp>
49 #include <liblas/export.hpp>
50 #include <liblas/filter.hpp>
51 // boost
52 #include <boost/foreach.hpp>
53 // std
54 #include <vector>
55 #include <functional>
56 #include <string>
57 #include <memory>
58 
59 using liblas::property_tree::ptree;
60 typedef boost::array<uint32_t, 32> classes_type;
61 
62 namespace liblas {
63 
65 class LAS_DLL Summary : public FilterI
66 {
67 public:
68 
69  Summary();
70  Summary(Summary const& other);
71  Summary& operator=(Summary const& rhs);
72  bool filter(const Point& point);
73 
74  void AddPoint(liblas::Point const& p);
75  ptree GetPTree() const;
76  void SetHeader(liblas::Header const& h);
77 
78  ~Summary() {}
79 private:
80 
81  classes_type classes;
82  uint32_t synthetic;
83  uint32_t withheld;
84  uint32_t keypoint;
85  uint32_t count;
86  boost::array<uint32_t, 8> points_by_return;
87  boost::array<uint32_t, 8> returns_of_given_pulse;
88  bool first;
89  boost::shared_ptr<liblas::Point> minimum;
90  boost::shared_ptr<liblas::Point> maximum;
91  liblas::Header m_header;
92  bool bHaveHeader;
93  bool bHaveColor;
94  bool bHaveTime;
95 };
96 
98 {
99 public:
100 
102  CoordinateSummary(CoordinateSummary const& other);
103  CoordinateSummary& operator=(CoordinateSummary const& rhs);
104  bool filter(const Point& point);
105 
106  void AddPoint(liblas::Point const& p);
107  ptree GetPTree() const;
108  void SetHeader(liblas::Header const& h);
109 
111 
112 private:
113 
114  uint32_t count;
115  boost::array<uint32_t, 8> points_by_return;
116  boost::array<uint32_t, 8> returns_of_given_pulse;
117  bool first;
118  boost::shared_ptr<liblas::Point> minimum;
119  boost::shared_ptr<liblas::Point> maximum;
120  liblas::Header m_header;
121  bool bHaveHeader;
122  bool bHaveColor;
123  bool bHaveTime;
124 };
125 
126 LAS_DLL std::ostream& operator<<(std::ostream& os, liblas::Summary const& s);
127 
128 LAS_DLL uint32_t GetStreamPrecision(double scale);
129 
130 } // namespace liblas
131 
132 #endif // ndef LIBLAS_LASSUMMARY_HPP_INCLUDED
#define LAS_DLL
Definition: export.hpp:58
std::ostream & operator<<(std::ostream &os, Classification const &cls)
The output stream operator is based on std::bitset<N>::operator<<.
Definition: classification.hpp:247
Defines public interface to LAS filter implementation.
Definition: filter.hpp:62
LAS_DLL uint32_t GetStreamPrecision(double scale)
Definition: utility.hpp:97
Namespace grouping all elements of libLAS public interface.
Definition: bounds.hpp:60
Point data record composed with X, Y, Z coordinates and attributes.
Definition: point.hpp:68
~Summary()
Definition: utility.hpp:78
A summarization utililty for LAS points.
Definition: utility.hpp:65
boost::array< uint32_t, 32 > classes_type
Definition: utility.hpp:60
~CoordinateSummary()
Definition: utility.hpp:110
Definition of public header block.
Definition: header.hpp:78