VehicleMapItem.qml 1.52 KB
Newer Older
1 2 3 4 5 6 7 8
/****************************************************************************
 *
 *   (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.
 *
 ****************************************************************************/
9 10 11 12 13


/// @file
///     @author Don Gagne <don@thegagnes.com>

14 15 16
import QtQuick          2.4
import QtLocation       5.3
import QtPositioning    5.3
17

18 19
import QGroundControl.ScreenTools   1.0
import QGroundControl.Vehicle       1.0
20 21 22

/// Marker for displaying a vehicle location on the map
MapQuickItem {
23 24 25
    property var    vehicle                ///< Vehicle object
    property bool   isSatellite:    false  ///< true: satellite map is showing
    property real   size:           ScreenTools.defaultFontPixelHeight * 5
26

27 28
    anchorPoint.x:  vehicleIcon.width  / 2
    anchorPoint.y:  vehicleIcon.height / 2
29
    visible:        vehicle && vehicle.coordinateValid
30 31

    sourceItem: Image {
dogmaphobic's avatar
dogmaphobic committed
32 33 34 35 36 37
        id:                 vehicleIcon
        source:             isSatellite ? "/qmlimages/airplaneOpaque.svg" : "/qmlimages/airplaneOutline.svg"
        mipmap:             true
        width:              size
        sourceSize.width:   size
        fillMode:           Image.PreserveAspectFit
38
        transform: Rotation {
dogmaphobic's avatar
dogmaphobic committed
39 40 41
            origin.x:       vehicleIcon.width  / 2
            origin.y:       vehicleIcon.height / 2
            angle:          vehicle ? vehicle.heading.value : 0
42 43 44
        }
    }
}