1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/* -*-c++-*- */
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
* Copyright 2015 Pelican Mapping
* http://osgearth.org
*
* osgEarth is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
#ifndef OSGEARTHFEATURES_FEATURE_CURSOR_H
#define OSGEARTHFEATURES_FEATURE_CURSOR_H 1
#include <osgEarthFeatures/Common>
#include <osgEarthFeatures/Feature>
#include <osgEarthFeatures/Filter>
#include <osgEarth/Profile>
namespace osgEarth { namespace Features
{
using namespace osgEarth;
/**
* A cursor that lets you iterate over a collection of features returned
* from a feature query performed on a FeatureStore.
*/
class OSGEARTHFEATURES_EXPORT FeatureCursor : public osg::Referenced
{
public:
virtual bool hasMore() const =0;
virtual Feature* nextFeature() =0;
public:
void fill( FeatureList& output );
virtual ~FeatureCursor() { }
};
/**
* A simple cursor implementation that returns features from an in-memory
* feature list.
*/
class OSGEARTHFEATURES_EXPORT FeatureListCursor : public FeatureCursor
{
public:
FeatureListCursor( const FeatureList& input, bool cloneFeatures =false );
virtual ~FeatureListCursor() { }
virtual bool hasMore() const;
virtual Feature* nextFeature();
protected:
FeatureList _features;
FeatureList::iterator _iter;
bool _clone;
};
/**
* A simple cursor that returns each Geometry wrapped in a feature.
*/
class OSGEARTHFEATURES_EXPORT GeometryFeatureCursor : public FeatureCursor
{
public:
GeometryFeatureCursor( Symbology::Geometry* geom );
GeometryFeatureCursor( Symbology::Geometry* geom, const FeatureProfile* fp, const FeatureFilterList& filters );
virtual ~GeometryFeatureCursor() { }
virtual bool hasMore() const;
virtual Feature* nextFeature();
protected:
osg::ref_ptr<Symbology::Geometry> _geom;
osg::ref_ptr<const FeatureProfile> _featureProfile;
const FeatureFilterList _filters;
osg::ref_ptr<Feature> _lastFeature;
};
} } // namespace osgEarth::Features
#endif // OSGEARTHFEATURES_FEATURE_CURSOR_H