Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
5ec5d936
Commit
5ec5d936
authored
Sep 21, 2011
by
lm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed braces
parent
7c239e80
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
16 deletions
+31
-16
UASWaypointManager.cc
src/uas/UASWaypointManager.cc
+3
-2
WaypointList.cc
src/ui/WaypointList.cc
+10
-5
QGCMapWidget.cc
src/ui/map/QGCMapWidget.cc
+18
-9
No files found.
src/uas/UASWaypointManager.cc
View file @
5ec5d936
...
...
@@ -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
();
}
}
...
...
src/ui/WaypointList.cc
View file @
5ec5d936
...
...
@@ -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
();
}
}
...
...
src/ui/map/QGCMapWidget.cc
View file @
5ec5d936
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment