Skip to content
Permalink
Browse files

Optional use of external osgEarthQt

  • Loading branch information
pka committed Oct 19, 2012
1 parent a3097b4 commit be7504459e73a9151274cfcfab2877df0eb35718
@@ -95,6 +95,10 @@ SET (WITH_GLOBE FALSE CACHE BOOL "Determines whether Globe plugin should be buil
IF (WITH_GLOBE)
SET(QT_USE_QTOPENGL 1)
FIND_PACKAGE(OSGEARTH REQUIRED)
IF (OSGEARTHQT_LIBRARY)
# following variable is used in qgsconfig.h
SET(HAVE_OSGEARTHQT TRUE)
ENDIF (OSGEARTHQT_LIBRARY)
ENDIF (WITH_GLOBE)

# Compile flag. Make it possible to turn it off.
@@ -38,5 +38,7 @@

#cmakedefine HAVE_TOUCH

#cmakedefine HAVE_OSGEARTHQT

#endif

@@ -17,6 +17,13 @@ SET (globe_plugin_SRCS
qgsosgearthtilesource.cpp
globe_plugin_dialog.cpp
)
IF (NOT HAVE_OSGEARTHQT)
SET(globe_plugin_SRCS
${globe_plugin_SRCS}
osgEarthQt/ViewerWidget.cpp
osgEarthUtil/Controls.cpp
)
ENDIF (NOT HAVE_OSGEARTHQT)

SET (globe_plugin_UIS
globe_plugin_dialog_guibase.ui
@@ -49,6 +56,17 @@ INCLUDE_DIRECTORIES(
..
)

SET (OSGEARTH_LIBS
${OSGEARTH_LIBRARY}
${OSGEARTHFEATURES_LIBRARY}
${OSGEARTHUTIL_LIBRARY}
)
IF (HAVE_OSGEARTHQT)
SET(OSGEARTH_LIBS
${OSGEARTH_LIBS}
${OSGEARTHQT_LIBRARY}
)
ENDIF (HAVE_OSGEARTHQT)
TARGET_LINK_LIBRARIES(globeplugin
qgis_core
qgis_gui
@@ -59,10 +77,7 @@ TARGET_LINK_LIBRARIES(globeplugin
${OSG_LIBRARY}
${OSGQT_LIBRARY}
${OSGVIEWER_LIBRARY}
${OSGEARTH_LIBRARY}
${OSGEARTHFEATURES_LIBRARY}
${OSGEARTHUTIL_LIBRARY}
${OSGEARTHQT_LIBRARY}
${OSGEARTH_LIBS}
${OPENTHREADS_LIBRARY}
)

@@ -19,8 +19,11 @@
#include "globe_plugin.h"
#include "globe_plugin_dialog.h"
#include "qgsosgearthtilesource.h"
#ifdef HAVE_OSGEARTHQT
#include <osgEarthQt/ViewerWidget>
//#include "osgEarthQt/ViewerWidget"
#else
#include "osgEarthQt/ViewerWidget"
#endif

#include <cmath>

@@ -60,8 +63,6 @@

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

#define MOVE_OFFSET 0.05

@@ -19,16 +19,25 @@
#ifndef QGS_GLOBE_PLUGIN_H
#define QGS_GLOBE_PLUGIN_H

#include "../qgisplugin.h"
#include "qgsconfig.h"
#include "qgisplugin.h"
#include "qgsosgearthtilesource.h"
#include "globe_plugin_dialog.h"
#include <QObject>
#include <osgViewer/Viewer>
#include <osgEarth/MapNode>
#include <osgEarth/ImageLayer>
#include <osgEarthUtil/EarthManipulator>
#ifndef HAVE_OSGEARTHQT //use backported controls if osgEarth <= 2.1
#define USE_BACKPORTED_CONTROLS
#endif
#ifdef USE_BACKPORTED_CONTROLS
#include "osgEarthUtil/Controls"
using namespace osgEarth::Util::Controls21;
#else
#include <osgEarthUtil/Controls>
//#include "osgEarthUtil/Controls"
using namespace osgEarth::Util::Controls;
#endif
#include <osgEarthUtil/ElevationManager>
#include <osgEarthUtil/ObjectPlacer>

@@ -126,7 +135,7 @@ class GlobePlugin : public QObject, public QgisPlugin
//! Tile source
osgEarth::Drivers::QgsOsgEarthTileSource* mTileSource;
//! Control Canvas
osgEarth::Util::Controls::ControlCanvas* mControlCanvas;
ControlCanvas* mControlCanvas;
//! Elevation manager
osgEarth::Util::ElevationManager* mElevationManager;
//! Object placer
@@ -193,7 +202,11 @@ namespace osgEarth
{
namespace Util
{
namespace Controls
#ifdef USE_BACKPORTED_CONTROLS
namespace Controls21
#else
namespace Controls
#endif
{
class NavigationControlHandler : public ControlEventHandler
{

0 comments on commit be75044

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