本文整理汇总了C++中FilterContext::hasReferenceFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ FilterContext::hasReferenceFrame方法的具体用法?C++ FilterContext::hasReferenceFrame怎么用?C++ FilterContext::hasReferenceFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilterContext
的用法示例。
在下文中一共展示了FilterContext::hasReferenceFrame方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: xform
//.........这里部分代码省略.........
}
// extruded geometry
if ( extrusion && ( line || polygon ) )
{
if ( clampRequired )
{
ClampFilter clamp;
clamp.setIgnoreZ( altitude->clamping() == AltitudeSymbol::CLAMP_TO_TERRAIN );
if ( extrusion->heightReference() == ExtrusionSymbol::HEIGHT_REFERENCE_MSL )
clamp.setMaxZAttributeName( "__max_z");
cx = clamp.push( workingSet, cx );
clampRequired = false;
}
ExtrudeGeometryFilter extrude;
if ( extrusion )
{
if ( extrusion->height().isSet() )
extrude.setExtrusionHeight( *extrusion->height() );
if ( extrusion->heightExpression().isSet() )
extrude.setExtrusionExpr( *extrusion->heightExpression() );
//extrude.setHeightReferenceFrame( *extrusion->heightReference() );
if ( extrusion->heightReference() == ExtrusionSymbol::HEIGHT_REFERENCE_MSL )
extrude.setHeightOffsetExpression( NumericExpression("[__max_z]") );
extrude.setFlatten( *extrusion->flatten() );
}
if ( polygon )
{
extrude.setColor( polygon->fill()->color() );
}
osg::Node* node = extrude.push( workingSet, cx );
if ( node )
resultGroup->addChild( node );
}
// simple geometry
else if ( point || line || polygon )
{
if ( clampRequired )
{
ClampFilter clamp;
clamp.setIgnoreZ( altitude->clamping() == AltitudeSymbol::CLAMP_TO_TERRAIN );
cx = clamp.push( workingSet, cx );
clampRequired = false;
}
BuildGeometryFilter filter( style );
if ( _options.maxGranularity().isSet() )
filter.maxGranularity() = *_options.maxGranularity();
if ( _options.mergeGeometry().isSet() )
filter.mergeGeometry() = *_options.mergeGeometry();
if ( _options.featureName().isSet() )
filter.featureName() = *_options.featureName();
cx = filter.push( workingSet, cx );
osg::Node* node = filter.getNode();
if ( node )
resultGroup->addChild( node );
}
if ( text )
{
if ( clampRequired )
{
ClampFilter clamp;
clamp.setIgnoreZ( altitude->clamping() == AltitudeSymbol::CLAMP_TO_TERRAIN );
cx = clamp.push( workingSet, cx );
clampRequired = false;
}
BuildTextFilter filter( style );
cx = filter.push( workingSet, cx );
osg::Node* node = filter.takeNode();
if ( node )
resultGroup->addChild( node );
}
//else // insufficient symbology
//{
// OE_WARN << LC << "Insufficient symbology; no geometry created" << std::endl;
//}
// install the localization transform if necessary.
if ( cx.hasReferenceFrame() )
{
osg::MatrixTransform* delocalizer = new osg::MatrixTransform( cx.inverseReferenceFrame() );
delocalizer->addChild( resultGroup.get() );
resultGroup = delocalizer;
}
resultGroup->getOrCreateStateSet()->setMode( GL_BLEND, 1 );
//osgDB::writeNodeFile( *(resultGroup.get()), "out.osg" );
return resultGroup.release();
}
示例2: Point
FilterContext
BuildGeometryFilter::push( FeatureList& input, const FilterContext& context )
{
reset();
OE_DEBUG << LC
<< context.toString() << std::endl;
bool ok = true;
for( FeatureList::iterator i = input.begin(); i != input.end(); i++ )
if ( !push( i->get(), context ) )
ok = false;
// In a feature class with one point-per-feature, you end up with one geometry per point,
// which results is (a) very bad performance and (b) geometries with a zero bbox that therefore
// don't draw. This is not a total solution (won't work for a single point, isn't friendly for
// doing feature-selection, etc.) but is a workable temporary fix. In the future we're going
// to replace this filter anyway with something more highly optimized (a la osgGIS).
//
// however...seems that MERGE_GEOMETRY destroys almost everything except for points!!
if ( _mergeGeometry == true )
{
osgUtil::Optimizer optimizer;
optimizer.optimize( _geode.get(), osgUtil::Optimizer::MERGE_GEOMETRY );
}
if ( ok )
{
if ( !_style.empty() && _geode.valid() )
{
// could optimize this to only happen is lines or points were created ..
const LineSymbol* lineSymbol = _style.getSymbol<LineSymbol>();
float size = 1.0;
if (lineSymbol)
size = lineSymbol->stroke()->width().value();
_geode->getOrCreateStateSet()->setAttribute( new osg::Point(size), osg::StateAttribute::ON );
_geode->getOrCreateStateSet()->setAttribute( new osg::LineWidth(size), osg::StateAttribute::ON );
const PointSymbol* pointSymbol = _style.getSymbol<PointSymbol>();
if ( pointSymbol && pointSymbol->size().isSet() )
_geode->getOrCreateStateSet()->setAttribute(
new osg::Point( *pointSymbol->size() ), osg::StateAttribute::ON );
}
_result = _geode.release();
if ( context.hasReferenceFrame() )
{
osg::MatrixTransform* delocalizer = new osg::MatrixTransform( context.inverseReferenceFrame() );
delocalizer->addChild( _result.get() );
_result = delocalizer;
}
}
else
{
_result = 0L;
}
FilterContext outCx( context );
outCx.setReferenceFrame( osg::Matrixd::identity() ); // clear the ref frame.
return outCx;
}