本文整理汇总了C++中ExtensionInterface类的典型用法代码示例。如果您正苦于以下问题:C++ ExtensionInterface类的具体用法?C++ ExtensionInterface怎么用?C++ ExtensionInterface使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ExtensionInterface类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createInstance
ExtensionInterface* ExtensionFactory::createInstance(const QString& kind,
int keycode, int keymask)
{
ExtensionInterface* ext;
QString kindstr = kind.lower();
ext = loadInstance(kindstr, keycode, keymask);
if(ext != NULL){
return(ext);
}
if(kindstr == "switch"){
ext = new TaskSwitcher(kindstr);
} else if(kindstr == "select"){
ext = new TaskSelector(kindstr);
} else if(kindstr.find("launch") == 0){
ext = new KeyLauncher(kindstr);
} else if(kindstr.find("menu") == 0){
ext = new MenuLauncher(kindstr);
} else {
return(NULL);
}
ext->setKeycode(keycode);
ext->setKeymask(keymask);
m_oExtList.append(ext);
return(ext);
}
示例2:
void
MapNode::clearExtensions()
{
for(Extensions::iterator i = _extensions.begin(); i != _extensions.end(); ++i)
{
ExtensionInterface<MapNode>* extensionIF = ExtensionInterface<MapNode>::get( i->get() );
if ( extensionIF )
{
extensionIF->disconnect( this );
}
}
_extensions.clear();
}
示例3: VBox
//.........这里部分代码省略.........
{
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 );
}
示例4: VBox
//.........这里部分代码省略.........
}
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 );
}