Commit 82aa7678 authored by DonLakeFlyer's avatar DonLakeFlyer

Use a master controller for all Plan elements

Update the user model to a single controller instead of multiple
parent da022f97
...@@ -472,6 +472,7 @@ HEADERS += \ ...@@ -472,6 +472,7 @@ HEADERS += \
src/MissionManager/MissionManager.h \ src/MissionManager/MissionManager.h \
src/MissionManager/MissionSettingsItem.h \ src/MissionManager/MissionSettingsItem.h \
src/MissionManager/PlanElementController.h \ src/MissionManager/PlanElementController.h \
src/MissionManager/PlanMasterController.h \
src/MissionManager/QGCMapPolygon.h \ src/MissionManager/QGCMapPolygon.h \
src/MissionManager/RallyPoint.h \ src/MissionManager/RallyPoint.h \
src/MissionManager/RallyPointController.h \ src/MissionManager/RallyPointController.h \
...@@ -654,6 +655,7 @@ SOURCES += \ ...@@ -654,6 +655,7 @@ SOURCES += \
src/MissionManager/MissionManager.cc \ src/MissionManager/MissionManager.cc \
src/MissionManager/MissionSettingsItem.cc \ src/MissionManager/MissionSettingsItem.cc \
src/MissionManager/PlanElementController.cc \ src/MissionManager/PlanElementController.cc \
src/MissionManager/PlanMasterController.cc \
src/MissionManager/QGCMapPolygon.cc \ src/MissionManager/QGCMapPolygon.cc \
src/MissionManager/RallyPoint.cc \ src/MissionManager/RallyPoint.cc \
src/MissionManager/RallyPointController.cc \ src/MissionManager/RallyPointController.cc \
......
...@@ -38,14 +38,18 @@ QGCView { ...@@ -38,14 +38,18 @@ QGCView {
property bool activeVehicleJoystickEnabled: _activeVehicle ? _activeVehicle.joystickEnabled : false property bool activeVehicleJoystickEnabled: _activeVehicle ? _activeVehicle.joystickEnabled : false
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var _planMasterController: masterController
property bool _mainIsMap: QGroundControl.videoManager.hasVideo ? QGroundControl.loadBoolGlobalSetting(_mainIsMapKey, true) : true property var _missionController: _planMasterController.missionController
property bool _isPipVisible: QGroundControl.videoManager.hasVideo ? QGroundControl.loadBoolGlobalSetting(_PIPVisibleKey, true) : false property var _geoFenceController: _planMasterController.geoFenceController
property real _savedZoomLevel: 0 property var _rallyPointController: _planMasterController.rallyPointController
property real _margins: ScreenTools.defaultFontPixelWidth / 2 property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property real _pipSize: mainWindow.width * 0.2 property bool _mainIsMap: QGroundControl.videoManager.hasVideo ? QGroundControl.loadBoolGlobalSetting(_mainIsMapKey, true) : true
property alias _guidedController: guidedActionsController property bool _isPipVisible: QGroundControl.videoManager.hasVideo ? QGroundControl.loadBoolGlobalSetting(_PIPVisibleKey, true) : false
property alias _altitudeSlider: altitudeSlider property real _savedZoomLevel: 0
property real _margins: ScreenTools.defaultFontPixelWidth / 2
property real _pipSize: mainWindow.width * 0.2
property alias _guidedController: guidedActionsController
property alias _altitudeSlider: altitudeSlider
readonly property bool isBackgroundDark: _mainIsMap ? (_flightMap ? _flightMap.isSatelliteMap : true) : true readonly property bool isBackgroundDark: _mainIsMap ? (_flightMap ? _flightMap.isSatelliteMap : true) : true
...@@ -92,20 +96,14 @@ QGCView { ...@@ -92,20 +96,14 @@ QGCView {
} }
} }
MissionController { PlanElemementMasterController {
id: flyMissionController id: masterController
Component.onCompleted: start(false /* editMode */) Component.onCompleted: start(false /* editMode */)
onResumeMissionReady: guidedActionsController.confirmAction(guidedActionsController.actionResumeMissionReady)
}
GeoFenceController {
id: flyGeoFenceController
Component.onCompleted: start(false /* editMode */)
} }
RallyPointController { Connections {
id: flyRallyPointController target: _missionController
Component.onCompleted: start(false /* editMode */) onResumeMissionReady: guidedActionsController.confirmAction(guidedActionsController.actionResumeMissionReady)
} }
MessageDialog { MessageDialog {
...@@ -116,7 +114,7 @@ QGCView { ...@@ -116,7 +114,7 @@ QGCView {
} }
Connections { Connections {
target: QGroundControl.multiVehicleManager target: QGroundControl.multiVehicleManager
onActiveVehicleChanged: px4JoystickCheck() onActiveVehicleChanged: px4JoystickCheck()
} }
...@@ -149,7 +147,7 @@ QGCView { ...@@ -149,7 +147,7 @@ QGCView {
vehicleWasArmed = true vehicleWasArmed = true
} }
} else { } else {
if (promptForMissionRemove && (flyMissionController.containsItems || flyGeoFenceController.containsItems || flyRallyPointController.containsItems)) { if (promptForMissionRemove && (_missionController.containsItems || _geoFenceController.containsItems || _rallyPointController.containsItems)) {
root.showDialog(removeMissionDialogComponent, qsTr("Flight complete"), showDialogDefaultWidth, StandardButton.No | StandardButton.Yes) root.showDialog(removeMissionDialogComponent, qsTr("Flight complete"), showDialogDefaultWidth, StandardButton.No | StandardButton.Yes)
} }
promptForMissionRemove = false promptForMissionRemove = false
...@@ -169,9 +167,9 @@ QGCView { ...@@ -169,9 +167,9 @@ QGCView {
message: qsTr("Do you want to remove the mission from the vehicle?") message: qsTr("Do you want to remove the mission from the vehicle?")
function accept() { function accept() {
flyMissionController.removeAllFromVehicle() _missionController.removeAllFromVehicle()
flyGeoFenceController.removeAllFromVehicle() _geoFenceController.removeAllFromVehicle()
flyRallyPointController.removeAllFromVehicle() _rallyPointController.removeAllFromVehicle()
hideDialog() hideDialog()
} }
...@@ -214,9 +212,7 @@ QGCView { ...@@ -214,9 +212,7 @@ QGCView {
FlightDisplayViewMap { FlightDisplayViewMap {
id: _flightMap id: _flightMap
anchors.fill: parent anchors.fill: parent
missionController: flyMissionController planMasterController: masterController
geoFenceController: flyGeoFenceController
rallyPointController: flyRallyPointController
guidedActionsController: _guidedController guidedActionsController: _guidedController
flightWidgets: flightDisplayViewWidgets flightWidgets: flightDisplayViewWidgets
rightPanelWidth: ScreenTools.defaultFontPixelHeight * 9 rightPanelWidth: ScreenTools.defaultFontPixelHeight * 9
...@@ -320,7 +316,7 @@ QGCView { ...@@ -320,7 +316,7 @@ QGCView {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
qgcView: root qgcView: root
useLightColors: isBackgroundDark useLightColors: isBackgroundDark
missionController: _flightMap.missionController missionController: _missionController
visible: singleVehicleView.checked visible: singleVehicleView.checked
} }
...@@ -511,7 +507,7 @@ QGCView { ...@@ -511,7 +507,7 @@ QGCView {
GuidedActionsController { GuidedActionsController {
id: guidedActionsController id: guidedActionsController
missionController: flyMissionController missionController: _missionController
confirmDialog: guidedActionConfirm confirmDialog: guidedActionConfirm
z: _flightVideoPipControl.z + 1 z: _flightVideoPipControl.z + 1
......
...@@ -34,9 +34,7 @@ FlightMap { ...@@ -34,9 +34,7 @@ FlightMap {
property alias scaleState: mapScale.state property alias scaleState: mapScale.state
// The following properties must be set by the consumer // The following properties must be set by the consumer
property var missionController property var planMasterController
property var geoFenceController
property var rallyPointController
property var guidedActionsController property var guidedActionsController
property var flightWidgets property var flightWidgets
property var rightPanelWidth property var rightPanelWidth
...@@ -44,6 +42,10 @@ FlightMap { ...@@ -44,6 +42,10 @@ FlightMap {
property rect centerViewport: Qt.rect(0, 0, width, height) property rect centerViewport: Qt.rect(0, 0, width, height)
property var _planMasterController: planMasterController
property var _missionController: _planMasterController.missionController
property var _geoFenceController: _planMasterController.geoFenceController
property var _rallyPointController: _planMasterController.rallyPointController
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property var _activeVehicleCoordinate: _activeVehicle ? _activeVehicle.coordinate : QtPositioning.coordinate() property var _activeVehicleCoordinate: _activeVehicle ? _activeVehicle.coordinate : QtPositioning.coordinate()
property var _gotoHereCoordinate: QtPositioning.coordinate() property var _gotoHereCoordinate: QtPositioning.coordinate()
...@@ -132,10 +134,10 @@ FlightMap { ...@@ -132,10 +134,10 @@ FlightMap {
QGCMapPalette { id: mapPal; lightColors: isSatelliteMap } QGCMapPalette { id: mapPal; lightColors: isSatelliteMap }
Connections { Connections {
target: missionController target: _missionController
onNewItemsFromVehicle: { onNewItemsFromVehicle: {
var visualItems = missionController.visualItems var visualItems = _missionController.visualItems
if (visualItems && visualItems.count != 1) { if (visualItems && visualItems.count != 1) {
mapFitFunctions.fitMapViewportToMissionItems() mapFitFunctions.fitMapViewportToMissionItems()
firstVehiclePositionReceived = true firstVehiclePositionReceived = true
...@@ -151,9 +153,7 @@ FlightMap { ...@@ -151,9 +153,7 @@ FlightMap {
id: mapFitFunctions id: mapFitFunctions
map: _flightMap map: _flightMap
usePlannedHomePosition: false usePlannedHomePosition: false
mapMissionController: missionController planMasterController: _planMasterController
mapGeoFenceController: geoFenceController
mapRallyPointController: rallyPointController
property real leftToolWidth: toolStrip.x + toolStrip.width property real leftToolWidth: toolStrip.x + toolStrip.width
} }
...@@ -188,7 +188,7 @@ FlightMap { ...@@ -188,7 +188,7 @@ FlightMap {
// Add the mission item visuals to the map // Add the mission item visuals to the map
Repeater { Repeater {
model: _mainIsMap ? missionController.visualItems : 0 model: _mainIsMap ? _missionController.visualItems : 0
delegate: MissionItemMapVisual { delegate: MissionItemMapVisual {
map: flightMap map: flightMap
...@@ -198,12 +198,12 @@ FlightMap { ...@@ -198,12 +198,12 @@ FlightMap {
// Add lines between waypoints // Add lines between waypoints
MissionLineView { MissionLineView {
model: _mainIsMap ? missionController.waypointLines : 0 model: _mainIsMap ? _missionController.waypointLines : 0
} }
GeoFenceMapVisuals { GeoFenceMapVisuals {
map: flightMap map: flightMap
myGeoFenceController: geoFenceController myGeoFenceController: _geoFenceController
interactive: false interactive: false
planView: false planView: false
homePosition: _activeVehicle && _activeVehicle.homePosition.isValid ? _activeVehicle.homePosition : undefined homePosition: _activeVehicle && _activeVehicle.homePosition.isValid ? _activeVehicle.homePosition : undefined
...@@ -211,7 +211,7 @@ FlightMap { ...@@ -211,7 +211,7 @@ FlightMap {
// Rally points on map // Rally points on map
MapItemView { MapItemView {
model: rallyPointController.points model: _rallyPointController.points
delegate: MapQuickItem { delegate: MapQuickItem {
id: itemIndicator id: itemIndicator
...@@ -243,7 +243,7 @@ FlightMap { ...@@ -243,7 +243,7 @@ FlightMap {
// Camera points // Camera points
MapItemView { MapItemView {
model: missionController.cameraPoints model: _missionController.cameraPoints
delegate: CameraTriggerIndicator { delegate: CameraTriggerIndicator {
coordinate: object.coordinate coordinate: object.coordinate
......
...@@ -16,9 +16,11 @@ import QGroundControl 1.0 ...@@ -16,9 +16,11 @@ import QGroundControl 1.0
Item { Item {
property var map property var map
property bool usePlannedHomePosition ///< true: planned home position used for calculations, false: vehicle home position use for calculations property bool usePlannedHomePosition ///< true: planned home position used for calculations, false: vehicle home position use for calculations
property var mapGeoFenceController property var planMasterController
property var mapMissionController
property var mapRallyPointController property var _missionController: planMasterController.missionController
property var _geoFenceController: planMasterController.geoFenceController
property var _rallyPointController: planMasterController.rallyPointController
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
...@@ -26,7 +28,7 @@ Item { ...@@ -26,7 +28,7 @@ Item {
var homePosition = QtPositioning.coordinate() var homePosition = QtPositioning.coordinate()
var activeVehicle = QGroundControl.multiVehicleManager.activeVehicle var activeVehicle = QGroundControl.multiVehicleManager.activeVehicle
if (usePlannedHomePosition) { if (usePlannedHomePosition) {
homePosition = mapMissionController.visualItems.get(0).coordinate homePosition = _missionController.visualItems.get(0).coordinate
} else if (activeVehicle) { } else if (activeVehicle) {
homePosition = activeVehicle.homePosition homePosition = activeVehicle.homePosition
} }
...@@ -92,8 +94,8 @@ Item { ...@@ -92,8 +94,8 @@ Item {
if (homePosition.isValid) { if (homePosition.isValid) {
coordList.push(homePosition) coordList.push(homePosition)
} }
for (var i=1; i<mapMissionController.visualItems.count; i++) { for (var i=1; i<_missionController.visualItems.count; i++) {
var missionItem = mapMissionController.visualItems.get(i) var missionItem = _missionController.visualItems.get(i)
if (missionItem.specifiesCoordinate && !missionItem.isStandaloneCoordinate) { if (missionItem.specifiesCoordinate && !missionItem.isStandaloneCoordinate) {
coordList.push(missionItem.coordinate) coordList.push(missionItem.coordinate)
} }
...@@ -101,7 +103,7 @@ Item { ...@@ -101,7 +103,7 @@ Item {
} }
function fitMapViewportToMissionItems() { function fitMapViewportToMissionItems() {
if (!mapMissionController.visualItems) { if (!_missionController.visualItems) {
// Being called prior to controller.start // Being called prior to controller.start
return return
} }
...@@ -112,16 +114,16 @@ Item { ...@@ -112,16 +114,16 @@ Item {
function addFenceItemCoordsForFit(coordList) { function addFenceItemCoordsForFit(coordList) {
var homePosition = fitHomePosition() var homePosition = fitHomePosition()
if (homePosition.isValid && mapGeoFenceController.circleEnabled) { if (homePosition.isValid && _geoFenceController.circleEnabled) {
var azimuthList = [ 0, 180, 90, 270 ] var azimuthList = [ 0, 180, 90, 270 ]
for (var i=0; i<azimuthList.length; i++) { for (var i=0; i<azimuthList.length; i++) {
var edgeCoordinate = homePosition.atDistanceAndAzimuth(mapGeoFenceController.circleRadius, azimuthList[i]) var edgeCoordinate = homePosition.atDistanceAndAzimuth(_geoFenceController.circleRadius, azimuthList[i])
coordList.push(edgeCoordinate) coordList.push(edgeCoordinate)
} }
} }
if (mapGeoFenceController.polygonEnabled && mapGeoFenceController.mapPolygon.path.count > 2) { if (_geoFenceController.polygonEnabled && _geoFenceController.mapPolygon.path.count > 2) {
for (var i=0; i<mapGeoFenceController.mapPolygon.path.count; i++) { for (var i=0; i<_geoFenceController.mapPolygon.path.count; i++) {
coordList.push(mapGeoFenceController.mapPolygon.path[i]) coordList.push(_geoFenceController.mapPolygon.path[i])
} }
} }
} }
...@@ -133,8 +135,8 @@ Item { ...@@ -133,8 +135,8 @@ Item {
} }
function addRallyItemCoordsForFit(coordList) { function addRallyItemCoordsForFit(coordList) {
for (var i=0; i<mapRallyPointController.points.count; i++) { for (var i=0; i<_rallyPointController.points.count; i++) {
coordList.push(mapRallyPointController.points.get(i).coordinate) coordList.push(_rallyPointController.points.get(i).coordinate)
} }
} }
...@@ -145,7 +147,7 @@ Item { ...@@ -145,7 +147,7 @@ Item {
} }
function fitMapViewportToAllItems() { function fitMapViewportToAllItems() {
if (!mapMissionController.visualItems) { if (!_missionController.visualItems) {
// Being called prior to controller.start // Being called prior to controller.start
return return
} }
......
...@@ -125,7 +125,7 @@ bool JsonHelper::parseEnum(const QJsonObject& jsonObject, QStringList& enumStrin ...@@ -125,7 +125,7 @@ bool JsonHelper::parseEnum(const QJsonObject& jsonObject, QStringList& enumStrin
return true; return true;
} }
bool JsonHelper::isJsonFile(const QByteArray& bytes, QJsonDocument& jsonDoc) bool JsonHelper::isJsonFile(const QByteArray& bytes, QJsonDocument& jsonDoc, QString& errorString)
{ {
QJsonParseError error; QJsonParseError error;
...@@ -192,6 +192,15 @@ bool JsonHelper::validateQGCJsonFile(const QJsonObject& jsonObject, ...@@ -192,6 +192,15 @@ bool JsonHelper::validateQGCJsonFile(const QJsonObject& jsonObject,
return true; return true;
} }
void JsonHelper::saveQGCJsonFileHeader(QJsonObject& jsonObject,
const QString& fileType,
int version)
{
jsonObject[jsonGroundStationKey] = jsonGroundStationValue;
jsonObject[jsonFileTypeKey] = fileType;
jsonObject[jsonVersionKey] = version;
}
bool JsonHelper::loadGeoCoordinateArray(const QJsonValue& jsonValue, bool JsonHelper::loadGeoCoordinateArray(const QJsonValue& jsonValue,
bool altitudeRequired, bool altitudeRequired,
QVariantList& rgVarPoints, QVariantList& rgVarPoints,
......
...@@ -20,9 +20,15 @@ class JsonHelper ...@@ -20,9 +20,15 @@ class JsonHelper
{ {
public: public:
/// Determines is the specified data is a json file /// Determines is the specified data is a json file
/// @param jsonDoc Returned json document if json file
/// @return true: file is json, false: file is not json /// @return true: file is json, false: file is not json
static bool isJsonFile(const QByteArray& bytes, QJsonDocument& jsonDoc); static bool isJsonFile(const QByteArray& bytes, ///< json bytes
QJsonDocument& jsonDoc, ///< returned json document
QString& errorString); ///< error on parse failure
/// Saves the standard file header the json object
static void saveQGCJsonFileHeader(QJsonObject& jsonObject, ///< root json object
const QString& fileType, ///< file type for file
int version); ///< version number for file
/// Validates the standard parts of a QGC json file: /// Validates the standard parts of a QGC json file:
/// jsonFileTypeKey - Required and checked to be equal to expectedFileType /// jsonFileTypeKey - Required and checked to be equal to expectedFileType
......
...@@ -89,13 +89,15 @@ void GeoFenceController::_signalAll(void) ...@@ -89,13 +89,15 @@ void GeoFenceController::_signalAll(void)
emit dirtyChanged(dirty()); emit dirtyChanged(dirty());
} }
void GeoFenceController::_activeVehicleBeingRemoved(void) void GeoFenceController::activeVehicleBeingRemoved(void)
{ {
_activeVehicle->geoFenceManager()->disconnect(this); _activeVehicle->geoFenceManager()->disconnect(this);
_activeVehicle = NULL;
} }
void GeoFenceController::_activeVehicleSet(void) void GeoFenceController::activeVehicleSet(Vehicle* vehicle)
{ {
_activeVehicle = vehicle;
GeoFenceManager* geoFenceManager = _activeVehicle->geoFenceManager(); GeoFenceManager* geoFenceManager = _activeVehicle->geoFenceManager();
connect(geoFenceManager, &GeoFenceManager::breachReturnSupportedChanged, this, &GeoFenceController::breachReturnSupportedChanged); connect(geoFenceManager, &GeoFenceManager::breachReturnSupportedChanged, this, &GeoFenceController::breachReturnSupportedChanged);
connect(geoFenceManager, &GeoFenceManager::circleEnabledChanged, this, &GeoFenceController::circleEnabledChanged); connect(geoFenceManager, &GeoFenceManager::circleEnabledChanged, this, &GeoFenceController::circleEnabledChanged);
...@@ -112,97 +114,40 @@ void GeoFenceController::_activeVehicleSet(void) ...@@ -112,97 +114,40 @@ void GeoFenceController::_activeVehicleSet(void)
_signalAll(); _signalAll();
} }
bool GeoFenceController::_loadJsonFile(QJsonDocument& jsonDoc, QString& errorString) bool GeoFenceController::load(const QJsonObject& json, QString& errorString)
{ {
QJsonObject json = jsonDoc.object(); QString errorStr;
QString errorMessage = tr("GeoFence: %1");
int fileVersion; if (json.contains(_jsonBreachReturnKey) &&
if (!JsonHelper::validateQGCJsonFile(json, !JsonHelper::loadGeoCoordinate(json[_jsonBreachReturnKey], false /* altitudeRequired */, _breachReturnPoint, errorStr)) {
_jsonFileTypeValue, // expected file type errorString = errorMessage.arg(errorStr);
1, // minimum supported version
1, // maximum supported version
fileVersion,
errorString)) {
return false; return false;
} }
if (!_activeVehicle->parameterManager()->loadFromJson(json, false /* required */, errorString)) { if (!_mapPolygon.loadFromJson(json, true, errorStr)) {
return false; errorString = errorMessage.arg(errorStr);
}
if (json.contains(_jsonBreachReturnKey)
&& !JsonHelper::loadGeoCoordinate(json[_jsonBreachReturnKey], false /* altitudeRequired */, _breachReturnPoint, errorString)) {
return false;
}
if (!_mapPolygon.loadFromJson(json, true, errorString)) {
return false; return false;
} }
_mapPolygon.setDirty(false); _mapPolygon.setDirty(false);
setDirty(false);
return true;
}
void GeoFenceController::loadFromFile(const QString& filename)
{
QString errorString;
if (filename.isEmpty()) {
return;
}
QFile file(filename);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
errorString = file.errorString() + QStringLiteral(" ") + filename;
} else {
QJsonDocument jsonDoc;
QByteArray bytes = file.readAll();
_loadJsonFile(jsonDoc, errorString);
}
if (!errorString.isEmpty()) {
qgcApp()->showMessage(errorString);
}
_signalAll(); _signalAll();
setDirty(true);
return true;
} }
void GeoFenceController::saveToFile(const QString& filename) void GeoFenceController::save(QJsonObject& json)
{ {
if (filename.isEmpty()) { json[JsonHelper::jsonVersionKey] = 1;
return;
}
QString fenceFilename = filename;
if (!QFileInfo(filename).fileName().contains(".")) {
fenceFilename += QString(".%1").arg(AppSettings::fenceFileExtension);
}
QFile file(fenceFilename);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
qgcApp()->showMessage(file.errorString());
} else {
QJsonObject fenceFileObject; // top level json object
fenceFileObject[JsonHelper::jsonFileTypeKey] = _jsonFileTypeValue;
fenceFileObject[JsonHelper::jsonVersionKey] = 1;
fenceFileObject[JsonHelper::jsonGroundStationKey] = JsonHelper::jsonGroundStationValue;
if (_breachReturnPoint.isValid()) {
QJsonValue jsonBreachReturn; QJsonValue jsonBreachReturn;
JsonHelper::saveGeoCoordinate(_breachReturnPoint, false /* writeAltitude */, jsonBreachReturn); JsonHelper::saveGeoCoordinate(_breachReturnPoint, false /* writeAltitude */, jsonBreachReturn);
fenceFileObject[_jsonBreachReturnKey] = jsonBreachReturn; json[_jsonBreachReturnKey] = jsonBreachReturn;
_mapPolygon.saveToJson(fenceFileObject);
QJsonDocument saveDoc(fenceFileObject);
file.write(saveDoc.toJson());
} }
setDirty(false); _mapPolygon.saveToJson(json);
} }
void GeoFenceController::removeAll(void) void GeoFenceController::removeAll(void)
...@@ -323,11 +268,6 @@ void GeoFenceController::_loadComplete(const QGeoCoordinate& breachReturn, const ...@@ -323,11 +268,6 @@ void GeoFenceController::_loadComplete(const QGeoCoordinate& breachReturn, const
emit loadComplete(); emit loadComplete();
} }
QString GeoFenceController::fileExtension(void) const
{
return AppSettings::fenceFileExtension;
}
bool GeoFenceController::containsItems(void) const bool GeoFenceController::containsItems(void) const
{ {
return _mapPolygon.count() > 2; return _mapPolygon.count() > 2;
......
...@@ -46,18 +46,18 @@ public: ...@@ -46,18 +46,18 @@ public:
void start (bool editMode) final; void start (bool editMode) final;
void startStaticActiveVehicle (Vehicle* vehicle) final; void startStaticActiveVehicle (Vehicle* vehicle) final;
void save (QJsonObject& json) final;
bool load (const QJsonObject& json, QString& errorString) final;
void loadFromVehicle (void) final; void loadFromVehicle (void) final;
void sendToVehicle (void) final; void sendToVehicle (void) final;
void loadFromFile (const QString& filename) final;
void saveToFile (const QString& filename) final;
void removeAll (void) final; void removeAll (void) final;
void removeAllFromVehicle (void) final; void removeAllFromVehicle (void) final;
bool syncInProgress (void) const final; bool syncInProgress (void) const final;
bool dirty (void) const final; bool dirty (void) const final;
void setDirty (bool dirty) final; void setDirty (bool dirty) final;
bool containsItems (void) const final; bool containsItems (void) const final;
void activeVehicleBeingRemoved (void) final;
QString fileExtension(void) const final; void activeVehicleSet (Vehicle* vehicle) final;
bool circleEnabled (void) const; bool circleEnabled (void) const;
Fact* circleRadiusFact (void) const; Fact* circleRadiusFact (void) const;
...@@ -95,10 +95,6 @@ private slots: ...@@ -95,10 +95,6 @@ private slots:
private: private:
void _init(void); void _init(void);
void _signalAll(void); void _signalAll(void);
bool _loadJsonFile(QJsonDocument& jsonDoc, QString& errorString);
void _activeVehicleBeingRemoved(void) final;
void _activeVehicleSet(void) final;
bool _dirty; bool _dirty;
QGCMapPolygon _mapPolygon; QGCMapPolygon _mapPolygon;
......
This diff is collapsed.
...@@ -98,13 +98,6 @@ public: ...@@ -98,13 +98,6 @@ public:
/// Updates the altitudes of the items in the current mission to the new default altitude /// Updates the altitudes of the items in the current mission to the new default altitude
Q_INVOKABLE void applyDefaultMissionAltitude(void); Q_INVOKABLE void applyDefaultMissionAltitude(void);
/// Loads the mission items from the specified file
/// @param[in] vehicle Vehicle we are loading items for