本文整理汇总了C++中FilterContext::getDBOptions方法的典型用法代码示例。如果您正苦于以下问题:C++ FilterContext::getDBOptions方法的具体用法?C++ FilterContext::getDBOptions怎么用?C++ FilterContext::getDBOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilterContext
的用法示例。
在下文中一共展示了FilterContext::getDBOptions方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
bool
SubstituteModelFilter::findResource(const URI& uri,
const InstanceSymbol* symbol,
FilterContext& context,
std::set<URI>& missing,
osg::ref_ptr<InstanceResource>& output )
{
// be careful about refptrs here since _instanceCache is an LRU.
InstanceCache::Record rec;
if ( _instanceCache.get(uri, rec) )
{
// found it in the cache:
output = rec.value().get();
}
else if ( _resourceLib.valid() )
{
// look it up in the resource library:
output = _resourceLib->getInstance( uri.base(), context.getDBOptions() );
}
else
{
// create it on the fly:
output = symbol->createResource();
output->uri() = uri;
_instanceCache.insert( uri, output.get() );
}
// failed to find the instance.
if ( !output.valid() )
{
if ( missing.find(uri) == missing.end() )
{
missing.insert(uri);
OE_WARN << LC << "Failed to locate resource: " << uri.full() << std::endl;
}
}
return output.valid();
}
示例2: wallSkinPRNG
bool
ExtrudeGeometryFilter::process( FeatureList& features, FilterContext& context )
{
// seed our random number generators
Random wallSkinPRNG( _wallSkinSymbol.valid()? *_wallSkinSymbol->randomSeed() : 0, Random::METHOD_FAST );
Random roofSkinPRNG( _roofSkinSymbol.valid()? *_roofSkinSymbol->randomSeed() : 0, Random::METHOD_FAST );
for( FeatureList::iterator f = features.begin(); f != features.end(); ++f )
{
Feature* input = f->get();
GeometryIterator iter( input->getGeometry(), false );
while( iter.hasMore() )
{
Geometry* part = iter.next();
osg::ref_ptr<osg::Geometry> walls = new osg::Geometry();
walls->setUseVertexBufferObjects( _useVertexBufferObjects.get() );
osg::ref_ptr<osg::Geometry> rooflines = 0L;
osg::ref_ptr<osg::Geometry> baselines = 0L;
osg::ref_ptr<osg::Geometry> outlines = 0L;
if ( part->getType() == Geometry::TYPE_POLYGON )
{
rooflines = new osg::Geometry();
rooflines->setUseVertexBufferObjects( _useVertexBufferObjects.get() );
// prep the shapes by making sure all polys are open:
static_cast<Polygon*>(part)->open();
}
// fire up the outline geometry if we have a line symbol.
if ( _outlineSymbol != 0L )
{
outlines = new osg::Geometry();
outlines->setUseVertexBufferObjects( _useVertexBufferObjects.get() );
}
// make a base cap if we're doing stencil volumes.
if ( _makeStencilVolume )
{
baselines = new osg::Geometry();
baselines->setUseVertexBufferObjects( _useVertexBufferObjects.get() );
}
// calculate the extrusion height:
float height;
if ( _heightCallback.valid() )
{
height = _heightCallback->operator()(input, context);
}
else if ( _heightExpr.isSet() )
{
height = input->eval( _heightExpr.mutable_value(), &context );
}
else
{
height = *_extrusionSymbol->height();
}
// calculate the height offset from the base:
float offset = 0.0;
if ( _heightOffsetExpr.isSet() )
{
offset = input->eval( _heightOffsetExpr.mutable_value(), &context );
}
osg::ref_ptr<osg::StateSet> wallStateSet;
osg::ref_ptr<osg::StateSet> roofStateSet;
// calculate the wall texturing:
SkinResource* wallSkin = 0L;
if ( _wallSkinSymbol.valid() )
{
if ( _wallResLib.valid() )
{
SkinSymbol querySymbol( *_wallSkinSymbol.get() );
querySymbol.objectHeight() = fabs(height) - offset;
wallSkin = _wallResLib->getSkin( &querySymbol, wallSkinPRNG, context.getDBOptions() );
}
else
{
//TODO: simple single texture?
}
}
// calculate the rooftop texture:
SkinResource* roofSkin = 0L;
if ( _roofSkinSymbol.valid() )
{
if ( _roofResLib.valid() )
{
SkinSymbol querySymbol( *_roofSkinSymbol.get() );
roofSkin = _roofResLib->getSkin( &querySymbol, roofSkinPRNG, context.getDBOptions() );
}
else
//.........这里部分代码省略.........
示例3: wallSkinPRNG
bool
ExtrudeGeometryFilter::process( FeatureList& features, FilterContext& context )
{
// seed our random number generators
Random wallSkinPRNG( _wallSkinSymbol.valid()? *_wallSkinSymbol->randomSeed() : 0, Random::METHOD_FAST );
Random roofSkinPRNG( _roofSkinSymbol.valid()? *_roofSkinSymbol->randomSeed() : 0, Random::METHOD_FAST );
for( FeatureList::iterator f = features.begin(); f != features.end(); ++f )
{
Feature* input = f->get();
GeometryIterator iter( input->getGeometry(), false );
while( iter.hasMore() )
{
Geometry* part = iter.next();
osg::ref_ptr<osg::Geometry> walls = new osg::Geometry();
walls->setUseVertexBufferObjects( _useVertexBufferObjects.get() );
osg::ref_ptr<osg::Geometry> rooflines = 0L;
osg::ref_ptr<osg::Geometry> baselines = 0L;
osg::ref_ptr<osg::Geometry> outlines = 0L;
if ( part->getType() == Geometry::TYPE_POLYGON )
{
rooflines = new osg::Geometry();
rooflines->setUseVertexBufferObjects( _useVertexBufferObjects.get() );
// prep the shapes by making sure all polys are open:
static_cast<Polygon*>(part)->open();
}
// fire up the outline geometry if we have a line symbol.
if ( _outlineSymbol != 0L )
{
outlines = new osg::Geometry();
outlines->setUseVertexBufferObjects( _useVertexBufferObjects.get() );
}
// make a base cap if we're doing stencil volumes.
if ( _makeStencilVolume )
{
baselines = new osg::Geometry();
baselines->setUseVertexBufferObjects( _useVertexBufferObjects.get() );
}
// calculate the extrusion height:
float height;
if ( _heightCallback.valid() )
{
height = _heightCallback->operator()(input, context);
}
else if ( _heightExpr.isSet() )
{
height = input->eval( _heightExpr.mutable_value(), &context );
}
else
{
height = *_extrusionSymbol->height();
}
// calculate the height offset from the base:
float offset = 0.0;
if ( _heightOffsetExpr.isSet() )
{
offset = input->eval( _heightOffsetExpr.mutable_value(), &context );
}
osg::ref_ptr<osg::StateSet> wallStateSet;
osg::ref_ptr<osg::StateSet> roofStateSet;
// calculate the wall texturing:
SkinResource* wallSkin = 0L;
if ( _wallSkinSymbol.valid() )
{
if ( _wallResLib.valid() )
{
SkinSymbol querySymbol( *_wallSkinSymbol.get() );
querySymbol.objectHeight() = fabs(height) - offset;
wallSkin = _wallResLib->getSkin( &querySymbol, wallSkinPRNG, context.getDBOptions() );
}
else
{
//TODO: simple single texture?
}
}
// calculate the rooftop texture:
SkinResource* roofSkin = 0L;
if ( _roofSkinSymbol.valid() )
{
if ( _roofResLib.valid() )
{
SkinSymbol querySymbol( *_roofSkinSymbol.get() );
roofSkin = _roofResLib->getSkin( &querySymbol, roofSkinPRNG, context.getDBOptions() );
}
else
//.........这里部分代码省略.........
示例4: markerURI
bool
SubstituteModelFilter::process(const FeatureList& features,
const MarkerSymbol* symbol,
Session* session,
osg::Group* attachPoint,
FilterContext& context )
{
bool makeECEF = context.getSession()->getMapInfo().isGeocentric();
// first, go through the features and build the model cache. Apply the model matrix' scale
// factor to any AutoTransforms directly (cloning them as necessary)
std::map< std::pair<URI, float>, osg::ref_ptr<osg::Node> > uniqueModels;
StringExpression uriEx = *symbol->url();
NumericExpression scaleEx = *symbol->scale();
for( FeatureList::const_iterator f = features.begin(); f != features.end(); ++f )
{
Feature* input = f->get();
// evaluate the marker URI expression:
StringExpression uriEx = *symbol->url();
URI markerURI( input->eval(uriEx, &context), uriEx.uriContext() );
// find the corresponding marker in the cache
MarkerResource* marker = 0L;
MarkerCache::Record rec = _markerCache.get( markerURI );
if ( rec.valid() ) {
marker = rec.value();
}
else if ( _markerLib.valid() ) {
marker = _markerLib->getMarker( markerURI.base(), context.getDBOptions() );
}
else {
marker = new MarkerResource();
marker->uri() = markerURI;
_markerCache.insert( markerURI, marker );
}
// evalute the scale expression (if there is one)
float scale = 1.0f;
osg::Matrixd scaleMatrix;
if ( symbol->scale().isSet() )
{
scale = input->eval( scaleEx, &context );
if ( scale == 0.0 )
scale = 1.0;
scaleMatrix = osg::Matrix::scale( scale, scale, scale );
}
osg::Matrixd rotationMatrix;
if ( symbol->orientation().isSet() )
{
osg::Vec3d hpr = *symbol->orientation();
//Rotation in HPR
//Apply the rotation
rotationMatrix.makeRotate(
osg::DegreesToRadians(hpr.y()), osg::Vec3(1,0,0),
osg::DegreesToRadians(hpr.x()), osg::Vec3(0,0,1),
osg::DegreesToRadians(hpr.z()), osg::Vec3(0,1,0) );
}
// how that we have a marker source, create a node for it
std::pair<URI,float> key( markerURI, scale );
osg::ref_ptr<osg::Node>& model = uniqueModels[key];
if ( !model.valid() )
{
model = context.resourceCache()->getMarkerNode( marker );
if ( scale != 1.0f && dynamic_cast<osg::AutoTransform*>( model.get() ) )
{
// clone the old AutoTransform, set the new scale, and copy over its children.
osg::AutoTransform* oldAT = dynamic_cast<osg::AutoTransform*>(model.get());
osg::AutoTransform* newAT = osg::clone( oldAT );
// make a scaler and put it between the new AutoTransform and its kids
osg::MatrixTransform* scaler = new osg::MatrixTransform(osg::Matrix::scale(scale,scale,scale));
for( unsigned i=0; i<newAT->getNumChildren(); ++i )
scaler->addChild( newAT->getChild(0) );
newAT->removeChildren(0, newAT->getNumChildren());
newAT->addChild( scaler );
model = newAT;
}
}
if ( model.valid() )
{
GeometryIterator gi( input->getGeometry(), false );
while( gi.hasMore() )
{
Geometry* geom = gi.next();
for( unsigned i=0; i<geom->size(); ++i )
{
osg::Matrixd mat;
osg::Vec3d point = (*geom)[i];
if ( makeECEF )
{
//.........这里部分代码省略.........
示例5: scriptExpr
//.........这里部分代码省略.........
}
if ( modelSymbol->scaleY().isSet() )
{
scaleVec.y() *= input->eval( scaleYEx, &context );
}
if ( modelSymbol->scaleZ().isSet() )
{
scaleVec.z() *= input->eval( scaleZEx, &context );
}
}
if ( scaleVec.x() == 0.0 ) scaleVec.x() = 1.0;
if ( scaleVec.y() == 0.0 ) scaleVec.y() = 1.0;
if ( scaleVec.z() == 0.0 ) scaleVec.z() = 1.0;
scaleMatrix = osg::Matrix::scale( scaleVec );
osg::Matrixd rotationMatrix;
if ( modelSymbol && modelSymbol->heading().isSet() )
{
float heading = input->eval(headingEx, &context);
rotationMatrix.makeRotate( osg::Quat(osg::DegreesToRadians(heading), osg::Vec3(0,0,1)) );
}
// how that we have a marker source, create a node for it
std::pair<URI,float> key( instanceURI, iconSymbol? scale : 1.0f ); //use 1.0 for models, since we don't want unique models based on scaling
// cache nodes per instance.
osg::ref_ptr<osg::Node>& model = uniqueModels[key];
if ( !model.valid() )
{
// Always clone the cached instance so we're not processing data that's
// already in the scene graph. -gw
context.resourceCache()->cloneOrCreateInstanceNode(instance.get(), model, context.getDBOptions());
// if icon decluttering is off, install an AutoTransform.
if ( iconSymbol )
{
if ( iconSymbol->declutter() == true )
{
ScreenSpaceLayout::activate(model->getOrCreateStateSet());
}
else if ( dynamic_cast<osg::AutoTransform*>(model.get()) == 0L )
{
osg::AutoTransform* at = new osg::AutoTransform();
at->setAutoRotateMode( osg::AutoTransform::ROTATE_TO_SCREEN );
at->setAutoScaleToScreen( true );
at->addChild( model );
model = at;
}
}
}
if ( model.valid() )
{
GeometryIterator gi( input->getGeometry(), false );
while( gi.hasMore() )
{
Geometry* geom = gi.next();
// if necessary, transform the points to the target SRS:
if ( !makeECEF && !targetSRS->isEquivalentTo(context.profile()->getSRS()) )
{
context.profile()->getSRS()->transform( geom->asVector(), targetSRS );
}