本文整理汇总了C++中URI::context方法的典型用法代码示例。如果您正苦于以下问题:C++ URI::context方法的具体用法?C++ URI::context怎么用?C++ URI::context使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类URI
的用法示例。
在下文中一共展示了URI::context方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gotNameLookup
void gotNameLookup(const Callback &cb, const URI &origNamedUri, ServiceIterator *services,
const Fingerprint &hash, const std::string &str, bool success) {
if (!success) {
doNameLookup(cb, origNamedUri, services, ServiceIterator::GENERAL_ERROR);
return;
}
services->finished(ServiceIterator::SUCCESS);
RemoteFileId rfid(hash, URI(origNamedUri.context(), str));
addToCache(origNamedUri, rfid);
cb(origNamedUri, &rfid);
}
示例2: doNameLookup
void doNameLookup(const Callback &cb, const URI &origNamedUri, ServiceIterator *services, ServiceIterator::ErrorType reason) {
URI lookupUri;
ServiceParams params;
std::tr1::shared_ptr<NameLookupHandler> handler;
if (mNameServ->getNextProtocol(services,reason,origNamedUri,lookupUri,params,handler)) {
/// FIXME: Need a way of aborting a name lookup that is taking too long.
handler->nameLookup(NULL, lookupUri,
std::tr1::bind(&NameLookupManager::gotNameLookup, this, cb, origNamedUri, services, _1, _2, _3));
} else {
SILOG(transfer,warn,"None of the services registered for " <<
origNamedUri << " were successful for NameLookup.");
/// Hashed download.
if (mDownloadServ) {
mDownloadServ->lookupService(origNamedUri.context(),
std::tr1::bind(&NameLookupManager::hashedDownload, this, cb, origNamedUri, _1));
} else {
cb(origNamedUri, NULL);
}
return;
}
}
示例3: buf
bool
ServiceReader::read( const URI& location, const osgDB::Options* options, RESTResponse& response )
{
response.setServiceURL( location.full() );
std::string serviceLocation = location.full() + "?f=json&pretty=true";
ReadResult r = URI(serviceLocation, location.context()).readString();
if ( r.failed() )
{
OE_WARN << "Failed to read ArcGIS Services tile map file from " << serviceLocation << std::endl;
return false;
}
// Read tile map into a Config:
Config conf;
std::stringstream buf( r.getString() );
if (!conf.fromJSON( buf.str() ))
{
return false;
}
return read( conf, response );
}
示例4: initialize
//.........这里部分代码省略.........
// Next, try to glean the extents from the layer list
if ( capabilities.valid() )
{
StringTokenizer tok(",");
StringVector tized;
tok.tokenize(_options.layers().value(), tized);
for (StringVector::const_iterator itr = tized.begin(); itr != tized.end(); ++itr)
{
std::string layerName = *itr;
WMSLayer* layer = capabilities->getLayerByName(layerName);
if (layer)
{
// Get the lat/lon extents
double minLon, minLat, maxLon, maxLat;
layer->getLatLonExtents(minLon, minLat, maxLon, maxLat);
GeoExtent wgs84Extent(SpatialReference::create("wgs84"), minLon, minLat, maxLon, maxLat);
getDataExtents().push_back(DataExtent(wgs84Extent, 0));
}
}
// If we don't have a profile yet, transform the lat/lon extents to the requested srs and use it as the extents of the profile.
if (!result.valid())
{
const SpatialReference* srs = SpatialReference::create(_srsToUse);
GeoExtent totalExtent(srs);
for (DataExtentList::const_iterator itr = getDataExtents().begin(); itr != getDataExtents().end(); ++itr)
{
GeoExtent dataExtent = *itr;
GeoExtent nativeExtent;
dataExtent.transform(srs, nativeExtent);
totalExtent.expandToInclude(nativeExtent);
}
result = Profile::create(srs, totalExtent.xMin(), totalExtent.yMin(), totalExtent.xMax(), totalExtent.yMax());
}
}
// Last resort: create a global extent profile (only valid for global maps)
if ( !result.valid() && wms_srs->isGeographic())
{
result = osgEarth::Registry::instance()->getGlobalGeodeticProfile();
}
#ifdef SUPPORT_JPL_TILESERVICE
// JPL uses an experimental interface called TileService -- ping to see if that's what
// we are trying to read:
URI tsUrl = _options.tileServiceUrl().value();
if ( tsUrl.empty() )
{
tsUrl = URI(_options.url()->full() + sep + std::string("request=GetTileService"), tsUrl.context());
}
OE_INFO << LC << "Testing for JPL/TileService at " << tsUrl.full() << std::endl;
osg::ref_ptr<TileService> tileService = TileServiceReader::read(tsUrl.full(), dbOptions);
if (tileService.valid())
{
OE_INFO << LC << "Found JPL/TileService spec" << std::endl;
TileService::TilePatternList patterns;
tileService->getMatchingPatterns(
_options.layers().value(),
_formatToUse,
_options.style().value(),
_srsToUse,
getPixelsPerTile(),
getPixelsPerTile(),
patterns );
if (patterns.size() > 0)
{
result = tileService->createProfile( patterns );
_prototype = _options.url()->full() + sep + patterns[0].getPrototype();
}
}
else
{
OE_INFO << LC << "No JPL/TileService spec found; assuming standard WMS" << std::endl;
}
#endif
// Use the override profile if one is passed in.
if ( getProfile() == 0L )
{
setProfile( result.get() );
}
if ( getProfile() )
{
OE_INFO << LC << "Profile=" << getProfile()->toString() << std::endl;
// set up the cache options properly for a TileSource.
_dbOptions = Registry::instance()->cloneOrCreateOptions( dbOptions );
return Status::OK();
}
else
{
return Status::Error( "Unable to establish profile" );
}
}
示例5: lookupHash
/** Takes a URI, and tries to lookup the hash and download URI from it.
*
* @param namedUri A ServiceURI or a regular URI (depending on if serviceLookup is NULL)
* @param cb The Callback to be called either on success or failure. */
virtual void lookupHash(const URI &namedUri, const Callback &cb) {
mNameServ->lookupService(namedUri.context(), std::tr1::bind(&NameLookupManager::doNameLookup,
this, cb, namedUri, _1, ServiceIterator::SUCCESS));
}