osgEarth 2.1.1

/home/cube/sources/osgearth/src/osgEarthSymbology/Symbol

Go to the documentation of this file.
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_SYMBOL_H
00021 #define OSGEARTHSYMBOLOGY_SYMBOL_H 1
00022 
00023 #include <osgEarthSymbology/Common>
00024 #include <osgEarth/Config>
00025 #include <osg/Referenced>
00026 #include <vector>
00027 
00028 namespace osgEarth { namespace Symbology
00029 {
00033     class OSGEARTHSYMBOLOGY_EXPORT Symbol : public osg::Referenced
00034     {
00035     public:
00036         Symbol( const Config& conf =Config() );
00037 
00038         const URIContext& uriContext() const { return _uriContext; }
00039 
00040         virtual Config getConfig() const { return Config(); }
00041 
00042     protected:
00043         URIContext _uriContext;
00044     };
00045     typedef std::vector<osg::ref_ptr<Symbol> > SymbolList;
00046 
00047     //--------------------------------------------------------------------
00048     
00052     class OSGEARTHSYMBOLOGY_EXPORT Stroke
00053     {
00054     public:
00055         enum LineCapStyle {
00056             LINECAP_DEFAULT,
00057             LINECAP_BUTT,
00058             LINECAP_SQUARE,
00059             LINECAP_ROUND
00060         };
00061 
00062         enum LineJoinStyle {
00063             LINEJOIN_DEFAULT
00064         };
00065 
00066     public:
00067         Stroke();
00068         Stroke( float r, float g, float b, float a );
00069         Stroke( const Config& conf ) { mergeConfig(conf); }
00070 
00072         osg::Vec4f& color() { return _color; }
00073         const osg::Vec4f& color() const { return _color; }
00074 
00076         optional<LineCapStyle>& lineCap() { return _lineCap; }
00077         const optional<LineCapStyle>& lineCap() const { return _lineCap; }
00078 
00080         optional<LineJoinStyle>& lineJoin() { return _lineJoin; }
00081         const optional<LineJoinStyle>& lineJoin() const { return _lineJoin; }
00082 
00084         optional<float>& width() { return _width; }        
00085         const optional<float>& width() const { return _width; }
00086 
00088         optional<unsigned short>& stipple() { return _stipple;}
00089         const optional<unsigned short>& stipple() const { return _stipple; }
00090 
00091     public:
00092         virtual Config getConfig() const;            
00093         virtual void mergeConfig( const Config& conf );
00094 
00095     protected:
00096         osg::Vec4f               _color;
00097         optional<LineCapStyle>   _lineCap;
00098         optional<LineJoinStyle>  _lineJoin;
00099         optional<float>          _width;
00100         optional<unsigned short> _stipple;
00101     };
00102 
00103     //--------------------------------------------------------------------
00104 
00108     class OSGEARTHSYMBOLOGY_EXPORT Fill
00109     {
00110     public:
00111         Fill();
00112         Fill( float r, float g, float b, float a );
00113         Fill( const Config& conf ) { mergeConfig(conf); }
00114 
00115         osg::Vec4f& color() { return _color; }
00116         const osg::Vec4f& color() const { return _color; }
00117 
00118     public:
00119         virtual Config getConfig() const;
00120         virtual void mergeConfig( const Config& conf );
00121 
00122     protected:
00123         osg::Vec4f _color;
00124     };
00125 
00126 } } // namespace osgEarth::Symbology
00127 
00128 #endif // OSGEARTH_SYMBOLOGY_SYMBOL_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines