Browse Source

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.
QGC4.4
tecnosapiens 15 years ago
parent
commit
e605f2dccf
  1. 1
      lib/QMapControl/src/mapcontrol.cpp
  2. 67
      src/ui/MainWindow.cc
  3. 2
      src/ui/MainWindow.h
  4. 10
      src/ui/MainWindow.ui
  5. 27
      src/ui/MapWidget.cc
  6. 3
      src/ui/MapWidget.h
  7. 268
      src/ui/WaypointGlobalView.ui
  8. 37
      src/ui/WaypointList.cc
  9. 4
      src/ui/WaypointList.h

1
lib/QMapControl/src/mapcontrol.cpp

@ -309,6 +309,7 @@ namespace qmapcontrol @@ -309,6 +309,7 @@ namespace qmapcontrol
click.y()-screen_middle.y()+layermanager->getMapmiddle_px().y());
// image coordinate to world coordinate
return layermanager->layer()->mapadapter()->displayToCoordinate(displayToImage);
}
void MapControl::updateRequest(QRect rect)

67
src/ui/MainWindow.cc

@ -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
connect(map, SIGNAL(captureMapCoordinateClick(QPointF)), waypoints, SLOT(addWaypointMouse(QPointF)));
// 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)) );
// 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(hud);
centerStack->addWidget(dataplot);
centerStack->addWidget(hsi);
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_data_analysis_view, SIGNAL(triggered()), this, SLOT(loadDataView()));
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.actionCredits_Developers, SIGNAL(triggered()), this, SLOT(showCredits()));
connect(ui.actionProject_Roadmap, SIGNAL(triggered()), this, SLOT(showRoadMap()));
@ -626,8 +630,11 @@ void MainWindow::loadOperatorView() @@ -626,8 +630,11 @@ void MainWindow::loadOperatorView()
{
clearView();
// MAP
centerStack->setCurrentWidget(map);
centerStack->setCurrentWidget(hsi);
hsi->start();
// UAS CONTROL
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);
// HORIZONTAL SITUATION INDICATOR
QDockWidget* container7 = new QDockWidget(tr("Horizontal Situation Indicator"), this);
container7->setWidget(hsi);
hsi->start();
addDockWidget(Qt::BottomDockWidgetArea, container7);
// QDockWidget* container7 = new QDockWidget(tr("Horizontal Situation Indicator"), this);
// container7->setWidget(hsi);
// hsi->start();
// addDockWidget(Qt::BottomDockWidgetArea, container7);
// OBJECT DETECTION
QDockWidget* container6 = new QDockWidget(tr("Object Recognition"), this);
@ -667,6 +674,50 @@ void MainWindow::loadOperatorView() @@ -667,6 +674,50 @@ void MainWindow::loadOperatorView()
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()
{
clearView();

2
src/ui/MainWindow.h

@ -120,6 +120,8 @@ public slots: @@ -120,6 +120,8 @@ public slots:
void loadDataView();
/** @brief Load data view, allowing to plot flight data */
void loadDataView(QString fileName);
/** @brief Load view for global operator, allowing to flight on earth */
void loadGlobalOperatorView();
/** @brief Show the online help for users */
void showHelp();

10
src/ui/MainWindow.ui

@ -75,6 +75,7 @@ @@ -75,6 +75,7 @@
<addaction name="actionEngineerView"/>
<addaction name="actionPilotView"/>
<addaction name="actionOperatorView"/>
<addaction name="actionGlobalOperatorView"/>
<addaction name="actionSettingsView"/>
<addaction name="separator"/>
<addaction name="actionShow_MAVLink_view"/>
@ -318,6 +319,15 @@ @@ -318,6 +319,15 @@
<string>Credits / Developers</string>
</property>
</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>
<layoutdefault spacing="6" margin="11"/>
<resources>

27
src/ui/MapWidget.cc

@ -310,8 +310,9 @@ void MapWidget::createPathButtonClicked(bool checked) @@ -310,8 +310,9 @@ void MapWidget::createPathButtonClicked(bool checked)
this->setCursor(Qt::PointingHandCursor);
mc->setMouseMode(qmapcontrol::MapControl::None);
// emit signal start to create a Waypoint global
emit createGlobalWP(true);
emit createGlobalWP(true, mc->currentCoordinate());
// // Clear the previous WP track
// // 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){
Q_UNUSED(geom);
Q_UNUSED(point);

3
src/ui/MapWidget.h

@ -105,6 +105,7 @@ protected: @@ -105,6 +105,7 @@ 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);
@ -116,7 +117,7 @@ protected: @@ -116,7 +117,7 @@ protected:
signals:
//void movePoint(QPointF newCoord);
void captureMapCoordinateClick(const QPointF coordinate); //ROCA
void createGlobalWP(bool value);
void createGlobalWP(bool value, QPointF centerCoordinate);
void sendGeometryEndDrag(const QPointF coordinate, const int index);

