/usr/include/osgEarthFeatures/FilterContext 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_CONTEXT_H
#define OSGEARTHFEATURES_FILTER_CONTEXT_H 1
#include <osgEarthFeatures/Common>
#include <osgEarthFeatures/Feature>
#include <osgEarthFeatures/Session>
#include <osgEarthSymbology/Geometry>
#include <osgEarthSymbology/ResourceCache>
#include <osgEarth/GeoData>
#include <osgEarth/ShaderUtils>
#include <osg/Matrix>
#include <list>
#include <vector>
namespace osgEarth { namespace Features
{
using namespace osgEarth;
using namespace osgEarth::Symbology;
class Session;
class FeatureProfile;
class FeatureIndexBuilder;
/**
* Context within which a chain of filters is executed.
*/
class OSGEARTHFEATURES_EXPORT FilterContext
{
public:
FilterContext(
Session* session =0L,
const FeatureProfile* profile =0L,
const GeoExtent& workingExtent =GeoExtent::INVALID,
FeatureIndexBuilder* index =0L);
FilterContext( const FilterContext& rhs );
virtual ~FilterContext() { }
/**
* Assigns a resource cache to use. One is created automatically if you
* don't assign one.
*/
void setResourceCache( ResourceCache* value ) { _resourceCache = value; }
/**
* Sets the profile (SRS etc) of the feature data
*/
void setProfile( const FeatureProfile* profile );
public: // properties
/**
* Whether this context contains complete georeferencing information.
*/
bool isGeoreferenced() const { return _session.valid() && _profile.valid(); }
/**
* Access to the Session under which this filter context operates
*/
Session* getSession() { return _session.get(); }
const Session* getSession() const { return _session.get(); }
/**
* The spatial profile of the feature data in this context.
*/
const FeatureProfile* profile() const { return _profile.get(); }
/**
* The spatial extent of the working cell
*/
optional<GeoExtent>& extent() { return _extent; }
const optional<GeoExtent>& extent() const { return _extent; }
/**
* The feature index
*/
FeatureIndexBuilder* featureIndex() { return _index; }
const FeatureIndexBuilder* featureIndex() const { return _index; }
/**
* Whether this context has a non-identity reference frame
*/
bool hasReferenceFrame() const { return !_referenceFrame.isIdentity(); }
/**
* Converts from world coordiantes into local coordinates
*/
osg::Vec3d toLocal( const osg::Vec3d& world ) const { return world * _referenceFrame; }
/**
* Converts a Geometry from world coords to local coords
*/
void toLocal( Geometry* geom ) const;
/**
* Converts from local (reference frame) coordinates into world coordinates
*/
osg::Vec3d toWorld( const osg::Vec3d& local ) const { return local * _inverseReferenceFrame; }
/**
* Converts a Geometry from local coords to world coords
*/
void toWorld( Geometry* geom ) const;
/**
* Converts a context-local point to a map coordinate.
*/
osg::Vec3d toMap( const osg::Vec3d& local ) const;
/**
* Converts a map coordinate to a context-local point.
*/
osg::Vec3d fromMap( const osg::Vec3d& map ) const;
/**
* Multiplying by the reference frame takes a point from world coords into local coords.
*/
const osg::Matrixd& referenceFrame() const { return _referenceFrame; }
/**
* Multiplying by the inverse reference frame takes a point from local coords into world coords.
*/
const osg::Matrix& inverseReferenceFrame() const { return _inverseReferenceFrame; }
/**
* Sets the reference frame (and its inverse)
*/
void setReferenceFrame( const osg::Matrixd& in ) {
_referenceFrame = in;
_inverseReferenceFrame.invert( _referenceFrame ); // = osg::Matrixd::inverse( _referenceFrame );
}
/**
* Accesses the shared resource cache where filters can store data.
*/
ResourceCache* resourceCache();
/**
* Shader policy. Unset by default, but code using this context can expressly
* set it to affect shader generation. Typical use case it to set the policy
* to "inherit" to inhibit shader generation if you have already generated
* shaders yourself.
*/
optional<ShaderPolicy>& shaderPolicy() { return _shaderPolicy; }
const optional<ShaderPolicy>& shaderPolicy() const { return _shaderPolicy; }
/**
* Dump as a string
*/
std::string toString() const;
/**
* Gets the DB Options associated with the context's session
*/
const osgDB::Options* getDBOptions() const;
/**
* Gets a "history" string for debugging purposes
*/
std::string getHistory() const;
void pushHistory(const std::string& value) { _history.push_back(value); }
protected:
osg::ref_ptr<Session> _session;
osg::ref_ptr<const FeatureProfile> _profile;
bool _isGeocentric;
optional<GeoExtent> _extent;
osg::Matrixd _referenceFrame;
osg::Matrixd _inverseReferenceFrame;
osg::ref_ptr<ResourceCache> _resourceCache;
FeatureIndexBuilder* _index;
optional<ShaderPolicy> _shaderPolicy;
std::vector<std::string> _history;
};
} } // namespace osgEarth::Features
#endif // OSGEARTHFEATURES_FILTER_CONTEXT_H
|