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


C++ const_iterator::value方法代码示例

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


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

示例1: uri

void
ShaderOptions::fromConfig(const Config& conf)
{
    _code = conf.value();

    _samplers.clear();
    ConfigSet s = conf.children("sampler");
    for (ConfigSet::const_iterator i = s.begin(); i != s.end(); ++i) {
        _samplers.push_back(Sampler());
        _samplers.back()._name = i->value("name");
        const Config* urlarray = i->find("array");
        if (urlarray) {
            ConfigSet uris = urlarray->children("url");
            for (ConfigSet::const_iterator j = uris.begin(); j != uris.end(); ++j) {
                URI uri(j->value(), URIContext(conf.referrer()));
                _samplers.back()._uris.push_back(uri);
            }
        }
        else {
            optional<URI> uri;
            i->get("url", uri);
            if (uri.isSet())
                _samplers.back()._uris.push_back(uri.get());
        }
    }

    s = conf.children("uniform");
    for (ConfigSet::const_iterator i = s.begin(); i != s.end(); ++i) {
        _uniforms.push_back(Uniform());
        _uniforms.back()._name = i->value("name");
        i->get("value", _uniforms.back()._value);
    }
}
开发者ID:aroth-fastprotect,项目名称:osgearth,代码行数:33,代码来源:LayerShader.cpp

示例2: TileMapEntry

bool
TileMapServiceReader::read( const Config& conf, TileMapEntryList& tileMaps)
{    
    const Config* TileMapServiceConf = conf.find("tilemapservice");

    if (!TileMapServiceConf)
    {
        OE_NOTICE << "Couldn't find root TileMapService element" << std::endl;
        return false;
    }

    const Config* TileMapsConf = TileMapServiceConf->find("tilemaps");
    if (TileMapsConf)
    {
        const ConfigSet& TileMaps = TileMapsConf->children("tilemap");
        if (TileMaps.size() == 0)
        {            
            return false;
        }
        
        for (ConfigSet::const_iterator itr = TileMaps.begin(); itr != TileMaps.end(); ++itr)
        {
            std::string href = itr->value("href");
            std::string title = itr->value("title");
            std::string profile = itr->value("profile");
            std::string srs = itr->value("srs");            

            tileMaps.push_back( TileMapEntry( title, href, srs, profile ) );
        }        

        return true;
    }    
    return false;
}
开发者ID:Arlockff,项目名称:osgearth,代码行数:34,代码来源:TMS.cpp

示例3: Region

Biome::Biome(const Config& conf)
{
    conf.getIfSet( "name", _name );
    conf.getIfSet( "catalog", _catalogURI );
    
    // only supports lat long for now
    const SpatialReference* srs = SpatialReference::create("wgs84");
    
    const Config& extentsConf = conf.child("regions");
    for(ConfigSet::const_iterator i = extentsConf.children().begin();
        i != extentsConf.children().end();
        ++i)
    {
        double xmin = i->value("xmin", -DBL_MAX);
        double xmax = i->value("xmax",  DBL_MAX);
        double ymin = i->value("ymin", -DBL_MAX);
        double ymax = i->value("ymax",  DBL_MAX);
        double zmin = i->value("zmin", -DBL_MAX);
        double zmax = i->value("zmax",  DBL_MAX);
        
        _regions.push_back( Region() );
        _regions.back().extent = GeoExtent(srs, xmin, ymin, xmax, ymax);
        _regions.back().zmin  = zmin;
        _regions.back().zmax  = zmax;
    }
}
开发者ID:Brucezhou1979,项目名称:osgearth,代码行数:26,代码来源:Biome.cpp

示例4: e

TerrainLayer::CacheBinMetadata::CacheBinMetadata(const Config& conf)
{
    _valid = !conf.empty();

    conf.getIfSet("cachebin_id", _cacheBinId);
    conf.getIfSet("source_name", _sourceName);
    conf.getIfSet("source_driver", _sourceDriver);
    conf.getIfSet("source_tile_size", _sourceTileSize);
    conf.getObjIfSet("source_profile", _sourceProfile);
    conf.getObjIfSet("cache_profile", _cacheProfile);
    conf.getIfSet("cache_create_time", _cacheCreateTime);

    const Config* extentsRoot = conf.child_ptr("extents");
    if ( extentsRoot )
    {
        const ConfigSet& extents = extentsRoot->children();

        for (ConfigSet::const_iterator i = extents.begin(); i != extents.end(); ++i)
        {
            std::string srsString;
            double xmin, ymin, xmax, ymax;
            optional<unsigned> minLevel, maxLevel;
        
            srsString = i->value("srs");
            xmin = i->value("xmin", 0.0f);
            ymin = i->value("ymin", 0.0f);
            xmax = i->value("xmax", 0.0f);
            ymax = i->value("ymax", 0.0f);
            i->getIfSet("minlevel", minLevel);
            i->getIfSet("maxlevel", maxLevel);

            const SpatialReference* srs = SpatialReference::get(srsString);
            DataExtent e( GeoExtent(srs, xmin,  ymin, xmax, ymax) );
            if (minLevel.isSet())
                e.minLevel() = minLevel.get();
            if (maxLevel.isSet())
                e.maxLevel() = maxLevel.get();

            _dataExtents.push_back(e);
        }
    }

    // check for validity. This will reject older caches that don't have
    // sufficient attribution.
    if (_valid)
    {
        if (!conf.hasValue("source_tile_size") ||
            !conf.hasChild("source_profile") ||
            !conf.hasChild("cache_profile"))
        {
            _valid = false;
        }
    }
}
开发者ID:caishanli,项目名称:osgearth,代码行数:54,代码来源:TerrainLayer.cpp

