1/****************************************************************************
3 * (c) 2009-2024 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
5 * QGroundControl is licensed according to the terms in the file
6 * COPYING.md in the root of the source code directory.
8 ****************************************************************************/
12/// Direction-indicator chevron for complex item visuals, positioned and
13/// rotated in screen space (not anchored via GeoMapItem): GeoMap's 2D camera
14/// heading is user-rotatable, so a geographic azimuth (as used by
15/// src/FlightMap/MapItems/MapLineArrow.qml) would point the wrong way on
16/// screen once the map is rotated. Callers derive screenPoint/heading from
17/// already-projected GeoMapProjectedPath.screenPoints (see
18/// GeoMapSegmentArrow.qml), avoiding a second projector per arrow.
22 property point screenPoint: Qt.point(0, 0)
23 property real heading: 0 ///< degrees, 0 = up, clockwise
25 readonly property real _arrowSize: 15
27 x: screenPoint.x - width / 2
32 transformOrigin: Item.Top
35 const ctx = getContext("2d")
36 ctx.clearRect(0, 0, width, height)
38 ctx.strokeStyle = "white"
40 ctx.moveTo(_arrowSize, 0)
41 ctx.lineTo(_arrowSize * 2, _arrowSize)
44 ctx.moveTo(_arrowSize, 0)
45 ctx.lineTo(0, _arrowSize)
49 Component.onCompleted: requestPaint()