diff --git a/.cproject b/.cproject
new file mode 100644
index 0000000000000000000000000000000000000000..43f99020af95d6f5d0d494e76fd4774c485bbc46
--- /dev/null
+++ b/.cproject
@@ -0,0 +1,148 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ mingw32-make
+
+ release
+ false
+ false
+ true
+
+
+ mingw32-make
+
+ debug
+ false
+ false
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.project b/.project
new file mode 100644
index 0000000000000000000000000000000000000000..fc9b8c2de7d855347764478762ca7b92aed604e6
--- /dev/null
+++ b/.project
@@ -0,0 +1,88 @@
+
+
+ qgroundcontrol
+
+
+
+
+
+ com.trolltech.qtcppproject.QtMakefileGenerator
+
+
+
+
+ org.eclipse.cdt.make.core.makeBuilder
+ clean,full,incremental,
+
+
+ org.eclipse.cdt.core.errorOutputParser
+ 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;
+
+
+ org.eclipse.cdt.make.core.append_environment
+ true
+
+
+ org.eclipse.cdt.make.core.build.arguments
+
+
+
+ org.eclipse.cdt.make.core.build.command
+ mingw32-make
+
+
+ org.eclipse.cdt.make.core.build.target.auto
+ debug
+
+
+ org.eclipse.cdt.make.core.build.target.clean
+ clean
+
+
+ org.eclipse.cdt.make.core.build.target.inc
+ debug
+
+
+ org.eclipse.cdt.make.core.enableAutoBuild
+ false
+
+
+ org.eclipse.cdt.make.core.enableCleanBuild
+ true
+
+
+ org.eclipse.cdt.make.core.enableFullBuild
+ true
+
+
+ org.eclipse.cdt.make.core.enabledIncrementalBuild
+ true
+
+
+ org.eclipse.cdt.make.core.environment
+ QMAKESPEC=win32-g++|PATH=C:\\Qt\\2010.04\\qt\\bin;${env_var:PATH}|
+
+
+ org.eclipse.cdt.make.core.stopOnError
+ false
+
+
+ org.eclipse.cdt.make.core.useDefaultBuildCmd
+ false
+
+
+
+
+ org.eclipse.cdt.make.core.ScannerConfigBuilder
+
+
+
+
+
+ org.eclipse.cdt.core.cnature
+ org.eclipse.cdt.core.ccnature
+ org.eclipse.cdt.make.core.makeNature
+ org.eclipse.cdt.make.core.ScannerConfigNature
+ com.trolltech.qtcppproject.QtNature
+
+
diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro
index 44a1974de84b2fc2ba049204cfd17bd709d6833b..4ae3cbd17a3cdbd5fd3ab8192ee3375942072a16 100644
--- a/qgroundcontrol.pro
+++ b/qgroundcontrol.pro
@@ -155,7 +155,8 @@ HEADERS += src/MG.h \
src/ui/linechart/IncrementalPlot.h \
src/ui/map/Waypoint2DIcon.h \
src/ui/map/MAV2DIcon.h \
- src/ui/map/QGC2DIcon.h
+ src/ui/map/QGC2DIcon.h \
+ src/WaypointGlobal.h
SOURCES += src/main.cc \
src/Core.cc \
src/uas/UASManager.cc \
@@ -218,7 +219,8 @@ SOURCES += src/main.cc \
src/ui/linechart/IncrementalPlot.cc \
src/ui/map/Waypoint2DIcon.cc \
src/ui/map/MAV2DIcon.cc \
- src/ui/map/QGC2DIcon.cc
+ src/ui/map/QGC2DIcon.cc \
+ src/WaypointGlobal.cpp
RESOURCES = mavground.qrc
# Include RT-LAB Library
diff --git a/src/Waypoint.h b/src/Waypoint.h
index 053f6cbb0f60b1c187ffa8394e306a8b90b54cf6..d8baeba9e04eb181e112e663c425e469693f7153 100644
--- a/src/Waypoint.h
+++ b/src/Waypoint.h
@@ -59,7 +59,7 @@ public:
bool load(QTextStream &loadStream);
-private:
+protected:
quint16 id;
float x;
float y;
diff --git a/src/WaypointGlobal.cpp b/src/WaypointGlobal.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..fc5526f1c1af4a735e87a1545d091feba0925b19
--- /dev/null
+++ b/src/WaypointGlobal.cpp
@@ -0,0 +1,10 @@
+#include "WaypointGlobal.h"
+
+#include
+
+WaypointGlobal::WaypointGlobal(const QPointF coordinate):
+ Waypoint(id, x, y, z, yaw, autocontinue, current, orbit, holdTime)
+{
+ coordinateWP = coordinate;
+
+}
diff --git a/src/WaypointGlobal.h b/src/WaypointGlobal.h
new file mode 100644
index 0000000000000000000000000000000000000000..4a3bc4e94ff188ad8415d77a94bd9c78797658c0
--- /dev/null
+++ b/src/WaypointGlobal.h
@@ -0,0 +1,29 @@
+#ifndef WAYPOINTGLOBAL_H
+#define WAYPOINTGLOBAL_H
+
+#include "Waypoint.h"
+#include
+
+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
diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc
index 9fbc2e675310fcc038705eaac79fc95847098967..208b75e8ea82991fd4681b15a6c6f79617b9dae1 100644
--- a/src/ui/MainWindow.cc
+++ b/src/ui/MainWindow.cc
@@ -92,14 +92,16 @@ MainWindow::MainWindow(QWidget *parent) :
// Create actions
connectActions();
- // Load widgets and show application window
+ // Load widgets and show application windowa
loadWidgets();
// Adjust the size
adjustSize();
- //waypoints->setMapHandle(map);
- connect(waypoints, SIGNAL(clearPahtclicked()), map, SLOT(clearPath()));
+ // clear path create on the map
+ connect(waypoints, SIGNAL(clearPathclicked()), map, SLOT(clearPath()));
+ // add Waypoint widget in the WaypointList widget when mouse clicked
+ connect(map, SIGNAL(captureMapCoordinateClick(QPointF)), waypoints, SLOT(addWaypointMouse(QPointF)));
}
MainWindow::~MainWindow()
diff --git a/src/ui/MapWidget.cc b/src/ui/MapWidget.cc
index a02de526668fee5bcdded4b984a66b691e474dc6..d6072eea5eb00c09f5b3e00219dba97314357605 100644
--- a/src/ui/MapWidget.cc
+++ b/src/ui/MapWidget.cc
@@ -342,6 +342,9 @@ void MapWidget::captureMapClick(const QMouseEvent* event, const QPointF coordina
// Refresh the screen
mc->updateRequestNew();
+
+ // emit signal mouse was clicked
+ emit captureMapCoordinateClick(coordinate);
}
}
diff --git a/src/ui/MapWidget.h b/src/ui/MapWidget.h
index 68b4055edaf547a00d75451c59fe28ad75d452c9..b9ca39a8de855e518c02af4c2524771fcd19988a 100644
--- a/src/ui/MapWidget.h
+++ b/src/ui/MapWidget.h
@@ -115,6 +115,8 @@ protected:
signals:
//void movePoint(QPointF newCoord);
+ void captureMapCoordinateClick(const QPointF coordinate); //ROCA
+
private:
Ui::MapWidget *m_ui;
diff --git a/src/ui/WaypointList.cc b/src/ui/WaypointList.cc
index bb4ef439e6507e6ff0750d9489ef2a09730a5c48..90e4a472e95b027a4e07acea65c04e03e6ff247a 100644
--- a/src/ui/WaypointList.cc
+++ b/src/ui/WaypointList.cc
@@ -358,5 +358,39 @@ void WaypointList::changeEvent(QEvent *e)
void WaypointList::on_clearWPListButton_clicked()
{
- emit clearPahtclicked();
+ emit clearPathclicked();
+
+// if (uas)
+// {
+// const QVector &waypoints = uas->getWaypointManager().getWaypointList();
+// for(int i = 0; i <=waypoints.size(); i++)
+// {
+// WaypointView* widget = wpViews.find(waypoints[i]).value();
+
+// widget->remove();
+
+// }
+
+// }
+}
+
+/** @brief Add a waypoint by mouse click over the map */
+void WaypointList::addWaypointMouse(QPointF coordinate)
+{
+ if (uas)
+ {
+ const QVector &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);
+ }
+ }
+
}
diff --git a/src/ui/WaypointList.h b/src/ui/WaypointList.h
index 88b53a671ec074906b409837f1acfeeca79ecda1..e39a21bc316d51be655990d406ce5363336e3d97 100644
--- a/src/ui/WaypointList.h
+++ b/src/ui/WaypointList.h
@@ -73,6 +73,8 @@ 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);
@@ -93,7 +95,7 @@ public slots:
signals:
- void clearPahtclicked();
+ void clearPathclicked();