/**************************************************************************** * * (c) 2009-2016 QGROUNDCONTROL PROJECT * * 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 QtLocation 5.3 import QtPositioning 5.3 import QGroundControl 1.0 import QGroundControl.Controls 1.0 import QGroundControl.FlightMap 1.0 // Adds visual items generated by wima planer to the map. Item { id: _root property var map ///< Map control to show items on property bool largeMapView ///< true: map takes up entire view, false: map is in small window property var wimaController property string mIColor: "#B4808080" // Mission Items Color, gray with alpha 0.7 #AARRGGBB property string mIlineColor: mIColor property string cMIColor: "orangered" // Current Mission Items Color property string cMIlineColor: cMIColor property var _map: map property var _missionLineViewComponent property var _currentMissionLineViewComponent property bool _showAllItems: wimaController.showAllMissionItems.value property bool _showCurrentItems: wimaController.showCurrentMissionItems.value // Add the mission item visuals to the map Repeater { model: largeMapView ? (_showAllItems ? wimaController.missionItems : 0) : 0 z: QGroundControl.zOrderWaypointIndicators-2 delegate: WimaMissionItemMapVisual { map: _map color: _root.mIColor // onClicked: { // if (isActiveVehicle) { // // Only active vehicle supports click to change current mission item // guidedActionsController.confirmAction(guidedActionsController.actionSetWaypoint, Math.max(object.sequenceNumber, 1)) // } // } } } // Add the current mission item visuals to the map Repeater { model: largeMapView ? (_showCurrentItems ? wimaController.currentMissionItems : 0) : 0 z: QGroundControl.zOrderWaypointIndicators-1 delegate: WimaMissionItemMapVisual { map: _map color: _root.cMIColor } } Component.onCompleted: { _missionLineViewComponent = missionLineViewComponent.createObject(map) if (_missionLineViewComponent.status === Component.Error) console.log(_missionLineViewComponent.errorString()) map.addMapItem(_missionLineViewComponent) _currentMissionLineViewComponent = currentMissionLineViewComponent.createObject(map) if (_currentMissionLineViewComponent.status === Component.Error) console.log(_currentMissionLineViewComponent.errorString()) map.addMapItem(_currentMissionLineViewComponent) } Component.onDestruction: { _missionLineViewComponent.destroy() _currentMissionLineViewComponent.destroy() } Component { id: missionLineViewComponent MapPolyline { line.width: 3 line.color: _showAllItems ? mIlineColor : "transparent" z: QGroundControl.zOrderWaypointLines-2 path: wimaController.waypointPath } } Component { id: currentMissionLineViewComponent MapPolyline { line.width: 3 line.color: _showCurrentItems ? cMIlineColor : "transparent" z: QGroundControl.zOrderWaypointLines-1 path: wimaController.currentWaypointPath } } }