mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
Globe: Fix compilation with osgearth 2.4
This commit is contained in:
parent
7a79ebc734
commit
1436056f77
@ -44,6 +44,7 @@ ENDMACRO( FIND_OSGEARTH_INCLUDE THIS_OSGEARTH_INCLUDE_DIR THIS_OSGEARTH_INCLUDE_
|
||||
|
||||
FIND_OSGEARTH_INCLUDE( OSGEARTH_GEN_INCLUDE_DIR osgEarth/Common )
|
||||
FIND_OSGEARTH_INCLUDE( OSGEARTH_INCLUDE_DIR osgEarth/TileSource )
|
||||
FIND_OSGEARTH_INCLUDE( OSGEARTH_ELEVATION_QUERY osgEarth/ElevationQuery )
|
||||
|
||||
###### libraries ######
|
||||
|
||||
|
@ -9,6 +9,10 @@ IF(HAVE_OSGEARTH_CHILD_SPACING)
|
||||
ADD_DEFINITIONS(-DHAVE_OSGEARTH_CHILD_SPACING)
|
||||
ENDIF(HAVE_OSGEARTH_CHILD_SPACING)
|
||||
|
||||
IF(OSGEARTH_ELEVATION_QUERY)
|
||||
ADD_DEFINITIONS(-DHAVE_OSGEARTH_ELEVATION_QUERY)
|
||||
ENDIF(OSGEARTH_ELEVATION_QUERY)
|
||||
|
||||
########################################################
|
||||
# Files
|
||||
|
||||
|
@ -311,9 +311,12 @@ void GlobePlugin::run()
|
||||
mOsgViewer->addEventHandler( new FlyToExtentHandler( this ) );
|
||||
mOsgViewer->addEventHandler( new KeyboardControlHandler( manip, mQGisIface ) );
|
||||
|
||||
#ifdef HAVE_OSGEARTH_ELEVATION_QUERY
|
||||
#else
|
||||
mOsgViewer->addEventHandler( new QueryCoordinatesHandler( this, mElevationManager,
|
||||
mMapNode->getMap()->getProfile()->getSRS() )
|
||||
);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -376,6 +379,8 @@ void GlobePlugin::setupMap()
|
||||
elevationLayersChanged();
|
||||
|
||||
// model placement utils
|
||||
#ifdef HAVE_OSGEARTH_ELEVATION_QUERY
|
||||
#else
|
||||
mElevationManager = new osgEarth::Util::ElevationManager( mMapNode->getMap() );
|
||||
mElevationManager->setTechnique( osgEarth::Util::ElevationManager::TECHNIQUE_GEOMETRIC );
|
||||
mElevationManager->setMaxTilesToCache( 50 );
|
||||
@ -398,6 +403,7 @@ void GlobePlugin::setupMap()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@ -863,6 +869,8 @@ void GlobePlugin::help()
|
||||
|
||||
void GlobePlugin::placeNode( osg::Node* node, double lat, double lon, double alt /*= 0.0*/ )
|
||||
{
|
||||
#ifdef HAVE_OSGEARTH_ELEVATION_QUERY
|
||||
#else
|
||||
// get elevation
|
||||
double elevation = 0.0;
|
||||
double resolution = 0.0;
|
||||
@ -875,6 +883,7 @@ void GlobePlugin::placeNode( osg::Node* node, double lat, double lon, double alt
|
||||
osg::MatrixTransform* mt = new osg::MatrixTransform( mat );
|
||||
mt->addChild( node );
|
||||
mRootNode->addChild( mt );
|
||||
#endif
|
||||
}
|
||||
|
||||
void GlobePlugin::copyFolder( QString sourceFolder, QString destFolder )
|
||||
@ -1068,6 +1077,8 @@ bool FlyToExtentHandler::handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIAct
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef HAVE_OSGEARTH_ELEVATION_QUERY
|
||||
#else
|
||||
bool QueryCoordinatesHandler::handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
|
||||
{
|
||||
if ( ea.getEventType() == osgGA::GUIEventAdapter::MOVE )
|
||||
@ -1144,6 +1155,7 @@ osg::Vec3d QueryCoordinatesHandler::getCoords( float x, float y, osgViewer::View
|
||||
}
|
||||
return coords;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Required extern functions needed for every plugin
|
||||
|
@ -38,8 +38,13 @@ using namespace osgEarth::Util::Controls21;
|
||||
#include <osgEarthUtil/Controls>
|
||||
using namespace osgEarth::Util::Controls;
|
||||
#endif
|
||||
#ifdef HAVE_OSGEARTH_ELEVATION_QUERY
|
||||
#include <osgEarth/ElevationQuery>
|
||||
#include <osgEarthUtil/ObjectLocator>
|
||||
#else
|
||||
#include <osgEarthUtil/ElevationManager>
|
||||
#include <osgEarthUtil/ObjectPlacer>
|
||||
#endif
|
||||
|
||||
class QAction;
|
||||
class QToolBar;
|
||||
@ -136,10 +141,17 @@ class GlobePlugin : public QObject, public QgisPlugin
|
||||
osgEarth::Drivers::QgsOsgEarthTileSource* mTileSource;
|
||||
//! Control Canvas
|
||||
ControlCanvas* mControlCanvas;
|
||||
#ifdef HAVE_OSGEARTH_ELEVATION_QUERY
|
||||
//! Elevation manager
|
||||
osgEarth::ElevationQuery* mElevationManager;
|
||||
//! Object placer
|
||||
osgEarth::Util::ObjectLocator* mObjectPlacer;
|
||||
#else
|
||||
//! Elevation manager
|
||||
osgEarth::Util::ElevationManager* mElevationManager;
|
||||
//! Object placer
|
||||
osgEarth::Util::ObjectPlacer* mObjectPlacer;
|
||||
#endif
|
||||
//! tracks if the globe is open
|
||||
bool mIsGlobeRunning;
|
||||
//! coordinates of the right-clicked point on the globe
|
||||
@ -164,6 +176,8 @@ class FlyToExtentHandler : public osgGA::GUIEventHandler
|
||||
};
|
||||
|
||||
// An event handler that will print out the coordinates at the clicked point
|
||||
#ifdef HAVE_OSGEARTH_ELEVATION_QUERY
|
||||
#else
|
||||
class QueryCoordinatesHandler : public osgGA::GUIEventHandler
|
||||
{
|
||||
public:
|
||||
@ -181,6 +195,7 @@ class QueryCoordinatesHandler : public osgGA::GUIEventHandler
|
||||
osg::ref_ptr<osgEarth::Util::ElevationManager> _elevMan;
|
||||
bool _mouseDown;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
class KeyboardControlHandler : public osgGA::GUIEventHandler
|
||||
|
Loading…
x
Reference in New Issue
Block a user