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
e63127ad
Commit
e63127ad
authored
May 19, 2014
by
Lorenz Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Map: Use sensible defaults to init map close to vehicle position
parent
78e89fa5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
8 deletions
+22
-8
QGCMapWidget.cc
src/ui/map/QGCMapWidget.cc
+21
-8
QGCMapWidget.h
src/ui/map/QGCMapWidget.h
+1
-0
No files found.
src/ui/map/QGCMapWidget.cc
View file @
e63127ad
...
...
@@ -16,6 +16,7 @@ QGCMapWidget::QGCMapWidget(QWidget *parent) :
trailInterval
(
2.0
f
),
followUAVID
(
0
),
mapInitialized
(
false
),
mapPositionInitialized
(
false
),
homeAltitude
(
0
),
uas
(
NULL
)
{
...
...
@@ -174,7 +175,6 @@ void QGCMapWidget::mouseReleaseEvent(QMouseEvent *event)
if
(
firingWaypointChange
)
{
firingWaypointChange
=
NULL
;
}
qDebug
()
<<
"MOUSE RELEASED"
;
}
QGCMapWidget
::~
QGCMapWidget
()
...
...
@@ -192,6 +192,9 @@ void QGCMapWidget::showEvent(QShowEvent* event)
// Pass on to parent widget
OPMapWidget
::
showEvent
(
event
);
// Connect map updates to the adapter slots
connect
(
this
,
SIGNAL
(
WPValuesChanged
(
WayPointItem
*
)),
this
,
SLOT
(
handleMapWaypointEdit
(
WayPointItem
*
)));
connect
(
UASManager
::
instance
(),
SIGNAL
(
UASCreated
(
UASInterface
*
)),
this
,
SLOT
(
addUAS
(
UASInterface
*
)),
Qt
::
UniqueConnection
);
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
this
,
SLOT
(
activeUASSet
(
UASInterface
*
)),
Qt
::
UniqueConnection
);
connect
(
UASManager
::
instance
(),
SIGNAL
(
homePositionChanged
(
double
,
double
,
double
)),
this
,
SLOT
(
updateHomePosition
(
double
,
double
,
double
)));
...
...
@@ -217,16 +220,15 @@ void QGCMapWidget::showEvent(QShowEvent* event)
setFrameStyle
(
QFrame
::
NoFrame
);
// no border frame
setBackgroundBrush
(
QBrush
(
Qt
::
black
));
// tile background
// Set current home position
if
(
!
UASManager
::
instance
()
->
getActiveUAS
())
{
SetCurrentPosition
(
pos_lat_lon
);
// set the map position to default
}
// Set home
updateHomePosition
(
UASManager
::
instance
()
->
getHomeLatitude
(),
UASManager
::
instance
()
->
getHomeLongitude
(),
UASManager
::
instance
()
->
getHomeAltitude
());
// Set currently selected system
activeUASSet
(
UASManager
::
instance
()
->
getActiveUAS
());
// Connect map updates to the adapter slots
connect
(
this
,
SIGNAL
(
WPValuesChanged
(
WayPointItem
*
)),
this
,
SLOT
(
handleMapWaypointEdit
(
WayPointItem
*
)));
SetCurrentPosition
(
pos_lat_lon
);
// set the map position
setFocus
();
// Start timer
...
...
@@ -387,6 +389,16 @@ void QGCMapWidget::activeUASSet(UASInterface* uas)
connect
(
currWPManager
,
SIGNAL
(
waypointEditableChanged
(
int
,
Waypoint
*
)),
this
,
SLOT
(
updateWaypoint
(
int
,
Waypoint
*
)));
connect
(
this
,
SIGNAL
(
waypointCreated
(
Waypoint
*
)),
currWPManager
,
SLOT
(
addWaypointEditable
(
Waypoint
*
)));
connect
(
this
,
SIGNAL
(
waypointChanged
(
Waypoint
*
)),
currWPManager
,
SLOT
(
notifyOfChangeEditable
(
Waypoint
*
)));
if
(
!
mapPositionInitialized
)
{
internals
::
PointLatLng
pos_lat_lon
=
internals
::
PointLatLng
(
uas
->
getLatitude
(),
uas
->
getLongitude
());
SetCurrentPosition
(
pos_lat_lon
);
// Zoom in
SetZoom
(
13
);
mapPositionInitialized
=
true
;
}
}
else
{
...
...
@@ -568,6 +580,7 @@ void QGCMapWidget::showGoToDialog()
void
QGCMapWidget
::
updateHomePosition
(
double
latitude
,
double
longitude
,
double
altitude
)
{
qDebug
()
<<
"HOME SET TO: "
<<
latitude
<<
longitude
<<
altitude
;
Home
->
SetCoord
(
internals
::
PointLatLng
(
latitude
,
longitude
));
Home
->
SetAltitude
(
altitude
);
homeAltitude
=
altitude
;
...
...
@@ -578,7 +591,7 @@ void QGCMapWidget::updateHomePosition(double latitude, double longitude, double
void
QGCMapWidget
::
goHome
()
{
SetCurrentPosition
(
Home
->
Coord
());
SetZoom
(
1
8
);
//zoom to "large RC park" size
SetZoom
(
1
7
);
}
/**
...
...
src/ui/map/QGCMapWidget.h
View file @
e63127ad
...
...
@@ -167,6 +167,7 @@ protected:
float
trailInterval
;
///< Time or distance between trail items
int
followUAVID
;
///< Which UAV should be tracked?
bool
mapInitialized
;
///< Map initialized?
bool
mapPositionInitialized
;
///< The position on the map has a reasonable value?
float
homeAltitude
;
///< Home altitude
QPoint
mousePressPos
;
///< Mouse position when the button is released.
QPoint
contextMousePressPos
;
///< Mouse position when context menu activated.
...
...
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