268
src/ui/WaypointGlobalView.ui

@ -6,8 +6,8 @@ @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>869</width>
<height>60</height>
<width>940</width>
<height>56</height>
</rect>
</property>
<property name="sizePolicy">
@ -144,6 +144,12 @@ QProgressBar::chunk#thrustBar { @@ -144,6 +144,12 @@ QProgressBar::chunk#thrustBar {
}</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy">
@ -170,7 +176,7 @@ QProgressBar::chunk#thrustBar { @@ -170,7 +176,7 @@ QProgressBar::chunk#thrustBar {
</property>
<property name="sizeHint" stdset="0">
<size>
<width>135</width>
<width>10</width>
<height>13</height>
</size>
</property>
@ -265,6 +271,19 @@ QProgressBar::chunk#thrustBar { @@ -265,6 +271,19 @@ QProgressBar::chunk#thrustBar {
<widget class="QDoubleSpinBox" name="m_heigthSpinBox"/>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>86</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="m_orbitCheckBox">
<property name="palette">
<palette>
@ -287,6 +306,42 @@ QProgressBar::chunk#thrustBar { @@ -287,6 +306,42 @@ QProgressBar::chunk#thrustBar {
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>127</red>
<green>127</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>170</red>
<green>170</green>
<blue>170</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
@ -296,6 +351,15 @@ QProgressBar::chunk#thrustBar { @@ -296,6 +351,15 @@ QProgressBar::chunk#thrustBar {
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
@ -323,6 +387,42 @@ QProgressBar::chunk#thrustBar { @@ -323,6 +387,42 @@ QProgressBar::chunk#thrustBar {
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
@ -343,6 +443,42 @@ QProgressBar::chunk#thrustBar { @@ -343,6 +443,42 @@ QProgressBar::chunk#thrustBar {
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>127</red>
<green>127</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>170</red>
<green>170</green>
<blue>170</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
@ -352,6 +488,15 @@ QProgressBar::chunk#thrustBar { @@ -352,6 +488,15 @@ QProgressBar::chunk#thrustBar {
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
@ -379,6 +524,42 @@ QProgressBar::chunk#thrustBar { @@ -379,6 +524,42 @@ QProgressBar::chunk#thrustBar {
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
@ -399,6 +580,42 @@ QProgressBar::chunk#thrustBar { @@ -399,6 +580,42 @@ QProgressBar::chunk#thrustBar {
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>127</red>
<green>127</green>
<blue>127</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>170</red>
<green>170</green>
<blue>170</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
@ -408,6 +625,15 @@ QProgressBar::chunk#thrustBar { @@ -408,6 +625,15 @@ QProgressBar::chunk#thrustBar {
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
@ -435,6 +661,42 @@ QProgressBar::chunk#thrustBar { @@ -435,6 +661,42 @@ QProgressBar::chunk#thrustBar {
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>

37
src/ui/WaypointList.cc

@ -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 "WaypointGlobalView.h"
#include <QMessageBox>
#include <QMouseEvent>
WaypointList::WaypointList(QWidget *parent, UASInterface* uas) :
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);
isGlobalWP = false;
isLocalWP = false;
centerMapCoordinate.setX(0.0);
centerMapCoordinate.setY(0.0);
}
WaypointList::~WaypointList()
@ -168,24 +172,44 @@ void WaypointList::add() @@ -168,24 +172,44 @@ void WaypointList::add()
{
if (uas)
{
if(isGlobalWP)
{
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());
Waypoint *wp = new Waypoint(0, centerMapCoordinate.x(), centerMapCoordinate.y(), last->getZ(), last->getYaw(), last->getAutoContinue(), false, last->getOrbit(), last->getHoldTime());
uas->getWaypointManager().localAddWaypoint(wp);
}
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);
}
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);
uas->getWaypointManager().localAddWaypoint(wp);
}
}
}
/** @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)

4
src/ui/WaypointList.h

@ -77,7 +77,7 @@ public slots: @@ -77,7 +77,7 @@ public slots:
/** @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);
void setIsWPGlobal(bool value, QPointF centerCoordinate);
//Update events
@ -105,6 +105,7 @@ public slots: @@ -105,6 +105,7 @@ public slots:
signals:
void clearPathclicked();
void createWaypointAtMap(const QPointF coordinate);
@ -122,6 +123,7 @@ protected: @@ -122,6 +123,7 @@ protected:
double mavYaw;
bool isGlobalWP;
bool isLocalWP;
QPointF centerMapCoordinate;
private:
Ui::WaypointList *m_ui;

Loading…
Cancel
Save