QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
ADSBVehicleMapItem.qml
Go to the documentation of this file.
1import QtQuick
2import QtLocation
3import QtPositioning
4
5import QGroundControl
6import QGroundControl.Controls
7
8/// Marker for displaying an ADS-B vehicle location on the map
9MapQuickItem {
10 id: _root
11
12 property var map
13 property double altitude: Number.NaN ///< NAN to not show
14 property string callsign: "" ///< Vehicle callsign
15 property double heading: Number.NaN ///< Vehicle heading, NAN for none
16 property real size: ScreenTools.defaultFontPixelHeight * 3
17 property bool alert: false ///< Collision alert
18
19 anchorPoint.x: vehicleItem.width / 2
20 anchorPoint.y: vehicleItem.height / 2
21 visible: coordinate.isValid
22
23 sourceItem: Item {
24 id: vehicleItem
25 width: vehicleIcon.width
26 height: vehicleIcon.height
27
28 Image {
29 id: vehicleIcon
30 source: alert ? "/qmlimages/AlertAircraft.svg" : "/qmlimages/AwarenessAircraft.svg"
31 mipmap: true
32 width: _root.size
33 sourceSize.width: _root.size
34 fillMode: Image.PreserveAspectFit
35 transform: Rotation {
36 origin.x: vehicleIcon.width / 2
37 origin.y: vehicleIcon.height / 2
38 angle: isNaN(heading) ? 0 : heading
39 }
40 }
41
42 QGCMapLabel {
43 anchors.top: parent.bottom
44 anchors.horizontalCenter: parent.horizontalCenter
45 map: _root.map
46 font.pointSize: ScreenTools.defaultFontPointSize
47 visible: !isNaN(altitude)
48 text: visible ? QGroundControl.unitsConversion.metersToAppSettingsVerticalDistanceUnitsString(altitude, 0) + "\n" + callsign : ""
49 }
50 }
51}