Skip to content
Permalink
Browse files

Use ViewerWidget and Controls from OsgEarth instead of backports

  • Loading branch information
pka committed Oct 19, 2012
1 parent 834ae19 commit b419adc514b3aca07f94238d99d0f5d0e542a932
@@ -92,6 +92,9 @@ FIND_OSGEARTH_LIBRARY( OSGEARTHFEATURES_LIBRARY_DEBUG osgEarthFeaturesd )
FIND_OSGEARTH_LIBRARY( OSGEARTHSYMBOLOGY_LIBRARY osgEarthSymbology )
FIND_OSGEARTH_LIBRARY( OSGEARTHSYMBOLOGY_LIBRARY_DEBUG osgEarthSymbologyd )

FIND_OSGEARTH_LIBRARY( OSGEARTHQT_LIBRARY osgEarthQt )
FIND_OSGEARTH_LIBRARY( OSGEARTHQT_LIBRARY_DEBUG osgEarthQtd )


SET( OSGEARTH_FOUND "NO" )
IF( OSGEARTH_LIBRARY AND OSGEARTH_INCLUDE_DIR )
@@ -16,8 +16,6 @@ SET (globe_plugin_SRCS
globe_plugin.cpp
qgsosgearthtilesource.cpp
globe_plugin_dialog.cpp
osgEarthQt/ViewerWidget.cpp
osgEarthUtil/Controls.cpp
)

SET (globe_plugin_UIS
@@ -64,6 +62,7 @@ TARGET_LINK_LIBRARIES(globeplugin
${OSGEARTH_LIBRARY}
${OSGEARTHFEATURES_LIBRARY}
${OSGEARTHUTIL_LIBRARY}
${OSGEARTHQT_LIBRARY}
${OPENTHREADS_LIBRARY}
)

@@ -19,7 +19,8 @@
#include "globe_plugin.h"
#include "globe_plugin_dialog.h"
#include "qgsosgearthtilesource.h"
#include "osgEarthQt/ViewerWidget"
#include <osgEarthQt/ViewerWidget>
//#include "osgEarthQt/ViewerWidget"

#include <cmath>

@@ -58,8 +59,9 @@
#include <osgEarthDrivers/tms/TMSOptions>

using namespace osgEarth::Drivers;
using namespace osgEarth::Util::Controls21;
using namespace osgEarth::Util;
using namespace osgEarth::Util::Controls;
//using namespace osgEarth::Util::Controls21;

#define MOVE_OFFSET 0.05

@@ -322,12 +324,14 @@ void GlobePlugin::settings()
void GlobePlugin::setupMap()
{
QSettings settings;
/*
QString cacheDirectory = settings.value( "cache/directory", QgsApplication::qgisSettingsDirPath() + "cache" ).toString();
TMSCacheOptions cacheOptions;
cacheOptions.setPath( cacheDirectory.toStdString() );
*/

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

//Default image layer
@@ -745,7 +749,7 @@ void GlobePlugin::imageLayersChanged()
ImageLayerOptions options( "QGIS" );
mQgisMapLayer = new ImageLayer( options, mTileSource );
map->addImageLayer( mQgisMapLayer );
mQgisMapLayer->setCache( 0 ); //disable caching
//[layer->setCache is private in 1.3.0] mQgisMapLayer->setCache( 0 ); //disable caching
}
else
{
@@ -782,7 +786,7 @@ void GlobePlugin::elevationLayersChanged()
for ( int i = 0; i < table->rowCount(); ++i )
{
QString type = table->item( i, 0 )->text();
bool cache = table->item( i, 1 )->checkState();
//bool cache = table->item( i, 1 )->checkState();
QString uri = table->item( i, 2 )->text();
ElevationLayer* layer = 0;

@@ -800,7 +804,7 @@ void GlobePlugin::elevationLayersChanged()
}
map->addElevationLayer( layer );

if ( !cache || type == "Worldwind" ) layer->setCache( 0 ); //no tms cache for worldwind (use worldwind_cache)
//if ( !cache || type == "Worldwind" ) layer->setCache( 0 ); //no tms cache for worldwind (use worldwind_cache)
}
}
else
@@ -27,8 +27,8 @@
#include <osgEarth/MapNode>
#include <osgEarth/ImageLayer>
#include <osgEarthUtil/EarthManipulator>
//#include <osgEarthUtil/Controls>
#include "osgEarthUtil/Controls"
#include <osgEarthUtil/Controls>
//#include "osgEarthUtil/Controls"
#include <osgEarthUtil/ElevationManager>
#include <osgEarthUtil/ObjectPlacer>

@@ -125,7 +125,7 @@ class GlobePlugin : public QObject, public QgisPlugin
//! Tile source
osgEarth::Drivers::QgsOsgEarthTileSource* mTileSource;
//! Control Canvas
osgEarth::Util::Controls21::ControlCanvas* mControlCanvas;
osgEarth::Util::Controls::ControlCanvas* mControlCanvas;
//! Elevation manager
osgEarth::Util::ElevationManager* mElevationManager;
//! Object placer
@@ -192,7 +192,7 @@ namespace osgEarth
{
namespace Util
{
namespace Controls21
namespace Controls
{
class NavigationControlHandler : public ControlEventHandler
{
@@ -186,7 +186,7 @@ void QgsGlobePluginDialog::on_elevationAdd_clicked()
QTableWidgetItem *type = new QTableWidgetItem( elevationCombo->currentText() );
QTableWidgetItem *uri = new QTableWidgetItem( elevationPath->text() );
QTableWidgetItem* cache = new QTableWidgetItem();
cache->setCheckState(( elevationCombo->currentText() == "Worldwind" ) ? Qt::Checked : Qt::Unchecked ); //worldwind_cache will be active
//cache->setCheckState(( elevationCombo->currentText() == "Worldwind" ) ? Qt::Checked : Qt::Unchecked ); //worldwind_cache will be active
elevationDatasourcesWidget->setRowCount( 1 + i );
elevationDatasourcesWidget->setItem( i, 0, type );
elevationDatasourcesWidget->setItem( i, 1, cache );
@@ -257,7 +257,7 @@ void QgsGlobePluginDialog::resetElevationDatasources()
elevationDatasourcesWidget->setRowCount( 1 );
elevationDatasourcesWidget->setItem( 0, 0, new QTableWidgetItem("TMS") );
elevationDatasourcesWidget->setItem( 0, 1, new QTableWidgetItem() );
elevationDatasourcesWidget->item( 0, 1 )->setCheckState( Qt::Unchecked );
//elevationDatasourcesWidget->item( 0, 1 )->setCheckState( Qt::Unchecked );
elevationDatasourcesWidget->setItem( 0, 2, new QTableWidgetItem("http://readymap.org/readymap/tiles/1.0.0/9/") );
}

@@ -281,7 +281,7 @@ void QgsGlobePluginDialog::readElevationDatasources()
elevationDatasourcesWidget->setRowCount( 1 + i );
elevationDatasourcesWidget->setItem( i, 0, type );
QTableWidgetItem* chkBoxItem = new QTableWidgetItem();
chkBoxItem->setCheckState( cache ? Qt::Checked : Qt::Unchecked );
//chkBoxItem->setCheckState( cache ? Qt::Checked : Qt::Unchecked );
elevationDatasourcesWidget->setItem( i, 1, chkBoxItem );
elevationDatasourcesWidget->setItem( i, 2, uri );
}

0 comments on commit b419adc

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