osgEarth 2.1.1
Public Types | Public Member Functions | Protected Attributes

osgEarth::Symbology::TextSymbol Class Reference

Inheritance diagram for osgEarth::Symbology::TextSymbol:
Collaboration diagram for osgEarth::Symbology::TextSymbol:

List of all members.

Public Types

enum  SizeMode { SIZEMODE_SCREEN, SIZEMODE_OBJECT }
enum  LineOrientation { LINEORIENTATION_PARALLEL, LINEORIENTATION_PERPENDICULAR, LINEORIENTATION_HORIZONTAL }
enum  LinePlacement { LINEPLACEMENT_ALONG_LINE, LINEPLACEMENT_CENTROID }

Public Member Functions

 TextSymbol (const Config &conf=Config())
optional< Fill > & fill ()
const optional< Fill > & fill () const
optional< Stroke > & halo ()
const optional< Stroke > & halo () const
optional< std::string > & font ()
const optional< std::string > & font () const
optional< StringExpression > & content ()
const optional
< StringExpression > & 
content () const
optional< NumericExpression > & priority ()
const optional
< NumericExpression > & 
priority () const
optional< float > & size ()
const optional< float > & size () const
optional< bool > & rotateToScreen ()
const optional< bool > & rotateToScreen () const
optional< osg::Vec2s > & pixelOffset ()
const optional< osg::Vec2s > & pixelOffset () const
optional< bool > & removeDuplicateLabels ()
const optional< bool > & removeDuplicateLabels () const
optional< SizeMode > & sizeMode ()
const optional< SizeMode > & sizeMode () const
optional< LineOrientation > & lineOrientation ()
const optional< LineOrientation > & lineOrientation () const
optional< LinePlacement > & linePlacement ()
const optional< LinePlacement > & linePlacement () const
optional< std::string > & provider ()
const optional< std::string > & provider () const
virtual Config getConfig () const
virtual void mergeConfig (const Config &conf)

Protected Attributes

optional< Fill_fill
optional< Stroke_halo
optional< std::string > _font
optional< float > _size
optional< StringExpression_content
optional< NumericExpression_priority
optional< bool > _rotateToScreen
optional< bool > _removeDuplicateLabels
optional< SizeMode_sizeMode
optional< LineOrientation_lineOrientation
optional< LinePlacement_linePlacement
optional< std::string > _theme
optional< osg::Vec2s > _pixelOffset
optional< std::string > _provider

Detailed Description

Symbol that describes how to render text labels.

Definition at line 33 of file TextSymbol.


Member Enumeration Documentation

Enumerator:
LINEORIENTATION_PARALLEL 
LINEORIENTATION_PERPENDICULAR 
LINEORIENTATION_HORIZONTAL 

Definition at line 41 of file TextSymbol.

Enumerator:
LINEPLACEMENT_ALONG_LINE 
LINEPLACEMENT_CENTROID 

Definition at line 47 of file TextSymbol.

Enumerator:
SIZEMODE_SCREEN 
SIZEMODE_OBJECT 

Definition at line 36 of file TextSymbol.


Constructor & Destructor Documentation

TextSymbol::TextSymbol ( const Config conf = Config())

Definition at line 24 of file TextSymbol.cpp.

                                           :
Symbol( conf ),
_fill( Fill( 1, 1, 1, 1 ) ),
_halo( Stroke( 0.3, 0.3, 0.3, 1) ),
_size( 16.0f ),
_sizeMode( SIZEMODE_SCREEN ),
_rotateToScreen( false ),
_removeDuplicateLabels( false ),
_provider( "overlay" )
{
    mergeConfig(conf);
}

Here is the call graph for this function:


Member Function Documentation

optional<StringExpression>& osgEarth::Symbology::TextSymbol::content ( ) [inline]

Actual text to render (if applicable)

Definition at line 67 of file TextSymbol.

{ return _content; }

Here is the caller graph for this function:

const optional<StringExpression>& osgEarth::Symbology::TextSymbol::content ( ) const [inline]

Definition at line 68 of file TextSymbol.

{ return _content; }
const optional<Fill>& osgEarth::Symbology::TextSymbol::fill ( ) const [inline]

Definition at line 56 of file TextSymbol.

{ return _fill; }
optional<Fill>& osgEarth::Symbology::TextSymbol::fill ( ) [inline]

Text fill color.

Definition at line 55 of file TextSymbol.

{ return _fill; }

