Commit 72c1e9a3 authored by Valentin Platzgummer's avatar Valentin Platzgummer

calc button added to plan view

parent 5456ee2a
...@@ -182,7 +182,6 @@ bool WimaPlaner::updateMission() ...@@ -182,7 +182,6 @@ bool WimaPlaner::updateMission()
{ {
QString errorString; QString errorString;
setMissionReady(false);
#define debug 0 #define debug 0
if ( !recalcJoinedArea(errorString)) { if ( !recalcJoinedArea(errorString)) {
...@@ -252,9 +251,14 @@ bool WimaPlaner::updateMission() ...@@ -252,9 +251,14 @@ bool WimaPlaner::updateMission()
if (survey == nullptr){ if (survey == nullptr){
qWarning("WimaPlaner::updateMission(): survey == nullptr"); qWarning("WimaPlaner::updateMission(): survey == nullptr");
return false; return false;
} else { }
if ( oldSurveyExists ) { if ( oldSurveyExists ) {
survey->setRefPoint(oldSurveyRef); survey->setRefPoint(oldSurveyRef);
disconnect(OldSurveyPt->deltaR(), &Fact::rawValueChanged, this, &WimaPlaner::resetMissionReady);
disconnect(OldSurveyPt->deltaAlpha(), &Fact::rawValueChanged, this, &WimaPlaner::resetMissionReady);
disconnect(OldSurveyPt->isSnakePath(), &Fact::rawValueChanged, this, &WimaPlaner::resetMissionReady);
disconnect(OldSurveyPt->transectMinLength(), &Fact::rawValueChanged, this, &WimaPlaner::resetMissionReady);
} else { } else {
survey->setRefPoint(_measurementArea.center()); survey->setRefPoint(_measurementArea.center());
} }
...@@ -262,7 +266,12 @@ bool WimaPlaner::updateMission() ...@@ -262,7 +266,12 @@ bool WimaPlaner::updateMission()
survey->setAutoGenerated(true); // prevents reinitialisation from gui survey->setAutoGenerated(true); // prevents reinitialisation from gui
survey->surveyAreaPolygon()->clear(); survey->surveyAreaPolygon()->clear();
survey->surveyAreaPolygon()->appendVertices(_measurementArea.coordinateList()); survey->surveyAreaPolygon()->appendVertices(_measurementArea.coordinateList());
}
connect(survey->deltaR(), &Fact::rawValueChanged, this, &WimaPlaner::resetMissionReady);
connect(survey->deltaAlpha(), &Fact::rawValueChanged, this, &WimaPlaner::resetMissionReady);
connect(survey->isSnakePath(), &Fact::rawValueChanged, this, &WimaPlaner::resetMissionReady);
connect(survey->transectMinLength(), &Fact::rawValueChanged, this, &WimaPlaner::resetMissionReady);
// calculate path from take off to opArea // calculate path from take off to opArea
...@@ -652,6 +661,11 @@ void WimaPlaner::setMissionReady(bool ready) ...@@ -652,6 +661,11 @@ void WimaPlaner::setMissionReady(bool ready)
} }
} }
void WimaPlaner::resetMissionReady()
{
setMissionReady(false);
}
QJsonDocument WimaPlaner::saveToJson(FileType fileType) QJsonDocument WimaPlaner::saveToJson(FileType fileType)
{ {
/// This function save all areas (of WimaPlaner) and all mission items (of MissionController) to a QJsonDocument /// This function save all areas (of WimaPlaner) and all mission items (of MissionController) to a QJsonDocument
......
...@@ -124,6 +124,7 @@ private slots: ...@@ -124,6 +124,7 @@ private slots:
void recalcPolygonInteractivity (int index); void recalcPolygonInteractivity (int index);
bool recalcJoinedArea (QString &errorString); bool recalcJoinedArea (QString &errorString);
void pushToContainer (); void pushToContainer ();
void resetMissionReady ();
private: private:
// Member Functions // Member Functions
......
...@@ -24,6 +24,7 @@ Rectangle { ...@@ -24,6 +24,7 @@ Rectangle {
signal showFlyView signal showFlyView
property var planMasterController property var planMasterController
property var wimaPlaner
property var currentMissionItem ///< Mission item to display status for property var currentMissionItem ///< Mission item to display status for
property var missionItems: _controllerValid ? planMasterController.missionController.visualItems : undefined property var missionItems: _controllerValid ? planMasterController.missionController.visualItems : undefined
...@@ -284,18 +285,18 @@ Rectangle { ...@@ -284,18 +285,18 @@ Rectangle {
anchors.rightMargin: _margins anchors.rightMargin: _margins
anchors.right: parent.right anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: _controllerDirty ? qsTr("Upload Required") : qsTr("Upload") text: qsTr("Calculate")
enabled: !_controllerSyncInProgress enabled: true
visible: !_controllerOffline && !_controllerSyncInProgress && !uploadCompleteText.visible visible: true
primary: _controllerDirty primary: !wimaPlaner.missionReady
onClicked: planMasterController.upload() onClicked: wimaPlaner.updateMission()
PropertyAnimation on opacity { PropertyAnimation on opacity {
easing.type: Easing.OutQuart easing.type: Easing.OutQuart
from: 0.5 from: 0.5
to: 1 to: 1
loops: Animation.Infinite loops: Animation.Infinite
running: _controllerDirty && !_controllerSyncInProgress running: !wimaPlaner.missionReady
alwaysRunToEnd: true alwaysRunToEnd: true
duration: 2000 duration: 2000
} }
......
...@@ -74,6 +74,8 @@ QGCView { ...@@ -74,6 +74,8 @@ QGCView {
Component.onCompleted: { Component.onCompleted: {
toolbar.planMasterController = Qt.binding(function () { return _planMasterController }) toolbar.planMasterController = Qt.binding(function () { return _planMasterController })
toolbar.currentMissionItem = Qt.binding(function () { return _missionController.currentPlanViewItem }) toolbar.currentMissionItem = Qt.binding(function () { return _missionController.currentPlanViewItem })
toolbar.wimaPlaner = Qt.binding(function () { return _wimaPlaner })
} }
function addComplexItem(complexItemName) { function addComplexItem(complexItemName) {
......
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