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

Enabled osgEarth caching

This commit is contained in:
Dmytro Poplavskiy 2012-07-29 12:17:10 +10:00
parent 999e5e9cc5
commit ec3919d2b7

View File

@ -38,6 +38,8 @@
#include <QtCore/qtimer.h>
#include "utils/pathutils.h"
OsgEarthItem::OsgEarthItem(QDeclarativeItem *parent):
QDeclarativeItem(parent),
m_fbo(0),
@ -290,6 +292,20 @@ void OsgEarthItem::initScene()
m_model = osgDB::readNodeFile(sceneFile.toStdString());
//setup caching
osgEarth::MapNode *mapNode = osgEarth::MapNode::findMapNode(m_model.get());
if (mapNode) {
osgEarth::TMSCacheOptions cacheOptions;
//cacheOptions.cacheOnly() = true;
QString cacheDir = Utils::PathUtils().GetStoragePath()+QLatin1String("osgEarth_cache");
cacheOptions.setPath(cacheDir.toStdString());
osgEarth::Cache *cache= new osgEarth::TMSCache(cacheOptions);
mapNode->getMap()->setCache(cache);
} else {
qWarning() << Q_FUNC_INFO << sceneFile << " doesn't look like an osgEarth file";
}
m_gw = new osgViewer::GraphicsWindowEmbedded(0,0,w,h);
m_viewer = new osgViewer::Viewer();