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 OSGEARTHSYMBOLOGY_MODEL_SYMBOL_H 00021 #define OSGEARTHSYMBOLOGY_MODEL_SYMBOL_H 1 00022 00023 #include <osgEarth/Common> 00024 #include <osgEarthSymbology/Symbol> 00025 #include <osgEarthSymbology/Expression> 00026 #include <osg/Vec3f> 00027 00028 namespace osgEarth { namespace Symbology 00029 { 00034 class OSGEARTHSYMBOLOGY_EXPORT MarkerSymbol : public Symbol 00035 { 00036 public: 00040 enum Placement 00041 { 00043 PLACEMENT_CENTROID, 00044 00046 PLACEMENT_VERTEX, 00047 00050 PLACEMENT_INTERVAL, 00051 00053 PLACEMENT_RANDOM 00054 }; 00055 00056 public: 00057 MarkerSymbol( const Config& conf =Config() ); 00058 00060 optional<StringExpression>& url() { return _url; } 00061 const optional<StringExpression>& url() const { return _url; } 00062 00064 optional<Placement>& placement() { return _placement; } 00065 const optional<Placement>& placement() const { return _placement; } 00066 00068 optional<float>& density() { return _density; } 00069 const optional<float>& density() const { return _density; } 00070 00072 optional<NumericExpression>& scale() { return _scale; } 00073 const optional<NumericExpression>& scale() const { return _scale; } 00074 00076 optional<unsigned>& randomSeed() { return _randomSeed; } 00077 const optional<unsigned>& randomSeed() const { return _randomSeed; } 00078 00079 public: // non-serialized properties (for programmatic use only) 00080 00082 void setImage( osg::Image* image ) { _image = image; } 00083 osg::Image* getImage() const { return _image.get(); } 00084 00086 void setModel( osg::Node* node ) { _node = node; } 00087 osg::Node* getNode() const { return _node.get(); } 00088 00089 public: 00090 virtual Config getConfig() const; 00091 virtual void mergeConfig( const Config& conf ); 00092 00093 protected: 00094 optional<StringExpression> _url; 00095 optional<NumericExpression> _scale; 00096 optional<Placement> _placement; 00097 optional<float> _density; 00098 optional<unsigned> _randomSeed; 00099 00100 osg::ref_ptr<osg::Image> _image; 00101 osg::ref_ptr<osg::Node> _node; 00102 }; 00103 00104 } } // namespace osgEarth::Symbology 00105 00106 #endif