From 5c298fa178b78c7be88999b7c9a3b158992f8bf1 Mon Sep 17 00:00:00 2001 From: lm Date: Fri, 26 Nov 2010 19:15:41 +0100 Subject: [PATCH] Added option to have 2D and 3D view in parallel --- qgroundcontrol.pri | 6 ++++++ src/ui/MainWindow.cc | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++-- src/ui/MainWindow.h | 3 +++ src/ui/MainWindow.ui | 12 ++++++++++- 4 files changed, 78 insertions(+), 3 deletions(-) diff --git a/qgroundcontrol.pri b/qgroundcontrol.pri index d94bb42..a8b08b1 100644 --- a/qgroundcontrol.pri +++ b/qgroundcontrol.pri @@ -177,6 +177,12 @@ linux-g++ { #-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/. + } linux-g++-64 { diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index 5f68ef8..efda831 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -136,8 +136,8 @@ void MainWindow::buildWidgets() protocolWidget = new XMLCommProtocolWidget(this); dataplotWidget = new QGCDataPlot2D(this); #ifdef QGC_OSG_ENABLED - //_3DWidget = Q3DWidgetFactory::get("PIXHAWK"); - _3DWidget = Q3DWidgetFactory::get("MAP3D"); + _3DWidget = Q3DWidgetFactory::get("PIXHAWK"); + _3DMapWidget = Q3DWidgetFactory::get("MAP3D"); #endif // Dock widgets @@ -232,6 +232,7 @@ void MainWindow::arrangeCenterStack() if (mapWidget) centerStack->addWidget(mapWidget); #ifdef QGC_OSG_ENABLED if (_3DWidget) centerStack->addWidget(_3DWidget); + if (_3DMapWidget) centerStack->addWidget(_3DMapWidget); #endif if (hudWidget) centerStack->addWidget(hudWidget); if (dataplotWidget) centerStack->addWidget(dataplotWidget); @@ -373,6 +374,7 @@ void MainWindow::connectActions() connect(ui.actionEngineerView, SIGNAL(triggered()), this, SLOT(loadEngineerView())); connect(ui.actionOperatorView, SIGNAL(triggered()), this, SLOT(loadOperatorView())); connect(ui.action3DView, SIGNAL(triggered()), this, SLOT(load3DView())); + connect(ui.action3DMapView, SIGNAL(triggered()), this, SLOT(load3DMapView())); connect(ui.actionShow_full_view, SIGNAL(triggered()), this, SLOT(loadAllView())); connect(ui.actionShow_MAVLink_view, SIGNAL(triggered()), this, SLOT(loadMAVLinkView())); connect(ui.actionShow_data_analysis_view, SIGNAL(triggered()), this, SLOT(loadDataView())); @@ -960,6 +962,60 @@ void MainWindow::loadGlobalOperatorView() } +void MainWindow::load3DMapView() +{ + #ifdef QGC_OSG_ENABLED + clearView(); + + // 3D map + if (_3DWidget) + { + QStackedWidget *centerStack = dynamic_cast(centralWidget()); + if (centerStack) + { + //map3DWidget->setActive(true); + centerStack->setCurrentWidget(_3DMapWidget); + } + } + + // UAS CONTROL + if (controlDockWidget) + { + addDockWidget(Qt::LeftDockWidgetArea, controlDockWidget); + controlDockWidget->show(); + } + + // UAS LIST + if (listDockWidget) + { + addDockWidget(Qt::BottomDockWidgetArea, listDockWidget); + listDockWidget->show(); + } + + // WAYPOINT LIST + if (waypointsDockWidget) + { + addDockWidget(Qt::BottomDockWidgetArea, waypointsDockWidget); + waypointsDockWidget->show(); + } + + // HORIZONTAL SITUATION INDICATOR + if (hsiDockWidget) + { + HSIDisplay* hsi = dynamic_cast( hsiDockWidget->widget() ); + if (hsi) + { + hsi->start(); + addDockWidget(Qt::LeftDockWidgetArea, hsiDockWidget); + hsiDockWidget->show(); + } + } +#endif + this->show(); + + } + + void MainWindow::load3DView() { #ifdef QGC_OSG_ENABLED diff --git a/src/ui/MainWindow.h b/src/ui/MainWindow.h index b053cbc..41277f6 100644 --- a/src/ui/MainWindow.h +++ b/src/ui/MainWindow.h @@ -113,6 +113,8 @@ public slots: void loadOperatorView(); /** @brief Load 3D view */ void load3DView(); + /** @brief Load 3D map view */ + void load3DMapView(); /** @brief Load view with all widgets */ void loadAllView(); /** @brief Load MAVLink XML generator view */ @@ -164,6 +166,7 @@ protected: QPointer dataplotWidget; #ifdef QGC_OSG_ENABLED QPointer _3DWidget; + QPointer _3DMapWidget; #endif // Dock widgets QPointer controlDockWidget; diff --git a/src/ui/MainWindow.ui b/src/ui/MainWindow.ui index 75f7eb0..ed91679 100644 --- a/src/ui/MainWindow.ui +++ b/src/ui/MainWindow.ui @@ -75,6 +75,7 @@ + @@ -234,7 +235,7 @@ :/images/categories/preferences-system.svg:/images/categories/preferences-system.svg - Show 3D view + Show 3D local view Show 3D view @@ -318,6 +319,15 @@ Show Global operator view + + + + :/images/categories/applications-internet.svg:/images/categories/applications-internet.svg + + + Show 3D Globe view + +