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