Commit bf94b35d authored by lm's avatar lm

Added opmapcontrol

parent 9396f137
...@@ -39,9 +39,12 @@ ...@@ -39,9 +39,12 @@
#include <QFont> #include <QFont>
#include <QObject> #include <QObject>
#include "waypointitem.h" #include "waypointitem.h"
#include "configuration.h"
//#include "uavitem.h" //#include "uavitem.h"
namespace mapcontrol namespace mapcontrol
{ {
using namespace mapcontrol;
class OPMapWidget; class OPMapWidget;
/** /**
* @brief The main graphicsItem used on the widget, contains the map and map logic * @brief The main graphicsItem used on the widget, contains the map and map logic
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <QtOpenGL/QGLWidget> #include <QtOpenGL/QGLWidget>
#include "waypointitem.h" #include "waypointitem.h"
#include "QtSvg/QGraphicsSvgItem" #include "QtSvg/QGraphicsSvgItem"
#include "configuration.h"
#include "uavitem.h" #include "uavitem.h"
#include "gpsitem.h" #include "gpsitem.h"
#include "homeitem.h" #include "homeitem.h"
...@@ -168,7 +169,7 @@ namespace mapcontrol ...@@ -168,7 +169,7 @@ namespace mapcontrol
* @param config pointer to configuration classed to be used * @param config pointer to configuration classed to be used
* @return * @return
*/ */
OPMapWidget(QWidget *parent=0,Configuration *config=new Configuration); OPMapWidget(QWidget *parent=0, mapcontrol::Configuration *config=new mapcontrol::Configuration());
~OPMapWidget(); ~OPMapWidget();
/** /**
......
...@@ -24,9 +24,9 @@ ...@@ -24,9 +24,9 @@
# include ( "../qmapcontrol/QMapControl/QMapControl.pri" ) #{ # include ( "../qmapcontrol/QMapControl/QMapControl.pri" ) #{
# Include bundled version if necessary # Include bundled version if necessary
include(lib/QMapControl/QMapControl.pri) #include(lib/QMapControl/QMapControl.pri)
include(lib/nmea/nmea.pri) include(lib/nmea/nmea.pri)
#include(lib/opmapcontrol/opmapcontrol.pri) include(lib/opmapcontrol/opmapcontrol.pri)
# message("Including bundled QMapControl version as FALLBACK. This is fine on Linux and MacOS, but not the best choice in Windows") # message("Including bundled QMapControl version as FALLBACK. This is fine on Linux and MacOS, but not the best choice in Windows")
QT += network \ QT += network \
...@@ -34,7 +34,8 @@ QT += network \ ...@@ -34,7 +34,8 @@ QT += network \
svg \ svg \
xml \ xml \
phonon \ phonon \
webkit webkit \
sql
TEMPLATE = app TEMPLATE = app
TARGET = qgroundcontrol TARGET = qgroundcontrol
BASEDIR = $$IN_PWD BASEDIR = $$IN_PWD
...@@ -104,13 +105,13 @@ include(src/lib/qextserialport/qextserialport.pri) ...@@ -104,13 +105,13 @@ include(src/lib/qextserialport/qextserialport.pri)
# Include QWT plotting library # Include QWT plotting library
include(src/lib/qwt/qwt.pri) include(src/lib/qwt/qwt.pri)
DEPENDPATH += . \ DEPENDPATH += . \
lib/QMapControl \ # lib/QMapControl \
lib/QMapControl/src \ # lib/QMapControl/src \
lib/opmapcontrol \ lib/opmapcontrol \
lib/opmapcontrol/src \ lib/opmapcontrol/src \
plugins plugins
INCLUDEPATH += . \ INCLUDEPATH += . \
lib/QMapControl \ # lib/QMapControl \
lib/opmapcontrol \ lib/opmapcontrol \
$$BASEDIR/../mavlink/include $$BASEDIR/../mavlink/include
...@@ -132,7 +133,7 @@ FORMS += src/ui/MainWindow.ui \ ...@@ -132,7 +133,7 @@ FORMS += src/ui/MainWindow.ui \
src/ui/ObjectDetectionView.ui \ src/ui/ObjectDetectionView.ui \
src/ui/JoystickWidget.ui \ src/ui/JoystickWidget.ui \
src/ui/DebugConsole.ui \ src/ui/DebugConsole.ui \
src/ui/MapWidget.ui \ # src/ui/MapWidget.ui \
src/ui/XMLCommProtocolWidget.ui \ src/ui/XMLCommProtocolWidget.ui \
src/ui/HDDisplay.ui \ src/ui/HDDisplay.ui \
src/ui/MAVLinkSettingsWidget.ui \ src/ui/MAVLinkSettingsWidget.ui \
...@@ -182,7 +183,7 @@ INCLUDEPATH += src \ ...@@ -182,7 +183,7 @@ INCLUDEPATH += src \
src/ui/designer src/ui/designer
HEADERS += src/MG.h \ HEADERS += src/MG.h \
src/Core.h \ src/QGCCore.h \
src/uas/UASInterface.h \ src/uas/UASInterface.h \
src/uas/UAS.h \ src/uas/UAS.h \
src/uas/UASManager.h \ src/uas/UASManager.h \
...@@ -218,7 +219,7 @@ HEADERS += src/MG.h \ ...@@ -218,7 +219,7 @@ HEADERS += src/MG.h \
src/input/JoystickInput.h \ src/input/JoystickInput.h \
src/ui/JoystickWidget.h \ src/ui/JoystickWidget.h \
src/ui/DebugConsole.h \ src/ui/DebugConsole.h \
src/ui/MapWidget.h \ # src/ui/MapWidget.h \
src/ui/XMLCommProtocolWidget.h \ src/ui/XMLCommProtocolWidget.h \
src/ui/mavlink/DomItem.h \ src/ui/mavlink/DomItem.h \
src/ui/mavlink/DomModel.h \ src/ui/mavlink/DomModel.h \
...@@ -245,8 +246,8 @@ HEADERS += src/MG.h \ ...@@ -245,8 +246,8 @@ HEADERS += src/MG.h \
src/ui/QGCPxImuFirmwareUpdate.h \ src/ui/QGCPxImuFirmwareUpdate.h \
src/ui/QGCDataPlot2D.h \ src/ui/QGCDataPlot2D.h \
src/ui/linechart/IncrementalPlot.h \ src/ui/linechart/IncrementalPlot.h \
src/ui/map/Waypoint2DIcon.h \ # src/ui/map/Waypoint2DIcon.h \
src/ui/map/MAV2DIcon.h \ # src/ui/map/MAV2DIcon.h \
src/ui/QGCRemoteControlView.h \ src/ui/QGCRemoteControlView.h \
src/ui/RadioCalibration/RadioCalibrationData.h \ src/ui/RadioCalibration/RadioCalibrationData.h \
src/ui/RadioCalibration/RadioCalibrationWindow.h \ src/ui/RadioCalibration/RadioCalibrationWindow.h \
...@@ -278,7 +279,8 @@ HEADERS += src/MG.h \ ...@@ -278,7 +279,8 @@ HEADERS += src/MG.h \
src/ui/uas/UASControlParameters.h \ src/ui/uas/UASControlParameters.h \
src/ui/mission/QGCMissionDoWidget.h \ src/ui/mission/QGCMissionDoWidget.h \
src/ui/mission/QGCMissionConditionWidget.h \ src/ui/mission/QGCMissionConditionWidget.h \
src/uas/QGCUASParamManager.h src/uas/QGCUASParamManager.h \
src/ui/QGCMapWidget.h
# Google Earth is only supported on Mac OS and Windows with Visual Studio Compiler # Google Earth is only supported on Mac OS and Windows with Visual Studio Compiler
macx|win32-msvc2008: { macx|win32-msvc2008: {
...@@ -318,7 +320,7 @@ contains(DEPENDENCIES_PRESENT, libfreenect) { ...@@ -318,7 +320,7 @@ contains(DEPENDENCIES_PRESENT, libfreenect) {
} }
SOURCES += src/main.cc \ SOURCES += src/main.cc \
src/Core.cc \ src/QGCCore.cc \
src/uas/UASManager.cc \ src/uas/UASManager.cc \
src/uas/UAS.cc \ src/uas/UAS.cc \
src/comm/LinkManager.cc \ src/comm/LinkManager.cc \
...@@ -349,7 +351,7 @@ SOURCES += src/main.cc \ ...@@ -349,7 +351,7 @@ SOURCES += src/main.cc \
src/input/JoystickInput.cc \ src/input/JoystickInput.cc \
src/ui/JoystickWidget.cc \ src/ui/JoystickWidget.cc \
src/ui/DebugConsole.cc \ src/ui/DebugConsole.cc \
src/ui/MapWidget.cc \ # src/ui/MapWidget.cc \
src/ui/XMLCommProtocolWidget.cc \ src/ui/XMLCommProtocolWidget.cc \
src/ui/mavlink/DomItem.cc \ src/ui/mavlink/DomItem.cc \
src/ui/mavlink/DomModel.cc \ src/ui/mavlink/DomModel.cc \
...@@ -376,8 +378,8 @@ SOURCES += src/main.cc \ ...@@ -376,8 +378,8 @@ SOURCES += src/main.cc \
src/ui/QGCPxImuFirmwareUpdate.cc \ src/ui/QGCPxImuFirmwareUpdate.cc \
src/ui/QGCDataPlot2D.cc \ src/ui/QGCDataPlot2D.cc \
src/ui/linechart/IncrementalPlot.cc \ src/ui/linechart/IncrementalPlot.cc \
src/ui/map/Waypoint2DIcon.cc \ # src/ui/map/Waypoint2DIcon.cc \
src/ui/map/MAV2DIcon.cc \ # src/ui/map/MAV2DIcon.cc \
src/ui/QGCRemoteControlView.cc \ src/ui/QGCRemoteControlView.cc \
src/ui/RadioCalibration/RadioCalibrationWindow.cc \ src/ui/RadioCalibration/RadioCalibrationWindow.cc \
src/ui/RadioCalibration/AirfoilServoCalibrator.cc \ src/ui/RadioCalibration/AirfoilServoCalibrator.cc \
...@@ -408,7 +410,8 @@ SOURCES += src/main.cc \ ...@@ -408,7 +410,8 @@ SOURCES += src/main.cc \
src/ui/uas/UASControlParameters.cpp \ src/ui/uas/UASControlParameters.cpp \
src/ui/mission/QGCMissionDoWidget.cc \ src/ui/mission/QGCMissionDoWidget.cc \
src/ui/mission/QGCMissionConditionWidget.cc \ src/ui/mission/QGCMissionConditionWidget.cc \
src/uas/QGCUASParamManager.cc src/uas/QGCUASParamManager.cc \
src/ui/QGCMapWidget.cc
macx|win32-msvc2008: { macx|win32-msvc2008: {
SOURCES += src/ui/map3D/QGCGoogleEarthView.cc SOURCES += src/ui/map3D/QGCGoogleEarthView.cc
......
...@@ -23,7 +23,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -23,7 +23,7 @@ This file is part of the QGROUNDCONTROL project
/** /**
* @file * @file
* @brief Implementation of class Core * @brief Implementation of class QGCCore
* *
* @author Lorenz Meier <mavteam@student.ethz.ch> * @author Lorenz Meier <mavteam@student.ethz.ch>
* *
...@@ -43,7 +43,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -43,7 +43,7 @@ This file is part of the QGROUNDCONTROL project
#include "configuration.h" #include "configuration.h"
#include "QGC.h" #include "QGC.h"
#include "Core.h" #include "QGCCore.h"
#include "MG.h" #include "MG.h"
#include "MainWindow.h" #include "MainWindow.h"
#include "GAudioOutput.h" #include "GAudioOutput.h"
...@@ -66,7 +66,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -66,7 +66,7 @@ This file is part of the QGROUNDCONTROL project
**/ **/
Core::Core(int &argc, char* argv[]) : QApplication(argc, argv) QGCCore::QGCCore(int &argc, char* argv[]) : QApplication(argc, argv)
{ {
...@@ -207,7 +207,7 @@ Core::Core(int &argc, char* argv[]) : QApplication(argc, argv) ...@@ -207,7 +207,7 @@ Core::Core(int &argc, char* argv[]) : QApplication(argc, argv)
* @brief Destructor for the groundstation. It destroys all loaded instances. * @brief Destructor for the groundstation. It destroys all loaded instances.
* *
**/ **/
Core::~Core() QGCCore::~QGCCore()
{ {
//mainWindow->storeSettings(); //mainWindow->storeSettings();
mainWindow->hide(); mainWindow->hide();
...@@ -223,7 +223,7 @@ Core::~Core() ...@@ -223,7 +223,7 @@ Core::~Core()
* The link manager keeps track of all communication links and provides the global * The link manager keeps track of all communication links and provides the global
* packet queue. It is the main communication hub * packet queue. It is the main communication hub
**/ **/
void Core::startLinkManager() void QGCCore::startLinkManager()
{ {
LinkManager::instance(); LinkManager::instance();
} }
...@@ -232,7 +232,7 @@ void Core::startLinkManager() ...@@ -232,7 +232,7 @@ void Core::startLinkManager()
* @brief Start the Unmanned Air System Manager * @brief Start the Unmanned Air System Manager
* *
**/ **/
void Core::startUASManager() void QGCCore::startUASManager()
{ {
// Load UAS plugins // Load UAS plugins
QDir pluginsDir = QDir(qApp->applicationDirPath()); QDir pluginsDir = QDir(qApp->applicationDirPath());
......
...@@ -30,8 +30,8 @@ This file is part of the PIXHAWK project ...@@ -30,8 +30,8 @@ This file is part of the PIXHAWK project
*/ */
#ifndef _CORE_H_ #ifndef QGC_CORE_H
#define _CORE_H_ #define QGC_CORE_H
#include <QApplication> #include <QApplication>
...@@ -51,13 +51,13 @@ This file is part of the PIXHAWK project ...@@ -51,13 +51,13 @@ This file is part of the PIXHAWK project
* the central management unit of the groundstation application. * the central management unit of the groundstation application.
* *
**/ **/
class Core : public QApplication class QGCCore : public QApplication
{ {
Q_OBJECT Q_OBJECT
public: public:
Core(int &argc, char* argv[]); QGCCore(int &argc, char* argv[]);
~Core(); ~QGCCore();
protected: protected:
void startLinkManager(); void startLinkManager();
......
...@@ -90,29 +90,35 @@ void UDPLink::addHost(const QString& host) ...@@ -90,29 +90,35 @@ void UDPLink::addHost(const QString& host)
{ {
qDebug() << "HOST: " << host.split(":").first(); qDebug() << "HOST: " << host.split(":").first();
QHostInfo info = QHostInfo::fromName(host.split(":").first()); QHostInfo info = QHostInfo::fromName(host.split(":").first());
// Add host if (info.error() == QHostInfo::NoError)
QList<QHostAddress> hostAddresses = info.addresses();
QHostAddress address;
for (int i = 0; i < hostAddresses.size(); i++)
{ {
// Exclude loopback IPv4 and all IPv6 addresses // Add host
if (!hostAddresses.at(i).toString().contains(":")) QList<QHostAddress> hostAddresses = info.addresses();
QHostAddress address;
for (int i = 0; i < hostAddresses.size(); i++)
{ {
address = hostAddresses.at(i); // Exclude loopback IPv4 and all IPv6 addresses
if (!hostAddresses.at(i).toString().contains(":"))
{
address = hostAddresses.at(i);
}
} }
hosts.append(address);
qDebug() << "Address:" << address.toString();
// Set port according to user input
ports.append(host.split(":").last().toInt());
} }
hosts.append(address);
qDebug() << "Address:" << address.toString();
// Set port according to user input
ports.append(host.split(":").last().toInt());
} }
else else
{ {
QHostInfo info = QHostInfo::fromName(host); QHostInfo info = QHostInfo::fromName(host);
// Add host if (info.error() == QHostInfo::NoError)
hosts.append(info.addresses().first()); {
// Set port according to default (this port) // Add host
ports.append(port); hosts.append(info.addresses().first());
// Set port according to default (this port)
ports.append(port);
}
} }
} }
......
#ifndef CONFIGURATION_H #ifndef QGC_CONFIGURATION_H
#define CONFIGURATION_H #define QGC_CONFIGURATION_H
#include "mavlink.h" #include "mavlink.h"
#include <QString> #include <QString>
...@@ -27,4 +27,4 @@ namespace QGC ...@@ -27,4 +27,4 @@ namespace QGC
const int APPLICATIONVERSION = 83; // 0.8.0 const int APPLICATIONVERSION = 83; // 0.8.0
} }
#endif // CONFIGURATION_H #endif // QGC_CONFIGURATION_H
...@@ -29,7 +29,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -29,7 +29,7 @@ This file is part of the QGROUNDCONTROL project
*/ */
#include <QtGui/QApplication> #include <QtGui/QApplication>
#include "Core.h" #include "QGCCore.h"
#include "MainWindow.h" #include "MainWindow.h"
#include "configuration.h" #include "configuration.h"
...@@ -70,6 +70,6 @@ int main(int argc, char *argv[]) ...@@ -70,6 +70,6 @@ int main(int argc, char *argv[])
qInstallMsgHandler( msgHandler ); qInstallMsgHandler( msgHandler );
#endif #endif
Core core(argc, argv); QGCCore core(argc, argv);
return core.exec(); return core.exec();
} }
...@@ -40,8 +40,8 @@ This file is part of the QGROUNDCONTROL project ...@@ -40,8 +40,8 @@ This file is part of the QGROUNDCONTROL project
#include "QGC.h" #include "QGC.h"
#include "Waypoint.h" #include "Waypoint.h"
#include "UASWaypointManager.h" #include "UASWaypointManager.h"
#include "Waypoint2DIcon.h" //#include "Waypoint2DIcon.h"
#include "MAV2DIcon.h" //#include "MAV2DIcon.h"
#include <QDebug> #include <QDebug>
...@@ -246,7 +246,7 @@ void HSIDisplay::renderOverlay() ...@@ -246,7 +246,7 @@ void HSIDisplay::renderOverlay()
// Translate to center // Translate to center
painter.translate((xCenterPos)*scalingFactor, (yCenterPos)*scalingFactor); painter.translate((xCenterPos)*scalingFactor, (yCenterPos)*scalingFactor);
QColor uasColor = uas->getColor(); QColor uasColor = uas->getColor();
MAV2DIcon::drawAirframePolygon(uas->getAirframe(), painter, static_cast<int>((vwidth/4.0f)*scalingFactor*1.1f), uasColor, 0.0f); //MAV2DIcon::drawAirframePolygon(uas->getAirframe(), painter, static_cast<int>((vwidth/4.0f)*scalingFactor*1.1f), uasColor, 0.0f);
// Translate back // Translate back
painter.translate(-(xCenterPos)*scalingFactor, -(yCenterPos)*scalingFactor); painter.translate(-(xCenterPos)*scalingFactor, -(yCenterPos)*scalingFactor);
} }
......
...@@ -383,7 +383,7 @@ void MainWindow::buildCommonWidgets() ...@@ -383,7 +383,7 @@ void MainWindow::buildCommonWidgets()
// Center widgets // Center widgets
if (!mapWidget) if (!mapWidget)
{ {
mapWidget = new MapWidget(this); mapWidget = new mapcontrol::OPMapWidget(this);//new MapWidget(this);
addToCentralWidgetsMenu (mapWidget, "Maps", SLOT(showCentralWidget()),CENTRAL_MAP); addToCentralWidgetsMenu (mapWidget, "Maps", SLOT(showCentralWidget()),CENTRAL_MAP);
} }
......
...@@ -55,7 +55,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -55,7 +55,7 @@ This file is part of the QGROUNDCONTROL project
#include "JoystickWidget.h" #include "JoystickWidget.h"
#include "input/JoystickInput.h" #include "input/JoystickInput.h"
#include "DebugConsole.h" #include "DebugConsole.h"
#include "MapWidget.h" //#include "MapWidget.h"
#include "ParameterInterface.h" #include "ParameterInterface.h"
#include "XMLCommProtocolWidget.h" #include "XMLCommProtocolWidget.h"
#include "HDDisplay.h" #include "HDDisplay.h"
...@@ -63,6 +63,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -63,6 +63,7 @@ This file is part of the QGROUNDCONTROL project
#include "HSIDisplay.h" #include "HSIDisplay.h"
#include "QGCDataPlot2D.h" #include "QGCDataPlot2D.h"
#include "QGCRemoteControlView.h" #include "QGCRemoteControlView.h"
#include "opmapcontrol.h"
#if (defined Q_OS_MAC) | (defined _MSC_VER) #if (defined Q_OS_MAC) | (defined _MSC_VER)
#include "QGCGoogleEarthView.h" #include "QGCGoogleEarthView.h"
#endif #endif
...@@ -366,7 +367,7 @@ protected: ...@@ -366,7 +367,7 @@ protected:
QPointer<HUD> hudWidget; QPointer<HUD> hudWidget;
QPointer<MapWidget> mapWidget; QPointer<mapcontrol::OPMapWidget> mapWidget;
QPointer<XMLCommProtocolWidget> protocolWidget; QPointer<XMLCommProtocolWidget> protocolWidget;
QPointer<QGCDataPlot2D> dataplotWidget; QPointer<QGCDataPlot2D> dataplotWidget;
#ifdef QGC_OSG_ENABLED #ifdef QGC_OSG_ENABLED
......
#include "QGCMapWidget.h"
QGCMapWidget::QGCMapWidget(QWidget *parent) :
OPMapWidget(parent)
{
}
#ifndef QGCMAPWIDGET_H
#define QGCMAPWIDGET_H
class QGCMapWidget : public OPMapWidget
{
Q_OBJECT
public:
explicit QGCMapWidget(QWidget *parent = 0);
signals:
public slots:
};
#endif // QGCMAPWIDGET_H
...@@ -2,11 +2,10 @@ ...@@ -2,11 +2,10 @@
#define MAV2DICON_H #define MAV2DICON_H
#include <QGraphicsItem> #include <QGraphicsItem>
#include "qmapcontrol.h"
#include "UASInterface.h" #include "UASInterface.h"
class MAV2DIcon : public qmapcontrol::Point class MAV2DIcon : public QGraphicsItem
{ {
public: public:
enum enum
......
...@@ -2,11 +2,10 @@ ...@@ -2,11 +2,10 @@
#define WAYPOINT2DICON_H #define WAYPOINT2DICON_H
#include <QGraphicsItem> #include <QGraphicsItem>
#include "qmapcontrol.h"
#include "Waypoint.h" #include "Waypoint.h"
class Waypoint2DIcon : public qmapcontrol::Point class Waypoint2DIcon : public QGraphicsItem
{ {
public: public:
/*! /*!
......
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