Commit bf94b35d authored by lm's avatar lm

Added opmapcontrol

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