本文整理汇总了C++中TextSymbol::onScreenRotation方法的典型用法代码示例。如果您正苦于以下问题:C++ TextSymbol::onScreenRotation方法的具体用法?C++ TextSymbol::onScreenRotation怎么用?C++ TextSymbol::onScreenRotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextSymbol
的用法示例。
在下文中一共展示了TextSymbol::onScreenRotation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createNode
/**
* Creates a complete set of positioned label nodes from a feature list.
*/
osg::Node* createNode(
const FeatureList& input,
const Style& style,
FilterContext& context )
{
if ( style.get<TextSymbol>() == 0L && style.get<IconSymbol>() == 0L )
return 0L;
// copy the style so we can (potentially) modify the text symbol.
Style styleCopy = style;
TextSymbol* text = styleCopy.get<TextSymbol>();
IconSymbol* icon = styleCopy.get<IconSymbol>();
osg::Group* group = new osg::Group();
StringExpression textContentExpr ( text ? *text->content() : StringExpression() );
NumericExpression textPriorityExpr( text ? *text->priority() : NumericExpression() );
NumericExpression textSizeExpr ( text ? *text->size() : NumericExpression() );
NumericExpression textRotationExpr( text ? *text->onScreenRotation() : NumericExpression() );
NumericExpression textCourseExpr ( text ? *text->geographicCourse() : NumericExpression() );
StringExpression iconUrlExpr ( icon ? *icon->url() : StringExpression() );
NumericExpression iconScaleExpr ( icon ? *icon->scale() : NumericExpression() );
NumericExpression iconHeadingExpr ( icon ? *icon->heading() : NumericExpression() );
for( FeatureList::const_iterator i = input.begin(); i != input.end(); ++i )
{
Feature* feature = i->get();
if ( !feature )
continue;
// run a symbol script if present.
if ( text && text->script().isSet() )
{
StringExpression temp( text->script().get() );
feature->eval( temp, &context );
}
// run a symbol script if present.
if ( icon && icon->script().isSet() )
{
StringExpression temp( icon->script().get() );
feature->eval( temp, &context );
}
const Geometry* geom = feature->getGeometry();
if ( !geom )
continue;
Style tempStyle = styleCopy;
// evaluate expressions into literals.
// TODO: Later we could replace this with a generate "expression evaluator" type
// that we could pass to PlaceNode in the DB options. -gw
if ( text )
{
if ( text->content().isSet() )
tempStyle.get<TextSymbol>()->content()->setLiteral( feature->eval( textContentExpr, &context ) );
if ( text->size().isSet() )
tempStyle.get<TextSymbol>()->size()->setLiteral( feature->eval(textSizeExpr, &context) );
if ( text->onScreenRotation().isSet() )
tempStyle.get<TextSymbol>()->onScreenRotation()->setLiteral( feature->eval(textRotationExpr, &context) );
if ( text->geographicCourse().isSet() )
tempStyle.get<TextSymbol>()->geographicCourse()->setLiteral( feature->eval(textCourseExpr, &context) );
}
if ( icon )
{
if ( icon->url().isSet() )
tempStyle.get<IconSymbol>()->url()->setLiteral( feature->eval(iconUrlExpr, &context) );
if ( icon->scale().isSet() )
tempStyle.get<IconSymbol>()->scale()->setLiteral( feature->eval(iconScaleExpr, &context) );
if ( icon->heading().isSet() )
tempStyle.get<IconSymbol>()->heading()->setLiteral( feature->eval(iconHeadingExpr, &context) );
}
osg::Node* node = makePlaceNode(
context,
feature,
tempStyle,
textPriorityExpr);
if ( node )
{
if ( context.featureIndex() )
{
context.featureIndex()->tagNode(node, feature);
}
group->addChild( node );
}
}
//.........这里部分代码省略.........