当前位置: 首页>>代码示例>>C++>>正文


C++ TileSource::getOptions方法代码示例

本文整理汇总了C++中TileSource::getOptions方法的典型用法代码示例。如果您正苦于以下问题:C++ TileSource::getOptions方法的具体用法?C++ TileSource::getOptions怎么用?C++ TileSource::getOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TileSource的用法示例。


在下文中一共展示了TileSource::getOptions方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

void
CompositeTileSource::initialize( const std::string& referenceURI, const Profile* overrideProfile )
{
    osg::ref_ptr<const Profile> profile = overrideProfile;

    for(CompositeTileSourceOptions::ComponentVector::iterator i = _options._components.begin();
        i != _options._components.end();
        ++i)
    {
        TileSource* source = i->_tileSourceInstance.get();
        if ( source )
        {
            osg::ref_ptr<const Profile> localOverrideProfile = overrideProfile;

            const TileSourceOptions& opt = source->getOptions();
            if ( opt.profile().isSet() )
                localOverrideProfile = Profile::create( opt.profile().value() );

            source->initialize( referenceURI, localOverrideProfile.get() );

            if ( !profile.valid() )
            {
                // assume the profile of the first source to be the overall profile.
                profile = source->getProfile();
            }
            else if ( !profile->isEquivalentTo( source->getProfile() ) )
            {
                // if sub-sources have different profiles, print a warning because this is
                // not supported!
                OE_WARN << LC << "Components with differing profiles are not supported. " 
                    << "Visual anomalies may result." << std::endl;
            }
            
            _dynamic = _dynamic || source->isDynamic();

            // gather extents
            const DataExtentList& extents = source->getDataExtents();
            for( DataExtentList::const_iterator j = extents.begin(); j != extents.end(); ++j )
            {
                getDataExtents().push_back( *j );
            }
        }
    }

    setProfile( profile.get() );

    _initialized = true;
}
开发者ID:hulumogu,项目名称:osgearth,代码行数:48,代码来源:CompositeTileSource.cpp

示例2: shared

