Skip to content

Commit

Permalink
[globe] Enable caching
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Nov 14, 2013
1 parent 0a8e4f9 commit 443ca0d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/plugins/globe/globe_plugin.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
{
Expand Down
16 changes: 10 additions & 6 deletions src/plugins/globe/globe_plugin_dialog.cpp
Expand Up @@ -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 );
}
}
}

Expand Down

0 comments on commit 443ca0d

Please sign in to comment.