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
e58ddc00
Commit
e58ddc00
authored
Sep 04, 2019
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated visuals
parent
6ce4d6cf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
165 additions
and
50 deletions
+165
-50
FWLandingPatternMapVisual.qml
src/PlanView/FWLandingPatternMapVisual.qml
+165
-50
No files found.
src/PlanView/FWLandingPatternMapVisual.qml
View file @
e58ddc00
...
...
@@ -26,17 +26,17 @@ Item {
signal
clicked
(
int
sequenceNumber
)
readonly
property
real
_landingWidthMeters
:
15
readonly
property
real
_landingLengthMeters
:
100
property
var
_missionItem
:
object
property
var
_itemVisuals
:
[
]
property
var
_mouseArea
property
var
_dragAreas
:
[
]
property
var
_flightPath
readonly
property
int
_flightPathIndex
:
0
readonly
property
int
_loiterPointIndex
:
1
readonly
property
int
_loiterRadiusIndex
:
2
readonly
property
int
_landingAreaIndex
:
3
readonly
property
int
_landPointIndex
:
4
property
real
_landingAreaBearing
:
_missionItem
.
landingCoordinate
.
azimuthTo
(
_missionItem
.
loiterTangentCoordinate
)
property
var
_loiterPointObject
property
var
_landingPointObject
function
hideItemVisuals
()
{
for
(
var
i
=
0
;
i
<
_itemVisuals
.
length
;
i
++
)
{
...
...
@@ -47,21 +47,22 @@ Item {
function
showItemVisuals
()
{
if
(
_itemVisuals
.
length
===
0
)
{
var
itemVisual
=
flightPathComponent
.
createObject
(
map
)
map
.
addMapItem
(
itemVisual
)
_itemVisuals
[
_flightPathIndex
]
=
itemVisual
itemVisual
=
loiterPointComponent
.
createObject
(
map
)
map
.
addMapItem
(
itemVisual
)
_itemVisuals
[
_loiterPointIndex
]
=
itemVisual
itemVisual
=
loiterRadiusComponent
.
createObject
(
map
)
map
.
addMapItem
(
itemVisual
)
_itemVisuals
[
_loiterRadiusIndex
]
=
itemVisual
itemVisual
=
landingAreaComponent
.
createObject
(
map
)
var
itemVisual
=
loiterPointComponent
.
createObject
(
map
)
map
.
addMapItem
(
itemVisual
)
_itemVisuals
[
_landingAreaIndex
]
=
itemVisual
itemVisual
=
landPointComponent
.
createObject
(
map
)
_itemVisuals
.
push
(
itemVisual
)
_loiterPointObject
=
itemVisual
itemVisual
=
landingPointComponent
.
createObject
(
map
)
map
.
addMapItem
(
itemVisual
)
_itemVisuals
[
_landPointIndex
]
=
itemVisual
_itemVisuals
.
push
(
itemVisual
)
_landingPointObject
=
itemVisual
var
rgComponents
=
[
flightPathComponent
,
loiterRadiusComponent
,
landingAreaComponent
,
landingAreaLabelComponent
,
glideSlopeComponent
,
glideSlopeLabelComponent
]
for
(
var
i
=
0
;
i
<
rgComponents
.
length
;
i
++
)
{
var
obj
=
rgComponents
[
i
].
createObject
(
map
)
_itemVisuals
.
push
(
obj
)
map
.
addMapItem
(
obj
)
}
}
}
...
...
@@ -177,7 +178,7 @@ Item {
MissionItemIndicatorDrag
{
mapControl
:
_root
.
map
itemIndicator
:
_
itemVisuals
[
_loiterPointIndex
]
itemIndicator
:
_
loiterPointObject
itemCoordinate
:
_missionItem
.
loiterCoordinate
onItemCoordinateChanged
:
_missionItem
.
loiterCoordinate
=
itemCoordinate
...
...
@@ -190,7 +191,7 @@ Item {
MissionItemIndicatorDrag
{
mapControl
:
_root
.
map
itemIndicator
:
_
itemVisuals
[
_landPointIndex
]
itemIndicator
:
_
landingPointObject
itemCoordinate
:
_missionItem
.
landingCoordinate
onItemCoordinateChanged
:
_missionItem
.
landingCoordinate
=
itemCoordinate
...
...
@@ -230,6 +231,26 @@ Item {
}
}
// Landing point
Component
{
id
:
landingPointComponent
MapQuickItem
{
anchorPoint.x
:
sourceItem
.
anchorPointX
anchorPoint.y
:
sourceItem
.
anchorPointY
z
:
QGroundControl
.
zOrderMapItems
coordinate
:
_missionItem
.
landingCoordinate
sourceItem
:
MissionItemIndexLabel
{
index
:
_missionItem
.
sequenceNumber
checked
:
_missionItem
.
isCurrentItem
onClicked
:
_root
.
clicked
(
_missionItem
.
sequenceNumber
)
}
}
}
Component
{
id
:
loiterRadiusComponent
...
...
@@ -244,21 +265,88 @@ Item {
}
Component
{
id
:
land
Point
Component
id
:
land
ingAreaLabel
Component
MapQuickItem
{
anchorPoint.x
:
sourceItem
.
anchorPointX
anchorPoint.y
:
sourceItem
.
anchorPointY
anchorPoint.x
:
sourceItem
.
contentWidth
/
2
anchorPoint.y
:
sourceItem
.
contentHeight
/
2
z
:
QGroundControl
.
zOrderMapItems
coordinate
:
_missionItem
.
landingCoordinate
visible
:
_missionItem
.
isCurrentItem
sourceItem
:
MissionItemIndexLabel
{
index
:
_missionItem
.
lastSequenceNumber
label
:
"
Land
"
checked
:
_missionItem
.
isCurrentItem
sourceItem
:
QGCLabel
{
id
:
landingAreaLabel
text
:
qsTr
(
"
Landing Area
"
)
color
:
"
white
"
onClicked
:
_root
.
clicked
(
_missionItem
.
sequenceNumber
)
property
real
_rawBearing
:
_landingAreaBearing
property
real
_adjustedBearing
on_RawBearingChanged
:
{
_adjustedBearing
=
_rawBearing
if
(
_adjustedBearing
>
180
)
{
_adjustedBearing
-=
180
}
_adjustedBearing
-=
90
if
(
_adjustedBearing
<
0
)
{
_adjustedBearing
+=
360
}
}
transform
:
Rotation
{
origin.x
:
landingAreaLabel
.
width
/
2
origin.y
:
landingAreaLabel
.
height
/
2
angle
:
landingAreaLabel
.
_adjustedBearing
}
}
}
}
Component
{
id
:
glideSlopeLabelComponent
MapQuickItem
{
anchorPoint.x
:
0
anchorPoint.y
:
sourceItem
.
contentHeight
/
2
z
:
QGroundControl
.
zOrderMapItems
visible
:
_missionItem
.
isCurrentItem
sourceItem
:
QGCLabel
{
id
:
glideSlopeLabel
text
:
qsTr
(
"
Glide Slope
"
)
color
:
"
white
"
property
real
_rawBearing
:
_landingAreaBearing
property
real
_adjustedBearing
on_RawBearingChanged
:
{
_adjustedBearing
=
_rawBearing
if
(
_adjustedBearing
>
180
)
{
_adjustedBearing
-=
180
}
_adjustedBearing
-=
90
if
(
_adjustedBearing
<
0
)
{
_adjustedBearing
+=
360
}
}
transform
:
Rotation
{
origin.x
:
0
origin.y
:
glideSlopeLabel
.
contentHeight
/
2
angle
:
glideSlopeLabel
.
_adjustedBearing
}
}
function
recalc
()
{
coordinate
=
_missionItem
.
landingCoordinate
.
atDistanceAndAzimuth
(
_landingLengthMeters
/
2
+
2
,
_landingAreaBearing
)
}
Component.onCompleted
:
recalc
()
Connections
{
target
:
_missionItem
onLandingCoordinateChanged
:
recalc
()
onLoiterTangentCoordinateChanged
:
recalc
()
}
}
}
...
...
@@ -273,28 +361,55 @@ Item {
color
:
"
green
"
opacity
:
0.5
readonly
property
real
landingWidth
:
15
readonly
property
real
landingLength
:
100
readonly
property
real
angleRadians
:
Math
.
atan
((
landingWidth
/
2
)
/
(
landingLength
/
2
))
readonly
property
real
angleRadians
:
Math
.
atan
((
_landingWidthMeters
/
2
)
/
(
_landingLengthMeters
/
2
))
readonly
property
real
angleDegrees
:
(
angleRadians
*
(
180
/
Math
.
PI
))
readonly
property
real
hypotenuse
:
(
landingWidth
/
2
)
/
Math
.
sin
(
angleRadians
)
readonly
property
real
hypotenuse
:
(
_landingWidthMeters
/
2
)
/
Math
.
sin
(
angleRadians
)
function
recalc
()
{
path
=
[
]
addCoordinate
(
_missionItem
.
landingCoordinate
.
atDistanceAndAzimuth
(
hypotenuse
,
_landingAreaBearing
-
angleDegrees
))
addCoordinate
(
_missionItem
.
landingCoordinate
.
atDistanceAndAzimuth
(
hypotenuse
,
_landingAreaBearing
+
angleDegrees
))
addCoordinate
(
_missionItem
.
landingCoordinate
.
atDistanceAndAzimuth
(
hypotenuse
,
_landingAreaBearing
+
(
180
-
angleDegrees
)))
addCoordinate
(
_missionItem
.
landingCoordinate
.
atDistanceAndAzimuth
(
hypotenuse
,
_landingAreaBearing
-
(
180
-
angleDegrees
)))
}
Component.onCompleted
:
recalc
()
Connections
{
target
:
_missionItem
onLandingCoordinateChanged
:
recalc
()
onLoiterTangentCoordinateChanged
:
recalc
()
}
}
}
Component
{
id
:
glideSlopeComponent
MapPolygon
{
z
:
QGroundControl
.
zOrderMapItems
border.width
:
1
border.color
:
"
black
"
color
:
"
orange
"
opacity
:
0.5
property
real
landingAreaAngle
:
_missionItem
.
landingCoordinate
.
azimuthTo
(
_missionItem
.
loiterTangentCoordinate
)
readonly
property
real
angleRadians
:
Math
.
atan
((
_landingWidthMeters
/
2
)
/
(
_landingLengthMeters
/
2
))
readonly
property
real
angleDegrees
:
(
angleRadians
*
(
180
/
Math
.
PI
))
readonly
property
real
hypotenuse
:
(
_landingWidthMeters
/
2
)
/
Math
.
sin
(
angleRadians
)
function
calcPoly
()
{
function
recalc
()
{
path
=
[
]
addCoordinate
(
_missionItem
.
landingCoordinate
.
atDistanceAndAzimuth
(
hypotenuse
,
landingAreaAngle
-
angleDegrees
))
addCoordinate
(
_missionItem
.
landingCoordinate
.
atDistanceAndAzimuth
(
hypotenuse
,
landingAreaAngle
+
angleDegrees
))
addCoordinate
(
_missionItem
.
landingCoordinate
.
atDistanceAndAzimuth
(
hypotenuse
,
landingAreaAngle
+
(
180
-
angleDegrees
)))
addCoordinate
(
_missionItem
.
landingCoordinate
.
atDistanceAndAzimuth
(
hypotenuse
,
landingAreaAngle
-
(
180
-
angleDegrees
)))
addCoordinate
(
_missionItem
.
landingCoordinate
.
atDistanceAndAzimuth
(
hypotenuse
,
_landingAreaBearing
-
angleDegrees
))
addCoordinate
(
_missionItem
.
landingCoordinate
.
atDistanceAndAzimuth
(
hypotenuse
,
_landingAreaBearing
+
angleDegrees
))
addCoordinate
(
_missionItem
.
loiterTangentCoordinate
)
}
Component.onCompleted
:
calcPoly
()
Component.onCompleted
:
recalc
()
Connections
{
target
:
_missionItem
onLandingCoordinateChanged
:
calcPoly
()
onLoiterTangentCoordinateChanged
:
calcPoly
()
onLandingCoordinateChanged
:
recalc
()
onLoiterTangentCoordinateChanged
:
recalc
()
}
}
}
...
...
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