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