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:
parent
b32567e5ec
commit
12f1359461
@ -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();
|
||||
const osgEarth::CachePolicy cachePolicy(osgEarth::CachePolicy::USAGE_READ_WRITE);
|
||||
|
||||
osg::ref_ptr<osgEarth::Cache> cache = osgEarth::CacheFactory::create(cacheOptions);
|
||||
if (cache->isOK()) {
|
||||
// set cache
|
||||
osgEarth::Registry::instance()->setCache(cache.get());
|
||||
// The default cache policy used when no policy is set elsewhere
|
||||
osgEarth::Registry::instance()->setDefaultCachePolicy(cachePolicy);
|
||||
|
||||
// set cache policy
|
||||
const osgEarth::CachePolicy cachePolicy(osgEarth::CachePolicy::USAGE_READ_WRITE);
|
||||
// The override cache policy (overrides all others if set)
|
||||
// osgEarth::Registry::instance()->setOverrideCachePolicy(cachePolicy);
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user