diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc
index 974c2eb57f2e0f4ade902d293d8db77999f10fe5..b86b5d2bc4c6b1ae7c4f3ec42c4475cf1c15d9c6 100644
--- a/qgroundcontrol.qrc
+++ b/qgroundcontrol.qrc
@@ -152,6 +152,7 @@
src/FlightMap/MapItems/MissionItemIndicatorDrag.qml
src/FlightMap/MapItems/MissionItemView.qml
src/FlightMap/MapItems/MissionLineView.qml
+ src/FlightMap/MapItems/PlanMapItems.qml
src/FlightMap/MapItems/PolygonEditor.qml
src/FlightMap/Widgets/QGCArtificialHorizon.qml
src/FlightMap/Widgets/QGCAttitudeHUD.qml
diff --git a/src/FlightDisplay/FlightDisplayViewMap.qml b/src/FlightDisplay/FlightDisplayViewMap.qml
index b3a0465f4f042a9c566a5803a5bb664cba8158af..93ed14a822ab7c566ce1c1e9dbc7da0cb4c450a0 100644
--- a/src/FlightDisplay/FlightDisplayViewMap.qml
+++ b/src/FlightDisplay/FlightDisplayViewMap.qml
@@ -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 {
diff --git a/src/FlightMap/MapItems/PlanMapItems.qml b/src/FlightMap/MapItems/PlanMapItems.qml
new file mode 100644
index 0000000000000000000000000000000000000000..b0775aa44d13d06e613b9bddad61029f76f9dcd6
--- /dev/null
+++ b/src/FlightMap/MapItems/PlanMapItems.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+ *
+ * (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 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
+ }
+ }
+}
diff --git a/src/FlightMap/qmldir b/src/FlightMap/qmldir
index bf11b6fc816e8ca4cddb00251aeac48ce530abbc..c0c4f24b2a5195e186f1eb5aba323b0eef61501f 100644
--- a/src/FlightMap/qmldir
+++ b/src/FlightMap/qmldir
@@ -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