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
82acad45
Commit
82acad45
authored
Jun 25, 2011
by
pixhawk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updating WP coordinates from map via drag and drop works. Working now on list enumeration changes
parent
9683bd14
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
2 deletions
+50
-2
QGCMapWidget.cc
src/ui/map/QGCMapWidget.cc
+41
-2
QGCMapWidget.h
src/ui/map/QGCMapWidget.h
+9
-0
No files found.
src/ui/map/QGCMapWidget.cc
View file @
82acad45
...
...
@@ -7,7 +7,8 @@
QGCMapWidget
::
QGCMapWidget
(
QWidget
*
parent
)
:
mapcontrol
::
OPMapWidget
(
parent
),
currWPManager
(
NULL
)
currWPManager
(
NULL
),
firingWaypointChange
(
NULL
)
{
connect
(
UASManager
::
instance
(),
SIGNAL
(
UASCreated
(
UASInterface
*
)),
this
,
SLOT
(
addUAS
(
UASInterface
*
)));
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
this
,
SLOT
(
activeUASSet
(
UASInterface
*
)));
...
...
@@ -81,6 +82,11 @@ QGCMapWidget::QGCMapWidget(QWidget *parent) :
// FIXME XXX this is a hack to trick OPs current 1-system design
SetShowUAV
(
false
);
// Connect map updates to the adapter slots
connect
(
this
,
SIGNAL
(
WPValuesChanged
(
WayPointItem
*
)),
this
,
SLOT
(
handleMapWaypointEdit
(
WayPointItem
*
)));
setFocus
();
}
...
...
@@ -113,6 +119,7 @@ void QGCMapWidget::activeUASSet(UASInterface* uas)
disconnect
(
currWPManager
,
SIGNAL
(
waypointListChanged
(
int
)),
this
,
SLOT
(
updateWaypointList
(
int
)));
disconnect
(
currWPManager
,
SIGNAL
(
waypointChanged
(
int
,
Waypoint
*
)),
this
,
SLOT
(
updateWaypoint
(
int
,
Waypoint
*
)));
disconnect
(
this
,
SIGNAL
(
waypointCreated
(
Waypoint
*
)),
currWPManager
,
SLOT
(
addWaypoint
(
Waypoint
*
)));
disconnect
(
this
,
SIGNAL
(
waypointChanged
(
Waypoint
*
)),
currWPManager
,
SLOT
(
notifyOfChange
(
Waypoint
*
)));
}
if
(
uas
)
{
...
...
@@ -132,7 +139,7 @@ void QGCMapWidget::activeUASSet(UASInterface* uas)
connect
(
currWPManager
,
SIGNAL
(
waypointListChanged
(
int
)),
this
,
SLOT
(
updateWaypointList
(
int
)));
connect
(
currWPManager
,
SIGNAL
(
waypointChanged
(
int
,
Waypoint
*
)),
this
,
SLOT
(
updateWaypoint
(
int
,
Waypoint
*
)));
connect
(
this
,
SIGNAL
(
waypointCreated
(
Waypoint
*
)),
currWPManager
,
SLOT
(
addWaypoint
(
Waypoint
*
)));
connect
(
this
,
SIGNAL
(
waypointChanged
(
Waypoint
*
)),
currWPManager
,
SLOT
(
notifyOfChange
(
Waypoint
*
)));
updateSelectedSystem
(
uas
->
getUASID
());
}
}
...
...
@@ -233,6 +240,32 @@ void QGCMapWidget::updateHomePosition(double latitude, double longitude, double
}
// WAYPOINT MAP INTERACTION FUNCTIONS
//void QGCMapWidget::createWaypointAtMousePos(QMouseEvent)
//{
//}
void
QGCMapWidget
::
handleMapWaypointEdit
(
mapcontrol
::
WayPointItem
*
waypoint
)
{
qDebug
()
<<
"UPDATING WP FROM MAP"
;
// Block circle updates
Waypoint
*
wp
=
iconsToWaypoints
.
value
(
waypoint
,
NULL
);
// Protect from vicious double update cycle
if
(
firingWaypointChange
==
wp
||
!
wp
)
return
;
// Not in cycle, block now from entering it
firingWaypointChange
=
wp
;
// Update WP values
internals
::
PointLatLng
pos
=
waypoint
->
Coord
();
wp
->
setLatitude
(
pos
.
Lat
());
wp
->
setLongitude
(
pos
.
Lng
());
wp
->
setAltitude
(
waypoint
->
Altitude
());
emit
waypointChanged
(
wp
);
firingWaypointChange
=
NULL
;
}
// WAYPOINT UPDATE FUNCTIONS
...
...
@@ -242,6 +275,8 @@ void QGCMapWidget::updateHomePosition(double latitude, double longitude, double
*/
void
QGCMapWidget
::
updateWaypoint
(
int
uas
,
Waypoint
*
wp
)
{
// Source of the event was in this widget, do nothing
if
(
firingWaypointChange
==
wp
)
return
;
// 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.
if
(
UASManager
::
instance
()
->
getUASForId
(
uas
)
->
getWaypointManager
()
==
currWPManager
)
{
...
...
@@ -255,6 +290,8 @@ void QGCMapWidget::updateWaypoint(int uas, Waypoint* wp)
int
wpindex
=
UASManager
::
instance
()
->
getUASForId
(
uas
)
->
getWaypointManager
()
->
getGlobalFrameAndNavTypeIndexOf
(
wp
);
// If not found, return (this should never happen, but helps safety)
if
(
wpindex
==
-
1
)
return
;
// Mark this wp as currently edited
firingWaypointChange
=
wp
;
// Check if wp exists yet in map
if
(
!
waypointsToIcons
.
contains
(
wp
))
{
...
...
@@ -281,6 +318,8 @@ void QGCMapWidget::updateWaypoint(int uas, Waypoint* wp)
// Re-enable signals again
this
->
blockSignals
(
false
);
}
firingWaypointChange
=
NULL
;
}
else
{
// Check if the index of this waypoint is larger than the global
// waypoint list. This implies that the coordinate frame of this
...
...
src/ui/map/QGCMapWidget.h
View file @
82acad45
...
...
@@ -7,6 +7,7 @@
class
UASInterface
;
class
UASWaypointManager
;
class
Waypoint
;
typedef
mapcontrol
::
WayPointItem
WayPointItem
;
/**
* @brief Class representing a 2D map using aerial imagery
...
...
@@ -20,6 +21,9 @@ public:
signals:
void
homePositionChanged
(
double
latitude
,
double
longitude
,
double
altitude
);
/** @brief Signal for newly created map waypoints */
void
waypointCreated
(
Waypoint
*
wp
);
void
waypointChanged
(
Waypoint
*
wp
);
public
slots
:
/** @brief Add system to map view */
...
...
@@ -39,6 +43,10 @@ public slots:
/** @brief Update the home position on the map */
void
updateHomePosition
(
double
latitude
,
double
longitude
,
double
altitude
);
protected
slots
:
/** @brief Convert a map edit into a QGC waypoint event */
void
handleMapWaypointEdit
(
WayPointItem
*
waypoint
);
protected:
/** @brief Update the highlighting of the currently controlled system */
void
updateSelectedSystem
(
int
uas
);
...
...
@@ -47,6 +55,7 @@ protected:
UASWaypointManager
*
currWPManager
;
///< The current waypoint manager
QMap
<
Waypoint
*
,
mapcontrol
::
WayPointItem
*>
waypointsToIcons
;
QMap
<
mapcontrol
::
WayPointItem
*
,
Waypoint
*>
iconsToWaypoints
;
Waypoint
*
firingWaypointChange
;
// enum editMode {
// NONE,
// WAYPOINTS,
...
...
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