示例5: URIContext

void
KML_Model::parseStyle(const Config& conf, KMLContext& cx, Style& style)
{    
    ModelSymbol* model = 0L;
    
    std::string url = KMLUtils::parseLink(conf);
    if ( !url.empty() )
    {
        if ( !model ) model = style.getOrCreate<ModelSymbol>();
        model->url()->setLiteral( url );
        model->url()->setURIContext( URIContext(conf.referrer()) );
    }

    Config scale = conf.child("scale");
    if (!scale.empty())
    {
        if ( !model ) model = style.getOrCreate<ModelSymbol>();
        //TODO:  Support XYZ scale instead of single value
        model->scale() = scale.value("x", 1.0);
    }

    Config orientation = conf.child("orientation");
    if (!orientation.empty())
    {
        if ( !model ) model = style.getOrCreate<ModelSymbol>();
        
        double h = orientation.value("heading", 0);
        if ( !osg::equivalent(h, 0.0) )
            model->heading() = NumericExpression( h );

        double p = orientation.value("tilt", 0);
        if ( !osg::equivalent(p, 0.0) )
            model->pitch() = NumericExpression( p );

        double r = orientation.value("roll", 0);
        if ( !osg::equivalent(r, 0.0) )
            model->roll() = NumericExpression( r );
    }

    // Read and store file path aliases from a KML ResourceMap.
    Config resource_map = conf.child("resourcemap");
    if ( !resource_map.empty() )
    {
        const ConfigSet aliases = resource_map.children("alias");
        for( ConfigSet::const_iterator i = aliases.begin(); i != aliases.end(); ++i )
        {
            std::string source = i->value("sourcehref");
            std::string target = i->value("targethref");
            if ( !source.empty() || !target.empty() )
            {
                if ( !model ) model = style.getOrCreate<ModelSymbol>();
                model->uriAliasMap()->insert( source, target );
            }
        }
    }

    KML_Geometry::parseStyle(conf, cx, style);
}
开发者ID:JohnDr,项目名称:osgearth,代码行数:58,代码来源:KML_Model.cpp

示例6: XmlElement

XmlElement::XmlElement( const Config& conf )
{
    name = conf.key();
    for( Properties::const_iterator i = conf.attrs().begin(); i != conf.attrs().end(); i++ )
        attrs[i->first] = i->second;
    for( ConfigSet::const_iterator j = conf.children().begin(); j != conf.children().end(); j++ )
    {
        if (!j->children().empty())
        {
            children.push_back( new XmlElement( *j ) );
        }
        else
        {
            addSubElement(j->key(), j->attrs(), j->value());
        }
    }
}
开发者ID:jehc,项目名称:osgearth,代码行数:17,代码来源:XmlUtils.cpp

示例7: end

void ChromeMetricsBackend::end(const std::string& name, const Config& args)
{
    osg::Timer_t now = osg::Timer::instance()->tick();

    OpenThreads::ScopedLock< OpenThreads::Mutex > lk(_mutex);
    if (_firstEvent)
    {
        _firstEvent = false;
    }
    else
    {
        _metricsFile << "," << std::endl;
    }
    _metricsFile << "{"
        << "\"cat\": \"" << "" << "\","
        << "\"pid\": \"" << 0 << "\","
        << "\"tid\": \"" << osgEarth::Threading::getCurrentThreadId() << "\","
        << "\"ts\": \""  << std::setprecision(9) << osg::Timer::instance()->delta_u(_startTime, now) << "\","
        << "\"ph\": \"E\","
        << "\"name\": \""  << name << "\"";

    if (!args.empty())
    {
        _metricsFile << "," << std::endl << " \"args\": {";
        bool first = true;
        for( ConfigSet::const_iterator i = args.children().begin(); i != args.children().end(); ++i ) {
            if (first)
            {
                first = !first;
            }
            else
            {
                _metricsFile << "," << std::endl;
            }
            _metricsFile << "\"" << i->key() << "\" : \"" << i->value() << "\"";
        }
        _metricsFile << "}";
    }

    _metricsFile << "}";
}
开发者ID:JD31,项目名称:osgearth,代码行数:41,代码来源:Metrics.cpp