CacheBin*
TerrainLayer::getCacheBin( const Profile* profile, const std::string& binId )
{
    // make sure we've initialized the tile source first.
    TileSource* tileSource = getTileSource();

    // in no-cache mode, there are no cache bins.
    if ( getCachePolicy() == CachePolicy::NO_CACHE )
    {
        return 0L;
    }

    // if cache is not setted, return NULL
    if (_cache == NULL)
    {
        return 0L;
    }

    // see if the cache bin already exists and return it if so
    {
        Threading::ScopedReadLock shared(_cacheBinsMutex);
        CacheBinInfoMap::iterator i = _cacheBins.find( binId );
        if ( i != _cacheBins.end() )
            return i->second._bin.get();
    }

    // create/open the cache bin.
    {
        Threading::ScopedWriteLock exclusive(_cacheBinsMutex);

        // double-check:
        CacheBinInfoMap::iterator i = _cacheBins.find( binId );
        if ( i != _cacheBins.end() )
            return i->second._bin.get();

        // add the new bin:
        osg::ref_ptr<CacheBin> newBin = _cache->addBin( binId );

        // and configure:
        if ( newBin.valid() )
        {
            // attempt to read the cache metadata:
            CacheBinMetadata meta( newBin->readMetadata() );

            if ( meta.isValid() ) // cache exists and is valid.
            {
                // verify that the cache if compatible with the tile source:
                if ( tileSource && getProfile() )
                {
                    //todo: check the profile too
                    if ( *meta._sourceDriver != tileSource->getOptions().getDriver() )
                    {
                        OE_WARN << LC << "Cache has an incompatible driver or profile... disabling"
                            << std::endl;
                        setCachePolicy( CachePolicy::NO_CACHE );
                        return 0L;
                    }
                }   

                else if ( isCacheOnly() && !_profile.valid() )
                {
                    // in cacheonly mode, create a profile from the first cache bin accessed
                    // (they SHOULD all be the same...)
                    _profile = Profile::create( *meta._sourceProfile );
                    _tileSize = *meta._sourceTileSize;
                }
            }

            else
            {
                // cache does not exist, so try to create it. A valid TileSource is necessary
                // for this.
                if ( tileSource && getProfile() )
                {
                    // no existing metadata; create some.
                    meta._cacheBinId      = binId;
                    meta._sourceName      = this->getName();
                    meta._sourceDriver    = tileSource->getOptions().getDriver();
                    meta._sourceTileSize  = getTileSize();
                    meta._sourceProfile   = getProfile()->toProfileOptions();
                    meta._cacheProfile    = profile->toProfileOptions();
                    meta._cacheCreateTime = DateTime().asTimeStamp();

                    // store it in the cache bin.
                    newBin->writeMetadata( meta.getConfig() );
                }
                else if ( isCacheOnly() )
                {
                    OE_WARN << LC <<
                        "Failed to open a cache for layer "
                        "because cache_only policy is in effect and bin [" << binId << "] "
                        "could not be located."
                        << std::endl;
                    return 0L;
                }
                else
                {
                    OE_WARN << LC <<
                        "Failed to create cache bin [" << binId << "] "
                        "because there is no valid tile source."
//.........这里部分代码省略.........
开发者ID:DavidLeehome,项目名称:osgearth,代码行数:101,代码来源:TerrainLayer.cpp

示例3: if

TileSource::Status
CompositeTileSource::initialize(const osgDB::Options* dbOptions)
{
    _dbOptions = Registry::instance()->cloneOrCreateOptions(dbOptions);

    osg::ref_ptr<const Profile> profile = getProfile();

    for(CompositeTileSourceOptions::ComponentVector::iterator i = _options._components.begin();
        i != _options._components.end(); )
    {
        if ( i->_imageLayerOptions.isSet() )
        {
            if ( !i->_tileSourceInstance.valid() )
            {
                i->_tileSourceInstance = TileSourceFactory::create( i->_imageLayerOptions->driver().value() );
            
                if ( !i->_tileSourceInstance.valid() )
                {
                    OE_WARN << LC << "Could not find a TileSource for driver [" << i->_imageLayerOptions->driver()->getDriver() << "]" << std::endl;
                }
            }
        }

        if ( !i->_tileSourceInstance.valid() )
        {
            OE_WARN << LC << "A component has no valid TileSource ... removing." << std::endl;
            i = _options._components.erase( i );
        }
        else
        {
            TileSource* source = i->_tileSourceInstance.get();
            if ( source )
            {
                osg::ref_ptr<const Profile> localOverrideProfile = profile.get();

                const TileSourceOptions& opt = source->getOptions();
                if ( opt.profile().isSet() )
                {
                    localOverrideProfile = Profile::create( opt.profile().value() );
                    source->setProfile( localOverrideProfile.get() );
                }

                // initialize the component tile source:
                TileSource::Status compStatus = source->startup( _dbOptions.get() );

                if ( compStatus == TileSource::STATUS_OK )
                {
                    if ( !profile.valid() )
                    {
                        // assume the profile of the first source to be the overall profile.
                        profile = source->getProfile();
                    }
                    else if ( !profile->isEquivalentTo( source->getProfile() ) )
                    {
                        // if sub-sources have different profiles, print a warning because this is
                        // not supported!
                        OE_WARN << LC << "Components with differing profiles are not supported. " 
                            << "Visual anomalies may result." << std::endl;
                    }
                
                    _dynamic = _dynamic || source->isDynamic();

                    // gather extents
                    const DataExtentList& extents = source->getDataExtents();
                    for( DataExtentList::const_iterator j = extents.begin(); j != extents.end(); ++j )
                    {
                        getDataExtents().push_back( *j );
                    }
                }

                else
                {
                    // if even one of the components fails to initialize, the entire
                    // composite tile source is invalid.
                    return Status::Error("At least one component is invalid");
                }
            }
        }

        ++i;
    }

    // set the new profile that was derived from the components
    setProfile( profile.get() );

    _initialized = true;
    return STATUS_OK;
}
开发者ID:WojtekLewandowski,项目名称:osgearth,代码行数:88,代码来源:CompositeTileSource.cpp

示例4: if

void
CompositeTileSource::initialize(const osgDB::Options* dbOptions, 
                                const Profile*        overrideProfile )
{
    _dbOptions = dbOptions;
    osg::ref_ptr<const Profile> profile = overrideProfile;

    for(CompositeTileSourceOptions::ComponentVector::iterator i = _options._components.begin();
        i != _options._components.end(); )
    {
        if ( i->_imageLayerOptions.isSet() )
        {
            if ( !i->_tileSourceInstance.valid() )
            {
                i->_tileSourceInstance = TileSourceFactory::create( i->_imageLayerOptions->driver().value() );
            
                if ( !i->_tileSourceInstance.valid() )
                {
                    OE_WARN << LC << "Could not find a TileSource for driver [" << i->_imageLayerOptions->driver()->getDriver() << "]" << std::endl;
                }
            }
        }

        if ( !i->_tileSourceInstance.valid() )
        {
            OE_WARN << LC << "A component has no valid TileSource ... removing." << std::endl;
            i = _options._components.erase( i );
        }
        else
        {
            TileSource* source = i->_tileSourceInstance.get();
            if ( source )
            {
                osg::ref_ptr<const Profile> localOverrideProfile = overrideProfile;

                const TileSourceOptions& opt = source->getOptions();
                if ( opt.profile().isSet() )
                    localOverrideProfile = Profile::create( opt.profile().value() );

                source->initialize( dbOptions, localOverrideProfile.get() );

                if ( !profile.valid() )
                {
                    // assume the profile of the first source to be the overall profile.
                    profile = source->getProfile();
                }
                else if ( !profile->isEquivalentTo( source->getProfile() ) )
                {
                    // if sub-sources have different profiles, print a warning because this is
                    // not supported!
                    OE_WARN << LC << "Components with differing profiles are not supported. " 
                        << "Visual anomalies may result." << std::endl;
                }
                
                _dynamic = _dynamic || source->isDynamic();

                // gather extents
                const DataExtentList& extents = source->getDataExtents();
                for( DataExtentList::const_iterator j = extents.begin(); j != extents.end(); ++j )
                {
                    getDataExtents().push_back( *j );
                }
            }
        }

        ++i;
    }

    setProfile( profile.get() );

    _initialized = true;
}
开发者ID:,项目名称:,代码行数:72,代码来源:


注:本文中的TileSource::getOptions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。