/usr/include/osgEarthFeatures/Filter is in libosgearth-dev 2.7.0+dfsg-2+b3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | /* -*-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_FILTER_H
#define OSGEARTHFEATURES_FILTER_H 1
#include <osgEarthFeatures/Common>
#include <osgEarthFeatures/Feature>
#include <osgEarthFeatures/FilterContext>
#include <osg/Matrixd>
#include <list>
namespace osgEarth { namespace Features
{
using namespace osgEarth;
/**
* Base class for a filter.
*/
class OSGEARTHFEATURES_EXPORT Filter : public osg::Referenced
{
protected:
virtual ~Filter();
};
/**
* Base class for feature filters.
*/
class OSGEARTHFEATURES_EXPORT FeatureFilter : public Filter
{
public:
virtual FilterContext push( FeatureList& input, FilterContext& context ) =0;
/**
* Serialize this FeatureFilter
*/
virtual Config getConfig() const { return Config(); }
virtual ~FeatureFilter();
};
typedef std::list< osg::ref_ptr<FeatureFilter> > FeatureFilterList;
/**
* A Factory that can create a FeatureFilter from a Config
*/
class OSGEARTHFEATURES_EXPORT FeatureFilterFactory : public osg::Referenced
{
public:
virtual FeatureFilter* create( const Config& conf ) = 0;
};
typedef std::list< osg::ref_ptr< FeatureFilterFactory > > FeatureFilterFactoryList;
/**
* A registry of FeatureFilter plugins
*/
class OSGEARTHFEATURES_EXPORT FeatureFilterRegistry : public osg::Referenced
{
public:
/**
* The singleton instance of the factory
*/
static FeatureFilterRegistry* instance();
/*
* Adds a new FeatureFilterFactory to the list
*/
void add( FeatureFilterFactory* factory );
/**
* Creates a FeatureFilter with the registered plugins from the given Config
*/
FeatureFilter* create( const Config& conf );
protected:
FeatureFilterRegistry();
FeatureFilterFactoryList _factories;
};
template<class T>
struct SimpleFeatureFilterFactory : public FeatureFilterFactory
{
SimpleFeatureFilterFactory(const std::string& key):_key(key){}
virtual FeatureFilter* create(const Config& conf)
{
if (conf.key() == _key) return new T(conf);
return 0;
}
std::string _key;
};
template<class T>
struct RegisterFeatureFilterProxy
{
RegisterFeatureFilterProxy( T* factory) { FeatureFilterRegistry::instance()->add( factory ); }
RegisterFeatureFilterProxy() { FeatureFilterRegistry::instance()->add( new T ); }
};
#define OSGEARTH_REGISTER_FEATUREFILTER( CLASSNAME )\
static osgEarth::Features::RegisterFeatureFilterProxy<CLASSNAME> s_osgEarthRegisterFeatureFilterProxy_##CLASSNAME;
#define OSGEARTH_REGISTER_SIMPLE_FEATUREFILTER( KEY, CLASSNAME)\
static osgEarth::Features::RegisterFeatureFilterProxy< osgEarth::Features::SimpleFeatureFilterFactory<CLASSNAME> > s_osgEarthRegisterFeatureFilterProxy_##CLASSNAME##KEY(new osgEarth::Features::SimpleFeatureFilterFactory<CLASSNAME>(#KEY));
template<typename T>
class TemplateFeatureFilter : public Filter, public T
{
public:
FilterContext push( FeatureList& input, FilterContext& context ) {
for( FeatureList::iterator i = input.begin(); i != input.end(); ++i ) {
T::operator()( i->get(), context );
}
return context;
}
};
/**
* Base class for a filter that converts features into an osg Node.
*/
class OSGEARTHFEATURES_EXPORT FeaturesToNodeFilter : public Filter
{
public:
virtual osg::Node* push( FeatureList& input, FilterContext& context ) =0;
public:
const osg::Matrixd& local2world() const { return _local2world; }
const osg::Matrixd& world2local() const { return _world2local; }
protected:
virtual ~FeaturesToNodeFilter();
// computes the matricies required to localizer/delocalize double-precision coords
void computeLocalizers( const FilterContext& context );
void computeLocalizers( const FilterContext& context, const osgEarth::GeoExtent &extent, osg::Matrixd &out_w2l, osg::Matrixd &out_l2w );
/** Parents the node with a localizer group if necessary */
osg::Node* delocalize( osg::Node* node ) const;
osg::Node* delocalize( osg::Node* node, const osg::Matrixd &local2World ) const;
osg::Group* delocalizeAsGroup( osg::Node* node ) const;
osg::Group* delocalizeAsGroup( osg::Node* node, const osg::Matrixd &local2World ) const;
osg::Group* createDelocalizeGroup() const;
osg::Group* createDelocalizeGroup( const osg::Matrixd &local2World) const;
void transformAndLocalize(
const std::vector<osg::Vec3d>& input,
const SpatialReference* inputSRS,
osg::Vec3Array* output,
const SpatialReference* outputSRS,
const osg::Matrixd& world2local,
bool toECEF );
void transformAndLocalize(
const std::vector<osg::Vec3d>& input,
const SpatialReference* inputSRS,
osg::Vec3Array* out_verts,
osg::Vec3Array* out_normals,
const SpatialReference* outputSRS,
const osg::Matrixd& world2local,
bool toECEF );
void transformAndLocalize(
const osg::Vec3d& input,
const SpatialReference* inputSRS,
osg::Vec3d& output,
const SpatialReference* outputSRS,
const osg::Matrixd& world2local,
bool toECEF );
void applyLineSymbology(osg::StateSet*, const class LineSymbol*);
void applyPointSymbology(osg::StateSet*, const class PointSymbol*);
osg::Matrixd _world2local, _local2world; // for coordinate localization
};
} } // namespace osgEarth::Features
#endif // OSGEARTHFEATURES_FILTER_H
|