1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-16 08:29:15 +01:00

LP-32 simplify osgearth cache initialization

This commit is contained in:
Philippe Renon 2016-06-24 02:52:20 +02:00
parent b32567e5ec
commit 12f1359461

View File

@ -128,27 +128,19 @@ void OsgEarth::initializePathes()
void OsgEarth::initializeCache()
{
#ifdef USE_OSGEARTH
QString cachePath = Utils::GetStoragePath() + "osgearth/cache";
osgEarth::Drivers::FileSystemCacheOptions cacheOptions;
qputenv("OSGEARTH_CACHE_PATH", cachePath.toLatin1());
cacheOptions.rootPath() = cachePath.toStdString();
osg::ref_ptr<osgEarth::Cache> cache = osgEarth::CacheFactory::create(cacheOptions);
if (cache->isOK()) {
// set cache
osgEarth::Registry::instance()->setCache(cache.get());
// set cache policy
const osgEarth::CachePolicy cachePolicy(osgEarth::CachePolicy::USAGE_READ_WRITE);
// The default cache policy used when no policy is set elsewhere
osgEarth::Registry::instance()->setDefaultCachePolicy(cachePolicy);
// The override cache policy (overrides all others if set)
// osgEarth::Registry::instance()->setOverrideCachePolicy(cachePolicy);
} else {
qWarning() << "OsgEarth::initializeCache - Failed to initialize cache";
}
#endif // ifdef USE_OSGEARTH
}