本文整理汇总了C++中ExtensionInterface::connect方法的典型用法代码示例。如果您正苦于以下问题:C++ ExtensionInterface::connect方法的具体用法?C++ ExtensionInterface::connect怎么用?C++ ExtensionInterface::connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExtensionInterface
的用法示例。
在下文中一共展示了ExtensionInterface::connect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
MapNode::addExtension(Extension* extension, const osgDB::Options* options)
{
if ( extension )
{
_extensions.push_back( extension );
// set the IO options is they were provided:
if ( options )
extension->setDBOptions( options );
// start it.
ExtensionInterface<MapNode>* extensionIF = ExtensionInterface<MapNode>::get(extension);
if ( extensionIF )
{
extensionIF->connect( this );
}
}
}
示例2: options
//.........这里部分代码省略.........
{
OE_INFO << LC << "Activating logarithmic depth buffer (vertex-only) on main camera" << std::endl;
osgEarth::Util::LogarithmicDepthBuffer logDepth;
logDepth.setUseFragDepth( false );
logDepth.install( view->getCamera() );
}
// Scan for images if necessary.
if ( !imageFolder.empty() )
{
std::vector<std::string> extensions;
if ( !imageExtensions.empty() )
StringTokenizer( imageExtensions, extensions, ",;", "", false, true );
if ( extensions.empty() )
extensions.push_back( "tif" );
OE_INFO << LC << "Loading images from " << imageFolder << "..." << std::endl;
ImageLayerVector imageLayers;
DataScanner scanner;
scanner.findImageLayers( imageFolder, extensions, imageLayers );
if ( imageLayers.size() > 0 )
{
mapNode->getMap()->beginUpdate();
for( ImageLayerVector::iterator i = imageLayers.begin(); i != imageLayers.end(); ++i )
{
mapNode->getMap()->addImageLayer( i->get() );
}
mapNode->getMap()->endUpdate();
}
OE_INFO << LC << "...found " << imageLayers.size() << " image layers." << std::endl;
}
// Install elevation morphing
if ( !lodBlendingConf.empty() )
{
mapNode->getTerrainEngine()->addEffect( new LODBlending(lodBlendingConf) );
}
// Install vertical scaler
if ( !vertScaleConf.empty() )
{
mapNode->getTerrainEngine()->addEffect( new VerticalScale(vertScaleConf) );
}
// Install a contour map effect.
if ( !contourMapConf.empty() )
{
mapNode->getTerrainEngine()->addEffect( new ContourMap(contourMapConf) );
}
// Generic named value uniform with min/max.
VBox* uniformBox = 0L;
while( args.find( "--uniform" ) >= 0 )
{
std::string name;
float minval, maxval;
if ( args.read( "--uniform", name, minval, maxval ) )
{
if ( uniformBox == 0L )
{
uniformBox = new VBox();
uniformBox->setBackColor(0,0,0,0.5);
uniformBox->setAbsorbEvents( true );
canvas->addControl( uniformBox );
}
osg::Uniform* uniform = new osg::Uniform(osg::Uniform::FLOAT, name);
uniform->set( minval );
root->getOrCreateStateSet()->addUniform( uniform, osg::StateAttribute::OVERRIDE );
HBox* box = new HBox();
box->addControl( new LabelControl(name) );
HSliderControl* hs = box->addControl( new HSliderControl(minval, maxval, minval, new ApplyValueUniform(uniform)));
hs->setHorizFill(true, 200);
box->addControl( new LabelControl(hs) );
uniformBox->addControl( box );
OE_INFO << LC << "Installed uniform controller for " << name << std::endl;
}
}
// Process extensions.
for(std::vector<osg::ref_ptr<Extension> >::const_iterator eiter = mapNode->getExtensions().begin();
eiter != mapNode->getExtensions().end();
++eiter)
{
Extension* e = eiter->get();
// Check for a View interface:
ExtensionInterface<osg::View>* viewIF = ExtensionInterface<osg::View>::get( e );
if ( viewIF )
viewIF->connect( view );
// Check for a Control interface:
ExtensionInterface<Control>* controlIF = ExtensionInterface<Control>::get( e );
if ( controlIF )
controlIF->connect( mainContainer );
}
root->addChild( canvas );
}
示例3: if
//.........这里部分代码省略.........
}
OE_INFO << LC << "...found " << imageLayers.size() << " image layers." << std::endl;
}
// Install elevation morphing
if ( !lodBlendingConf.empty() )
{
mapNode->getTerrainEngine()->addEffect( new LODBlending(lodBlendingConf) );
}
// Install vertical scaler
if ( !vertScaleConf.empty() )
{
mapNode->getTerrainEngine()->addEffect( new VerticalScale(vertScaleConf) );
}
// Install a contour map effect.
if (args.read("--contourmap"))
{
mapNode->addExtension(Extension::create("contourmap", ConfigOptions()));
// with the cmdline switch, hids all the image layer so we can see the contour map.
for (unsigned i = 0; i < mapNode->getMap()->getNumImageLayers(); ++i) {
mapNode->getMap()->getImageLayerAt(i)->setVisible(false);
}
}
// Generic named value uniform with min/max.
VBox* uniformBox = 0L;
while( args.find( "--uniform" ) >= 0 )
{
std::string name;
float minval, maxval;
if ( args.read( "--uniform", name, minval, maxval ) )
{
if ( uniformBox == 0L )
{
uniformBox = new VBox();
uniformBox->setBackColor(0,0,0,0.5);
uniformBox->setAbsorbEvents( true );
canvas->addControl( uniformBox );
}
osg::Uniform* uniform = new osg::Uniform(osg::Uniform::FLOAT, name);
uniform->set( minval );
root->getOrCreateStateSet()->addUniform( uniform, osg::StateAttribute::OVERRIDE );
HBox* box = new HBox();
box->addControl( new LabelControl(name) );
HSliderControl* hs = box->addControl( new HSliderControl(minval, maxval, minval, new ApplyValueUniform(uniform)));
hs->setHorizFill(true, 200);
box->addControl( new LabelControl(hs) );
uniformBox->addControl( box );
OE_INFO << LC << "Installed uniform controller for " << name << std::endl;
}
}
// Map inspector:
if (args.read("--inspect"))
{
mapNode->addExtension( Extension::create("mapinspector", ConfigOptions()) );
}
// Memory monitor:
if (args.read("--monitor"))
{
mapNode->addExtension(Extension::create("monitor", ConfigOptions()) );
}
// Simple sky model:
if (args.read("--sky"))
{
mapNode->addExtension(Extension::create("sky_simple", ConfigOptions()) );
}
// Simple ocean model:
if (args.read("--ocean"))
{
mapNode->addExtension(Extension::create("ocean_simple", ConfigOptions()));
}
// Hook up the extensions!
for(std::vector<osg::ref_ptr<Extension> >::const_iterator eiter = mapNode->getExtensions().begin();
eiter != mapNode->getExtensions().end();
++eiter)
{
Extension* e = eiter->get();
// Check for a View interface:
ExtensionInterface<osg::View>* viewIF = ExtensionInterface<osg::View>::get( e );
if ( viewIF )
viewIF->connect( view );
// Check for a Control interface:
ExtensionInterface<Control>* controlIF = ExtensionInterface<Control>::get( e );
if ( controlIF )
controlIF->connect( mainContainer );
}
root->addChild( canvas );
}