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
3992e5bd
Commit
3992e5bd
authored
Jun 19, 2018
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Draggable radius adjustment for Orbit
parent
beff8561
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
105 additions
and
46 deletions
+105
-46
FlightDisplayViewMap.qml
src/FlightDisplay/FlightDisplayViewMap.qml
+61
-19
GuidedActionsController.qml
src/FlightDisplay/GuidedActionsController.qml
+3
-1
MissionItemIndicatorDrag.qml
src/FlightMap/MapItems/MissionItemIndicatorDrag.qml
+2
-1
QGCMapCircleVisuals.qml
src/MissionManager/QGCMapCircleVisuals.qml
+37
-25
QGCApplication.cc
src/QGCApplication.cc
+2
-0
No files found.
src/FlightDisplay/FlightDisplayViewMap.qml
View file @
3992e5bd
...
...
@@ -49,7 +49,6 @@ FlightMap {
property
var
_rallyPointController
:
_planMasterController
.
rallyPointController
property
var
_activeVehicle
:
QGroundControl
.
multiVehicleManager
.
activeVehicle
property
var
_activeVehicleCoordinate
:
_activeVehicle
?
_activeVehicle
.
coordinate
:
QtPositioning
.
coordinate
()
property
var
_guidedLocationCoordinate
:
QtPositioning
.
coordinate
()
property
real
_toolButtonTopMargin
:
parent
.
height
-
ScreenTools
.
availableHeight
+
(
ScreenTools
.
defaultFontPixelHeight
/
2
)
property
bool
_disableVehicleTracking
:
false
...
...
@@ -274,23 +273,58 @@ FlightMap {
}
}
// Guided action location
MapQuickItem
{
id
:
guidedLocationItem
coordinate
:
_guidedLocationCoordinate
visible
:
_activeVehicle
&&
_activeVehicle
.
guidedModeSupported
&&
_guidedLocationCoordinate
.
isValid
id
:
gotoLocationItem
visible
:
false
z
:
QGroundControl
.
zOrderMapItems
anchorPoint.x
:
sourceItem
.
anchorPointX
anchorPoint.y
:
sourceItem
.
anchorPointY
property
bool
gotoLocation
:
true
///< true: Used for go to location, false: used for orbit
sourceItem
:
MissionItemIndexLabel
{
checked
:
true
index
:
-
1
label
:
guidedLocationItem
.
gotoLocation
?
qsTr
(
"
Goto here
"
,
"
Goto here waypoint
"
)
:
qsTr
(
"
Orbit here
"
,
"
Orbit here waypoint
"
)
label
:
qsTr
(
"
Goto here
"
,
"
Goto here waypoint
"
)
}
function
show
(
coord
)
{
gotoLocationItem
.
coordinate
=
coord
gotoLocationItem
.
visible
=
true
}
function
hide
()
{
gotoLocationItem
.
visible
=
false
}
}
QGCMapCircleVisuals
{
id
:
orbitMapCircle
mapControl
:
parent
mapCircle
:
_mapCircle
visible
:
false
property
alias
center
:
_mapCircle
.
center
property
real
radius
:
defaultRadius
readonly
property
real
defaultRadius
:
30
function
show
(
coord
)
{
orbitMapCircle
.
radius
=
defaultRadius
orbitMapCircle
.
center
=
coord
orbitMapCircle
.
visible
=
true
}
function
hide
()
{
orbitMapCircle
.
visible
=
false
}
Component.onCompleted
:
guidedActionsController
.
orbitMapCircle
=
orbitMapCircle
QGCMapCircle
{
id
:
_mapCircle
interactive
:
true
radius.rawValue
:
orbitMapCircle
.
radius
}
}
}
// Handle guided mode clicks
MouseArea
{
...
...
@@ -299,22 +333,27 @@ FlightMap {
Menu
{
id
:
clickMenu
property
var
coord
MenuItem
{
text
:
qsTr
(
"
Go to location
"
)
visible
:
guidedActionsController
.
showGotoLocation
onTriggered
:
{
guidedLocationItem
.
gotoLocation
=
true
guidedActionsController
.
confirmAction
(
guidedActionsController
.
actionGoto
,
_guidedLocationCoordinate
)
gotoLocationItem
.
show
(
clickMenu
.
coord
)
orbitMapCircle
.
hide
()
guidedActionsController
.
confirmAction
(
guidedActionsController
.
actionGoto
,
clickMenu
.
coord
)
}
}
MenuItem
{
text
:
qsTr
(
"
Orbit at location
"
)
visible
:
guidedActionsController
.
showOrbit
onTriggered
:
{
guidedLocationItem
.
gotoLocation
=
false
guidedActionsController
.
confirmAction
(
guidedActionsController
.
actionOrbit
,
_guidedLocationCoordinate
)
orbitMapCircle
.
show
(
clickMenu
.
coord
)
gotoLocationItem
.
hide
()
guidedActionsController
.
confirmAction
(
guidedActionsController
.
actionOrbit
,
clickMenu
.
coord
)
}
}
}
...
...
@@ -322,16 +361,19 @@ FlightMap {
onClicked
:
{
if
(
guidedActionsController
.
guidedUIVisible
||
(
!
guidedActionsController
.
showGotoLocation
&&
!
guidedActionsController
.
showOrbit
))
{
return
}
_guidedLocationCoordinate
=
flightMap
.
toCoordinate
(
Qt
.
point
(
mouse
.
x
,
mouse
.
y
),
false
/* clipToViewPort */
)
}
orbitMapCircle
.
hide
()
gotoLocationItem
.
hide
()
var
clickCoord
=
flightMap
.
toCoordinate
(
Qt
.
point
(
mouse
.
x
,
mouse
.
y
),
false
/* clipToViewPort */
)
if
(
guidedActionsController
.
showGotoLocation
&&
guidedActionsController
.
showOrbit
)
{
clickMenu
.
coord
=
clickCoord
clickMenu
.
popup
()
}
else
if
(
guidedActionsController
.
showGotoLocation
)
{
guidedLocationItem
.
gotoLocation
=
true
guidedActionsController
.
confirmAction
(
guidedActionsController
.
actionGoto
,
_guidedLocationCoordinate
)
_guidedLocationCoordinate
=
clickCoord
guidedActionsController
.
confirmAction
(
guidedActionsController
.
actionGoto
,
clickCoord
)
}
else
if
(
guidedActionsController
.
showOrbit
)
{
guidedLocationItem
.
gotoLocation
=
false
guidedActionsController
.
confirmAction
(
guidedActionsController
.
actionOrbit
,
_guidedLocationCoordinate
)
orbitMapCircle
.
show
(
clickCoord
)
guidedActionsController
.
confirmAction
(
guidedActionsController
.
actionOrbit
,
clickCoord
)
}
}
}
...
...
src/FlightDisplay/GuidedActionsController.qml
View file @
3992e5bd
...
...
@@ -31,6 +31,7 @@ Item {
property
var
confirmDialog
property
var
actionList
property
var
altitudeSlider
property
var
orbitMapCircle
readonly
property
string
emergencyStopTitle
:
qsTr
(
"
EMERGENCY STOP
"
)
readonly
property
string
armTitle
:
qsTr
(
"
Arm
"
)
...
...
@@ -388,7 +389,8 @@ Item {
_activeVehicle
.
setCurrentMissionSequence
(
actionData
)
break
case
actionOrbit
:
_activeVehicle
.
guidedModeOrbit
(
actionData
,
10
/* Hacked fixed radius */
,
_activeVehicle
.
altitudeAMSL
+
actionAltitudeChange
)
_activeVehicle
.
guidedModeOrbit
(
orbitMapCircle
.
center
,
orbitMapCircle
.
radius
,
_activeVehicle
.
altitudeAMSL
+
actionAltitudeChange
)
orbitMapCircle
.
hide
()
break
case
actionLandAbort
:
_activeVehicle
.
abortLanding
(
50
)
// hardcoded value for climbOutAltitude that is currently ignored
...
...
src/FlightMap/MapItems/MissionItemIndicatorDrag.qml
View file @
3992e5bd
...
...
@@ -25,6 +25,7 @@ Rectangle {
z
:
QGroundControl
.
zOrderMapItems
+
1
// Above item icons
// Properties which must be specific by consumer
property
var
mapControl
///< Map control which contains this item
property
var
itemIndicator
///< The mission item indicator to drag around
property
var
itemCoordinate
///< Coordinate we are updating during drag
...
...
@@ -51,7 +52,7 @@ Rectangle {
function
liveDrag
()
{
if
(
!
itemDragger
.
_preventCoordinateBindingLoop
&&
itemDrag
.
drag
.
active
)
{
var
point
=
Qt
.
point
(
itemDragger
.
x
+
_touchMarginHorizontal
+
itemIndicator
.
anchorPoint
.
x
,
itemDragger
.
y
+
_touchMarginVertical
+
itemIndicator
.
anchorPoint
.
y
)
var
coordinate
=
map
.
toCoordinate
(
point
,
false
/* clipToViewPort */
)
var
coordinate
=
map
Control
.
toCoordinate
(
point
,
false
/* clipToViewPort */
)
itemDragger
.
_preventCoordinateBindingLoop
=
true
coordinate
.
altitude
=
itemCoordinate
.
altitude
itemCoordinate
=
coordinate
...
...
src/MissionManager/QGCMapCircleVisuals.qml
View file @
3992e5bd
...
...
@@ -27,52 +27,60 @@ Item {
property
bool
interactive
:
mapCircle
.
interactive
/// true: user can manipulate polygon
property
color
interiorColor
:
"
transparent
"
property
real
interiorOpacity
:
1
property
int
borderWidth
:
0
property
color
borderColor
:
"
black
"
property
int
borderWidth
:
2
property
color
borderColor
:
"
orange
"
property
var
_circleComponent
property
var
_
centerDragHandle
Component
property
var
_
dragHandles
Component
function
addVisuals
()
{
_circleComponent
=
circleComponent
.
createObject
(
mapControl
)
mapControl
.
addMapItem
(
_circleComponent
)
if
(
!
_circleComponent
)
{
_circleComponent
=
circleComponent
.
createObject
(
mapControl
)
mapControl
.
addMapItem
(
_circleComponent
)
}
}
function
removeVisuals
()
{
_circleComponent
.
destroy
()
if
(
_circleComponent
)
{
_circleComponent
.
destroy
()
_circleComponent
=
undefined
}
}
function
addHandles
()
{
if
(
!
_
centerDragHandle
Component
)
{
_
centerDragHandleComponent
=
centerDragHandle
Component
.
createObject
(
mapControl
)
function
add
Drag
Handles
()
{
if
(
!
_
dragHandles
Component
)
{
_
dragHandlesComponent
=
dragHandles
Component
.
createObject
(
mapControl
)
}
}
function
removeHandles
()
{
if
(
_
centerDragHandle
Component
)
{
_
centerDragHandle
Component
.
destroy
()
_
centerDragHandle
Component
=
undefined
function
remove
Drag
Handles
()
{
if
(
_
dragHandles
Component
)
{
_
dragHandles
Component
.
destroy
()
_
dragHandles
Component
=
undefined
}
}
onInteractiveChanged
:
{
if
(
interactive
)
{
addHandles
()
function
updateInternalComponents
()
{
if
(
visible
)
{
addVisuals
()
if
(
interactive
)
{
addDragHandles
()
}
else
{
removeDragHandles
()
}
}
else
{
removeHandles
()
removeVisuals
()
removeDragHandles
()
}
}
Component.onCompleted
:
{
addVisuals
()
if
(
interactive
)
{
addHandles
()
}
}
Component.onCompleted
:
updateInternalComponents
()
onInteractiveChanged
:
updateInternalComponents
()
onVisibleChanged
:
updateInternalComponents
()
Component.onDestruction
:
{
removeVisuals
()
removeHandles
()
remove
Drag
Handles
()
}
Component
{
...
...
@@ -112,6 +120,8 @@ Item {
id
:
centerDragAreaComponent
MissionItemIndicatorDrag
{
mapControl
:
_root
.
mapControl
onItemCoordinateChanged
:
mapCircle
.
center
=
itemCoordinate
}
}
...
...
@@ -120,12 +130,14 @@ Item {
id
:
radiusDragAreaComponent
MissionItemIndicatorDrag
{
mapControl
:
_root
.
mapControl
onItemCoordinateChanged
:
mapCircle
.
radius
.
rawValue
=
mapCircle
.
center
.
distanceTo
(
itemCoordinate
)
}
}
Component
{
id
:
centerDragHandle
Component
id
:
dragHandles
Component
Item
{
property
var
centerDragHandle
...
...
src/QGCApplication.cc
View file @
3992e5bd
...
...
@@ -76,6 +76,7 @@
#include "FollowMe.h"
#include "MissionCommandTree.h"
#include "QGCMapPolygon.h"
#include "QGCMapCircle.h"
#include "ParameterManager.h"
#include "SettingsManager.h"
#include "QGCCorePlugin.h"
...
...
@@ -389,6 +390,7 @@ void QGCApplication::_initCommon(void)
qmlRegisterType
<
LogDownloadController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"LogDownloadController"
);
qmlRegisterType
<
SyslinkComponentController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"SyslinkComponentController"
);
qmlRegisterType
<
EditPositionDialogController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"EditPositionDialogController"
);
qmlRegisterType
<
QGCMapCircle
>
(
"QGroundControl.FlightMap"
,
1
,
0
,
"QGCMapCircle"
);
#ifndef __mobile__
qmlRegisterType
<
ViewWidgetController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"ViewWidgetController"
);
qmlRegisterType
<
CustomCommandWidgetController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"CustomCommandWidgetController"
);
...
...
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