2
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
3
* Copyright 2008-2010 Pelican Mapping
6
* osgEarth is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU Lesser General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU Lesser General Public License for more details.
16
* You should have received a copy of the GNU Lesser General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>
20
#ifndef OSGEARTHFEATURES_BUFFER_FILTER_H
21
#define OSGEARTHFEATURES_BUFFER_FILTER_H 1
23
#include <osgEarthFeatures/Common>
24
#include <osgEarthFeatures/Feature>
25
#include <osgEarthFeatures/Filter>
26
#include <osgEarthSymbology/Style>
27
#include <osgEarthSymbology/GeometrySymbol>
30
namespace osgEarth { namespace Features
32
using namespace osgEarth;
33
using namespace osgEarth::Symbology;
36
* The buffer geometry operation takes each input vector shape and applies
37
* morphological dilation or erosion to it.
38
* (see http://en.wikipedia.org/wiki/Morphological_image_processing)
40
* The buffer distance determines which operation to use:
42
* A positive distance dilates the shape (expands it).
43
* A negative distance erodes the shape (shrinks it).
45
* Note: buffering always converts the input vector data into polygons.
47
class OSGEARTHFEATURES_EXPORT BufferFilter : public FeatureFilter
50
// Call this determine whether this filter is available. This filter uses
51
// the GEOS library, so you must compile osgEarth against GEOS for this
52
// filter to be available.
53
static bool isSupported();
57
BufferFilter( const BufferFilter& rhs );
60
// how far to buffer; positive to dialate, negative to erode
61
optional<double>& distance() { return _distance; }
62
const optional<double>& distance() const { return _distance; }
64
// for ENDCAP_ROUND, controls the tessellation detail for corners,
65
// measured in the number of segments to create per 90 degrees
66
int numQuadrantSegments() const { return _numQuadSegs; }
67
int& numQuadrantSegments() { return _numQuadSegs; }
69
// tessellation style of buffered corners and line ends
70
const Stroke::LineCapStyle& capStyle() const { return _capStyle; }
71
Stroke::LineCapStyle& capStyle() { return _capStyle; }
74
virtual FilterContext push( FeatureList& input, const FilterContext& context );
77
optional<double> _distance;
79
Stroke::LineCapStyle _capStyle;
81
bool push( Feature* input, const FilterContext& context );
84
} } // namespace osgEarth::Features
86
#endif // OSGEARTHFEATURES_BUFFER_FILTER_H