libLAS API Reference
1.8.1
|
A templated class that allows you to create complex filters using functions that are callable from the liblas::Point class. More...
#include <filter.hpp>
Public Types | |
typedef boost::function< T(const Point *)> | filter_func |
typedef boost::function< bool(T, T)> | compare_func |
Public Types inherited from liblas::FilterI | |
enum | FilterType { eExclusion = 0, eInclusion = 1 } |
Determines whether or not the filter keeps or rejects points that meet filtering criteria. More... | |
Public Member Functions | |
ContinuousValueFilter (filter_func f, T value, compare_func c) | |
Construct the filter with a filter_func, a comparison value, and a compare_func. More... | |
ContinuousValueFilter (filter_func f, std::string const &filter_string) | |
Construct the filter with a filter_func and a simple expression. More... | |
bool | filter (const liblas::Point &p) |
Function called by liblas::Reader::ReadNextPoint to apply the (list) of filter to the point. More... | |
Public Member Functions inherited from liblas::FilterI | |
void | SetType (FilterType t) |
Sets whether the filter is one that keeps data that matches construction criteria or rejects them. More... | |
FilterType | GetType () const |
Gets the type of filter. More... | |
virtual | ~FilterI () |
FilterI (FilterType t) | |
Base constructor. Initializes the FilterType. More... | |
A templated class that allows you to create complex filters using functions that are callable from the liblas::Point class.
See laskernel.cpp for examples how to use it for filtering intensity and time values.
typedef boost::function<bool(T, T)> liblas::ContinuousValueFilter< T >::compare_func |
typedef boost::function<T (const Point*)> liblas::ContinuousValueFilter< T >::filter_func |
|
inline |
Construct the filter with a filter_func, a comparison value, and a compare_func.
To use this we must take in a filtering function that returns us a value from the point, and a binary_predicate comparator (ie, std::less, std::greater, std::equal_to, etc).
f | - The function to compare with from the liblas::Point. It must be one of the functions that returns an integer type or double type |
value | - The value to use for one-way comparison |
c | - the std::binary_predicate to use for comparison To use this we must take in a filtering function that returns us a value from the point, and a binary_predicate comparator (ie, std::less, std::greater, std::equal_to, etc). Example: GetIntensity returns a uint16_t, so we use that for our template value. This filter would keep all points with intensities that are less than 100. liblas::ContinuousValueFilter<uint16_t>::compare_func c = std::less<uint16_t>(); liblas::ContinuousValueFilter<uint16_t>::filter_func f = &liblas::Point::GetIntensity; liblas::ContinuousValueFilter<uint16_t>* intensity_filter = new liblas::ContinuousValueFilter<uint16_t>(f, 100, c); intensity_filter->SetType(liblas::FilterI::eInclusion); |
|
inline |
Construct the filter with a filter_func and a simple expression.
f | - The function to compare with from the liblas::Point. It must be one of the functions that returns an integer type or double type |
filter_string | - A string to use for the filter. Supports taking in a simple expression and turning it into a comparator we can use. We support dead simple stuff: >200 ==150 >=32 <=150 <100 We don't strip whitespace, and we don't support complex comparisons (ie, two function 10<x<300) In addition to explicitly setting your comparator function, you can also use the constructor that takes in a simple expression string and constructs the basic comparators. See the source code or las2las2 help output for the forms that are supported. This may be improved in the future. std::string intensities("<100") liblas::ContinuousValueFilter<uint16_t>::filter_func f = &liblas::Point::GetIntensity; liblas::ContinuousValueFilter<uint16_t>* intensity_filter = new liblas::ContinuousValueFilter<uint16_t>(f, intensities); intensity_filter->SetType(liblas::FilterI::eInclusion); |
|
inlinevirtual |
Function called by liblas::Reader::ReadNextPoint to apply the (list) of filter to the point.
If the function returns true, the point passes the filter and is kept.
Implements liblas::FilterI.