diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index 36df1d2193acb75ea1abdeb5b04afc63cad728b3..795ddb432d4875d6aee2c597edfed8646283e0cd 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -59,6 +59,8 @@ src/FlightMap/Images/rollPointerWhite.svg src/FlightMap/Images/scale.png src/FlightMap/Images/scale_end.png + src/FlightMap/Images/airplaneOutline.svg + src/FlightMap/Images/airplaneOpaque.svg src/test.qml diff --git a/src/FlightMap/FlightMap.qml b/src/FlightMap/FlightMap.qml index a32c4ee91426224222017648ee0ac140df754fd7..38fb13c6cae76917cfa0f9384b20d43dcf5854eb 100644 --- a/src/FlightMap/FlightMap.qml +++ b/src/FlightMap/FlightMap.qml @@ -53,6 +53,7 @@ Item { property alias mapMenu: mapTypeMenu property bool showVehicles: false property bool showMissionItems: false + property bool isSatelliteMap: false Component.onCompleted: { map.zoomLevel = 18 @@ -62,6 +63,15 @@ Item { updateMissionItems() } + function updateMapType(type) { + var isSatellite = (type === MapType.SatelliteMapDay || type === MapType.SatelliteMapNight) + if(isSatelliteMap !== isSatellite) { + isSatelliteMap = isSatellite; + removeAllVehicles() + addExistingVehicles() + } + } + //-- Menu to select supported map types Menu { id: mapTypeMenu @@ -72,6 +82,7 @@ Item { for (var i = 0; i < map.supportedMapTypes.length; i++) { if (mapID === map.supportedMapTypes[i].name) { map.activeMapType = map.supportedMapTypes[i] + updateMapType(map.supportedMapTypes[i].style) multiVehicleManager.saveSetting(root.mapName + "/currentMapType", mapID); return; } @@ -164,7 +175,8 @@ Item { var qmlItemTemplate = "VehicleMapItem { " + "coordinate: _vehicles[%1].coordinate; " + - "heading: _vehicles[%1].heading " + + "heading: _vehicles[%1].heading; " + + "isSatellite: root.isSatelliteMap; " + "}" var i = _vehicles.length @@ -194,6 +206,18 @@ Item { } } + function removeAllVehicles() { + if (!showVehicles) { + return + } + + for (var i=0; i<_vehicles.length; i++) { + _vehicles[i] = undefined + map.removeMapItem(_vehicleMapItems[i]) + _vehicleMapItems[i] = undefined + } + } + function addExistingVehicles() { if (!showVehicles) { return diff --git a/src/FlightMap/Images/airplaneOpaque.svg b/src/FlightMap/Images/airplaneOpaque.svg new file mode 100644 index 0000000000000000000000000000000000000000..c9ac663f140ed7f870cc015218fc953cc3bf8afc --- /dev/null +++ b/src/FlightMap/Images/airplaneOpaque.svg @@ -0,0 +1,10 @@ + + + +Layer 1 + + diff --git a/src/FlightMap/Images/airplaneOutline.svg b/src/FlightMap/Images/airplaneOutline.svg new file mode 100644 index 0000000000000000000000000000000000000000..686381d439e6339491df6d4ffb66d0031fab1b4e --- /dev/null +++ b/src/FlightMap/Images/airplaneOutline.svg @@ -0,0 +1,10 @@ + + + +Layer 1 + + diff --git a/src/FlightMap/MapItems/VehicleMapItem.qml b/src/FlightMap/MapItems/VehicleMapItem.qml index 0dab13fbcb315929ad4f7bd71ee64e9fe576439d..2da49863e4658566c6eda5b89139901a6c34d425 100644 --- a/src/FlightMap/MapItems/VehicleMapItem.qml +++ b/src/FlightMap/MapItems/VehicleMapItem.qml @@ -32,15 +32,16 @@ import QGroundControl.ScreenTools 1.0 /// Marker for displaying a vehicle location on the map MapQuickItem { property real heading: 0 + property bool isSatellite: false anchorPoint.x: vehicleIcon.width / 2 anchorPoint.y: vehicleIcon.height / 2 sourceItem: Image { id: vehicleIcon - source: "/qmlimages/compassInstrumentAirplane.svg" + source: isSatellite ? "/qmlimages/airplaneOpaque.svg" : "/qmlimages/airplaneOutline.svg" mipmap: true - width: ScreenTools.defaultFontPixelHeight * 4 + width: ScreenTools.defaultFontPixelHeight * 5 fillMode: Image.PreserveAspectFit transform: Rotation {