示例8: if

XmlElement::XmlElement( const Config& conf )
{
    name = conf.key();

    if ( !conf.value().empty() )
    {
        children.push_back( new XmlText(conf.value()) );
    }

    for( ConfigSet::const_iterator j = conf.children().begin(); j != conf.children().end(); j++ )
    {
        if ( j->isSimple() )
        {
            attrs[j->key()] = j->value();
        }
        else if ( j->children().size() > 0 )
        {
            children.push_back( new XmlElement(*j) );
        }
    }
}
开发者ID:JohnDr,项目名称:osgearth,代码行数:21,代码来源:XmlUtils.cpp

示例9: createImage

    /**
     * Create and return an image for the given TileKey.
     */
    osg::Image* createImage( const TileKey& key, ProgressCallback* progress )
    {
        if (_debugDirect)
        {
            //osg::Image* image = new osg::Image;
            //image->allocateImage(256,256,1, GL_RGB, GL_UNSIGNED_BYTE);
            //return image;

            return osgDB::readImageFile( getDirectURI(key) );
            //return URI(getDirectURI(key)).getImage(_dbOptions.get(), progress);
        }

        // center point of the tile (will be in spherical mercator)
        double x, y;
        key.getExtent().getCentroid(x, y);

        // transform it to lat/long:
        GeoPoint geo;

        GeoPoint( getProfile()->getSRS(), x, y ).transform(
            getProfile()->getSRS()->getGeographicSRS(),
            geo );

        // contact the REST API. Docs are here:
        // http://msdn.microsoft.com/en-us/library/ff701716.aspx

        // construct the request URI:
        std::string request = Stringify()
            << std::setprecision(12)
            << _options.imageryMetadataAPI().get()     // base REST API
            << "/"    << _options.imagerySet().get()   // imagery set to use
            << "/"    << geo.y() << "," << geo.x()     // center point in lat/long
            << "?zl=" << key.getLOD() + 1              // zoom level
            << "&o=json"                               // response format
            << "&key=" << _options.key().get();        // API key

        // check the URI cache.
        URI                  location;
        TileURICache::Record rec;

        if ( _tileURICache.get(request, rec) )
        {
            location = URI(rec.value());
            //CacheStats stats = _tileURICache.getStats();
            //OE_INFO << "Ratio = " << (stats._hitRatio*100) << "%" << std::endl;
        }
        else
        {
            unsigned c = ++_apiCount;
            if ( c % 25 == 0 )
                OE_INFO << LC << "API calls = " << c << std::endl;
            
            // fetch it:
            ReadResult metadataResult = URI(request).readString(_dbOptions, progress);

            if ( metadataResult.failed() )
            {
                // check for a REST error:
                if ( metadataResult.code() == ReadResult::RESULT_SERVER_ERROR )
                {
                    OE_WARN << LC << "REST API request error!" << std::endl;

                    Config metadata;
                    std::string content = metadataResult.getString();
                    metadata.fromJSON( content );
                    ConfigSet errors = metadata.child("errorDetails").children();
                    for(ConfigSet::const_iterator i = errors.begin(); i != errors.end(); ++i )
                    {
                        OE_WARN << LC << "REST API: " << i->value() << std::endl;
                    }
                    return 0L;
                }
                else
                {
                    OE_WARN << LC << "Request error: " << metadataResult.getResultCodeString() << std::endl;
                }
                return 0L;
            }

            // decode it:
            Config metadata;
            if ( !metadata.fromJSON(metadataResult.getString()) )
            {
                OE_WARN << LC << "Error decoding REST API response" << std::endl;
                return 0L;
            }

            // check the vintage field. If it's empty, that means we got a "no data" tile.
            Config* vintageEnd = metadata.find("vintageEnd");
            if ( !vintageEnd || vintageEnd->value().empty() )
            {
                OE_DEBUG << LC << "NO data image encountered." << std::endl;
                return 0L;
            }

            // find the tile URI:
            Config* locationConf= metadata.find("imageUrl");
//.........这里部分代码省略.........
开发者ID:Sylla,项目名称:osgearth,代码行数:101,代码来源:BingTileSource.cpp


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