当前位置: 首页>>代码示例>>C++>>正文


C++ Style::empty方法代码示例

本文整理汇总了C++中Style::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ Style::empty方法的具体用法?C++ Style::empty怎么用?C++ Style::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Style的用法示例。


在下文中一共展示了Style::empty方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

void
GeodeticGraticuleOptions::addLevel( float maxRange, float minRange, unsigned subFactor, const Style& lineStyle, const Style& textStyle )
{
    Level level;
    level._maxRange = maxRange;
    level._minRange = minRange;
    level._subdivisionFactor = subFactor;
    if ( !lineStyle.empty() )
        level._lineStyle = lineStyle;
    if ( !textStyle.empty() )
        level._textStyle = textStyle;

    _levels.push_back(level);
}
开发者ID:wlhm1984,项目名称:osgEarthX,代码行数:14,代码来源:GeodeticGraticule.cpp

示例2: newStyle

Style
Style::combineWith( const Style& rhs ) const
{
    // start by deep-cloning this style.
    Style newStyle(*this);
    newStyle.copySymbols(rhs);
    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;
}
开发者ID:2php,项目名称:osgearth,代码行数:16,代码来源:Style.cpp

示例3:

Feature::Feature( Geometry* geom, const Style& style, FeatureID fid ) :
_geom ( geom ),
_fid  ( fid )
{
    if ( !style.empty() )
        _style = style;
}
开发者ID:rdelmont,项目名称:osgearth,代码行数:7,代码来源:Feature.cpp

示例4:

void
GeodeticGraticule::addLevel(float        maxRange,
                            float        minRange,
                            unsigned     subdivFactor,
                            const Style& style)
{
    if ( _autoLevels )
    {
        _autoLevels = false;
        _levels.clear();
    }

    // the "-2" here is because normal tile paging gives you one subdivision already,
    // so we only need to account for > 1 subdivision factor.
    unsigned cellsPerTile = subdivFactor <= 2u ? 1u : 1u << (subdivFactor-2u);

    Level level;
    level._maxRange = maxRange;
    level._minRange = minRange;
    _profile->getNumTiles( _levels.size(), level._tilesX, level._tilesY );
    level._cellsPerTileX = std::max(1u, cellsPerTile);
    level._cellsPerTileY = std::max(1u, cellsPerTile);

    if ( !style.empty() )
    {
        level._style = style;
    }
    else
    {
        level._style = _levels.size() > 0 ? _levels[_levels.size()-1]._style : _defaultLineStyle;
    }

    _levels.push_back( level );
}
开发者ID:Thomas-Lerman,项目名称:osgearth,代码行数:34,代码来源:GeodeticGraticule.cpp

示例5: dirty

Feature::Feature( Geometry* geom, const SpatialReference* srs, const Style& style, FeatureID fid ) :
_geom ( geom ),
_srs  ( srs ),
_fid  ( fid )
{
    if ( !style.empty() )
        _style = style;

    dirty();
}
开发者ID:DavidLeehome,项目名称:osgearth,代码行数:10,代码来源:Feature.cpp

示例6: newStyle

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;
}
开发者ID:Geo12,项目名称:osgearth,代码行数:21,代码来源:Style.cpp

示例7: setStyle

FeatureNode::FeatureNode(Feature* feature,
                         const Style& in_style,
                         const GeometryCompilerOptions& options,
                         StyleSheet* styleSheet) :
AnnotationNode(),
_options           ( options ),
_needsRebuild      ( true ),
_styleSheet        ( styleSheet ),
_clampDirty        (false),
_index             ( 0 )
{
    _features.push_back( feature );

    Style style = in_style;
    if (style.empty() && feature->style().isSet())
    {
        style = *feature->style();
    }

    setStyle( style );
}
开发者ID:pprabhu78,项目名称:osgearth,代码行数:21,代码来源:FeatureNode.cpp

示例8: setStyle

FeatureNode::FeatureNode(MapNode* mapNode,
                         Feature* feature,
                         const Style& in_style,
                         const GeometryCompilerOptions& options,
                         StyleSheet* styleSheet) :
AnnotationNode(),
_options           ( options ),
_needsRebuild      ( true ),
_styleSheet        ( styleSheet )
{
    _features.push_back( feature );

    FeatureNode::setMapNode( mapNode );
    
    Style style = in_style;
    if (style.empty() && feature->style().isSet())
    {
        style = *feature->style();
    }

    setStyle( style );
}
开发者ID:2php,项目名称:osgearth,代码行数:22,代码来源:FeatureNode.cpp

示例9: context

/**
 * Querys the feature source;
 * Visits each feature and uses the Style Expression to resolve its style class;
 * Sorts the features into bins based on style class;
 * Compiles each bin into a separate style group;
 * Adds the resulting style groups to the provided parent.
 */
void
FeatureModelGraph::queryAndSortIntoStyleGroups(const Query&            query,
                                               const StringExpression& styleExpr,
                                               FeatureSourceIndex*     index,
                                               osg::Group*             parent)
{
    // the profile of the features
    const FeatureProfile* featureProfile = _session->getFeatureSource()->getFeatureProfile();

    // get the extent of the full set of feature data:
    const GeoExtent& extent = featureProfile->getExtent();
    
    // query the feature source:
    osg::ref_ptr<FeatureCursor> cursor = _session->getFeatureSource()->createFeatureCursor( query );
    if ( !cursor.valid() )
        return;

    // establish the working bounds and a context:
    Bounds bounds = query.bounds().isSet() ? *query.bounds() : extent.bounds();
    FilterContext context( _session.get(), featureProfile, GeoExtent(featureProfile->getSRS(), bounds), index );
    StringExpression styleExprCopy( styleExpr );

    // visit each feature and run the expression to sort it into a bin.
    std::map<std::string, FeatureList> styleBins;
    while( cursor->hasMore() )
    {
        osg::ref_ptr<Feature> feature = cursor->nextFeature();
        if ( feature.valid() )
        {
            const std::string& styleString = feature->eval( styleExprCopy, &context );
            styleBins[styleString].push_back( feature.get() );
        }
    }

    // next create a style group per bin.
    for( std::map<std::string,FeatureList>::iterator i = styleBins.begin(); i != styleBins.end(); ++i )
    {
        const std::string& styleString = i->first;
        FeatureList&       workingSet  = i->second;

        // resolve the style:
        Style combinedStyle;

        // if the style string begins with an open bracket, it's an inline style definition.
        if ( styleString.length() > 0 && styleString.at(0) == '{' )
        {
            Config conf( "style", styleString );
            conf.setReferrer( styleExpr.uriContext().referrer() );
            conf.set( "type", "text/css" );
            combinedStyle = Style(conf);
        }

        // otherwise, look up the style in the stylesheet. Do NOT fall back on a default
        // style in this case: for style expressions, the user must be explicity about 
        // default styling; this is because there is no other way to exclude unwanted
        // features.
        else
        {
            const Style* selectedStyle = _session->styles()->getStyle(styleString, false);
            if ( selectedStyle )
                combinedStyle = *selectedStyle;
        }

        // if there is a valid style, create the node and add it. (Otherwise we will skip
        // the feature.)
        if ( !combinedStyle.empty() )
        {
            osg::Group* styleGroup = createStyleGroup(combinedStyle, workingSet, context);
            if ( styleGroup )
                parent->addChild( styleGroup );
        }
    }
}
开发者ID:fly1008,项目名称:osgearth,代码行数:80,代码来源:FeatureModelGraph.cpp


注:本文中的Style::empty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。