示例#1
0
void
FeatureNode::setStyle(const Style& style)
{
    // Try to compare the styles and see if we can get away with not compiling the geometry again.
    Style a = _style;
    Style b = style;
   
    // If the only thing that has changed is the AltitudeSymbol, we don't need to worry about rebuilding the entire geometry again.
    a.remove<AltitudeSymbol>();
    b.remove<AltitudeSymbol>();
    if (a.getConfig().toJSON() == b.getConfig().toJSON())
    {
        _needsRebuild = false;
    }
    else
    {
        _needsRebuild = true;
    }
    _style = style;
    build();
}
示例#2
0
文件: Style.cpp 项目: Geo12/osgearth
Style::Style(const Style& rhs, const osg::CopyOp& op) :
_name    ( rhs._name ),
_symbols ( rhs._symbols ),
_origType( rhs._origType ),
_origData( rhs._origData ),
_uri     ( rhs._uri )
{
    if ( op.getCopyFlags() == osg::CopyOp::SHALLOW_COPY )
    {
        _symbols = rhs._symbols;
    }
    else
    {
        _symbols.clear();
        mergeConfig( rhs.getConfig(false) );
    }
}
示例#3
0
文件: Style.cpp 项目: Geo12/osgearth
Style
Style::combineWith( const Style& rhs ) const
{
    // start by deep-cloning this style.
    Config conf = getConfig( false );
    Style newStyle( conf );

    // next, merge in the symbology from the other style.
    newStyle.mergeConfig( rhs.getConfig(false) );

    if ( !this->empty() && !rhs.empty() )
        newStyle.setName( _name + std::string(":") + rhs.getName() );
    else if ( !this->empty() && rhs.empty() )
        newStyle.setName( _name );
    else if ( this->empty() && !rhs.empty() )
        newStyle.setName( rhs.getName() );
    else
        newStyle.setName( _name );

    return newStyle;
}