Here is the caller graph for this function:

optional<std::string>& osgEarth::Symbology::TextSymbol::font ( ) [inline]

Name of text font.

Definition at line 63 of file TextSymbol.

{ return _font; }

Here is the caller graph for this function:

const optional<std::string>& osgEarth::Symbology::TextSymbol::font ( ) const [inline]

Definition at line 64 of file TextSymbol.

{ return _font; }
Config TextSymbol::getConfig ( ) const [virtual]

Reimplemented from osgEarth::Symbology::Symbol.

Definition at line 38 of file TextSymbol.cpp.

{
    Config conf = Symbol::getConfig();
    conf.key() = "text";
    conf.addObjIfSet( "fill", _fill );
    conf.addObjIfSet( "halo", _halo );
    conf.addIfSet( "font", _font );
    conf.addIfSet( "size", _size );
    conf.addObjIfSet( "content", _content );
    conf.addObjIfSet( "priority", _priority );
    conf.addIfSet( "rotate_to_screen", _rotateToScreen );
    conf.addIfSet( "remove_duplicate_labels", _removeDuplicateLabels );
    conf.addIfSet( "size_mode", "screen", _sizeMode, SIZEMODE_SCREEN );
    conf.addIfSet( "size_mode", "object", _sizeMode, SIZEMODE_OBJECT );
    conf.addIfSet( "line_orientation", "parallel", _lineOrientation, LINEORIENTATION_PARALLEL );
    conf.addIfSet( "line_orientation", "perpendicular", _lineOrientation, LINEORIENTATION_PERPENDICULAR );
    conf.addIfSet( "line_orientation", "horizontal", _lineOrientation, LINEORIENTATION_HORIZONTAL );
    conf.addIfSet( "line_placement", "along_line", _linePlacement, LINEPLACEMENT_ALONG_LINE );
    conf.addIfSet( "line_placement", "centroid", _linePlacement, LINEPLACEMENT_CENTROID );
    conf.addIfSet( "provider", _provider );
    conf.addIfSet( "theme", _theme );
    if ( _pixelOffset.isSet() ) {
        conf.add( "pixel_offset_x", toString(_pixelOffset->x()) );
        conf.add( "pixel_offset_y", toString(_pixelOffset->y()) );
    }
    return conf;
}

Here is the call graph for this function:

const optional<Stroke>& osgEarth::Symbology::TextSymbol::halo ( ) const [inline]

Definition at line 60 of file TextSymbol.

{ return _halo; }
optional<Stroke>& osgEarth::Symbology::TextSymbol::halo ( ) [inline]

Text outline color.

Definition at line 59 of file TextSymbol.

{ return _halo; }

Here is the caller graph for this function:

optional<LineOrientation>& osgEarth::Symbology::TextSymbol::lineOrientation ( ) [inline]

Definition at line 95 of file TextSymbol.

{ return _lineOrientation; }

Here is the caller graph for this function:

const optional<LineOrientation>& osgEarth::Symbology::TextSymbol::lineOrientation ( ) const [inline]

Definition at line 96 of file TextSymbol.

{ return _lineOrientation; }
optional<LinePlacement>& osgEarth::Symbology::TextSymbol::linePlacement ( ) [inline]

Whether to render text relative to line data

Definition at line 99 of file TextSymbol.

{ return _linePlacement; }

Here is the caller graph for this function:

const optional<LinePlacement>& osgEarth::Symbology::TextSymbol::linePlacement ( ) const [inline]

Definition at line 100 of file TextSymbol.

{ return _linePlacement; }
void TextSymbol::mergeConfig ( const Config conf) [virtual]

Definition at line 93 of file Style.cpp.

