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_SCATTER_FILTER_H 00021 #define OSGEARTHFEATURES_SCATTER_FILTER_H 1 00022 00023 #include <osgEarthFeatures/Common> 00024 #include <osgEarthFeatures/Filter> 00025 #include <osgEarth/Random> 00026 00027 namespace osgEarth { namespace Features 00028 { 00029 using namespace osgEarth; 00030 using namespace osgEarth::Symbology; 00031 00037 class OSGEARTHFEATURES_EXPORT ScatterFilter : public FeatureFilter 00038 { 00039 public: 00040 // Call this determine whether this filter is available. 00041 static bool isSupported() { return true; } 00042 00043 public: 00044 ScatterFilter(); 00045 00047 void setDensity( float value ) { _density = value; } 00048 float getDensity() const { return _density; } 00049 00051 void setRandom( bool value ) { _random = value; } 00052 bool getRandom() const { return _random; } 00053 00055 void setRandomSeed( unsigned value ) { _randomSeed = value; } 00056 unsigned getRandomSeed() const { return _randomSeed; } 00057 00058 public: 00060 virtual FilterContext push( FeatureList& input, FilterContext& context ); 00061 00062 protected: 00063 void polyScatter( 00064 const Geometry* input, 00065 const SpatialReference* inputSRS, 00066 const FilterContext& context, 00067 PointSet* output); 00068 00069 void lineScatter( 00070 const Geometry* input, 00071 const SpatialReference* inputSRS, 00072 const FilterContext& context, 00073 PointSet* output); 00074 00075 private: 00076 float _density; 00077 bool _random; 00078 unsigned _randomSeed; 00079 Random _prng; 00080 }; 00081 00082 } } // namespace osgEarth::Features 00083 00084 #endif // OSGEARTHFEATURES_SUBSTITUTE_MODEL_FILTER_H