Skip to content
Permalink
Browse files

[globe] Enable caching

  • Loading branch information
m-kuhn committed Nov 14, 2013
1 parent 0a8e4f9 commit 443ca0d81afa78148b69baa2009e2986e8931c69
Showing with 16 additions and 12 deletions.
  1. +6 −6 src/plugins/globe/globe_plugin.cpp
  2. +10 −6 src/plugins/globe/globe_plugin_dialog.cpp
@@ -62,6 +62,7 @@
#include <osgEarthDrivers/gdal/GDALOptions>
#include <osgEarthDrivers/tms/TMSOptions>
#include <osgEarth/Version>
#include <osgEarthDrivers/cache_filesystem/FileSystemCache>

using namespace osgEarth::Drivers;
using namespace osgEarth::Util;
@@ -373,14 +374,13 @@ void GlobePlugin::settings()
void GlobePlugin::setupMap()
{
QSettings settings;
/*

QString cacheDirectory = settings.value( "cache/directory", QgsApplication::qgisSettingsDirPath() + "cache" ).toString();
TMSCacheOptions cacheOptions;
cacheOptions.setPath( cacheDirectory.toStdString() );
*/
FileSystemCacheOptions cacheOptions;
cacheOptions.rootPath() = cacheDirectory.toStdString();

MapOptions mapOptions;
//mapOptions.cache() = cacheOptions;
mapOptions.cache() = cacheOptions;
osgEarth::Map *map = new osgEarth::Map( mapOptions );

//Default image layer
@@ -742,9 +742,9 @@ void GlobePlugin::imageLayersChanged()
mTileSource = new QgsOsgEarthTileSource( mQGisIface );
mTileSource->initialize( "", 0 );
ImageLayerOptions options( "QGIS" );
options.cachePolicy() = CachePolicy::NO_CACHE;
mQgisMapLayer = new ImageLayer( options, mTileSource );
map->addImageLayer( mQgisMapLayer );
//[layer->setCache is private in 1.3.0] mQgisMapLayer->setCache( 0 ); //disable caching
}
else
{
@@ -584,13 +584,17 @@ void QgsGlobePluginDialog::saveMapSettings()
settings.setValue( "/Plugin-Globe/baseLayerEnabled", mBaseLayerGroupBox->isChecked() );
settings.setValue( "/Plugin-Globe/baseLayerURL", mBaseLayerURL->text() );

if ( mBaseLayerGroupBox->isChecked() )
// If there is a viewer instance already, apply it on this instance
if ( mGlobe->osgViewer() )
{
mGlobe->setBaseMap( mBaseLayerURL->text() );
}
else
{
mGlobe->setBaseMap( QString::null );
if ( mBaseLayerGroupBox->isChecked() )
{
mGlobe->setBaseMap( mBaseLayerURL->text() );
}
else
{
mGlobe->setBaseMap( QString::null );
}
}
}

0 comments on commit 443ca0d

Please sign in to comment.
You can’t perform that action at this time.