{
    if ( _name.empty() )
        _name = conf.value( "name" );

    // if there's no explicit name, use the KEY as the name.
    if ( _name.empty() )
        _name = conf.key();

    conf.getIfSet( "url", _uri ); // named "url" for back compat

    _origType = conf.value( "type" );

    if ( conf.value( "type" ) == "text/css" )
    {
        _origData = conf.value();
    }
    else
    {
        Config symbolConf = conf.child( "symbols" );
        if ( !symbolConf.empty() )
        {
            for( ConfigSet::const_iterator i = symbolConf.children().begin(); i != symbolConf.children().end(); ++i )
            {
                const Config& c = *i;

                if ( c.key() == "text" )
                {
                    getOrCreateSymbol<TextSymbol>()->mergeConfig( c );
                }
                else if ( c.key() == "point" )
                {
                    getOrCreateSymbol<PointSymbol>()->mergeConfig( c );
                }
                else if ( c.key() == "line" )
                {
                    getOrCreateSymbol<LineSymbol>()->mergeConfig( c );
                }
                else if ( c.key() == "polygon" )
                {
                    getOrCreateSymbol<PolygonSymbol>()->mergeConfig( c );
                }
                else if ( c.key() == "extrusion" )
                {
                    getOrCreateSymbol<ExtrusionSymbol>()->mergeConfig( c );
                }
                else if ( c.key() == "altitude" )
                {
                    getOrCreateSymbol<AltitudeSymbol>()->mergeConfig( c );
                }
                else if ( c.key() == "marker" )
                {
                    getOrCreateSymbol<MarkerSymbol>()->mergeConfig( c );
                }
            }
        }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

const optional<osg::Vec2s>& osgEarth::Symbology::TextSymbol::pixelOffset ( ) const [inline]

Definition at line 84 of file TextSymbol.

{ return _pixelOffset; }
optional<osg::Vec2s>& osgEarth::Symbology::TextSymbol::pixelOffset ( ) [inline]

Pixel offset from the center point.

Definition at line 83 of file TextSymbol.

{ return _pixelOffset; }
optional<NumericExpression>& osgEarth::Symbology::TextSymbol::priority ( ) [inline]

Priority of the label (applicable when the renderer sorts labels)

Definition at line 71 of file TextSymbol.

{ return _priority; }

Here is the caller graph for this function:

const optional<NumericExpression>& osgEarth::Symbology::TextSymbol::priority ( ) const [inline]

Definition at line 72 of file TextSymbol.

{ return _priority; }
optional<std::string>& osgEarth::Symbology::TextSymbol::provider ( ) [inline]

Label generation provider to use

Definition at line 103 of file TextSymbol.

{ return _provider; }

Here is the caller graph for this function:

const optional<std::string>& osgEarth::Symbology::TextSymbol::provider ( ) const [inline]

Definition at line 104 of file TextSymbol.

{ return _provider; }
const optional<bool>& osgEarth::Symbology::TextSymbol::removeDuplicateLabels ( ) const [inline]

Definition at line 88 of file TextSymbol.

optional<bool>& osgEarth::Symbology::TextSymbol::removeDuplicateLabels ( ) [inline]

Whether to remove duplicates when drawing multiple labels.

Definition at line 87 of file TextSymbol.

Here is the caller graph for this function:

const optional<bool>& osgEarth::Symbology::TextSymbol::rotateToScreen ( ) const [inline]

Definition at line 80 of file TextSymbol.

{ return _rotateToScreen; }
optional<bool>& osgEarth::Symbology::TextSymbol::rotateToScreen ( ) [inline]

Whether the text should face the screen (be 2D)

Definition at line 79 of file TextSymbol.

{ return _rotateToScreen; }

Here is the caller graph for this function:

const optional<float>& osgEarth::Symbology::TextSymbol::size ( ) const [inline]

Definition at line 76 of file TextSymbol.

{ return _size; }
optional<float>& osgEarth::Symbology::TextSymbol::size ( ) [inline]

Font size.

Definition at line 75 of file TextSymbol.

{ return _size; }

Here is the caller graph for this function:

optional<SizeMode>& osgEarth::Symbology::TextSymbol::sizeMode ( ) [inline]

Whether the size() property refers to pixels or scene units

Definition at line 91 of file TextSymbol.

{ return _sizeMode; }

Here is the caller graph for this function:

const optional<SizeMode>& osgEarth::Symbology::TextSymbol::sizeMode ( ) const [inline]

Definition at line 92 of file TextSymbol.

{ return _sizeMode; }

Member Data Documentation

Definition at line 115 of file TextSymbol.

Definition at line 111 of file TextSymbol.

Definition at line 113 of file TextSymbol.

Definition at line 112 of file TextSymbol.

Definition at line 120 of file TextSymbol.

Definition at line 121 of file TextSymbol.

Definition at line 123 of file TextSymbol.

Definition at line 116 of file TextSymbol.

Definition at line 124 of file TextSymbol.

Definition at line 118 of file TextSymbol.

Definition at line 117 of file TextSymbol.

Definition at line 114 of file TextSymbol.

Definition at line 119 of file TextSymbol.

Definition at line 122 of file TextSymbol.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines