osgEarth 2.1.1
|
00001 /* -*-c++-*- */ 00002 /* osgEarth - Dynamic map generation toolkit for OpenSceneGraph 00003 * Copyright 2008-2010 Pelican Mapping 00004 * http://osgearth.org 00005 * 00006 * osgEarth is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU Lesser General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public License 00017 * along with this program. If not, see <http://www.gnu.org/licenses/> 00018 */ 00019 00020 #ifndef OSGEARTHFEATURES_SUBSTITUTE_MODEL_FILTER_H 00021 #define OSGEARTHFEATURES_SUBSTITUTE_MODEL_FILTER_H 1 00022 00023 #include <osgEarthFeatures/Common> 00024 #include <osgEarthFeatures/Feature> 00025 #include <osgEarthFeatures/Filter> 00026 #include <osgEarthSymbology/Style> 00027 #include <osgEarthSymbology/MarkerResource> 00028 #include <osgEarth/Utils> 00029 00030 namespace osgEarth { namespace Features 00031 { 00032 using namespace osgEarth; 00033 using namespace osgEarth::Symbology; 00034 00050 class OSGEARTHFEATURES_EXPORT SubstituteModelFilter : public FeaturesToNodeFilter 00051 { 00052 public: 00053 // Call this determine whether this filter is available. 00054 static bool isSupported() { return true; } 00055 00056 public: 00058 SubstituteModelFilter( const Style& style =Style() ); 00059 00061 void setClustering( bool value ) { _cluster = value; } 00062 bool getClustering() const { return _cluster; } 00063 00065 void setMergeGeometry( bool value ) { _merge = value; } 00066 bool getMergeGeometry() const { return _merge; } 00067 00069 //void setModelMatrix( const osg::Matrixd& value ) { _modelMatrix = value; } 00070 //const osg::Matrixd& getModelMatrix() const { return _modelMatrix; } 00071 00072 void setFeatureNameExpr( const StringExpression& expr ) { _featureNameExpr = expr; } 00073 const StringExpression& getFeatureNameExpr() const { return _featureNameExpr; } 00074 00075 public: 00077 virtual osg::Node* push( FeatureList& input, FilterContext& context ); 00078 00079 protected: 00080 Style _style; 00081 bool _cluster; 00082 bool _merge; 00083 //osg::Matrixd _modelMatrix; 00084 StringExpression _featureNameExpr; 00085 00086 typedef LRUCache<URI, osg::ref_ptr<MarkerResource> > MarkerCache; 00087 MarkerCache _markerCache; 00088 00089 bool process(const FeatureList& features, const MarkerSymbol* symbol, Session* session, osg::Group* ap, FilterContext& context ); 00090 bool cluster(const FeatureList& features, const MarkerSymbol* symbol, Session* session, osg::Group* ap, FilterContext& context ); 00091 }; 00092 00093 } } // namespace osgEarth::Features 00094 00095 #endif // OSGEARTHFEATURES_SUBSTITUTE_MODEL_FILTER_H