Commit 5ec5d936 authored by lm's avatar lm

Changed braces

parent 7c239e80
......@@ -305,7 +305,8 @@ int UASWaypointManager::setCurrentWaypoint(quint16 seq)
*/
void UASWaypointManager::addWaypoint(Waypoint *wp, bool enforceFirstActive)
{
if (wp) {
if (wp)
{
wp->setId(waypoints.size());
if (enforceFirstActive && waypoints.size() == 0)
{
......@@ -315,8 +316,8 @@ void UASWaypointManager::addWaypoint(Waypoint *wp, bool enforceFirstActive)
waypoints.insert(waypoints.size(), wp);
connect(wp, SIGNAL(changed(Waypoint*)), this, SLOT(notifyOfChange(Waypoint*)));
emit waypointListChanged();
emit waypointListChanged(uas.getUASID());
emit waypointListChanged();
}
}
......
......@@ -118,7 +118,8 @@ void WaypointList::updateAttitude(UASInterface* uas, double roll, double pitch,
void WaypointList::setUAS(UASInterface* uas)
{
if (this->uas == NULL && uas != NULL) {
if (this->uas == NULL && uas != NULL)
{
this->uas = uas;
connect(uas, SIGNAL(localPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updatePosition(UASInterface*,double,double,double,quint64)));
......@@ -136,7 +137,8 @@ void WaypointList::setUAS(UASInterface* uas)
void WaypointList::saveWaypoints()
{
if (uas) {
if (uas)
{
QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), "./waypoints.txt", tr("Waypoint File (*.txt)"));
uas->getWaypointManager()->saveWaypoints(fileName);
}
......@@ -144,7 +146,8 @@ void WaypointList::saveWaypoints()
void WaypointList::loadWaypoints()
{
if (uas) {
if (uas)
{
QString fileName = QFileDialog::getOpenFileName(this, tr("Load File"), ".", tr("Waypoint File (*.txt)"));
uas->getWaypointManager()->loadWaypoints(fileName);
}
......@@ -152,14 +155,16 @@ void WaypointList::loadWaypoints()
void WaypointList::transmit()
{
if (uas) {
if (uas)
{
uas->getWaypointManager()->writeWaypoints();
}
}
void WaypointList::read()
{
if (uas) {
if (uas)
{
uas->getWaypointManager()->readWaypoints();
}
}
......
......@@ -427,9 +427,11 @@ void QGCMapWidget::updateWaypoint(int uas, Waypoint* wp)
// Currently only accept waypoint updates from the UAS in focus
// this has to be changed to accept read-only updates from other systems as well.
UASInterface* uasInstance = UASManager::instance()->getUASForId(uas);
if (uasInstance->getWaypointManager() == currWPManager || uas == -1) {
if (uasInstance->getWaypointManager() == currWPManager || uas == -1)
{
// Only accept waypoints in global coordinate frame
if (((wp->getFrame() == MAV_FRAME_GLOBAL) || (wp->getFrame() == MAV_FRAME_GLOBAL_RELATIVE_ALT)) && wp->isNavigationType()) {
if (((wp->getFrame() == MAV_FRAME_GLOBAL) || (wp->getFrame() == MAV_FRAME_GLOBAL_RELATIVE_ALT)) && wp->isNavigationType())
{
// We're good, this is a global waypoint
// Get the index of this waypoint
......@@ -442,7 +444,8 @@ void QGCMapWidget::updateWaypoint(int uas, Waypoint* wp)
firingWaypointChange = wp;
// Check if wp exists yet in map
if (!waypointsToIcons.contains(wp)) {
if (!waypointsToIcons.contains(wp))
{
// Create icon for new WP
QColor wpColor(Qt::red);
if (uasInstance) wpColor = uasInstance->getColor();
......@@ -473,7 +476,9 @@ void QGCMapWidget::updateWaypoint(int uas, Waypoint* wp)
}
}
}
} else {
}
else
{
// Waypoint exists, block it's signals and update it
mapcontrol::WayPointItem* icon = waypointsToIcons.value(wp);
// Make sure we don't die on a null pointer
......@@ -504,12 +509,15 @@ void QGCMapWidget::updateWaypoint(int uas, Waypoint* wp)
firingWaypointChange = NULL;
} else {
}
else
{
// Check if the index of this waypoint is larger than the global
// waypoint list. This implies that the coordinate frame of this
// waypoint was changed and the list containing only global
// waypoints was shortened. Thus update the whole list
if (waypointsToIcons.size() > currWPManager->getGlobalFrameAndNavTypeCount()) {
if (waypointsToIcons.size() > currWPManager->getGlobalFrameAndNavTypeCount())
{
updateWaypointList(uas);
}
}
......@@ -526,7 +534,8 @@ void QGCMapWidget::updateWaypointList(int uas)
// Currently only accept waypoint updates from the UAS in focus
// this has to be changed to accept read-only updates from other systems as well.
UASInterface* uasInstance = UASManager::instance()->getUASForId(uas);
if ((uasInstance && (uasInstance->getWaypointManager() == currWPManager)) || uas == -1) {
if ((uasInstance && (uasInstance->getWaypointManager() == currWPManager)) || uas == -1)
{
// ORDER MATTERS HERE!
// TWO LOOPS ARE NEEDED - INFINITY LOOP ELSE
......@@ -535,10 +544,10 @@ void QGCMapWidget::updateWaypointList(int uas)
QVector<Waypoint* > wps = currWPManager->getGlobalFrameAndNavTypeWaypointList();
foreach (Waypoint* wp, waypointsToIcons.keys())
{
// Get icon to work on
mapcontrol::WayPointItem* icon = waypointsToIcons.value(wp);
if (!wps.contains(wp))
{
// Get icon to work on
mapcontrol::WayPointItem* icon = waypointsToIcons.value(wp);
waypointsToIcons.remove(wp);
iconsToWaypoints.remove(icon);
WPDelete(icon);
......
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