From a5e07a7d46baf183a60b7af8e92adea1fe25dcbe Mon Sep 17 00:00:00 2001 From: Mariano Lizarraga Date: Sun, 7 Nov 2010 00:05:12 -0600 Subject: [PATCH] Corrected minor bugs in Map Control --- src/uas/SlugsMAV.cc | 2 +- src/ui/MapWidget.cc | 22 +++++++++++++++++----- src/ui/MapWidget.h | 8 +++++--- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/uas/SlugsMAV.cc b/src/uas/SlugsMAV.cc index 5fcbc0fad..277a52156 100644 --- a/src/uas/SlugsMAV.cc +++ b/src/uas/SlugsMAV.cc @@ -67,7 +67,7 @@ void SlugsMAV::receiveMessage(LinkInterface* link, mavlink_message_t message) emit valueChanged(uasId, tr("ControlDSC Load"), cpu_load.ctrlLoad, time); emit valueChanged(uasId, tr("Battery Volt"), cpu_load.batVolt, time); - emit newCpuLoad (uasId, &cpu_load); + //emit newCpuLoad (uasId, &cpu_load); break; } diff --git a/src/ui/MapWidget.cc b/src/ui/MapWidget.cc index f866f7fc7..14120f79b 100644 --- a/src/ui/MapWidget.cc +++ b/src/ui/MapWidget.cc @@ -340,10 +340,19 @@ void MapWidget::createPathButtonClicked(bool checked) } +/** + * Captures a click on the map and if in create WP path mode, it adds the WP on MouseButtonRelease + * + * @param event The mouse event + * @param coordinate The coordinate in which it occured the mouse event + * @note This slot is connected to the mouseEventCoordinate of the QMapControl object + */ void MapWidget::captureMapClick(const QMouseEvent* event, const QPointF coordinate) { + qDebug() << mc->mouseMode(); + if (QEvent::MouseButtonRelease == event->type() && createPath->isChecked()) { // Create waypoint name @@ -403,6 +412,7 @@ void MapWidget::createWaypointGraphAtMap(const QPointF coordinate) // emit captureMapCoordinateClick(coordinate); } + void MapWidget::captureGeometryClick(Geometry* geom, QPoint point) { Q_UNUSED(geom); @@ -414,7 +424,7 @@ void MapWidget::captureGeometryClick(Geometry* geom, QPoint point) void MapWidget::captureGeometryDrag(Geometry* geom, QPointF coordinate) { - Q_UNUSED(coordinate); + waypointIsDrag = true; @@ -445,13 +455,15 @@ void MapWidget::captureGeometryDrag(Geometry* geom, QPointF coordinate) void MapWidget::captureGeometryEndDrag(Geometry* geom, QPointF coordinate) { - waypointIsDrag = false; + // TODO: Investigate why when creating the waypoint path this slot is being called + + // Only change the mouse mode back to panning when not creating a WP path + if (!createPath->isChecked()){ + waypointIsDrag = false; mc->setMouseMode(qmapcontrol::MapControl::Panning); + } -// qDebug() << geom->name(); -// qDebug() << geom->GeometryType; -// qDebug() << point; } MapWidget::~MapWidget() diff --git a/src/ui/MapWidget.h b/src/ui/MapWidget.h index 450ed255f..cb6025c04 100644 --- a/src/ui/MapWidget.h +++ b/src/ui/MapWidget.h @@ -107,13 +107,15 @@ protected: protected slots: void captureMapClick (const QMouseEvent* event, const QPointF coordinate); - void createWaypointGraphAtMap (const QPointF coordinate); - void createPathButtonClicked(bool checked); void captureGeometryClick(Geometry*, QPoint); - void mapproviderSelected(QAction* action); void captureGeometryDrag(Geometry* geom, QPointF coordinate); void captureGeometryEndDrag(Geometry* geom, QPointF coordinate); + void createPathButtonClicked(bool checked); + + void createWaypointGraphAtMap (const QPointF coordinate); + void mapproviderSelected(QAction* action); + -- 2.22.2