Commit c3496c0e authored by pixhawk's avatar pixhawk

Merged last changes

parents 9a6a3ea6 869f7c1a
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="org.eclipse.cdt.core.default.config.989472769">
<storageModule buildSystemId="org.eclipse.cdt.core.defaultConfigDataProvider" id="org.eclipse.cdt.core.default.config.989472769" moduleId="org.eclipse.cdt.core.settings" name="Configuration">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-c 'gcc -E -P -v -dD &quot;${plugin_state_location}/${specs_file}&quot;'" command="sh" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-c 'g++ -E -P -v -dD &quot;${plugin_state_location}/specs.cpp&quot;'" command="sh" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-c 'gcc -E -P -v -dD &quot;${plugin_state_location}/specs.c&quot;'" command="sh" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
<buildTargets>
<target name="Qt Release Build" path="" targetID="org.eclipse.cdt.make.MakeTargetBuilder">
<buildCommand>mingw32-make</buildCommand>
<buildArguments/>
<buildTarget>release</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="Qt Debug Build" path="" targetID="org.eclipse.cdt.make.MakeTargetBuilder">
<buildCommand>mingw32-make</buildCommand>
<buildArguments/>
<buildTarget>debug</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
</buildTargets>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.pathentry">
<pathentry base-path="C:/Qt/2010.04/qt/include" include="" kind="inc" path="" system="true"/>
<pathentry base-path="C:/Qt/2010.04/qt/include" include="ActiveQt" kind="inc" path="" system="true"/>
<pathentry base-path="C:/Qt/2010.04/qt/include" include="phonon" kind="inc" path="" system="true"/>
<pathentry base-path="C:/Qt/2010.04/qt/include" include="phonon_compat" kind="inc" path="" system="true"/>
<pathentry base-path="C:/Qt/2010.04/qt/include" include="Qt" kind="inc" path="" system="true"/>
<pathentry base-path="C:/Qt/2010.04/qt/include" include="Qt3Support" kind="inc" path="" system="true"/>
<pathentry base-path="C:/Qt/2010.04/qt/include" include="QtAssistant" kind="inc" path="" system="true"/>
<pathentry base-path="C:/Qt/2010.04/qt/include" include="QtCore" kind="inc" path="" system="true"/>
<pathentry base-path="C:/Qt/2010.04/qt/include" include="QtDBus" kind="inc" path="" system="true"/>
<pathentry base-path="C:/Qt/2010.04/qt/include" include="QtDeclarative" kind="inc" path="" system="true"/>
<pathentry base-path="C:/Qt/2010.04/qt/include" include="QtDesigner" kind="inc" path="" system="true"/>
<pathentry base-path="C:/Qt/2010.04/qt/include" include="QtGui" kind="inc" path="" system="true"/>
<pathentry base-path="C:/Qt/2010.04/qt/include" include="QtHelp" kind="inc" path="" system="true"/>
<pathentry base-path="C:/Qt/2010.04/qt/include" include="QtMultimedia" kind="inc" path="" system="true"/>
<pathentry base-path="C:/Qt/2010.04/qt/include" include="QtNetwork" kind="inc" path="" system="true"/>
<pathentry base-path="C:/Qt/2010.04/qt/include" include="QtOpenGL" kind="inc" path="" system="true"/>
<pathentry base-path="C:/Qt/2010.04/qt/include" include="QtOpenVG" kind="inc" path="" system="true"/>
<pathentry base-path="C:/Qt/2010.04/qt/include" include="QtScript" kind="inc" path="" system="true"/>
<pathentry base-path="C:/Qt/2010.04/qt/include" include="QtScriptTools" kind="inc" path="" system="true"/>
<pathentry base-path="C:/Qt/2010.04/qt/include" include="QtSql" kind="inc" path="" system="true"/>
<pathentry base-path="C:/Qt/2010.04/qt/include" include="QtSvg" kind="inc" path="" system="true"/>
<pathentry base-path="C:/Qt/2010.04/qt/include" include="QtTest" kind="inc" path="" system="true"/>
<pathentry base-path="C:/Qt/2010.04/qt/include" include="QtUiTools" kind="inc" path="" system="true"/>
<pathentry base-path="C:/Qt/2010.04/qt/include" include="QtWebKit" kind="inc" path="" system="true"/>
<pathentry base-path="C:/Qt/2010.04/qt/include" include="QtXml" kind="inc" path="" system="true"/>
<pathentry base-path="C:/Qt/2010.04/qt/include" include="QtXmlPatterns" kind="inc" path="" system="true"/>
</storageModule>
</cconfiguration>
</storageModule>
</cproject>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>qgroundcontrol</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.trolltech.qtcppproject.QtMakefileGenerator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.make.core.makeBuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>org.eclipse.cdt.core.errorOutputParser</key>
<value>org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.VCErrorParser;org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.MakeErrorParser;</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.build.arguments</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.build.command</key>
<value>mingw32-make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.build.target.auto</key>
<value>debug</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.build.target.clean</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.build.target.inc</key>
<value>debug</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enabledIncrementalBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.environment</key>
<value>QMAKESPEC=win32-g++|PATH=C:\\Qt\\2010.04\\qt\\bin;${env_var:PATH}|</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>false</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.make.core.ScannerConfigBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.make.core.makeNature</nature>
<nature>org.eclipse.cdt.make.core.ScannerConfigNature</nature>
<nature>com.trolltech.qtcppproject.QtNature</nature>
</natures>
</projectDescription>
......@@ -155,7 +155,7 @@ QPushButton {
}
QPushButton:checked {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #101010, stop: 1 #404040);
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #404040, stop: 1 #808080);
}
QPushButton:pressed {
......
......@@ -29,9 +29,9 @@ namespace qmapcontrol
Geometry::Geometry(QString name)
: GeometryType("Geometry"), myparentGeometry(0), mypen(0), visible(true), myname(name)
{
myIndex = name.toInt(0,10);
}
Geometry::~Geometry()
{
}
......@@ -40,6 +40,11 @@ namespace qmapcontrol
{
return myname;
}
int Geometry::get_myIndex() const
{
return myIndex;
}
Geometry* Geometry::parentGeometry() const
{
return myparentGeometry;
......@@ -85,4 +90,5 @@ namespace qmapcontrol
{
return mypen;
}
}
......@@ -49,6 +49,7 @@ namespace qmapcontrol
Q_OBJECT
public:
explicit Geometry(QString name = QString());
virtual ~Geometry();
QString GeometryType;
......@@ -74,6 +75,12 @@ namespace qmapcontrol
*/
QString name() const;
//! returns the index of this Geometry
/*!
* @return the index of this Geometry
*/
int get_myIndex() const;
//! returns the parent Geometry of this Geometry
/*!
* A LineString is a composition of many Points. This methods returns the parent (the LineString) of a Point
......@@ -123,6 +130,7 @@ namespace qmapcontrol
QPen* mypen;
bool visible;
QString myname;
int myIndex;
void setParentGeometry(Geometry* geom);
signals:
......@@ -149,6 +157,8 @@ namespace qmapcontrol
* @param visible if the layer should be visible
*/
virtual void setVisible(bool visible);
};
}
#endif
......@@ -29,6 +29,7 @@ namespace qmapcontrol
Layer::Layer(QString layername, MapAdapter* mapadapter, enum LayerType layertype, bool takeevents)
:visible(true), mylayername(layername), mylayertype(layertype), mapAdapter(mapadapter), takeevents(takeevents), myoffscreenViewport(QRect(0,0,0,0))
{
draggingGeometry = false;
//qDebug() << "creating new Layer: " << layername << ", type: " << contents;
//qDebug() << this->layertype;
}
......
......@@ -366,15 +366,26 @@ namespace qmapcontrol
void LayerManager::mouseEvent(const QMouseEvent* evnt)
{
QListIterator<Layer*> it(mylayers);
while (it.hasNext())
// TODO: to review errors generated in the Windows operating system when the QListIterator is used
for(int i=0; i<mylayers.size(); i++)
{
Layer* l = it.next();
Layer* l = mylayers[i];
if (l->isVisible())
{
l->mouseEvent(evnt, mapmiddle_px);
}
}
// QListIterator<Layer*> it(mylayers);
// while (it.hasNext())
// {
// qDebug() << it.next();
// Layer* l = it.next();
// if (l->isVisible())
// {
// l->mouseEvent(evnt, mapmiddle_px);
// }
// }
}
void LayerManager::updateRequest(QRectF rect)
......
......@@ -126,7 +126,8 @@ win32 {
# Special settings for debug
#CONFIG += CONSOLE
INCLUDEPATH += $$BASEDIR\lib\sdl\include #\
INCLUDEPATH += $$BASEDIR\lib\sdl\include \
$$BASEDIR\lib\opal\include #\ #\
#"C:\Program Files\Microsoft SDKs\Windows\v7.0\Include"
LIBS += -L$$BASEDIR\lib\sdl\win32 \
......
......@@ -75,7 +75,8 @@ FORMS += src/ui/MainWindow.ui \
src/ui/QGCFirmwareUpdate.ui \
src/ui/QGCPxImuFirmwareUpdate.ui \
src/ui/QGCDataPlot2D.ui \
src/ui/QGCRemoteControlView.ui
src/ui/QGCRemoteControlView.ui \
src/ui/WaypointGlobalView.ui
INCLUDEPATH += src \
src/ui \
src/ui/linechart \
......@@ -157,7 +158,9 @@ HEADERS += src/MG.h \
src/ui/map/Waypoint2DIcon.h \
src/ui/map/MAV2DIcon.h \
src/ui/map/QGC2DIcon.h \
src/ui/QGCRemoteControlView.h
src/ui/QGCRemoteControlView.h \
src/WaypointGlobal.h \
src/ui/WaypointGlobalView.h
SOURCES += src/main.cc \
src/Core.cc \
src/uas/UASManager.cc \
......@@ -221,7 +224,9 @@ SOURCES += src/main.cc \
src/ui/map/Waypoint2DIcon.cc \
src/ui/map/MAV2DIcon.cc \
src/ui/map/QGC2DIcon.cc \
src/ui/QGCRemoteControlView.cc
src/ui/QGCRemoteControlView.cc \
src/WaypointGlobal.cpp \
src/ui/WaypointGlobalView.cpp
RESOURCES = mavground.qrc
# Include RT-LAB Library
......
......@@ -59,7 +59,7 @@ public:
bool load(QTextStream &loadStream);
private:
protected:
quint16 id;
float x;
float y;
......
#include "WaypointGlobal.h"
#include <QPointF>
WaypointGlobal::WaypointGlobal(const QPointF coordinate):
Waypoint(id, x, y, z, yaw, autocontinue, current, orbit, holdTime)
{
coordinateWP = coordinate;
}
#ifndef WAYPOINTGLOBAL_H
#define WAYPOINTGLOBAL_H
#include "Waypoint.h"
#include <QPointF>
class WaypointGlobal: public Waypoint {
Q_OBJECT
public:
WaypointGlobal(const QPointF coordinate);
public slots:
// void set_latitud(double latitud);
// void set_longitud(double longitud);
// double get_latitud();
// double get_longitud();
private:
QPointF coordinateWP;
};
#endif // WAYPOINTGLOBAL_H
......@@ -451,6 +451,7 @@ void UASWaypointManager::writeWaypoints()
current_partner_compid = MAV_COMP_ID_WAYPOINTPLANNER;
//clear local buffer
//TODO: Why not replace with waypoint_buffer.clear() ?
while(!waypoint_buffer.empty())
{
delete waypoint_buffer.back();
......@@ -473,6 +474,7 @@ void UASWaypointManager::writeWaypoints()
cur_d->orbit_direction = 0;
cur_d->param1 = cur_s->getOrbit();
cur_d->param2 = cur_s->getHoldTime();
// TODO: Replace this value depending on the type of waypoint
cur_d->type = 1; //FIXME: we only use local waypoints at the moment
cur_d->seq = i; // don't read out the sequence number of the waypoint class
cur_d->x = cur_s->getX();
......
......@@ -92,7 +92,7 @@ MainWindow::MainWindow(QWidget *parent) :
// Create actions
connectActions();
// Load widgets and show application window
// Load widgets and show application windowa
loadWidgets();
// Adjust the size
......@@ -175,6 +175,9 @@ void MainWindow::buildWidgets()
}
/**
* Connect all signals and slots of the main window widgets
*/
void MainWindow::connectWidgets()
{
if (linechartWidget)
......@@ -191,6 +194,16 @@ void MainWindow::connectWidgets()
connect(mavlink, SIGNAL(receiveLossChanged(int, float)),
infoDockWidget->widget(), SLOT(updateSendLoss(int, float)));
}
if (mapWidget && waypointsDockWidget->widget())
{
// clear path create on the map
connect(waypointsDockWidget->widget(), SIGNAL(clearPathclicked()), mapWidget, SLOT(clearPath()));
// add Waypoint widget in the WaypointList widget when mouse clicked
connect(mapWidget, SIGNAL(captureMapCoordinateClick(QPointF)), waypointsDockWidget->widget(), SLOT(addWaypointMouse(QPointF)));
// it notifies that a waypoint global goes to do create
connect(mapWidget, SIGNAL(createGlobalWP(bool)), waypointsDockWidget->widget(), SLOT(setIsWPGlobal(bool)));
connect(mapWidget, SIGNAL(sendGeometryEndDrag(QPointF,int)), waypointsDockWidget->widget(), SLOT(waypointGlobalChanged(QPointF,int)) );
}
}
void MainWindow::arrangeCenterStack()
......@@ -353,6 +366,8 @@ void MainWindow::connectActions()
// Joystick configuration
connect(ui.actionJoystickSettings, SIGNAL(triggered()), this, SLOT(configure()));
}
void MainWindow::showHelp()
......
......@@ -22,6 +22,9 @@
<height>800</height>
</size>
</property>
<property name="mouseTracking">
<bool>false</bool>
</property>
<property name="windowTitle">
<string>MGMainWindow</string>
</property>
......@@ -35,7 +38,7 @@
<x>0</x>
<y>0</y>
<width>1000</width>
<height>22</height>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="menuMGround">
......
......@@ -87,7 +87,10 @@ MapWidget::MapWidget(QWidget *parent) :
// Set default zoom level
mc->setZoom(16);
// Zurich, ETH
mc->setView(QPointF(8.548056,47.376389));
//mc->setView(QPointF(8.548056,47.376389));
// Veracruz Mexico, ETH
mc->setView(QPointF(-96.105208,19.138955));
// Add controls to select map provider
/////////////////////////////////////////////////
......@@ -299,24 +302,32 @@ void MapWidget::createPathButtonClicked(bool checked)
{
Q_UNUSED(checked);
if (createPath->isChecked())
{
// change the cursor shape
this->setCursor(Qt::PointingHandCursor);
mc->setMouseMode(qmapcontrol::MapControl::None);
// Clear the previous WP track
// TODO: Move this to an actual clear track button and add a warning dialog
mc->layer("Waypoints")->clearGeometries();
wps.clear();
path->setPoints(wps);
mc->layer("Waypoints")->addGeometry(path);
wpIndex.clear();
// emit signal start to create a Waypoint global
emit createGlobalWP(true);
// // Clear the previous WP track
// // TODO: Move this to an actual clear track button and add a warning dialog
// mc->layer("Waypoints")->clearGeometries();
// wps.clear();
// path->setPoints(wps);
// mc->layer("Waypoints")->addGeometry(path);
// wpIndex.clear();
} else {
this->setCursor(Qt::ArrowCursor);
mc->setMouseMode(qmapcontrol::MapControl::Panning);
}
}
......@@ -328,7 +339,7 @@ void MapWidget::captureMapClick(const QMouseEvent* event, const QPointF coordina
// Create waypoint name
QString str;
str = QString("WP%1").arg(path->numberOfPoints());
str = QString("%1").arg(path->numberOfPoints());
// create the WP and set everything in the LineString to display the path
CirclePoint* tempCirclePoint = new CirclePoint(coordinate.x(), coordinate.y(), 10, str);
......@@ -342,6 +353,10 @@ void MapWidget::captureMapClick(const QMouseEvent* event, const QPointF coordina
// Refresh the screen
mc->updateRequestNew();
// emit signal mouse was clicked
emit captureMapCoordinateClick(coordinate);
}
}
......@@ -357,6 +372,10 @@ void MapWidget::captureGeometryClick(Geometry* geom, QPoint point){
void MapWidget::captureGeometryDrag(Geometry* geom, QPointF coordinate){
Q_UNUSED(coordinate);
// Refresh the screen
mc->updateRequestNew();
int temp = 0;
Point* point2Find;
point2Find = wpIndex[geom->name()];
point2Find->setCoordinate(coordinate);
......@@ -364,11 +383,17 @@ void MapWidget::captureGeometryDrag(Geometry* geom, QPointF coordinate){
point2Find = dynamic_cast <Point*> (geom);
point2Find->setCoordinate(coordinate);
// Refresh the screen
mc->updateRequestNew();
// qDebug() << geom->name();
temp = geom->get_myIndex();
//qDebug() << temp;
emit sendGeometryEndDrag(coordinate,temp);
}
void MapWidget::captureGeometryEndDrag(Geometry* geom, QPointF coordinate){
void MapWidget::captureGeometryEndDrag(Geometry* geom, QPointF coordinate)
{
mc->setMouseMode(qmapcontrol::MapControl::Panning);
// qDebug() << geom->name();
......@@ -536,3 +561,21 @@ void MapWidget::changeEvent(QEvent *e)
break;
}
}
void MapWidget::clearPath()
{
// Clear the previous WP track
mc->layer("Waypoints")->clearGeometries();
wps.clear();
path->setPoints(wps);
mc->layer("Waypoints")->addGeometry(path);
wpIndex.clear();
mc->updateRequestNew();
// si el boton de crear wp globales esta activo desactivarlo llamando a su evento clicket
if(createPath->isChecked())
{
createPath->click();
}
}
......@@ -63,6 +63,9 @@ public slots:
void updateGlobalPosition(UASInterface* uas, double lat, double lon, double alt, quint64 usec);
void updatePosition(float time, double lat, double lon);
//ROCA
void clearPath();
protected:
void changeEvent(QEvent* e);
void wheelEvent(QWheelEvent *event);
......@@ -108,8 +111,14 @@ protected:
void captureGeometryDrag(Geometry* geom, QPointF coordinate);
void captureGeometryEndDrag(Geometry* geom, QPointF coordinate);
signals:
void movePoint(QPointF newCoord);
//void movePoint(QPointF newCoord);
void captureMapCoordinateClick(const QPointF coordinate); //ROCA
void createGlobalWP(bool value);
void sendGeometryEndDrag(const QPointF coordinate, const int index);
private:
Ui::MapWidget *m_ui;
......
#include "WaypointGlobalView.h"
#include "ui_WaypointGlobalView.h"
#include <math.h>
WaypointGlobalView::WaypointGlobalView(Waypoint* wp,QWidget *parent) :
QWidget(parent),
ui(new Ui::WaypointGlobalView)
{
ui->setupUi(this);
this->wp = wp;
ui->m_orbitalSpinBox->hide();
connect(ui->m_orbitalSpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setOrbit(double)));
connect(ui->m_heigthSpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setZ(double)));
connect(ui->m_orbitCheckBox, SIGNAL(stateChanged(int)), this, SLOT(changeOrbitalState(int)));
// Read values and set user interface
updateValues();
// connect(m_ui->xSpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setX(double)));
// connect(m_ui->ySpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setY(double)));
// connect(m_ui->zSpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setZ(double)));
// //hidden degree to radian conversion of the yaw angle
// connect(m_ui->yawSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setYaw(int)));
// connect(this, SIGNAL(setYaw(double)), wp, SLOT(setYaw(double)));
// connect(m_ui->upButton, SIGNAL(clicked()), this, SLOT(moveUp()));
// connect(m_ui->downButton, SIGNAL(clicked()), this, SLOT(moveDown()));
// connect(m_ui->removeButton, SIGNAL(clicked()), this, SLOT(remove()));
// connect(m_ui->autoContinue, SIGNAL(stateChanged(int)), this, SLOT(changedAutoContinue(int)));
// connect(m_ui->selectedBox, SIGNAL(stateChanged(int)), this, SLOT(changedCurrent(int)));
//
// connect(m_ui->holdTimeSpinBox, SIGNAL(valueChanged(int)), wp, SLOT(setHoldTime(int)));
}
WaypointGlobalView::~WaypointGlobalView()
{
delete ui;
}
void WaypointGlobalView::updateValues()
{
ui->m_latitudtextEdit->setText(getLatitudString(wp->getY()));
ui->m_longitudtextEdit->setText(getLongitudString(wp->getX()));
ui->idWP_label->setText(QString("%1").arg(wp->getId()));\
}
void WaypointGlobalView::changeEvent(QEvent *e)
{
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
void WaypointGlobalView::remove()
{
emit removeWaypoint(wp);
delete this;
}
QString WaypointGlobalView::getLatitudString(float latitud)
{
QString tempNS ="";
QString stringLatitudTemp = "";
float minutos = 0;
float grados = 0;
float entero = 0;
float dec = 0;
if (latitud<0){tempNS="S"; latitud = latitud * -1;}
else {tempNS="N";}
if(latitud< 90 || latitud > -90)
{
dec = latitud - (entero = ::floor(latitud));;
minutos = dec * 60;
grados = entero;
if(grados < 0) grados = grados * (-1);
if(minutos < 0) minutos = minutos * (-1);
stringLatitudTemp = QString::number(grados)+ " "+ QString::number(minutos)+"' "+ tempNS;
return stringLatitudTemp;
}
else
{
stringLatitudTemp = "erroneous latitude";
return stringLatitudTemp;
}
}
QString WaypointGlobalView::getLongitudString(float longitud)
{
QString tempEW ="";
QString stringLongitudTemp = "";
float minutos = 0;
float grados = 0;
float entero = 0;
float dec = 0;
if (longitud<0){tempEW="W"; longitud = longitud * -1;}
else {tempEW="E";}
if(longitud<180 || longitud > -180)
{
dec = longitud - (entero = ::floor(longitud));;
minutos = dec * 60;
grados = entero;
if(grados < 0) grados = grados * (-1);
if(minutos < 0) minutos = minutos * (-1);
stringLongitudTemp = QString::number(grados)+ " "+ QString::number(minutos)+"' "+ tempEW;
return stringLongitudTemp;
}
else
{
stringLongitudTemp = "erroneous longitude";
return stringLongitudTemp;
}
}
void WaypointGlobalView::changeOrbitalState(int state)
{
Q_UNUSED(state);
if(ui->m_orbitCheckBox->isChecked())
{
ui->m_orbitalSpinBox->setEnabled(true);
ui->m_orbitalSpinBox->show();
}
else
{
ui->m_orbitalSpinBox->setEnabled(false);
ui->m_orbitalSpinBox->hide();
}
}
#ifndef WAYPOINTGLOBALVIEW_H
#define WAYPOINTGLOBALVIEW_H
#include <QWidget>
#include "Waypoint.h"
namespace Ui {
class WaypointGlobalView;
}
class WaypointGlobalView : public QWidget
{
Q_OBJECT
public:
explicit WaypointGlobalView(Waypoint* wp, QWidget *parent = 0);
~WaypointGlobalView();
public slots:
void updateValues(void);
void remove();
QString getLatitudString(float lat);
QString getLongitudString(float lon);
void changeOrbitalState(int state);
signals:
void removeWaypoint(Waypoint*);
protected:
virtual void changeEvent(QEvent *e);
Waypoint* wp;
private:
Ui::WaypointGlobalView *ui;
private slots:
};
#endif // WAYPOINTGLOBALVIEW_H
This diff is collapsed.
......@@ -37,6 +37,8 @@ This file is part of the PIXHAWK project
#include <UASManager.h>
#include <QDebug>
#include <QFileDialog>
#include "WaypointGlobalView.h"
#include <QMessageBox>
WaypointList::WaypointList(QWidget *parent, UASInterface* uas) :
QWidget(parent),
......@@ -77,6 +79,8 @@ WaypointList::WaypointList(QWidget *parent, UASInterface* uas) :
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setUAS(UASInterface*)));
// SET UAS AFTER ALL SIGNALS/SLOTS ARE CONNECTED
setUAS(uas);
......@@ -84,6 +88,8 @@ WaypointList::WaypointList(QWidget *parent, UASInterface* uas) :
updateStatusLabel("");
this->setVisible(false);
isGlobalWP = false;
isLocalWP = false;
}
WaypointList::~WaypointList()
......@@ -162,6 +168,7 @@ void WaypointList::add()
{
if (uas)
{
const QVector<Waypoint *> &waypoints = uas->getWaypointManager().getWaypointList();
if (waypoints.size() > 0)
{
......@@ -174,12 +181,24 @@ void WaypointList::add()
Waypoint *wp = new Waypoint(0, 1.1, 1.1, -0.8, 0.0, true, true, 0.15, 2000);
uas->getWaypointManager().localAddWaypoint(wp);
}
isLocalWP = true;
}
}
void WaypointList::addCurrentPositonWaypoint()
{
if (uas)
{
// For Global Waypoints
if(isGlobalWP)
{
isLocalWP = false;
}
else
{
const QVector<Waypoint *> &waypoints = uas->getWaypointManager().getWaypointList();
if (waypoints.size() > 0)
......@@ -193,6 +212,9 @@ void WaypointList::addCurrentPositonWaypoint()
Waypoint *wp = new Waypoint(0, (qRound(mavX*100))/100., (qRound(mavY*100))/100., (qRound(mavZ*100))/100., (qRound(mavYaw*100))/100., true, true, 0.15, 2000);
uas->getWaypointManager().localAddWaypoint(wp);
}
isLocalWP = true;
}
}
}
......@@ -240,6 +262,60 @@ void WaypointList::waypointListChanged()
{
const QVector<Waypoint *> &waypoints = uas->getWaypointManager().getWaypointList();
// For Global Waypoints
if(isGlobalWP)
{
isLocalWP = false;
// first remove all views of non existing waypoints
if (!wpGlobalViews.empty())
{
QMapIterator<Waypoint*,WaypointGlobalView*> viewIt(wpGlobalViews);
viewIt.toFront();
while(viewIt.hasNext())
{
viewIt.next();
Waypoint *cur = viewIt.key();
int i;
for (i = 0; i < waypoints.size(); i++)
{
if (waypoints[i] == cur)
{
break;
}
}
if (i == waypoints.size())
{
WaypointGlobalView* widget = wpGlobalViews.find(cur).value();
widget->hide();
listLayout->removeWidget(widget);
wpGlobalViews.remove(cur);
}
}
}
// then add/update the views for each waypoint in the list
for(int i = 0; i < waypoints.size(); i++)
{
Waypoint *wp = waypoints[i];
if (!wpGlobalViews.contains(wp))
{
WaypointGlobalView* wpview = new WaypointGlobalView(wp, this);
wpGlobalViews.insert(wp, wpview);
// connect(wpview, SIGNAL(moveDownWaypoint(Waypoint*)), this, SLOT(moveDown(Waypoint*)));
// connect(wpview, SIGNAL(moveUpWaypoint(Waypoint*)), this, SLOT(moveUp(Waypoint*)));
connect(wpview, SIGNAL(removeWaypoint(Waypoint*)), this, SLOT(removeWaypoint(Waypoint*)));
// connect(wpview, SIGNAL(currentWaypointChanged(quint16)), this, SLOT(currentWaypointChanged(quint16)));
// connect(wpview, SIGNAL(changeCurrentWaypoint(quint16)), this, SLOT(changeCurrentWaypoint(quint16)));
}
WaypointGlobalView *wpgv = wpGlobalViews.value(wp);
wpgv->updateValues();
listLayout->addWidget(wpgv);
}
}
else
{
// for local Waypoints
// first remove all views of non existing waypoints
if (!wpViews.empty())
{
......@@ -281,12 +357,18 @@ void WaypointList::waypointListChanged()
connect(wpview, SIGNAL(currentWaypointChanged(quint16)), this, SLOT(currentWaypointChanged(quint16)));
connect(wpview, SIGNAL(changeCurrentWaypoint(quint16)), this, SLOT(changeCurrentWaypoint(quint16)));
}
WaypointView *wpv = wpViews.value(wp);
wpv->updateValues(); // update the values of the ui elements in the view
listLayout->addWidget(wpv);
}
}
}
}
void WaypointList::moveUp(Waypoint* wp)
......@@ -352,3 +434,140 @@ void WaypointList::changeEvent(QEvent *e)
}
}
void WaypointList::on_clearWPListButton_clicked()
{
if (uas)
{
if(isGlobalWP)
{
emit clearPathclicked();
const QVector<Waypoint *> &waypoints = uas->getWaypointManager().getWaypointList();
while(!waypoints.isEmpty())//for(int i = 0; i <= waypoints.size(); i++)
{
WaypointGlobalView* widget = wpGlobalViews.find(waypoints[0]).value();
widget->remove();
}
isGlobalWP = false;
}
else
{
const QVector<Waypoint *> &waypoints = uas->getWaypointManager().getWaypointList();
while(!waypoints.isEmpty())//for(int i = 0; i <= waypoints.size(); i++)
{
WaypointView* widget = wpViews.find(waypoints[0]).value();
widget->remove();
}
}
}
}
/** @brief Add a waypoint by mouse click over the map */
void WaypointList::addWaypointMouse(QPointF coordinate)
{
if (uas)
{
const QVector<Waypoint *> &waypoints = uas->getWaypointManager().getWaypointList();
if (waypoints.size() > 0)
{
Waypoint *last = waypoints.at(waypoints.size()-1);
Waypoint *wp = new Waypoint(0, coordinate.x(), coordinate.y(), last->getZ(), last->getYaw(), last->getAutoContinue(), false, last->getOrbit(), last->getHoldTime());
uas->getWaypointManager().localAddWaypoint(wp);
}
else
{
Waypoint *wp = new Waypoint(0, coordinate.x(), coordinate.y(), -0.8, 0.0, true, true, 0.15, 2000);
uas->getWaypointManager().localAddWaypoint(wp);
}
}
}
/** @brief it notifies that a global waypoint goes to do created */
void WaypointList::setIsWPGlobal(bool value)
{
if(isLocalWP)
{
if(wpViews.size()!= 0)
{
int ret = QMessageBox::warning(this, tr("My Application"),
tr("There are Waypoints local created.\n"
"Do you want to clear them?"),
QMessageBox::Ok | QMessageBox::Cancel);
if(ret)
{
clearLocalWPWidget();
isGlobalWP = value;
isLocalWP = !(value);
}
}
}
else
{
isGlobalWP = value;
}
}
/** @brief The MapWidget informs that a waypoint global was changed on the map */
void WaypointList::waypointGlobalChanged(QPointF coordinate, int indexWP)
{
if (uas)
{
const QVector<Waypoint *> &waypoints = uas->getWaypointManager().getWaypointList();
if (waypoints.size() > 0)
{
Waypoint *temp = waypoints.at(indexWP);
temp->setX(coordinate.x());
temp->setY(coordinate.y());
WaypointGlobalView* widget = wpGlobalViews.find(waypoints[indexWP]).value();
widget->updateValues();
}
}
}
void WaypointList::clearLocalWPWidget()
{
if (uas)
{
const QVector<Waypoint *> &waypoints = uas->getWaypointManager().getWaypointList();
while(!waypoints.isEmpty())//for(int i = 0; i <= waypoints.size(); i++)
{
WaypointView* widget = wpViews.find(waypoints[0]).value();
widget->remove();
}
}
}
......@@ -41,6 +41,8 @@ This file is part of the QGROUNDCONTROL project
#include "Waypoint.h"
#include "UASInterface.h"
#include "WaypointView.h"
#include "WaypointGlobalView.h"
namespace Ui {
class WaypointList;
......@@ -72,6 +74,11 @@ public slots:
void add();
/** @brief Add a waypoint at the current MAV position */
void addCurrentPositonWaypoint();
/** @brief Add a waypoint by mouse click over the map */
void addWaypointMouse(QPointF coordinate);
/** @brief it notifies that a global waypoint goes to do created */
void setIsWPGlobal(bool value);
//Update events
/** @brief sets statusLabel string */
......@@ -83,25 +90,49 @@ public slots:
/** @brief The waypoint manager informs that the waypoint list was changed */
void waypointListChanged(void);
/** @brief The MapWidget informs that a waypoint global was changed on the map */
void waypointGlobalChanged(const QPointF coordinate, const int indexWP);
void clearLocalWPWidget();
// Waypoint operations
void moveUp(Waypoint* wp);
void moveDown(Waypoint* wp);
void removeWaypoint(Waypoint* wp);
signals:
void clearPathclicked();
protected:
virtual void changeEvent(QEvent *e);
protected:
QMap<Waypoint*, WaypointView*> wpViews;
QMap<Waypoint*, WaypointGlobalView*> wpGlobalViews;
QVBoxLayout* listLayout;
UASInterface* uas;
double mavX;
double mavY;
double mavZ;
double mavYaw;
bool isGlobalWP;
bool isLocalWP;
private:
Ui::WaypointList *m_ui;
private slots:
void on_clearWPListButton_clicked();
};
#endif // WAYPOINTLIST_H
......@@ -26,7 +26,7 @@
<property name="spacing">
<number>4</number>
</property>
<item row="0" column="0" colspan="9">
<item row="0" column="0" colspan="10">
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
......@@ -37,7 +37,7 @@
<x>0</x>
<y>0</y>
<width>466</width>
<height>149</height>
<height>163</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
......@@ -54,7 +54,7 @@
</widget>
</widget>
</item>
<item row="2" column="7">
<item row="2" column="8">
<widget class="QPushButton" name="readButton">
<property name="text">
<string>Read</string>
......@@ -65,7 +65,7 @@
</property>
</widget>
</item>
<item row="2" column="8">
<item row="2" column="9">
<widget class="QPushButton" name="transmitButton">
<property name="text">
<string>Write</string>
......@@ -76,7 +76,7 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="9">
<item row="3" column="0" colspan="10">
<widget class="QLabel" name="statusLabel">
<property name="text">
<string>TextLabel</string>
......@@ -135,6 +135,17 @@
</property>
</widget>
</item>
<item row="2" column="7">
<widget class="QPushButton" name="clearWPListButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/actions/process-stop.svg</normaloff>:/images/actions/process-stop.svg</iconset>
</property>
</widget>
</item>
</layout>
<action name="actionAddWaypoint">
<property name="icon">
......
......@@ -355,7 +355,7 @@ QProgressBar::chunk#thrustBar {
<string/>
</property>
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset>
<normaloff>:/images/actions/go-up.svg</normaloff>:/images/actions/go-up.svg</iconset>
</property>
</widget>
......@@ -375,7 +375,7 @@ QProgressBar::chunk#thrustBar {
<string/>
</property>
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset>
<normaloff>:/images/actions/go-down.svg</normaloff>:/images/actions/go-down.svg</iconset>
</property>
</widget>
......@@ -395,7 +395,7 @@ QProgressBar::chunk#thrustBar {
<string/>
</property>
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset>
<normaloff>:/images/actions/list-remove.svg</normaloff>:/images/actions/list-remove.svg</iconset>
</property>
</widget>
......@@ -405,8 +405,6 @@ QProgressBar::chunk#thrustBar {
</item>
</layout>
</widget>
<resources>
<include location="../../mavground.qrc"/>
</resources>
<resources/>
<connections/>
</ui>
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