Commit e605f2dc authored by tecnosapiens's avatar tecnosapiens

separation of the view of the local operator of the view of the global...

separation of the view of the local operator of the view of the global operator adding the view of global operator.
add the functionality to draw a waypoints on the map when they are generated from widget waypointlist.
parent 42161c97
...@@ -309,6 +309,7 @@ namespace qmapcontrol ...@@ -309,6 +309,7 @@ namespace qmapcontrol
click.y()-screen_middle.y()+layermanager->getMapmiddle_px().y()); click.y()-screen_middle.y()+layermanager->getMapmiddle_px().y());
// image coordinate to world coordinate // image coordinate to world coordinate
return layermanager->layer()->mapadapter()->displayToCoordinate(displayToImage); return layermanager->layer()->mapadapter()->displayToCoordinate(displayToImage);
} }
void MapControl::updateRequest(QRect rect) void MapControl::updateRequest(QRect rect)
......
...@@ -103,8 +103,11 @@ MainWindow::MainWindow(QWidget *parent) : ...@@ -103,8 +103,11 @@ MainWindow::MainWindow(QWidget *parent) :
// add Waypoint widget in the WaypointList widget when mouse clicked // add Waypoint widget in the WaypointList widget when mouse clicked
connect(map, SIGNAL(captureMapCoordinateClick(QPointF)), waypoints, SLOT(addWaypointMouse(QPointF))); connect(map, SIGNAL(captureMapCoordinateClick(QPointF)), waypoints, SLOT(addWaypointMouse(QPointF)));
// it notifies that a waypoint global goes to do create // it notifies that a waypoint global goes to do create
connect(map, SIGNAL(createGlobalWP(bool)), waypoints, SLOT(setIsWPGlobal(bool))); connect(map, SIGNAL(createGlobalWP(bool,QPointF)), waypoints, SLOT(setIsWPGlobal(bool, QPointF)));
// it notifies that a waypoint global goes to do create
connect(map, SIGNAL(sendGeometryEndDrag(QPointF,int)), waypoints, SLOT(waypointGlobalChanged(QPointF,int)) ); connect(map, SIGNAL(sendGeometryEndDrag(QPointF,int)), waypoints, SLOT(waypointGlobalChanged(QPointF,int)) );
// it notifies that a waypoint global goes to do create and a map graphic too
connect(waypoints, SIGNAL(createWaypointAtMap(QPointF)), map, SLOT(createWaypointGraphAtMap(QPointF)));
} }
...@@ -172,6 +175,7 @@ void MainWindow::arrangeCenterStack() ...@@ -172,6 +175,7 @@ void MainWindow::arrangeCenterStack()
centerStack->addWidget(map); centerStack->addWidget(map);
centerStack->addWidget(hud); centerStack->addWidget(hud);
centerStack->addWidget(dataplot); centerStack->addWidget(dataplot);
centerStack->addWidget(hsi);
setCentralWidget(centerStack); setCentralWidget(centerStack);
} }
...@@ -314,7 +318,7 @@ void MainWindow::connectActions() ...@@ -314,7 +318,7 @@ void MainWindow::connectActions()
connect(ui.actionShow_MAVLink_view, SIGNAL(triggered()), this, SLOT(loadMAVLinkView())); connect(ui.actionShow_MAVLink_view, SIGNAL(triggered()), this, SLOT(loadMAVLinkView()));
connect(ui.actionShow_data_analysis_view, SIGNAL(triggered()), this, SLOT(loadDataView())); connect(ui.actionShow_data_analysis_view, SIGNAL(triggered()), this, SLOT(loadDataView()));
connect(ui.actionStyleConfig, SIGNAL(triggered()), this, SLOT(reloadStylesheet())); connect(ui.actionStyleConfig, SIGNAL(triggered()), this, SLOT(reloadStylesheet()));
connect(ui.actionGlobalOperatorView, SIGNAL(triggered()), this, SLOT(loadGlobalOperatorView()));
connect(ui.actionOnline_documentation, SIGNAL(triggered()), this, SLOT(showHelp())); connect(ui.actionOnline_documentation, SIGNAL(triggered()), this, SLOT(showHelp()));
connect(ui.actionCredits_Developers, SIGNAL(triggered()), this, SLOT(showCredits())); connect(ui.actionCredits_Developers, SIGNAL(triggered()), this, SLOT(showCredits()));
connect(ui.actionProject_Roadmap, SIGNAL(triggered()), this, SLOT(showRoadMap())); connect(ui.actionProject_Roadmap, SIGNAL(triggered()), this, SLOT(showRoadMap()));
...@@ -626,8 +630,11 @@ void MainWindow::loadOperatorView() ...@@ -626,8 +630,11 @@ void MainWindow::loadOperatorView()
{ {
clearView(); clearView();
// MAP
centerStack->setCurrentWidget(map); centerStack->setCurrentWidget(hsi);
hsi->start();
// UAS CONTROL // UAS CONTROL
QDockWidget* container1 = new QDockWidget(tr("Control"), this); QDockWidget* container1 = new QDockWidget(tr("Control"), this);
...@@ -650,10 +657,10 @@ void MainWindow::loadOperatorView() ...@@ -650,10 +657,10 @@ void MainWindow::loadOperatorView()
addDockWidget(Qt::BottomDockWidgetArea, container5); addDockWidget(Qt::BottomDockWidgetArea, container5);
// HORIZONTAL SITUATION INDICATOR // HORIZONTAL SITUATION INDICATOR
QDockWidget* container7 = new QDockWidget(tr("Horizontal Situation Indicator"), this); // QDockWidget* container7 = new QDockWidget(tr("Horizontal Situation Indicator"), this);
container7->setWidget(hsi); // container7->setWidget(hsi);
hsi->start(); // hsi->start();
addDockWidget(Qt::BottomDockWidgetArea, container7); // addDockWidget(Qt::BottomDockWidgetArea, container7);
// OBJECT DETECTION // OBJECT DETECTION
QDockWidget* container6 = new QDockWidget(tr("Object Recognition"), this); QDockWidget* container6 = new QDockWidget(tr("Object Recognition"), this);
...@@ -667,6 +674,50 @@ void MainWindow::loadOperatorView() ...@@ -667,6 +674,50 @@ void MainWindow::loadOperatorView()
this->show(); this->show();
} }
void MainWindow::loadGlobalOperatorView()
{
clearView();
// MAP
centerStack->setCurrentWidget(map);
// UAS CONTROL
QDockWidget* container1 = new QDockWidget(tr("Control"), this);
container1->setWidget(control);
addDockWidget(Qt::LeftDockWidgetArea, container1);
// UAS LIST
QDockWidget* container4 = new QDockWidget(tr("Unmanned Systems"), this);
container4->setWidget(list);
addDockWidget(Qt::BottomDockWidgetArea, container4);
// UAS STATUS
QDockWidget* container3 = new QDockWidget(tr("Status Details"), this);
container3->setWidget(info);
addDockWidget(Qt::LeftDockWidgetArea, container3);
// WAYPOINT LIST
QDockWidget* container5 = new QDockWidget(tr("Waypoint List"), this);
container5->setWidget(waypoints);
addDockWidget(Qt::BottomDockWidgetArea, container5);
// // HEAD UP DISPLAY
QDockWidget* container6 = new QDockWidget(tr("Control Indicator"), this);
container6->setWidget(hud);
hud->start();
addDockWidget(Qt::RightDockWidgetArea, container6);
// // OBJECT DETECTION
// QDockWidget* container6 = new QDockWidget(tr("Object Recognition"), this);
// container6->setWidget(detection);
// addDockWidget(Qt::RightDockWidgetArea, container6);
// PROCESS CONTROL
QDockWidget* pControl = new QDockWidget(tr("Process Control"), this);
pControl->setWidget(watchdogControl);
addDockWidget(Qt::BottomDockWidgetArea, pControl);
this->show();
}
void MainWindow::loadSettingsView() void MainWindow::loadSettingsView()
{ {
clearView(); clearView();
......
...@@ -120,6 +120,8 @@ public slots: ...@@ -120,6 +120,8 @@ public slots:
void loadDataView(); void loadDataView();
/** @brief Load data view, allowing to plot flight data */ /** @brief Load data view, allowing to plot flight data */
void loadDataView(QString fileName); void loadDataView(QString fileName);
/** @brief Load view for global operator, allowing to flight on earth */
void loadGlobalOperatorView();
/** @brief Show the online help for users */ /** @brief Show the online help for users */
void showHelp(); void showHelp();
......
...@@ -75,6 +75,7 @@ ...@@ -75,6 +75,7 @@
<addaction name="actionEngineerView"/> <addaction name="actionEngineerView"/>
<addaction name="actionPilotView"/> <addaction name="actionPilotView"/>
<addaction name="actionOperatorView"/> <addaction name="actionOperatorView"/>
<addaction name="actionGlobalOperatorView"/>
<addaction name="actionSettingsView"/> <addaction name="actionSettingsView"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionShow_MAVLink_view"/> <addaction name="actionShow_MAVLink_view"/>
...@@ -318,6 +319,15 @@ ...@@ -318,6 +319,15 @@
<string>Credits / Developers</string> <string>Credits / Developers</string>
</property> </property>
</action> </action>
<action name="actionGlobalOperatorView">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/categories/applications-internet.svg</normaloff>:/images/categories/applications-internet.svg</iconset>
</property>
<property name="text">
<string>Show Global operator view</string>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<resources> <resources>
......
...@@ -310,8 +310,9 @@ void MapWidget::createPathButtonClicked(bool checked) ...@@ -310,8 +310,9 @@ void MapWidget::createPathButtonClicked(bool checked)
this->setCursor(Qt::PointingHandCursor); this->setCursor(Qt::PointingHandCursor);
mc->setMouseMode(qmapcontrol::MapControl::None); mc->setMouseMode(qmapcontrol::MapControl::None);
// emit signal start to create a Waypoint global // emit signal start to create a Waypoint global
emit createGlobalWP(true); emit createGlobalWP(true, mc->currentCoordinate());
// // Clear the previous WP track // // Clear the previous WP track
// // TODO: Move this to an actual clear track button and add a warning dialog // // TODO: Move this to an actual clear track button and add a warning dialog
...@@ -360,6 +361,30 @@ void MapWidget::captureMapClick(const QMouseEvent* event, const QPointF coordina ...@@ -360,6 +361,30 @@ void MapWidget::captureMapClick(const QMouseEvent* event, const QPointF coordina
} }
} }
void MapWidget::createWaypointGraphAtMap(const QPointF coordinate)
{
// Create waypoint name
QString str;
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);
mc->layer("Waypoints")->addGeometry(tempCirclePoint);
Point* tempPoint = new Point(coordinate.x(), coordinate.y(),str);
wps.append(tempPoint);
path->addPoint(tempPoint);
wpIndex.insert(str,tempPoint);
// Refresh the screen
mc->updateRequestNew();
//// // emit signal mouse was clicked
// emit captureMapCoordinateClick(coordinate);
}
void MapWidget::captureGeometryClick(Geometry* geom, QPoint point){ void MapWidget::captureGeometryClick(Geometry* geom, QPoint point){
Q_UNUSED(geom); Q_UNUSED(geom);
Q_UNUSED(point); Q_UNUSED(point);
......
...@@ -105,6 +105,7 @@ protected: ...@@ -105,6 +105,7 @@ protected:
protected slots: protected slots:
void captureMapClick (const QMouseEvent* event, const QPointF coordinate); void captureMapClick (const QMouseEvent* event, const QPointF coordinate);
void createWaypointGraphAtMap (const QPointF coordinate);
void createPathButtonClicked(bool checked); void createPathButtonClicked(bool checked);
void captureGeometryClick(Geometry*, QPoint); void captureGeometryClick(Geometry*, QPoint);
void mapproviderSelected(QAction* action); void mapproviderSelected(QAction* action);
...@@ -116,7 +117,7 @@ protected: ...@@ -116,7 +117,7 @@ protected:
signals: signals:
//void movePoint(QPointF newCoord); //void movePoint(QPointF newCoord);
void captureMapCoordinateClick(const QPointF coordinate); //ROCA void captureMapCoordinateClick(const QPointF coordinate); //ROCA
void createGlobalWP(bool value); void createGlobalWP(bool value, QPointF centerCoordinate);
void sendGeometryEndDrag(const QPointF coordinate, const int index); void sendGeometryEndDrag(const QPointF coordinate, const int index);
......
This diff is collapsed.
...@@ -39,6 +39,7 @@ This file is part of the PIXHAWK project ...@@ -39,6 +39,7 @@ This file is part of the PIXHAWK project
#include <QFileDialog> #include <QFileDialog>
#include "WaypointGlobalView.h" #include "WaypointGlobalView.h"
#include <QMessageBox> #include <QMessageBox>
#include <QMouseEvent>
WaypointList::WaypointList(QWidget *parent, UASInterface* uas) : WaypointList::WaypointList(QWidget *parent, UASInterface* uas) :
QWidget(parent), QWidget(parent),
...@@ -90,6 +91,9 @@ WaypointList::WaypointList(QWidget *parent, UASInterface* uas) : ...@@ -90,6 +91,9 @@ WaypointList::WaypointList(QWidget *parent, UASInterface* uas) :
this->setVisible(false); this->setVisible(false);
isGlobalWP = false; isGlobalWP = false;
isLocalWP = false; isLocalWP = false;
centerMapCoordinate.setX(0.0);
centerMapCoordinate.setY(0.0);
} }
WaypointList::~WaypointList() WaypointList::~WaypointList()
...@@ -168,24 +172,44 @@ void WaypointList::add() ...@@ -168,24 +172,44 @@ 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) if (waypoints.size() > 0)
{ {
Waypoint *last = waypoints.at(waypoints.size()-1); Waypoint *last = waypoints.at(waypoints.size()-1);
Waypoint *wp = new Waypoint(0, last->getX(), last->getY(), last->getZ(), last->getYaw(), last->getAutoContinue(), false, last->getOrbit(), last->getHoldTime()); Waypoint *wp = new Waypoint(0, centerMapCoordinate.x(), centerMapCoordinate.y(), last->getZ(), last->getYaw(), last->getAutoContinue(), false, last->getOrbit(), last->getHoldTime());
uas->getWaypointManager().localAddWaypoint(wp); uas->getWaypointManager().localAddWaypoint(wp);
} }
else else
{ {
Waypoint *wp = new Waypoint(0, 1.1, 1.1, -0.8, 0.0, true, true, 0.15, 2000); Waypoint *wp = new Waypoint(0, centerMapCoordinate.x(), centerMapCoordinate.y(), -0.8, 0.0, true, true, 0.15, 2000);
uas->getWaypointManager().localAddWaypoint(wp); uas->getWaypointManager().localAddWaypoint(wp);
} }
isLocalWP = true; emit createWaypointAtMap(centerMapCoordinate);
}
else
{
const QVector<Waypoint *> &waypoints = uas->getWaypointManager().getWaypointList();
if (waypoints.size() > 0)
{
Waypoint *last = waypoints.at(waypoints.size()-1);
Waypoint *wp = new Waypoint(0, last->getX(), last->getY(), last->getZ(), last->getYaw(), last->getAutoContinue(), false, last->getOrbit(), last->getHoldTime());
uas->getWaypointManager().localAddWaypoint(wp);
}
else
{
isLocalWP = true;
Waypoint *wp = new Waypoint(0, 1.1, 1.1, -0.8, 0.0, true, true, 0.15, 2000);
uas->getWaypointManager().localAddWaypoint(wp);
}
}
} }
} }
...@@ -498,13 +522,16 @@ void WaypointList::addWaypointMouse(QPointF coordinate) ...@@ -498,13 +522,16 @@ void WaypointList::addWaypointMouse(QPointF coordinate)
Waypoint *wp = new Waypoint(0, coordinate.x(), coordinate.y(), -0.8, 0.0, true, true, 0.15, 2000); Waypoint *wp = new Waypoint(0, coordinate.x(), coordinate.y(), -0.8, 0.0, true, true, 0.15, 2000);
uas->getWaypointManager().localAddWaypoint(wp); uas->getWaypointManager().localAddWaypoint(wp);
} }
} }
} }
/** @brief it notifies that a global waypoint goes to do created */ /** @brief it notifies that a global waypoint goes to do created */
void WaypointList::setIsWPGlobal(bool value) void WaypointList::setIsWPGlobal(bool value, QPointF centerCoordinate)
{ {
centerMapCoordinate = centerCoordinate;
if(isLocalWP) if(isLocalWP)
......
...@@ -77,7 +77,7 @@ public slots: ...@@ -77,7 +77,7 @@ public slots:
/** @brief Add a waypoint by mouse click over the map */ /** @brief Add a waypoint by mouse click over the map */
void addWaypointMouse(QPointF coordinate); void addWaypointMouse(QPointF coordinate);
/** @brief it notifies that a global waypoint goes to do created */ /** @brief it notifies that a global waypoint goes to do created */
void setIsWPGlobal(bool value); void setIsWPGlobal(bool value, QPointF centerCoordinate);
//Update events //Update events
...@@ -105,6 +105,7 @@ public slots: ...@@ -105,6 +105,7 @@ public slots:
signals: signals:
void clearPathclicked(); void clearPathclicked();
void createWaypointAtMap(const QPointF coordinate);
...@@ -122,6 +123,7 @@ protected: ...@@ -122,6 +123,7 @@ protected:
double mavYaw; double mavYaw;
bool isGlobalWP; bool isGlobalWP;
bool isLocalWP; bool isLocalWP;
QPointF centerMapCoordinate;
private: private:
Ui::WaypointList *m_ui; Ui::WaypointList *m_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