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
f83821e5
Commit
f83821e5
authored
Aug 12, 2013
by
David Goodman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Set Home option to map menu. Fix home icon always placed in bottom right.
parent
4b142a48
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
0 deletions
+38
-0
QGCMapWidget.cc
src/ui/map/QGCMapWidget.cc
+36
-0
QGCMapWidget.h
src/ui/map/QGCMapWidget.h
+2
-0
No files found.
src/ui/map/QGCMapWidget.cc
View file @
f83821e5
...
...
@@ -38,6 +38,7 @@ QGCMapWidget::QGCMapWidget(QWidget *parent) :
this
->
setContextMenuPolicy
(
Qt
::
ActionsContextMenu
);
// Got to options
QAction
*
guidedaction
=
new
QAction
(
this
);
guidedaction
->
setText
(
"Go To Here (Guided Mode)"
);
connect
(
guidedaction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
guidedActionTriggered
()));
...
...
@@ -46,10 +47,16 @@ QGCMapWidget::QGCMapWidget(QWidget *parent) :
guidedaction
->
setText
(
"Go To Here Alt (Guided Mode)"
);
connect
(
guidedaction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
guidedAltActionTriggered
()));
this
->
addAction
(
guidedaction
);
// Point camera option
QAction
*
cameraaction
=
new
QAction
(
this
);
cameraaction
->
setText
(
"Point Camera Here"
);
connect
(
cameraaction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
cameraActionTriggered
()));
this
->
addAction
(
cameraaction
);
// Set home location option
QAction
*
sethomeaction
=
new
QAction
(
this
);
sethomeaction
->
setText
(
"Set Home Location Here"
);
connect
(
sethomeaction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
setHomeActionTriggered
()));
this
->
addAction
(
sethomeaction
);
}
void
QGCMapWidget
::
guidedActionTriggered
()
{
...
...
@@ -111,6 +118,35 @@ void QGCMapWidget::cameraActionTriggered()
}
}
/**
* @brief QGCMapWidget::setHomeActionTriggered
*/
bool
QGCMapWidget
::
setHomeActionTriggered
()
{
if
(
!
uas
)
{
QMessageBox
::
information
(
0
,
"Error"
,
"Please connect first"
);
return
false
;
}
UASManager
*
uasManager
=
UASManager
::
instance
();
if
(
!
uasManager
)
{
return
false
;
}
// Enter an altitude
bool
ok
=
false
;
int
alt
=
QInputDialog
::
getInt
(
this
,
"Altitude"
,
"Enter default altitude (in meters) of destination point for guided mode"
,
100
,
0
,
30000
,
1
,
&
ok
);
if
(
!
ok
)
return
false
;
//Use has chosen cancel. Do not send the waypoint
// Create new waypoint and send it to the WPManager to send out.
internals
::
PointLatLng
pos
=
map
->
FromLocalToLatLng
(
mousePressPos
.
x
(),
mousePressPos
.
y
());
qDebug
()
<<
"Set home location sent. Lat:"
<<
pos
.
Lat
()
<<
", Lon:"
<<
pos
.
Lng
()
<<
", Alt: "
<<
alt
;
bool
success
=
uasManager
->
setHomePositionAndNotify
(
pos
.
Lat
(),
pos
.
Lng
(),
alt
);
qDebug
()
<<
((
success
)
?
"Set new home location."
:
"Failed to set new home location."
);
return
success
;
}
void
QGCMapWidget
::
mousePressEvent
(
QMouseEvent
*
event
)
{
mapcontrol
::
OPMapWidget
::
mousePressEvent
(
event
);
...
...
src/ui/map/QGCMapWidget.h
View file @
f83821e5
...
...
@@ -46,6 +46,8 @@ public slots:
void
guidedActionTriggered
();
/** @brief Action triggered when guided action is selected from the context menu, allows for altitude selection */
bool
guidedAltActionTriggered
();
/** @brief Action triggered when set home action is selected from the context menu. */
bool
setHomeActionTriggered
();
/** @brief Add system to map view */
void
addUAS
(
UASInterface
*
uas
);
/** @brief Update the global position of a system */
...
...
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