Commit e55c1444 authored by Don Gagne's avatar Don Gagne

parent 754a3ebb
......@@ -185,6 +185,7 @@
<file alias="QGroundControl/FlightMap/FlightMap.qml">src/FlightMap/FlightMap.qml</file>
<file alias="QGroundControl/FlightMap/InstrumentSwipeView.qml">src/FlightMap/Widgets/InstrumentSwipeView.qml</file>
<file alias="QGroundControl/FlightMap/MapFitFunctions.qml">src/FlightMap/Widgets/MapFitFunctions.qml</file>
<file alias="QGroundControl/FlightMap/MapLineArrow.qml">src/MissionManager/MapLineArrow.qml</file>
<file alias="QGroundControl/FlightMap/MapScale.qml">src/FlightMap/MapScale.qml</file>
<file alias="QGroundControl/FlightMap/MissionItemIndicator.qml">src/FlightMap/MapItems/MissionItemIndicator.qml</file>
<file alias="QGroundControl/FlightMap/MissionItemIndicatorDrag.qml">src/FlightMap/MapItems/MissionItemIndicatorDrag.qml</file>
......
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtLocation 5.3
import QtPositioning 5.3
import QGroundControl 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
import QGroundControl.FlightMap 1.0
MapQuickItem {
property color arrowColor: "white"
property var fromCoord: QtPositioning.coordinate()
property var toCoord: QtPositioning.coordinate()
property bool exitPosition: false
property var _map: parent
property real _arrowSize: 20
property real _arrowHeading: 0
function _updateArrowDetails() {
if (fromCoord && fromCoord.isValid && toCoord && toCoord.isValid) {
_arrowHeading = fromCoord.azimuthTo(toCoord)
var lineDistanceQuarter = fromCoord.distanceTo(toCoord) / 4
coordinate = fromCoord.atDistanceAndAzimuth(lineDistanceQuarter * (exitPosition ? 3 : 1), _arrowHeading)
} else {
coordinate = QtPositioning.coordinate()
_arrowHeading = 0
}
}
onFromCoordChanged: _updateArrowDetails()
onToCoordChanged: _updateArrowDetails()
sourceItem: Canvas {
x: -_arrowSize
y: 0
width: _arrowSize * 2
height: _arrowSize
onPaint: {
var ctx = getContext("2d");
ctx.lineWidth = 2
ctx.strokeStyle = arrowColor
ctx.beginPath();
ctx.moveTo(_arrowSize, 0);
ctx.lineTo(_arrowSize * 2, _arrowSize)
ctx.stroke();
ctx.beginPath();
ctx.moveTo(_arrowSize, 0);
ctx.lineTo(0, _arrowSize)
ctx.stroke();
}
transform: Rotation {
origin.x: width / 2
origin.y: 0
angle: _arrowHeading
}
}
}
......@@ -10,6 +10,7 @@ CenterMapDropPanel 1.0 CenterMapDropPanel.qml
CompassRing 1.0 CompassRing.qml
InstrumentSwipeView 1.0 InstrumentSwipeView.qml
MapFitFunctions 1.0 MapFitFunctions.qml
MapLineArrow 1.0 MapLineArrow.qml
MapScale 1.0 MapScale.qml
QGCArtificialHorizon 1.0 QGCArtificialHorizon.qml
QGCAttitudeHUD 1.0 QGCAttitudeHUD.qml
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment