Commit f84781fa authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #5553 from DonLakeFlyer/PlanMapItems

Encapsulate Fly view map items into PlanMapItems control
parents 72ac8f8a 1dbacddf
......@@ -152,6 +152,7 @@
<file alias="QGroundControl/FlightMap/MissionItemIndicatorDrag.qml">src/FlightMap/MapItems/MissionItemIndicatorDrag.qml</file>
<file alias="QGroundControl/FlightMap/MissionItemView.qml">src/FlightMap/MapItems/MissionItemView.qml</file>
<file alias="QGroundControl/FlightMap/MissionLineView.qml">src/FlightMap/MapItems/MissionLineView.qml</file>
<file alias="QGroundControl/FlightMap/PlanMapItems.qml">src/FlightMap/MapItems/PlanMapItems.qml</file>
<file alias="QGroundControl/FlightMap/PolygonEditor.qml">src/FlightMap/MapItems/PolygonEditor.qml</file>
<file alias="QGroundControl/FlightMap/QGCArtificialHorizon.qml">src/FlightMap/Widgets/QGCArtificialHorizon.qml</file>
<file alias="QGroundControl/FlightMap/QGCAttitudeHUD.qml">src/FlightMap/Widgets/QGCAttitudeHUD.qml</file>
......
......@@ -206,19 +206,11 @@ FlightMap {
}
}
// Add the mission item visuals to the map
Repeater {
model: _mainIsMap ? _missionController.visualItems : 0
delegate: MissionItemMapVisual {
map: flightMap
onClicked: guidedActionsController.confirmAction(guidedActionsController.actionSetWaypoint, Math.max(object.sequenceNumber, 1))
}
}
// Add lines between waypoints
MissionLineView {
model: _mainIsMap ? _missionController.waypointLines : 0
// Add the items associated with the flight place to the map
PlanMapItems {
map: flightMap
largeMapView: _mainIsMap
masterController: _planMasterController
}
GeoFenceMapVisuals {
......
......@@ -122,8 +122,8 @@ Item {
property bool _hideOrbit: !QGroundControl.corePlugin.options.guidedBarShowOrbit
property bool _vehicleWasFlying: false
// This is a temporary hack to debug a problem with RTL and Pause being disabled at the wrong time
//Handy code for debugging state problems
/*
property bool __guidedModeSupported: _activeVehicle ? _activeVehicle.guidedModeSupported : false
property bool __pauseVehicleSupported: _activeVehicle ? _activeVehicle.pauseVehicleSupported : false
property bool __flightMode: _flightMode
......@@ -140,11 +140,10 @@ Item {
on__FlightModeChanged: _outputState()
on__GuidedModeSupportedChanged: _outputState()
on__PauseVehicleSupportedChanged: _outputState()
// End of hack
*/
on_VehicleFlyingChanged: {
_outputState()
//_outputState()
if (!_vehicleFlying) {
// We use _vehicleWasFLying to help trigger Resume Mission only if the vehicle actually flew and came back down.
// Otherwise it may trigger during the Start Mission sequence due to signal ordering or armed and resume mission index.
......
/****************************************************************************
*
* (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.
*
****************************************************************************/
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 associated with the Flight Plan 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 masterController ///< Reference to PlanMasterController for vehicle
property var _map: map
property var _missionController: masterController.missionController
property var _geoFenceController: masterController.geoFenceController
property var _rallyPointController: masterController.rallyPointController
property var _missionLineViewComponent
// Add the mission item visuals to the map
Repeater {
model: largeMapView ? _missionController.visualItems : 0
delegate: MissionItemMapVisual {
map: _map
onClicked: guidedActionsController.confirmAction(guidedActionsController.actionSetWaypoint, Math.max(object.sequenceNumber, 1))
}
}
// Waypiont lines
Instantiator {
model: largeMapView ? _missionController.waypointLines : 0
Item {
property var _missionLineViewComponent
Component.onCompleted: {
_missionLineViewComponent = missionLineViewComponent.createObject(map, {"object": object})
if (_missionLineViewComponent.status === Component.Error)
console.log(_missionLineViewComponent.errorString())
map.addMapItem(_missionLineViewComponent)
}
Component.onDestruction: {
_missionLineViewComponent.destroy()
}
}
}
Component {
id: missionLineViewComponent
MapPolyline {
line.width: 3
line.color: "#be781c" // Hack, can't get palette to work in here
z: QGroundControl.zOrderWaypointLines
path: object ? [ object.coordinate1, object.coordinate2] : undefined
property var object
}
}
}
......@@ -27,5 +27,6 @@ MissionItemIndicator 1.0 MissionItemIndicator.qml
MissionItemIndicatorDrag 1.0 MissionItemIndicatorDrag.qml
MissionItemView 1.0 MissionItemView.qml
MissionLineView 1.0 MissionLineView.qml
PlanMapItems 1.0 PlanMapItems.qml
PolygonEditor 1.0 PolygonEditor.qml
VehicleMapItem 1.0 VehicleMapItem.qml
......@@ -70,8 +70,11 @@ bool MockLinkMissionItemHandler::handleMessage(const mavlink_message_t& msg)
break;
case MAVLINK_MSG_ID_MISSION_CLEAR_ALL:
// Delete all mission items
// Delete all plan items
_missionItems.clear();
_fenceItems.clear();
_rallyItems.clear();
_sendAck(MAV_MISSION_ACCEPTED);
break;
default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment