Skip to content
Permalink
Browse files

globe plugin fixes:

- implement a compile check to tell apart OSGEARTH 2.0 from 3.0
- fix warnings
  • Loading branch information
jef-n committed Jul 13, 2011
1 parent 0c1cd9e commit 5a1f7683a8599982c5462aa385b8e344ac66c6b4
@@ -97,6 +97,22 @@ SET( OSGEARTH_FOUND "NO" )
IF( OSGEARTH_LIBRARY AND OSGEARTH_INCLUDE_DIR )
SET( OSGEARTH_FOUND "YES" )
SET( OSGEARTH_INCLUDE_DIRS ${OSGEARTH_INCLUDE_DIR} ${OSGEARTH_GEN_INCLUDE_DIR} )
INCLUDE(CheckCXXSourceCompiles)
SET(SAFE_CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES})
SET(SAFE_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${OSGEARTH_INCLUDE_DIR})
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${OSGEARTHUTIL_LIBRARY})
CHECK_CXX_SOURCE_COMPILES("
#include <osgEarthUtil/Controls>
using namespace osgEarth::Util::Controls;
int main(int argc, char **argv)
{
Container *c;
c->setChildSpacing(0.0);
}
" HAVE_OSGEARTH_CHILD_SPACING)
SET(CMAKE_REQUIRED_INCLUDES ${SAFE_CMAKE_REQUIRED_INCLUDES})
SET(CMAKE_REQUIRED_LIBRARIES ${SAFE_CMAKE_REQUIRED_LIBRARIES})
GET_FILENAME_COMPONENT( OSGEARTH_LIBRARIES_DIR ${OSGEARTH_LIBRARY} PATH )
ENDIF( OSGEARTH_LIBRARY AND OSGEARTH_INCLUDE_DIR )

@@ -5,6 +5,10 @@ FIND_PACKAGE(OSG REQUIRED)
FIND_PACKAGE(OSGEARTH REQUIRED)
FIND_PACKAGE(Threads)

IF(HAVE_OSGEARTH_CHILD_SPACING)
ADD_DEFINITIONS(-DHAVE_OSGEARTH_CHILD_SPACING)
ENDIF(HAVE_OSGEARTH_CHILD_SPACING)

########################################################
# Files

@@ -44,10 +44,11 @@ namespace osgEarth { namespace Drivers
//const optional<std::string>& imageURL() const { return _imageURL; }

public:
WorldWindOptions( const TileSourceOptions& opt =TileSourceOptions() ) : TileSourceOptions( opt ),
_maxLOD( 11 ),
_elevationURL( "http://worldwind25.arc.nasa.gov/wwelevation/wwelevation.aspx?T=srtm30pluszip" ),
_imageURL( "http://s0.tileservice.worldwindcentral.com/getTile?" )
WorldWindOptions( const TileSourceOptions& opt =TileSourceOptions() )
: TileSourceOptions( opt )
, _imageURL( "http://s0.tileservice.worldwindcentral.com/getTile?" )
, _elevationURL( "http://worldwind25.arc.nasa.gov/wwelevation/wwelevation.aspx?T=srtm30pluszip" )
, _maxLOD( 11 )
{
setDriver( "worldwind" );
fromConfig( _conf );
@@ -7,7 +7,7 @@
Date : 08-Jul-2010
Copyright : (C) 2010 by Sourcepole
Email : info at sourcepole.ch
/***************************************************************************
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -156,7 +156,7 @@ class QueryCoordinatesHandler : public osgGA::GUIEventHandler
public:
QueryCoordinatesHandler( GlobePlugin* globe, osgEarth::Util::ElevationManager* elevMan,
const osgEarth::SpatialReference* mapSRS )
: mGlobe( globe ), _elevMan( elevMan ), _mapSRS( mapSRS ), _mouseDown( false ) { }
: mGlobe( globe ), _mapSRS( mapSRS ), _elevMan( elevMan ), _mouseDown( false ) { }

bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa );

@@ -194,8 +194,8 @@ namespace osgEarth
class NavigationControlHandler : public ControlEventHandler
{
public:
virtual void onMouseDown( class Control* control, int mouseButtonMask ) { }
virtual void onClick( class Control* control, int mouseButtonMask, const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa ) { }
virtual void onMouseDown( class Control* control, int mouseButtonMask ) { Q_UNUSED( control ); Q_UNUSED( mouseButtonMask ); }
virtual void onClick( class Control* control, int mouseButtonMask, const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa ) { Q_UNUSED( control ); Q_UNUSED( mouseButtonMask ); Q_UNUSED( ea ); Q_UNUSED( aa ); }
};

class NavigationControl : public ImageControl
@@ -1,13 +1,10 @@
/*
* $Id$
*/
/***************************************************************************
* globe_plugin_dialog.cpp - settings dialog for the globe plugin
* --------------------------------------
* Date : 11-Nov-2010
* Copyright : (C) 2010 by Marco Bernasocchi
* Email : marco at bernawebdesign.ch
* /***************************************************************************
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -42,7 +39,8 @@

//constructor
QgsGlobePluginDialog::QgsGlobePluginDialog( QgsOsgViewer* viewer, QWidget* parent, Qt::WFlags fl )
: mViewer( viewer ), QDialog( parent, fl )
: QDialog( parent, fl )
, mViewer( viewer )
{
setupUi( this );
loadStereoConfig(); //values from settings, default values from OSG
@@ -405,6 +403,7 @@ void QgsGlobePluginDialog::on_resetStereoDefaults_clicked()

void QgsGlobePluginDialog::on_comboStereoMode_currentIndexChanged( QString value )
{
Q_UNUSED( value );
setStereoMode();
updateStereoDialog();
}
@@ -7,7 +7,7 @@
Date : 11-Nov-2010
Copyright : (C) 2010 by Marco Bernasocchi
Email : marco at bernawebdesign.ch
/***************************************************************************
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -36,19 +36,21 @@ QgsOsgEarthTileSource::QgsOsgEarthTileSource( QgisInterface* theQgisInterface, c

void QgsOsgEarthTileSource::initialize( const std::string& referenceURI, const Profile* overrideProfile )
{
Q_UNUSED( referenceURI );
Q_UNUSED( overrideProfile );

setProfile( osgEarth::Registry::instance()->getGlobalGeodeticProfile() );
QgsMapRenderer* mainRenderer = mQGisIface->mapCanvas()->mapRenderer();
mMapRenderer = new QgsMapRenderer();

long epsgGlobe = 4326;
if ( mainRenderer->destinationSrs().epsg() != epsgGlobe )
if ( mainRenderer->destinationCrs().authid().compare( QString( "EPSG:%1" ).arg( epsgGlobe ), Qt::CaseInsensitive ) == 0 )
{
QgsCoordinateReferenceSystem srcCRS;
srcCRS.createFromEpsg( mainRenderer->destinationSrs().epsg() ); //FIXME: crs from canvas or first layer?
QgsCoordinateReferenceSystem srcCRS( mainRenderer->destinationCrs() ); //FIXME: crs from canvas or first layer?
QgsCoordinateReferenceSystem destCRS;
destCRS.createFromEpsg( epsgGlobe );
destCRS.createFromOgcWmsCrs( QString( "EPSG:%1" ).arg( epsgGlobe ) );
//QgsProject::instance()->writeEntry("SpatialRefSys","/ProjectionsEnabled",1);
mMapRenderer->setDestinationSrs( destCRS );
mMapRenderer->setDestinationCrs( destCRS );
mMapRenderer->setProjectionsEnabled( true );
mCoordTranform = new QgsCoordinateTransform( srcCRS, destCRS );
}
@@ -60,6 +62,8 @@ void QgsOsgEarthTileSource::initialize( const std::string& referenceURI, const P

osg::Image* QgsOsgEarthTileSource::createImage( const TileKey& key, ProgressCallback* progress )
{
Q_UNUSED( key );
Q_UNUSED( progress );
osg::ref_ptr<osg::Image> image;
if ( intersects( &key ) )
{
@@ -28,6 +28,8 @@ namespace osgEarth
osg::HeightField* createHeightField( const TileKey* key,
ProgressCallback* progress )
{
Q_UNUSED( key );
Q_UNUSED( progress );
//NI
OE_WARN << "[QGIS] Driver does not support heightfields" << std::endl;
return NULL;

0 comments on commit 5a1f768

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