Commit 1f54d9a3 authored by Mariano Lizarraga's avatar Mariano Lizarraga

Merge branch 'master' of git://github.com/tecnosapiens/qgroundcontrol into mergeRemote

parents 2226a433 6d43e99e
......@@ -75,6 +75,7 @@ bool Waypoint::load(QTextStream &loadStream)
return false;
}
void Waypoint::setId(quint16 id)
{
this->id = id;
......
......@@ -59,6 +59,7 @@ public:
bool load(QTextStream &loadStream);
protected:
quint16 id;
float x;
......
......@@ -105,6 +105,8 @@ protected:
mavlink_slugs_action_t mlAction;
// Standart messages MAVLINK used by SLUGS
private:
......
......@@ -383,9 +383,12 @@ void UASWaypointManager::localLoadWaypoints(const QString &loadFile)
}
file.close();
emit loadWPFile();
emit waypointListChanged();
}
void UASWaypointManager::globalAddWaypoint(Waypoint *wp)
{
......
......@@ -91,6 +91,7 @@ public:
void localMoveWaypoint(quint16 cur_seq, quint16 new_seq); ///< locally move a waypoint from its current position cur_seq to a new position new_seq
void localSaveWaypoints(const QString &saveFile); ///< saves the local waypoint list to saveFile
void localLoadWaypoints(const QString &loadFile); ///< loads a waypoint list from loadFile
/*@}*/
/** @name Global waypoint list operations */
......@@ -120,6 +121,8 @@ signals:
void currentWaypointChanged(quint16); ///< emits the new current waypoint sequence number
void updateStatusString(const QString &); ///< emits the current status string
void loadWPFile(); ///< emits signal that a file wp has been load
private:
UAS &uas; ///< Reference to the corresponding UAS
quint32 current_retries; ///< The current number of retries left
......
......@@ -401,6 +401,9 @@ void MainWindow::connectActions()
// Slugs View
connect(ui.actionShow_Slugs_View, SIGNAL(triggered()), this, SLOT(loadSlugsView()));
//GlobalOperatorView
// connect(ui.actionGlobalOperatorView,SIGNAL(triggered()),waypointsDockWidget->widget(),SLOT())
}
void MainWindow::showHelp()
......@@ -918,6 +921,7 @@ void MainWindow::loadGlobalOperatorView()
{
addDockWidget(Qt::BottomDockWidgetArea, waypointsDockWidget);
waypointsDockWidget->show();
}
// Slugs Data View
......
......@@ -396,7 +396,17 @@ void MapWidget::createWaypointGraphAtMap(const QPointF coordinate)
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);
//CirclePoint* tempCirclePoint = new CirclePoint(coordinate.x(), coordinate.y(), 10, str);
Waypoint2DIcon* tempCirclePoint;
if (mav)
{
tempCirclePoint = new Waypoint2DIcon(coordinate.x(), coordinate.y(), 20, str, qmapcontrol::Point::Middle, new QPen(mav->getColor()));
}
else
{
tempCirclePoint = new Waypoint2DIcon(coordinate.x(), coordinate.y(), 20, str, qmapcontrol::Point::Middle);
}
mc->layer("Waypoints")->addGeometry(tempCirclePoint);
Point* tempPoint = new Point(coordinate.x(), coordinate.y(),str);
......
......@@ -51,7 +51,6 @@ void SlugsDataSensorView::addUAS(UASInterface* uas)
connect(slugsMav, SIGNAL(slugsGPSDateTime(int,const mavlink_gps_date_time_t&)),this,SLOT(slugsGPSDateTimeChanged(int,const mavlink_gps_date_time_t&)));
#endif // MAVLINK_ENABLED_SLUGS
// Set this UAS as active if it is the first one
if(activeUAS == 0) {
activeUAS = uas;
......
......@@ -91,6 +91,7 @@ WaypointList::WaypointList(QWidget *parent, UASInterface* uas) :
this->setVisible(false);
isGlobalWP = false;
isLocalWP = false;
loadFileGlobalWP = false;
centerMapCoordinate.setX(0.0);
centerMapCoordinate.setY(0.0);
......@@ -131,6 +132,7 @@ void WaypointList::setUAS(UASInterface* uas)
connect(&uas->getWaypointManager(), SIGNAL(updateStatusString(const QString &)), this, SLOT(updateStatusLabel(const QString &)));
connect(&uas->getWaypointManager(), SIGNAL(waypointListChanged(void)), this, SLOT(waypointListChanged(void)));
connect(&uas->getWaypointManager(), SIGNAL(currentWaypointChanged(quint16)), this, SLOT(currentWaypointChanged(quint16)));
connect(&uas->getWaypointManager(),SIGNAL(loadWPFile()),this,SLOT(setIsLoadFileWP()));
}
}
......@@ -147,8 +149,11 @@ void WaypointList::loadWaypoints()
{
if (uas)
{
QString fileName = QFileDialog::getOpenFileName(this, tr("Load File"), ".", tr("Waypoint File (*.txt)"));
uas->getWaypointManager().localLoadWaypoints(fileName);
}
}
......@@ -336,6 +341,11 @@ void WaypointList::waypointListChanged()
WaypointGlobalView *wpgv = wpGlobalViews.value(wp);
wpgv->updateValues();
listLayout->addWidget(wpgv);
if(loadFileGlobalWP)
{
emit createWaypointAtMap(QPointF(wp->getX(),wp->getY()));
qDebug()<<"Emitiendo Pos: "<<wp->getX()<<" - "<<wp->getY();
}
}
}
......@@ -391,7 +401,7 @@ void WaypointList::waypointListChanged()
}
loadFileGlobalWP = false;
}
......@@ -622,3 +632,8 @@ void WaypointList::changeWPPositionBySpinBox(Waypoint *wp)
emit changePositionWPGlobalBySpinBox(wp->getId(), wp->getY(), wp->getX());
}
void WaypointList::setIsLoadFileWP()
{
loadFileGlobalWP = true;
}
......@@ -102,6 +102,8 @@ public slots:
void moveDown(Waypoint* wp);
void removeWaypoint(Waypoint* wp);
void setIsLoadFileWP();
......@@ -128,6 +130,7 @@ protected:
bool isGlobalWP;
bool isLocalWP;
QPointF centerMapCoordinate;
bool loadFileGlobalWP;
private:
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