Skip to content

Commit

Permalink
Use ViewerWidget and Controls from OsgEarth instead of backports
Browse files Browse the repository at this point in the history
  • Loading branch information
pka committed Oct 19, 2012
1 parent 834ae19 commit b419adc
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 15 deletions.
3 changes: 3 additions & 0 deletions cmake/FindOSGEARTH.cmake
Expand Up @@ -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 )
Expand Down
3 changes: 1 addition & 2 deletions src/plugins/globe/CMakeLists.txt
Expand Up @@ -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
Expand Down Expand Up @@ -64,6 +62,7 @@ TARGET_LINK_LIBRARIES(globeplugin
${OSGEARTH_LIBRARY}
${OSGEARTHFEATURES_LIBRARY}
${OSGEARTHUTIL_LIBRARY}
${OSGEARTHQT_LIBRARY}
${OPENTHREADS_LIBRARY}
)

Expand Down
16 changes: 10 additions & 6 deletions src/plugins/globe/globe_plugin.cpp
Expand Up @@ -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>

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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;

Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/globe/globe_plugin.h
Expand Up @@ -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>

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -192,7 +192,7 @@ namespace osgEarth
{
namespace Util
{
namespace Controls21
namespace Controls
{
class NavigationControlHandler : public ControlEventHandler
{
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/globe/globe_plugin_dialog.cpp
Expand Up @@ -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 );
Expand Down Expand Up @@ -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/") );
}

Expand All @@ -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 );
}
Expand Down

0 comments on commit b419adc

Please sign in to comment.