Commit d03e945a authored by Valentin Platzgummer's avatar Valentin Platzgummer

adding wp to flight view

parent 95fdac9e
......@@ -227,6 +227,7 @@
<file alias="QGroundControl/Controls/CoordinateIndicator.qml">src/WimaView/CoordinateIndicator.qml</file>
<file alias="QGroundControl/Controls/WimaJoinedAreaMapVisual.qml">src/WimaView/WimaJoinedAreaMapVisual.qml</file>
<file alias="QGroundControl/Controls/WimaCorridorEditor.qml">src/WimaView/WimaCorridorEditor.qml</file>
<file>src/FlightMap/MapItems/WimaPlanMapItems.qml</file>
</qresource>
<qresource prefix="/json">
<file alias="APMMavlinkStreamRate.SettingsGroup.json">src/Settings/APMMavlinkStreamRate.SettingsGroup.json</file>
......
......@@ -209,6 +209,16 @@ FlightMap {
}
}
// Add mission items generated by wima planer to the map
PlanMapItems {
map: flightMap
largeMapView: _mainIsMap
masterController: masterController
isActiveVehicle: _vehicle.active
property var _vehicle: object
}
// Add trajectory points to the map
MapItemView {
model: _mainIsMap ? _activeVehicle ? _activeVehicle.trajectoryPoints : 0 : 0
......
/****************************************************************************
*
* (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 generated by wima planer to the map.
// Currently only used by Fly View even though it's called PlanMapItems!
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 value
property var _map: map
property var _missionLineViewComponent
// Add the mission item visuals to the map
Repeater {
model: largeMapView ? _missionController.visualItems : 0
delegate: MissionItemMapVisual {
map: _map
onClicked: {
if (isActiveVehicle) {
// Only active vehicle supports click to change current mission item
guidedActionsController.confirmAction(guidedActionsController.actionSetWaypoint, Math.max(object.sequenceNumber, 1))
}
}
}
}
Component.onCompleted: {
_missionLineViewComponent = missionLineViewComponent.createObject(map)
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: _missionController.waypointPath
}
}
}
......@@ -43,6 +43,11 @@ WimaDataContainer *WimaController::dataContainer() const
return _container;
}
QmlObjectListModel *WimaController::missionItems()
{
return &_missionItems;
}
void WimaController::setMasterController(PlanMasterController *masterC)
{
_masterController = masterC;
......@@ -146,6 +151,7 @@ void WimaController::containerDataValidChanged(bool valid)
}
_localPlanDataValid = false;
_visualItems.clear();
_missionItems.clear();
WimaPlanData planData = _container->pull();
// extract list with WimaAreas
......@@ -198,14 +204,22 @@ void WimaController::containerDataValidChanged(bool valid)
break;
}
QList<const MissionItem*> tempMissionItems = planData.missionItems();
for (auto missionItem : tempMissionItems)
_missionItems.append(const_cast<MissionItem *>(missionItem)); // losing const qualifier here
if (areaCounter == numAreas)
_localPlanDataValid = true;
} else {
_localPlanDataValid = false;
_visualItems.clear();
_visualItems.clear();
_missionItems.clear();
}
emit visualItemsChanged();
emit missionItemsChanged();
}
......
......@@ -53,7 +53,7 @@ public:
QString fileExtension (void) const { return wimaFileExtension; }
QGCMapPolygon joinedArea (void) const;
WimaDataContainer* dataContainer (void) const;
QmlObjectListModel* missionItems (void);
// Property setters
......@@ -89,6 +89,7 @@ signals:
void currentFileChanged ();
void dataContainerChanged ();
void readyForSaveSendChanged (bool ready);
void missionItemsChanged (void);
private slots:
void containerDataValidChanged (bool valid);
......
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