Commit bf83aba1 authored by lm's avatar lm

Merged

parents b0ab9b34 6344a49d
...@@ -42,8 +42,11 @@ QMAKE_PRE_LINK += echo "Copying files" ...@@ -42,8 +42,11 @@ QMAKE_PRE_LINK += echo "Copying files"
# MAC OS X # MAC OS X
macx { macx {
COMPILER_VERSION = $$system(gcc -v)
message(Using compiler $$COMPILER_VERSION)
HARDWARE_PLATFORM = $$system(uname -a) HARDWARE_PLATFORM = $$system(uname -a)
contains( HARDWARE_PLATFORM, 9.6.0 ) || contains( HARDWARE_PLATFORM, 9.7.0 ) || contains( HARDWARE_PLATFORM, 9.8.0 ) || || contains( HARDWARE_PLATFORM, 9.9.0 ) { contains( HARDWARE_PLATFORM, 9.6.0 ) || contains( HARDWARE_PLATFORM, 9.7.0 ) || contains( HARDWARE_PLATFORM, 9.8.0 ) || contains( HARDWARE_PLATFORM, 9.9.0 ) {
# x86 Mac OS X Leopard 10.5 and earlier # x86 Mac OS X Leopard 10.5 and earlier
CONFIG += x86 cocoa phonon CONFIG += x86 cocoa phonon
message(Building for Mac OS X 32bit/Leopard 10.5 and earlier) message(Building for Mac OS X 32bit/Leopard 10.5 and earlier)
...@@ -60,18 +63,15 @@ macx { ...@@ -60,18 +63,15 @@ macx {
message(Building for Mac OS X 64bit/Snow Leopard 10.6 and later) message(Building for Mac OS X 64bit/Snow Leopard 10.6 and later)
} }
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6 QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.5
DESTDIR = $$BASEDIR/bin/mac DESTDIR = $$BASEDIR/bin/mac
INCLUDEPATH += -framework SDL \ INCLUDEPATH += -framework SDL
$$BASEDIR/../mavlink/contrib/slugs/include \
$$BASEDIR/../mavlink/include
LIBS += -framework IOKit \ LIBS += -framework IOKit \
-framework SDL \ -framework SDL \
-framework CoreFoundation \ -framework CoreFoundation \
-framework ApplicationServices \ -framework ApplicationServices \
# -framework GLUT \
-lm -lm
ICON = $$BASEDIR/images/icons/macx.icns ICON = $$BASEDIR/images/icons/macx.icns
...@@ -79,30 +79,63 @@ macx { ...@@ -79,30 +79,63 @@ macx {
# Copy audio files if needed # Copy audio files if needed
QMAKE_PRE_LINK += cp -rf $$BASEDIR/audio $$DESTDIR/qgroundcontrol.app/Contents/MacOs/. QMAKE_PRE_LINK += cp -rf $$BASEDIR/audio $$DESTDIR/qgroundcontrol.app/Contents/MacOs/.
exists(/usr/include/osg) { exists(/Library/Frameworks/osg.framework):exists(/Library/Frameworks/OpenThreads.framework) {
# No check for GLUT.framework since it's a MAC default
message("Building support for OpenSceneGraph") message("Building support for OpenSceneGraph")
DEPENDENCIES_PRESENT += osg DEPENDENCIES_PRESENT += osg
DEFINES += QGC_OSG_ENABLED
# Include OpenSceneGraph libraries # Include OpenSceneGraph libraries
LIBS += -losg INCLUDEPATH += -framework GLUT \
-framework Carbon \
-framework OpenThreads \
-framework osg \
-framework osgViewer \
-framework osgGA \
-framework osgDB \
-framework osgText \
-framework osgWidget
LIBS += -framework GLUT \
-framework Carbon \
-framework OpenThreads \
-framework osg \
-framework osgViewer \
-framework osgGA \
-framework osgDB \
-framework osgText \
-framework osgWidget
} }
exists(/usr/include/osgEarth) { exists(/usr/include/osgEarth) {
message("Building support for osgEarth") message("Building support for osgEarth")
DEPENDENCIES_PRESENT += osgearth DEPENDENCIES_PRESENT += osgearth
# Include osgEarth libraries # Include osgEarth libraries
LIBS += -losgViewer \ INCLUDEPATH += -framework GDAL \
-losgEarth \ $$IN_PWD/lib/mac32-gcc/include \
-losgEarthUtil -framework GEOS \
-framework SQLite3 \
-framework osgFX \
-framework osgTerrain
LIBS += -framework GDAL \
-framework GEOS \
-framework SQLite3 \
-framework osgFX \
-framework osgTerrain \
DEFINES += QGC_OSGEARTH_ENABLED DEFINES += QGC_OSGEARTH_ENABLED
} }
exists(/usr/local/include/libfreenect) { exists(/opt/local/include/libfreenect) {
message("Building support for libfreenect") message("Building support for libfreenect")
DEPENDENCIES_PRESENT += libfreenect DEPENDENCIES_PRESENT += libfreenect
# Include libfreenect libraries # Include libfreenect libraries
LIBS += -lfreenect LIBS += -lfreenect
DEFINES += QGC_LIBFREENECT_ENABLED DEFINES += QGC_LIBFREENECT_ENABLED
} }
# osg/osgEarth dynamic casts might fail without this compiler option.
# see http://osgearth.org/wiki/FAQ for details.
#QMAKE_CXXFLAGS += -Wl, -E
} }
# GNU/Linux # GNU/Linux
...@@ -145,7 +178,7 @@ linux-g++ { ...@@ -145,7 +178,7 @@ linux-g++ {
DEFINES += QGC_OSG_ENABLED DEFINES += QGC_OSG_ENABLED
} }
exists(/usr/include/osgEarth) { exists(/usr/include/osgEarth) | exists(/usr/local/include/osgEarth) {
message("Building support for osgEarth") message("Building support for osgEarth")
DEPENDENCIES_PRESENT += osgearth DEPENDENCIES_PRESENT += osgearth
# Include osgEarth libraries # Include osgEarth libraries
...@@ -164,16 +197,14 @@ linux-g++ { ...@@ -164,16 +197,14 @@ linux-g++ {
DEFINES += QGC_LIBFREENECT_ENABLED DEFINES += QGC_LIBFREENECT_ENABLED
} }
#QMAKE_CXXFLAGS += -Wl,-E
#-lflite_cmu_us_rms \
#-lflite_cmu_us_slt \
QMAKE_PRE_LINK += && cp -rf $$BASEDIR/models $$TARGETDIR/debug/. QMAKE_PRE_LINK += && cp -rf $$BASEDIR/models $$TARGETDIR/debug/.
QMAKE_PRE_LINK += && cp -rf $$BASEDIR/models $$TARGETDIR/release/. QMAKE_PRE_LINK += && cp -rf $$BASEDIR/models $$TARGETDIR/release/.
QMAKE_PRE_LINK += && cp -rf $$BASEDIR/data $$TARGETDIR/debug/. QMAKE_PRE_LINK += && cp -rf $$BASEDIR/data $$TARGETDIR/debug/.
QMAKE_PRE_LINK += && cp -rf $$BASEDIR/data $$TARGETDIR/release/. QMAKE_PRE_LINK += && cp -rf $$BASEDIR/data $$TARGETDIR/release/.
# osg/osgEarth dynamic casts might fail without this compiler option.
# see http://osgearth.org/wiki/FAQ for details.
QMAKE_CXXFLAGS += -Wl, -E
} }
linux-g++-64 { linux-g++-64 {
...@@ -234,6 +265,10 @@ linux-g++-64 { ...@@ -234,6 +265,10 @@ linux-g++-64 {
LIBS += -lfreenect LIBS += -lfreenect
DEFINES += QGC_LIBFREENECT_ENABLED DEFINES += QGC_LIBFREENECT_ENABLED
} }
# osg/osgEarth dynamic casts might fail without this compiler option.
# see http://osgearth.org/wiki/FAQ for details.
QMAKE_CXXFLAGS += -Wl, -E
} }
# Windows (32bit) # Windows (32bit)
...@@ -261,6 +296,10 @@ win32-msvc2008 { ...@@ -261,6 +296,10 @@ win32-msvc2008 {
QMAKE_PRE_LINK += cp -rf $$BASEDIR/audio $$TARGETDIR/release/. && QMAKE_PRE_LINK += cp -rf $$BASEDIR/audio $$TARGETDIR/release/. &&
QMAKE_PRE_LINK += cp -rf $$BASEDIR/models $$TARGETDIR/debug/. && QMAKE_PRE_LINK += cp -rf $$BASEDIR/models $$TARGETDIR/debug/. &&
QMAKE_PRE_LINK += cp -rf $$BASEDIR/models $$TARGETDIR/release/. QMAKE_PRE_LINK += cp -rf $$BASEDIR/models $$TARGETDIR/release/.
# osg/osgEarth dynamic casts might fail without this compiler option.
# see http://osgearth.org/wiki/FAQ for details.
QMAKE_CXXFLAGS += /Wl /E
} }
# Windows (32bit) # Windows (32bit)
...@@ -297,6 +336,10 @@ win32-g++ { ...@@ -297,6 +336,10 @@ win32-g++ {
QMAKE_PRE_LINK += cp -rf $$BASEDIR/audio $$TARGETDIR/release/. QMAKE_PRE_LINK += cp -rf $$BASEDIR/audio $$TARGETDIR/release/.
QMAKE_PRE_LINK += cp -rf $$BASEDIR/models $$TARGETDIR/debug/. && QMAKE_PRE_LINK += cp -rf $$BASEDIR/models $$TARGETDIR/debug/. &&
QMAKE_PRE_LINK += cp -rf $$BASEDIR/models $$TARGETDIR/release/. QMAKE_PRE_LINK += cp -rf $$BASEDIR/models $$TARGETDIR/release/.
# osg/osgEarth dynamic casts might fail without this compiler option.
# see http://osgearth.org/wiki/FAQ for details.
QMAKE_CXXFLAGS += -Wl, -E
} }
# Windows (64bit) # Windows (64bit)
...@@ -331,4 +374,8 @@ win64-g++ { ...@@ -331,4 +374,8 @@ win64-g++ {
QMAKE_PRE_LINK += cp -f $$BASEDIR/lib/sdl/win32/SDL.dll $$BUILDDIR/release/. && QMAKE_PRE_LINK += cp -f $$BASEDIR/lib/sdl/win32/SDL.dll $$BUILDDIR/release/. &&
QMAKE_PRE_LINK += cp -rf $$BASEDIR/audio $$BUILDDIR/debug/. && QMAKE_PRE_LINK += cp -rf $$BASEDIR/audio $$BUILDDIR/debug/. &&
QMAKE_PRE_LINK += cp -rf $$BASEDIR/audio $$BUILDDIR/release/. QMAKE_PRE_LINK += cp -rf $$BASEDIR/audio $$BUILDDIR/release/.
# osg/osgEarth dynamic casts might fail without this compiler option.
# see http://osgearth.org/wiki/FAQ for details.
QMAKE_CXXFLAGS += -Wl, -E
} }
...@@ -236,19 +236,19 @@ contains(DEPENDENCIES_PRESENT, osg) { ...@@ -236,19 +236,19 @@ contains(DEPENDENCIES_PRESENT, osg) {
message("Including headers for OpenSceneGraph") message("Including headers for OpenSceneGraph")
# Enable only if OpenSceneGraph is available # Enable only if OpenSceneGraph is available
HEADERS += src/ui/map3D/Q3DWidget.h HEADERS += src/ui/map3D/Q3DWidget.h \
src/ui/map3D/GCManipulator.h \
src/ui/map3D/ImageWindowGeode.h \
src/ui/map3D/QOSGWidget.h \
src/ui/map3D/PixhawkCheetahGeode.h \
src/ui/map3D/Pixhawk3DWidget.h \
src/ui/map3D/Q3DWidgetFactory.h
contains(DEPENDENCIES_PRESENT, osgearth) { contains(DEPENDENCIES_PRESENT, osgearth) {
message("Including headers for OSGEARTH") message("Including headers for OSGEARTH")
# Enable only if OpenSceneGraph is available # Enable only if OpenSceneGraph is available
HEADERS += src/ui/map3D/QOSGWidget.h \ HEADERS += src/ui/map3D/QMap3D.h
src/ui/map3D/QMap3D.h \
src/ui/map3D/PixhawkCheetahGeode.h \
src/ui/map3D/Pixhawk3DWidget.h \
src/ui/map3D/Q3DWidgetFactory.h \
src/ui/map3D/GCManipulator.h \
src/ui/map3D/ImageWindowGeode.h
} }
} }
...@@ -327,25 +327,27 @@ SOURCES += src/main.cc \ ...@@ -327,25 +327,27 @@ SOURCES += src/main.cc \
src/ui/RadioCalibration/SwitchCalibrator.cc \ src/ui/RadioCalibration/SwitchCalibrator.cc \
src/ui/RadioCalibration/CurveCalibrator.cc \ src/ui/RadioCalibration/CurveCalibrator.cc \
src/ui/RadioCalibration/AbstractCalibrator.cc \ src/ui/RadioCalibration/AbstractCalibrator.cc \
src/ui/RadioCalibration/RadioCalibrationData.cc \ # src/ui/WaypointGlobalView.cc \ src/ui/RadioCalibration/RadioCalibrationData.cc
src/ui/map3D/ImageWindowGeode.cc
contains(DEPENDENCIES_PRESENT, osg) { contains(DEPENDENCIES_PRESENT, osg) {
message("Including sources for OpenSceneGraph") message("Including sources for OpenSceneGraph")
# Enable only if OpenSceneGraph is available # Enable only if OpenSceneGraph is available
SOURCES += src/ui/map3D/Q3DWidget.cc SOURCES += src/ui/map3D/Q3DWidget.cc \
src/ui/map3D/ImageWindowGeode.cc \
src/ui/map3D/GCManipulator.cc \
src/ui/map3D/QOSGWidget.cc \
src/ui/map3D/PixhawkCheetahGeode.cc \
src/ui/map3D/Pixhawk3DWidget.cc \
src/ui/map3D/Q3DWidgetFactory.cc
contains(DEPENDENCIES_PRESENT, osgearth) { contains(DEPENDENCIES_PRESENT, osgearth) {
message("Including sources for osgEarth") message("Including sources for osgEarth")
# Enable only if OpenSceneGraph is available # Enable only if OpenSceneGraph is available
SOURCES += src/ui/map3D/QOSGWidget.cc \ SOURCES += src/ui/map3D/QMap3D.cc
src/ui/map3D/QMap3D.cc \
src/ui/map3D/PixhawkCheetahGeode.cc \
src/ui/map3D/Pixhawk3DWidget.cc \
src/ui/map3D/Q3DWidgetFactory.cc \
src/ui/map3D/GCManipulator.cc
} }
} }
......
...@@ -137,9 +137,12 @@ void MainWindow::buildWidgets() ...@@ -137,9 +137,12 @@ void MainWindow::buildWidgets()
dataplotWidget = new QGCDataPlot2D(this); dataplotWidget = new QGCDataPlot2D(this);
#ifdef QGC_OSG_ENABLED #ifdef QGC_OSG_ENABLED
_3DWidget = Q3DWidgetFactory::get("PIXHAWK"); _3DWidget = Q3DWidgetFactory::get("PIXHAWK");
_3DMapWidget = Q3DWidgetFactory::get("MAP3D");
#endif #endif
#ifdef QGC_OSGEARTH_ENABLED
_3DMapWidget = Q3DWidgetFactory::get("MAP3D");
#endif
// Dock widgets // Dock widgets
controlDockWidget = new QDockWidget(tr("Control"), this); controlDockWidget = new QDockWidget(tr("Control"), this);
controlDockWidget->setWidget( new UASControlWidget(this) ); controlDockWidget->setWidget( new UASControlWidget(this) );
...@@ -232,6 +235,8 @@ void MainWindow::arrangeCenterStack() ...@@ -232,6 +235,8 @@ void MainWindow::arrangeCenterStack()
if (mapWidget) centerStack->addWidget(mapWidget); if (mapWidget) centerStack->addWidget(mapWidget);
#ifdef QGC_OSG_ENABLED #ifdef QGC_OSG_ENABLED
if (_3DWidget) centerStack->addWidget(_3DWidget); if (_3DWidget) centerStack->addWidget(_3DWidget);
#endif
#ifdef QGC_OSGEARTH_ENABLED
if (_3DMapWidget) centerStack->addWidget(_3DMapWidget); if (_3DMapWidget) centerStack->addWidget(_3DMapWidget);
#endif #endif
if (hudWidget) centerStack->addWidget(hudWidget); if (hudWidget) centerStack->addWidget(hudWidget);
...@@ -964,11 +969,11 @@ void MainWindow::loadGlobalOperatorView() ...@@ -964,11 +969,11 @@ void MainWindow::loadGlobalOperatorView()
void MainWindow::load3DMapView() void MainWindow::load3DMapView()
{ {
#ifdef QGC_OSG_ENABLED #ifdef QGC_OSGEARTH_ENABLED
clearView(); clearView();
// 3D map // 3D map
if (_3DWidget) if (_3DMapWidget)
{ {
QStackedWidget *centerStack = dynamic_cast<QStackedWidget*>(centralWidget()); QStackedWidget *centerStack = dynamic_cast<QStackedWidget*>(centralWidget());
if (centerStack) if (centerStack)
......
...@@ -166,6 +166,8 @@ protected: ...@@ -166,6 +166,8 @@ protected:
QPointer<QGCDataPlot2D> dataplotWidget; QPointer<QGCDataPlot2D> dataplotWidget;
#ifdef QGC_OSG_ENABLED #ifdef QGC_OSG_ENABLED
QPointer<QWidget> _3DWidget; QPointer<QWidget> _3DWidget;
#endif
#ifdef QGC_OSGEARTH_ENABLED
QPointer<QWidget> _3DMapWidget; QPointer<QWidget> _3DMapWidget;
#endif #endif
// Dock widgets // Dock widgets
......
...@@ -254,7 +254,7 @@ GCManipulator::calcMovement() ...@@ -254,7 +254,7 @@ GCManipulator::calcMovement()
if (buttonMask == GUIEventAdapter::LEFT_MOUSE_BUTTON) if (buttonMask == GUIEventAdapter::LEFT_MOUSE_BUTTON)
{ {
// rotate camera // rotate camera
osg::Vec3 axis; osg::Vec3d axis;
float angle; float angle;
float px0 = _ga_t0->getXnormalized(); float px0 = _ga_t0->getXnormalized();
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <osg/Geode> #include <osg/Geode>
#include <osg/Image> #include <osg/Image>
#include <osgDB/ReadFile>
#include <osg/LineWidth> #include <osg/LineWidth>
#include <osg/ShapeDrawable> #include <osg/ShapeDrawable>
......
...@@ -34,6 +34,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -34,6 +34,7 @@ This file is part of the QGROUNDCONTROL project
#include <osg/Geometry> #include <osg/Geometry>
#include <osg/LineWidth> #include <osg/LineWidth>
#include <osg/MatrixTransform> #include <osg/MatrixTransform>
#include <Carbon/Carbon.h>
Q3DWidget::Q3DWidget(QWidget* parent) Q3DWidget::Q3DWidget(QWidget* parent)
: QGLWidget(parent) : QGLWidget(parent)
...@@ -90,7 +91,7 @@ Q3DWidget::init(float fps) ...@@ -90,7 +91,7 @@ Q3DWidget::init(float fps)
egocentricMap->addChild(createRobot()); egocentricMap->addChild(createRobot());
// set up camera control // set up camera control
cameraManipulator = new GCManipulator; cameraManipulator = new GCManipulator();
setCameraManipulator(cameraManipulator); setCameraManipulator(cameraManipulator);
cameraManipulator->setMinZoomRange(cameraParams.minZoomRange); cameraManipulator->setMinZoomRange(cameraParams.minZoomRange);
cameraManipulator->setDistance(cameraParams.minZoomRange * 2.0); cameraManipulator->setDistance(cameraParams.minZoomRange * 2.0);
......
...@@ -32,21 +32,25 @@ This file is part of the QGROUNDCONTROL project ...@@ -32,21 +32,25 @@ This file is part of the QGROUNDCONTROL project
#include "Q3DWidgetFactory.h" #include "Q3DWidgetFactory.h"
#include "Pixhawk3DWidget.h" #include "Pixhawk3DWidget.h"
#ifdef QGC_OSGEARTH_ENABLED
#include "QMap3D.h" #include "QMap3D.h"
#endif
QPointer<QWidget> QPointer<QWidget>
Q3DWidgetFactory::get(const std::string& type) Q3DWidgetFactory::get(const std::string& type)
{ {
if (type == "PIXHAWK") if (type == "PIXHAWK")
{ {
return QPointer<QWidget>(new Pixhawk3DWidget); return QPointer<QWidget>(new Pixhawk3DWidget());
} }
#ifdef QGC_OSGEARTH_ENABLED
else if (type == "MAP3D") else if (type == "MAP3D")
{ {
return QPointer<QWidget>(new QMap3D); return QPointer<QWidget>(new QMap3D());
} }
#endif
else else
{ {
return QPointer<QWidget>(new Q3DWidget); return QPointer<QWidget>(new Q3DWidget());
} }
} }
...@@ -21,6 +21,8 @@ This file is part of the QGROUNDCONTROL project ...@@ -21,6 +21,8 @@ This file is part of the QGROUNDCONTROL project
======================================================================*/ ======================================================================*/
#ifdef QGC_OSGEARTH_ENABLED
/** /**
* @file * @file
* @brief Definition of the class QMap3D. * @brief Definition of the class QMap3D.
...@@ -62,3 +64,5 @@ void QMap3D::on_pushButton_vehicle_clicked() ...@@ -62,3 +64,5 @@ void QMap3D::on_pushButton_vehicle_clicked()
graphicsView->getSceneData()->asGroup()->addChild(osgDB::readNodeFile(vehicleName.toStdString())); graphicsView->getSceneData()->asGroup()->addChild(osgDB::readNodeFile(vehicleName.toStdString()));
graphicsView->updateCamera(); graphicsView->updateCamera();
} }
#endif
...@@ -29,6 +29,8 @@ This file is part of the QGROUNDCONTROL project ...@@ -29,6 +29,8 @@ This file is part of the QGROUNDCONTROL project
* *
*/ */
#ifdef QGC_OSGEARTH_ENABLED
#ifndef QMAP3D_H #ifndef QMAP3D_H
#define QMAP3D_H #define QMAP3D_H
...@@ -52,3 +54,4 @@ public slots: ...@@ -52,3 +54,4 @@ public slots:
#endif // QMAP3D_H #endif // QMAP3D_H
#endif
...@@ -18,6 +18,10 @@ ...@@ -18,6 +18,10 @@
#include "QOSGWidget.h" #include "QOSGWidget.h"
#ifdef Q_OS_MACX
#endif
QOSGWidget::QOSGWidget( QWidget * parent, const char * name, WindowFlags f, bool overrideTraits): QOSGWidget::QOSGWidget( QWidget * parent, const char * name, WindowFlags f, bool overrideTraits):
QWidget(parent, f), _overrideTraits (overrideTraits) QWidget(parent, f), _overrideTraits (overrideTraits)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment