Commit 352fe512 authored by Alejandro's avatar Alejandro

check code UAS

parent 768fed96
...@@ -328,11 +328,13 @@ namespace qmapcontrol ...@@ -328,11 +328,13 @@ namespace qmapcontrol
layermanager->zoomIn(); layermanager->zoomIn();
update(); update();
} }
void MapControl::zoomOut() void MapControl::zoomOut()
{ {
layermanager->zoomOut(); layermanager->zoomOut();
update(); update();
} }
void MapControl::setZoom(int zoomlevel) void MapControl::setZoom(int zoomlevel)
{ {
layermanager->setZoom(zoomlevel); layermanager->setZoom(zoomlevel);
......
...@@ -315,7 +315,9 @@ int UASWaypointManager::removeWaypoint(quint16 seq) ...@@ -315,7 +315,9 @@ int UASWaypointManager::removeWaypoint(quint16 seq)
{ {
waypoints[i]->setId(i); waypoints[i]->setId(i);
} }
emit waypointListChanged(); emit waypointListChanged();
return 0; return 0;
} }
return -1; return -1;
......
...@@ -826,6 +826,7 @@ void MainWindow::updateLocationSettings (Qt::DockWidgetArea location) ...@@ -826,6 +826,7 @@ void MainWindow::updateLocationSettings (Qt::DockWidgetArea location)
} }
} }
/** /**
* Connect the signals and slots of the common window widgets * Connect the signals and slots of the common window widgets
*/ */
...@@ -841,11 +842,17 @@ void MainWindow::connectCommonWidgets() ...@@ -841,11 +842,17 @@ void MainWindow::connectCommonWidgets()
{ {
// clear path create on the map // clear path create on the map
connect(waypointsDockWidget->widget(), SIGNAL(clearPathclicked()), mapWidget, SLOT(clearWaypoints())); connect(waypointsDockWidget->widget(), SIGNAL(clearPathclicked()), mapWidget, SLOT(clearWaypoints()));
//
connect(waypointsDockWidget->widget(), SIGNAL(changePointList()), mapWidget, SLOT(clearWaypoints()));
// add Waypoint widget in the WaypointList widget when mouse clicked // add Waypoint widget in the WaypointList widget when mouse clicked
connect(mapWidget, SIGNAL(captureMapCoordinateClick(QPointF)), waypointsDockWidget->widget(), SLOT(addWaypointMouse(QPointF))); connect(mapWidget, SIGNAL(captureMapCoordinateClick(QPointF)), waypointsDockWidget->widget(), SLOT(addWaypointMouse(QPointF)));
// it notifies that a waypoint global goes to do create and a map graphic too // it notifies that a waypoint global goes to do create and a map graphic too
connect(waypointsDockWidget->widget(), SIGNAL(createWaypointAtMap(QPointF)), mapWidget, SLOT(createWaypointGraphAtMap(QPointF))); connect(waypointsDockWidget->widget(), SIGNAL(createWaypointAtMap(QPointF)), mapWidget, SLOT(createWaypointGraphAtMap(QPointF)));
} }
//TODO temporaly debug //TODO temporaly debug
......
...@@ -106,8 +106,10 @@ public slots: ...@@ -106,8 +106,10 @@ public slots:
void configure(); void configure();
/** @brief Set the currently controlled UAS */ /** @brief Set the currently controlled UAS */
void setActiveUAS(UASInterface* uas); void setActiveUAS(UASInterface* uas);
/** @brief Add a new UAS */ /** @brief Add a new UAS */
void UASCreated(UASInterface* uas); void UASCreated(UASInterface* uas);
void startVideoCapture(); void startVideoCapture();
void stopVideoCapture(); void stopVideoCapture();
void saveScreen(); void saveScreen();
......
...@@ -177,11 +177,9 @@ MapWidget::MapWidget(QWidget *parent) : ...@@ -177,11 +177,9 @@ MapWidget::MapWidget(QWidget *parent) :
// Connect the required signals-slots // Connect the required signals-slots
connect(zoomin, SIGNAL(clicked(bool)), connect(zoomin, SIGNAL(clicked(bool)), mc, SLOT(zoomIn()));
mc, SLOT(zoomIn()));
connect(zoomout, SIGNAL(clicked(bool)), connect(zoomout, SIGNAL(clicked(bool)), mc, SLOT(zoomOut()));
mc, SLOT(zoomOut()));
QList<UASInterface*> systems = UASManager::instance()->getUASList(); QList<UASInterface*> systems = UASManager::instance()->getUASList();
foreach(UASInterface* system, systems) foreach(UASInterface* system, systems)
...@@ -351,7 +349,6 @@ void MapWidget::createPathButtonClicked(bool checked) ...@@ -351,7 +349,6 @@ void MapWidget::createPathButtonClicked(bool checked)
* @param coordinate The coordinate in which it occured 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 * @note This slot is connected to the mouseEventCoordinate of the QMapControl object
*/ */
void MapWidget::captureMapClick(const QMouseEvent* event, const QPointF coordinate) void MapWidget::captureMapClick(const QMouseEvent* event, const QPointF coordinate)
{ {
//qDebug() << mc->mouseMode(); //qDebug() << mc->mouseMode();
...@@ -373,6 +370,8 @@ void MapWidget::captureMapClick(const QMouseEvent* event, const QPointF coordina ...@@ -373,6 +370,8 @@ void MapWidget::captureMapClick(const QMouseEvent* event, const QPointF coordina
{ {
tempCirclePoint = new Waypoint2DIcon(coordinate.x(), coordinate.y(), 20, str, qmapcontrol::Point::Middle); tempCirclePoint = new Waypoint2DIcon(coordinate.x(), coordinate.y(), 20, str, qmapcontrol::Point::Middle);
} }
//draw WP in map
mc->layer("Waypoints")->addGeometry(tempCirclePoint); mc->layer("Waypoints")->addGeometry(tempCirclePoint);
qmapcontrol::Point* tempPoint = new qmapcontrol::Point(coordinate.x(), coordinate.y(),str); qmapcontrol::Point* tempPoint = new qmapcontrol::Point(coordinate.x(), coordinate.y(),str);
...@@ -500,6 +499,7 @@ MapWidget::~MapWidget() ...@@ -500,6 +499,7 @@ MapWidget::~MapWidget()
{ {
delete m_ui; delete m_ui;
} }
/** /**
* *
* @param uas the UAS/MAV to monitor/display with the HUD * @param uas the UAS/MAV to monitor/display with the HUD
......
...@@ -138,7 +138,7 @@ protected: ...@@ -138,7 +138,7 @@ protected:
signals: signals:
//void movePoint(QPointF newCoord); //void movePoint(QPointF newCoord);
void captureMapCoordinateClick(const QPointF coordinate); //ROCA void captureMapCoordinateClick(const QPointF coordinate);
void createGlobalWP(bool value, QPointF centerCoordinate); void createGlobalWP(bool value, QPointF centerCoordinate);
void sendGeometryEndDrag(const QPointF coordinate, const int index); void sendGeometryEndDrag(const QPointF coordinate, const int index);
......
...@@ -176,27 +176,7 @@ void WaypointList::add() ...@@ -176,27 +176,7 @@ void WaypointList::add()
{ {
if (uas) if (uas)
{ {
// if(isGlobalWP) const QVector<Waypoint *> &waypoints = uas->getWaypointManager().getWaypointList();
// {
// const QVector<Waypoint *> &waypoints = uas->getWaypointManager().getWaypointList();
// if (waypoints.size() > 0)
// {
// Waypoint *last = waypoints.at(waypoints.size()-1);
// Waypoint *wp = new Waypoint(0, centerMapCoordinate.x(), centerMapCoordinate.y(), last->getZ(), last->getYaw(), last->getAutoContinue(), false, last->getOrbit(), last->getHoldTime());
// uas->getWaypointManager().addWaypoint(wp);
// }
// else
// {
// Waypoint *wp = new Waypoint(0, centerMapCoordinate.x(), centerMapCoordinate.y(), -0.8, 0.0, true, true, 0.15, 2000);
// uas->getWaypointManager().addWaypoint(wp);
// }
//
// emit createWaypointAtMap(centerMapCoordinate);
// }
// else
{
const QVector<Waypoint *> &waypoints = uas->getWaypointManager().getWaypointList();
Waypoint *wp; Waypoint *wp;
...@@ -219,7 +199,7 @@ void WaypointList::add() ...@@ -219,7 +199,7 @@ void WaypointList::add()
{ {
emit createWaypointAtMap(QPointF(wp->getX(), wp->getY())); emit createWaypointAtMap(QPointF(wp->getX(), wp->getY()));
} }
}
} }
} }
...@@ -300,62 +280,7 @@ void WaypointList::waypointListChanged() ...@@ -300,62 +280,7 @@ void WaypointList::waypointListChanged()
{ {
const QVector<Waypoint *> &waypoints = uas->getWaypointManager().getWaypointList(); const QVector<Waypoint *> &waypoints = uas->getWaypointManager().getWaypointList();
// For Global Waypoints // for local 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(removeWaypoint(Waypoint*)), this, SLOT(removeWaypoint(Waypoint*)));
//connect(wpview, SIGNAL(changePositionWP(Waypoint*)), this, SLOT(changeWPPositionBySpinBox(Waypoint*)));
//// connect(wpview, SIGNAL(moveDownWaypoint(Waypoint*)), this, SLOT(moveDown(Waypoint*)));
//// connect(wpview, SIGNAL(moveUpWaypoint(Waypoint*)), this, SLOT(moveUp(Waypoint*)));
//// connect(wpview, SIGNAL(changePositionWP(Waypoint*)), this, SLOT(waypointGlobalPositionChanged(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 // first remove all views of non existing waypoints
if (!wpViews.empty()) if (!wpViews.empty())
{ {
...@@ -402,10 +327,10 @@ void WaypointList::waypointListChanged() ...@@ -402,10 +327,10 @@ void WaypointList::waypointListChanged()
listLayout->addWidget(wpv); listLayout->addWidget(wpv);
} }
}
loadFileGlobalWP = false; loadFileGlobalWP = false;
//emit changePointList();
} }
...@@ -431,6 +356,9 @@ void WaypointList::moveUp(Waypoint* wp) ...@@ -431,6 +356,9 @@ void WaypointList::moveUp(Waypoint* wp)
uas->getWaypointManager().moveWaypoint(i, i-1); uas->getWaypointManager().moveWaypoint(i, i-1);
} }
} }
//emitir seal de cambio orden en la lista,
//la debe capturar el mapwidget para volver a dibujar la ruta
} }
void WaypointList::moveDown(Waypoint* wp) void WaypointList::moveDown(Waypoint* wp)
...@@ -490,13 +418,6 @@ void WaypointList::on_clearWPListButton_clicked() ...@@ -490,13 +418,6 @@ void WaypointList::on_clearWPListButton_clicked()
widget->remove(); widget->remove();
} }
} }
else
{
// if(isGlobalWP)
// {
// emit clearPathclicked();
// }
}
} }
/** @brief Add a waypoint by mouse click over the map */ /** @brief Add a waypoint by mouse click over the map */
......
...@@ -113,7 +113,7 @@ signals: ...@@ -113,7 +113,7 @@ signals:
void createWaypointAtMap(const QPointF coordinate); void createWaypointAtMap(const QPointF coordinate);
// void ChangeWaypointGlobalPosition(int index, QPointF coord); // void ChangeWaypointGlobalPosition(int index, QPointF coord);
void changePositionWPBySpinBox(int indexWP, float lat, float lon); void changePositionWPBySpinBox(int indexWP, float lat, float lon);
void changePointList();
protected: protected:
......
...@@ -107,6 +107,7 @@ void WaypointView::moveDown() ...@@ -107,6 +107,7 @@ void WaypointView::moveDown()
emit moveDownWaypoint(wp); emit moveDownWaypoint(wp);
} }
void WaypointView::remove() void WaypointView::remove()
{ {
emit removeWaypoint(wp); emit removeWaypoint(wp);
......
...@@ -35,10 +35,10 @@ const char* kActionLabels[MAV_ACTION_NB] = ...@@ -35,10 +35,10 @@ const char* kActionLabels[MAV_ACTION_NB] =
"LOITER", "LOITER",
"SET ORIGIN", "SET ORIGIN",
"RELAY ON", "RELAY ON",
"RELAY OFF", //"RELAY OFF",
"GET IMAGE", //"GET IMAGE",
"START VIDEO", //"START VIDEO",
"STOP VIDEO", //"STOP VIDEO",
"RESET MAP"}; "RESET MAP"};
QGCActionButton::QGCActionButton(QWidget *parent) : QGCActionButton::QGCActionButton(QWidget *parent) :
......
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