Commit bf83aba1 authored by lm's avatar lm

Merged

parents b0ab9b34 6344a49d
......@@ -42,8 +42,11 @@ QMAKE_PRE_LINK += echo "Copying files"
# MAC OS X
macx {
COMPILER_VERSION = $$system(gcc -v)
message(Using compiler $$COMPILER_VERSION)
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
CONFIG += x86 cocoa phonon
message(Building for Mac OS X 32bit/Leopard 10.5 and earlier)
......@@ -60,18 +63,15 @@ macx {
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
INCLUDEPATH += -framework SDL \
$$BASEDIR/../mavlink/contrib/slugs/include \
$$BASEDIR/../mavlink/include
INCLUDEPATH += -framework SDL
LIBS += -framework IOKit \
-framework SDL \
-framework CoreFoundation \
-framework ApplicationServices \
# -framework GLUT \
-lm
ICON = $$BASEDIR/images/icons/macx.icns
......@@ -79,30 +79,63 @@ macx {
# Copy audio files if needed
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")
DEPENDENCIES_PRESENT += osg
DEFINES += QGC_OSG_ENABLED
# 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) {
message("Building support for osgEarth")
DEPENDENCIES_PRESENT += osgearth
# Include osgEarth libraries
LIBS += -losgViewer \
-losgEarth \
-losgEarthUtil
INCLUDEPATH += -framework GDAL \
$$IN_PWD/lib/mac32-gcc/include \
-framework GEOS \
-framework SQLite3 \
-framework osgFX \
-framework osgTerrain
LIBS += -framework GDAL \
-framework GEOS \
-framework SQLite3 \
-framework osgFX \
-framework osgTerrain \
DEFINES += QGC_OSGEARTH_ENABLED
}
exists(/usr/local/include/libfreenect) {
exists(/opt/local/include/libfreenect) {
message("Building support for libfreenect")
DEPENDENCIES_PRESENT += libfreenect
# Include libfreenect libraries
LIBS += -lfreenect
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
......@@ -145,7 +178,7 @@ linux-g++ {
DEFINES += QGC_OSG_ENABLED
}
exists(/usr/include/osgEarth) {
exists(/usr/include/osgEarth) | exists(/usr/local/include/osgEarth) {
message("Building support for osgEarth")
DEPENDENCIES_PRESENT += osgearth
# Include osgEarth libraries
......@@ -164,16 +197,14 @@ linux-g++ {
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/release/.
QMAKE_PRE_LINK += && cp -rf $$BASEDIR/data $$TARGETDIR/debug/.
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 {
......@@ -234,6 +265,10 @@ linux-g++-64 {
LIBS += -lfreenect
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)
......@@ -261,6 +296,10 @@ win32-msvc2008 {
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/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)
......@@ -297,6 +336,10 @@ win32-g++ {
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/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)
......@@ -331,4 +374,8 @@ win64-g++ {
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/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) {
message("Including headers for OpenSceneGraph")
# 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) {
message("Including headers for OSGEARTH")
# Enable only if OpenSceneGraph is available
HEADERS += src/ui/map3D/QOSGWidget.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
HEADERS += src/ui/map3D/QMap3D.h
}
}
......@@ -327,25 +327,27 @@ SOURCES += src/main.cc \
src/ui/RadioCalibration/SwitchCalibrator.cc \
src/ui/RadioCalibration/CurveCalibrator.cc \
src/ui/RadioCalibration/AbstractCalibrator.cc \
src/ui/RadioCalibration/RadioCalibrationData.cc \ # src/ui/WaypointGlobalView.cc \
src/ui/map3D/ImageWindowGeode.cc
src/ui/RadioCalibration/RadioCalibrationData.cc
contains(DEPENDENCIES_PRESENT, osg) {
message("Including sources for OpenSceneGraph")
# 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) {
message("Including sources for osgEarth")
# Enable only if OpenSceneGraph is available
SOURCES += src/ui/map3D/QOSGWidget.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
SOURCES += src/ui/map3D/QMap3D.cc
}
}
......
......@@ -137,9 +137,12 @@ void MainWindow::buildWidgets()
dataplotWidget = new QGCDataPlot2D(this);
#ifdef QGC_OSG_ENABLED
_3DWidget = Q3DWidgetFactory::get("PIXHAWK");
_3DMapWidget = Q3DWidgetFactory::get("MAP3D");
#endif
#ifdef QGC_OSGEARTH_ENABLED
_3DMapWidget = Q3DWidgetFactory::get("MAP3D");
#endif
// Dock widgets
controlDockWidget = new QDockWidget(tr("Control"), this);
controlDockWidget->setWidget( new UASControlWidget(this) );
......@@ -232,6 +235,8 @@ void MainWindow::arrangeCenterStack()
if (mapWidget) centerStack->addWidget(mapWidget);
#ifdef QGC_OSG_ENABLED
if (_3DWidget) centerStack->addWidget(_3DWidget);
#endif
#ifdef QGC_OSGEARTH_ENABLED
if (_3DMapWidget) centerStack->addWidget(_3DMapWidget);
#endif
if (hudWidget) centerStack->addWidget(hudWidget);
......@@ -964,11 +969,11 @@ void MainWindow::loadGlobalOperatorView()
void MainWindow::load3DMapView()
{
#ifdef QGC_OSG_ENABLED
#ifdef QGC_OSGEARTH_ENABLED
clearView();
// 3D map
if (_3DWidget)
if (_3DMapWidget)
{
QStackedWidget *centerStack = dynamic_cast<QStackedWidget*>(centralWidget());
if (centerStack)
......
......@@ -166,6 +166,8 @@ protected:
QPointer<QGCDataPlot2D> dataplotWidget;
#ifdef QGC_OSG_ENABLED
QPointer<QWidget> _3DWidget;
#endif
#ifdef QGC_OSGEARTH_ENABLED
QPointer<QWidget> _3DMapWidget;
#endif
// Dock widgets
......
......@@ -254,7 +254,7 @@ GCManipulator::calcMovement()
if (buttonMask == GUIEventAdapter::LEFT_MOUSE_BUTTON)
{
// rotate camera
osg::Vec3 axis;
osg::Vec3d axis;
float angle;
float px0 = _ga_t0->getXnormalized();
......
......@@ -35,6 +35,7 @@
#include <osg/Geode>
#include <osg/Image>
#include <osgDB/ReadFile>
#include <osg/LineWidth>
#include <osg/ShapeDrawable>
......
......@@ -34,6 +34,7 @@ This file is part of the QGROUNDCONTROL project
#include <osg/Geometry>
#include <osg/LineWidth>
#include <osg/MatrixTransform>
#include <Carbon/Carbon.h>
Q3DWidget::Q3DWidget(QWidget* parent)
: QGLWidget(parent)
......@@ -90,7 +91,7 @@ Q3DWidget::init(float fps)
egocentricMap->addChild(createRobot());
// set up camera control
cameraManipulator = new GCManipulator;
cameraManipulator = new GCManipulator();
setCameraManipulator(cameraManipulator);
cameraManipulator->setMinZoomRange(cameraParams.minZoomRange);
cameraManipulator->setDistance(cameraParams.minZoomRange * 2.0);
......
......@@ -32,21 +32,25 @@ This file is part of the QGROUNDCONTROL project
#include "Q3DWidgetFactory.h"
#include "Pixhawk3DWidget.h"
#ifdef QGC_OSGEARTH_ENABLED
#include "QMap3D.h"
#endif
QPointer<QWidget>
Q3DWidgetFactory::get(const std::string& type)
{
if (type == "PIXHAWK")
{
return QPointer<QWidget>(new Pixhawk3DWidget);
return QPointer<QWidget>(new Pixhawk3DWidget());
}
#ifdef QGC_OSGEARTH_ENABLED
else if (type == "MAP3D")
{
return QPointer<QWidget>(new QMap3D);
return QPointer<QWidget>(new QMap3D());
}
#endif
else
{
return QPointer<QWidget>(new Q3DWidget);
return QPointer<QWidget>(new Q3DWidget());
}
}
......@@ -21,6 +21,8 @@ This file is part of the QGROUNDCONTROL project
======================================================================*/
#ifdef QGC_OSGEARTH_ENABLED
/**
* @file
* @brief Definition of the class QMap3D.
......@@ -62,3 +64,5 @@ void QMap3D::on_pushButton_vehicle_clicked()
graphicsView->getSceneData()->asGroup()->addChild(osgDB::readNodeFile(vehicleName.toStdString()));
graphicsView->updateCamera();
}
#endif
......@@ -29,6 +29,8 @@ This file is part of the QGROUNDCONTROL project
*
*/
#ifdef QGC_OSGEARTH_ENABLED
#ifndef QMAP3D_H
#define QMAP3D_H
......@@ -52,3 +54,4 @@ public slots:
#endif // QMAP3D_H
#endif
......@@ -18,6 +18,10 @@
#include "QOSGWidget.h"
#ifdef Q_OS_MACX
#endif
QOSGWidget::QOSGWidget( QWidget * parent, const char * name, WindowFlags f, bool 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