Commit cfedca5a authored by DonLakeFlyer's avatar DonLakeFlyer

parent 10fc35fb
...@@ -6,6 +6,7 @@ Note: This file only contains high level features or important fixes. ...@@ -6,6 +6,7 @@ Note: This file only contains high level features or important fixes.
### 3.6.0 - Daily Build ### 3.6.0 - Daily Build
* Plan View: New create plan UI for initial plan creation
* New Corridor editing tools ui. Includes ability to trace polyline by clicking. * New Corridor editing tools ui. Includes ability to trace polyline by clicking.
* New Polygon editing tools ui. Includes ability to trace polygon by clicking. * New Polygon editing tools ui. Includes ability to trace polygon by clicking.
* ArduCopter/Rover: Follow Me setup page * ArduCopter/Rover: Follow Me setup page
......
...@@ -127,6 +127,10 @@ ...@@ -127,6 +127,10 @@
<file alias="pipHide.svg">src/FlightMap/Images/pipHide.svg</file> <file alias="pipHide.svg">src/FlightMap/Images/pipHide.svg</file>
<file alias="pipResize.svg">src/FlightMap/Images/pipResize.svg</file> <file alias="pipResize.svg">src/FlightMap/Images/pipResize.svg</file>
<file alias="Plan.svg">src/ui/toolbar/Images/Plan.svg</file> <file alias="Plan.svg">src/ui/toolbar/Images/Plan.svg</file>
<file alias="PlanCreator/CustomPlanCreator.png">src/MissionManager/CustomPlanCreator.png</file>
<file alias="PlanCreator/CorridorScanPlanCreator.png">src/MissionManager/CorridorScanPlanCreator.png</file>
<file alias="PlanCreator/StructureScanPlanCreator.png">src/MissionManager/StructureScanPlanCreator.png</file>
<file alias="PlanCreator/SurveyPlanCreator.png">src/MissionManager/SurveyPlanCreator.png</file>
<file alias="PowerComponentBattery_01cell.svg">src/AutoPilotPlugins/PX4/Images/PowerComponentBattery_01cell.svg</file> <file alias="PowerComponentBattery_01cell.svg">src/AutoPilotPlugins/PX4/Images/PowerComponentBattery_01cell.svg</file>
<file alias="PowerComponentBattery_02cell.svg">src/AutoPilotPlugins/PX4/Images/PowerComponentBattery_02cell.svg</file> <file alias="PowerComponentBattery_02cell.svg">src/AutoPilotPlugins/PX4/Images/PowerComponentBattery_02cell.svg</file>
<file alias="PowerComponentBattery_03cell.svg">src/AutoPilotPlugins/PX4/Images/PowerComponentBattery_03cell.svg</file> <file alias="PowerComponentBattery_03cell.svg">src/AutoPilotPlugins/PX4/Images/PowerComponentBattery_03cell.svg</file>
......
...@@ -591,6 +591,8 @@ HEADERS += \ ...@@ -591,6 +591,8 @@ HEADERS += \
src/MissionManager/CameraSpec.h \ src/MissionManager/CameraSpec.h \
src/MissionManager/ComplexMissionItem.h \ src/MissionManager/ComplexMissionItem.h \
src/MissionManager/CorridorScanComplexItem.h \ src/MissionManager/CorridorScanComplexItem.h \
src/MissionManager/CorridorScanPlanCreator.h \
src/MissionManager/CustomPlanCreator.h \
src/MissionManager/FixedWingLandingComplexItem.h \ src/MissionManager/FixedWingLandingComplexItem.h \
src/MissionManager/GeoFenceController.h \ src/MissionManager/GeoFenceController.h \
src/MissionManager/GeoFenceManager.h \ src/MissionManager/GeoFenceManager.h \
...@@ -603,6 +605,7 @@ HEADERS += \ ...@@ -603,6 +605,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/PlanCreator.h \
src/MissionManager/PlanManager.h \ src/MissionManager/PlanManager.h \
src/MissionManager/PlanMasterController.h \ src/MissionManager/PlanMasterController.h \
src/MissionManager/QGCFenceCircle.h \ src/MissionManager/QGCFenceCircle.h \
...@@ -617,7 +620,9 @@ HEADERS += \ ...@@ -617,7 +620,9 @@ HEADERS += \
src/MissionManager/Section.h \ src/MissionManager/Section.h \
src/MissionManager/SpeedSection.h \ src/MissionManager/SpeedSection.h \
src/MissionManager/StructureScanComplexItem.h \ src/MissionManager/StructureScanComplexItem.h \
src/MissionManager/StructureScanPlanCreator.h \
src/MissionManager/SurveyComplexItem.h \ src/MissionManager/SurveyComplexItem.h \
src/MissionManager/SurveyPlanCreator.h \
src/MissionManager/TransectStyleComplexItem.h \ src/MissionManager/TransectStyleComplexItem.h \
src/MissionManager/VisualMissionItem.h \ src/MissionManager/VisualMissionItem.h \
src/PositionManager/PositionManager.h \ src/PositionManager/PositionManager.h \
...@@ -817,6 +822,8 @@ SOURCES += \ ...@@ -817,6 +822,8 @@ SOURCES += \
src/MissionManager/CameraSpec.cc \ src/MissionManager/CameraSpec.cc \
src/MissionManager/ComplexMissionItem.cc \ src/MissionManager/ComplexMissionItem.cc \
src/MissionManager/CorridorScanComplexItem.cc \ src/MissionManager/CorridorScanComplexItem.cc \
src/MissionManager/CorridorScanPlanCreator.cc \
src/MissionManager/CustomPlanCreator.cc \
src/MissionManager/FixedWingLandingComplexItem.cc \ src/MissionManager/FixedWingLandingComplexItem.cc \
src/MissionManager/GeoFenceController.cc \ src/MissionManager/GeoFenceController.cc \
src/MissionManager/GeoFenceManager.cc \ src/MissionManager/GeoFenceManager.cc \
...@@ -829,6 +836,7 @@ SOURCES += \ ...@@ -829,6 +836,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/PlanCreator.cc \
src/MissionManager/PlanManager.cc \ src/MissionManager/PlanManager.cc \
src/MissionManager/PlanMasterController.cc \ src/MissionManager/PlanMasterController.cc \
src/MissionManager/QGCFenceCircle.cc \ src/MissionManager/QGCFenceCircle.cc \
...@@ -842,7 +850,9 @@ SOURCES += \ ...@@ -842,7 +850,9 @@ SOURCES += \
src/MissionManager/SimpleMissionItem.cc \ src/MissionManager/SimpleMissionItem.cc \
src/MissionManager/SpeedSection.cc \ src/MissionManager/SpeedSection.cc \
src/MissionManager/StructureScanComplexItem.cc \ src/MissionManager/StructureScanComplexItem.cc \
src/MissionManager/StructureScanPlanCreator.cc \
src/MissionManager/SurveyComplexItem.cc \ src/MissionManager/SurveyComplexItem.cc \
src/MissionManager/SurveyPlanCreator.cc \
src/MissionManager/TransectStyleComplexItem.cc \ src/MissionManager/TransectStyleComplexItem.cc \
src/MissionManager/VisualMissionItem.cc \ src/MissionManager/VisualMissionItem.cc \
src/PositionManager/PositionManager.cpp \ src/PositionManager/PositionManager.cpp \
......
...@@ -102,6 +102,7 @@ ...@@ -102,6 +102,7 @@
<file alias="QGroundControl/Controls/ParameterEditorDialog.qml">src/QmlControls/ParameterEditorDialog.qml</file> <file alias="QGroundControl/Controls/ParameterEditorDialog.qml">src/QmlControls/ParameterEditorDialog.qml</file>
<file alias="QGroundControl/Controls/PIDTuning.qml">src/QmlControls/PIDTuning.qml</file> <file alias="QGroundControl/Controls/PIDTuning.qml">src/QmlControls/PIDTuning.qml</file>
<file alias="QGroundControl/Controls/PlanEditToolbar.qml">src/PlanView/PlanEditToolbar.qml</file> <file alias="QGroundControl/Controls/PlanEditToolbar.qml">src/PlanView/PlanEditToolbar.qml</file>
<file alias="QGroundControl/Controls/PlanStartOverlay.qml">src/PlanView/PlanStartOverlay.qml</file>
<file alias="QGroundControl/Controls/PreFlightCheckButton.qml">src/QmlControls/PreFlightCheckButton.qml</file> <file alias="QGroundControl/Controls/PreFlightCheckButton.qml">src/QmlControls/PreFlightCheckButton.qml</file>
<file alias="QGroundControl/Controls/PreFlightCheckGroup.qml">src/QmlControls/PreFlightCheckGroup.qml</file> <file alias="QGroundControl/Controls/PreFlightCheckGroup.qml">src/QmlControls/PreFlightCheckGroup.qml</file>
<file alias="QGroundControl/Controls/PreFlightCheckModel.qml">src/QmlControls/PreFlightCheckModel.qml</file> <file alias="QGroundControl/Controls/PreFlightCheckModel.qml">src/QmlControls/PreFlightCheckModel.qml</file>
......
...@@ -51,6 +51,8 @@ CorridorScanComplexItem::CorridorScanComplexItem(Vehicle* vehicle, bool flyView, ...@@ -51,6 +51,8 @@ CorridorScanComplexItem::CorridorScanComplexItem(Vehicle* vehicle, bool flyView,
connect(&_corridorPolyline, &QGCMapPolyline::pathChanged, this, &CorridorScanComplexItem::_rebuildCorridorPolygon); connect(&_corridorPolyline, &QGCMapPolyline::pathChanged, this, &CorridorScanComplexItem::_rebuildCorridorPolygon);
connect(&_corridorWidthFact, &Fact::valueChanged, this, &CorridorScanComplexItem::_rebuildCorridorPolygon); connect(&_corridorWidthFact, &Fact::valueChanged, this, &CorridorScanComplexItem::_rebuildCorridorPolygon);
connect(&_corridorPolyline, &QGCMapPolyline::isValidChanged,this, &CorridorScanComplexItem::readyForSaveStateChanged);
if (!kmlFile.isEmpty()) { if (!kmlFile.isEmpty()) {
_corridorPolyline.loadKMLFile(kmlFile); _corridorPolyline.loadKMLFile(kmlFile);
_corridorPolyline.setDirty(false); _corridorPolyline.setDirty(false);
...@@ -490,9 +492,9 @@ void CorridorScanComplexItem::_recalcCameraShots(void) ...@@ -490,9 +492,9 @@ void CorridorScanComplexItem::_recalcCameraShots(void)
emit cameraShotsChanged(); emit cameraShotsChanged();
} }
bool CorridorScanComplexItem::readyForSave(void) const CorridorScanComplexItem::ReadyForSaveState CorridorScanComplexItem::readyForSaveState(void) const
{ {
return TransectStyleComplexItem::readyForSave(); return TransectStyleComplexItem::readyForSaveState();
} }
double CorridorScanComplexItem::timeBetweenShots(void) double CorridorScanComplexItem::timeBetweenShots(void)
......
...@@ -48,11 +48,11 @@ public: ...@@ -48,11 +48,11 @@ public:
QString mapVisualQML (void) const final { return QStringLiteral("CorridorScanMapVisual.qml"); } QString mapVisualQML (void) const final { return QStringLiteral("CorridorScanMapVisual.qml"); }
// Overrides from VisualMissionionItem // Overrides from VisualMissionionItem
QString commandDescription (void) const final { return tr("Corridor Scan"); } QString commandDescription (void) const final { return tr("Corridor Scan"); }
QString commandName (void) const final { return tr("Corridor Scan"); } QString commandName (void) const final { return tr("Corridor Scan"); }
QString abbreviation (void) const final { return tr("C"); } QString abbreviation (void) const final { return tr("C"); }
bool readyForSave (void) const; ReadyForSaveState readyForSaveState (void) const final;
double additionalTimeDelay (void) const final { return 0; } double additionalTimeDelay (void) const final { return 0; }
static const char* jsonComplexItemTypeValue; static const char* jsonComplexItemTypeValue;
......
...@@ -139,7 +139,7 @@ void CorridorScanComplexItemTest::_waitForReadyForSave(void) ...@@ -139,7 +139,7 @@ void CorridorScanComplexItemTest::_waitForReadyForSave(void)
{ {
int loops = 0; int loops = 0;
while (loops++ < 8) { while (loops++ < 8) {
if (_corridorItem->readyForSave()) { if (_corridorItem->readyForSaveState() == CorridorScanComplexItem::ReadyForSave) {
return; return;
} }
QTest::qWait(500); QTest::qWait(500);
......
/****************************************************************************
*
* (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.
*
****************************************************************************/
#include "CorridorScanPlanCreator.h"
#include "PlanMasterController.h"
#include "MissionSettingsItem.h"
CorridorScanPlanCreator::CorridorScanPlanCreator(PlanMasterController* planMasterController, QObject* parent)
: PlanCreator(planMasterController, MissionController::patternCorridorScanName, QStringLiteral("/qmlimages/PlanCreator/CorridorScanPlanCreator.png"), parent)
{
}
void CorridorScanPlanCreator::createPlan(const QGeoCoordinate& mapCenterCoord)
{
_planMasterController->removeAll();
int seqNum = _missionController->insertComplexMissionItem(
MissionController::patternCorridorScanName,
mapCenterCoord,
_missionController->visualItems()->count());
if (_planMasterController->managerVehicle()->fixedWing()) {
_missionController->insertComplexMissionItem(
MissionController::patternFWLandingName,
mapCenterCoord,
_missionController->visualItems()->count());
} else {
MissionSettingsItem* settingsItem = _missionController->visualItems()->value<MissionSettingsItem*>(0);
settingsItem->setMissionEndRTL(true);
}
_missionController->setCurrentPlanViewIndex(seqNum, false);
}
/****************************************************************************
*
* (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.
*
****************************************************************************/
#pragma once
#include "PlanCreator.h"
class CorridorScanPlanCreator : public PlanCreator
{
Q_OBJECT
public:
CorridorScanPlanCreator(PlanMasterController* planMasterController, QObject* parent = nullptr);
Q_INVOKABLE void createPlan(const QGeoCoordinate& mapCenterCoord) final;
};
/****************************************************************************
*
* (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.
*
****************************************************************************/
#include "CustomPlanCreator.h"
#include "PlanMasterController.h"
#include "MissionSettingsItem.h"
CustomPlanCreator::CustomPlanCreator(PlanMasterController* planMasterController, QObject* parent)
: PlanCreator(planMasterController, tr("Custom"), QStringLiteral("/qmlimages/PlanCreator/CustomPlanCreator.png"), parent)
{
}
void CustomPlanCreator::createPlan(const QGeoCoordinate& mapCenterCoord)
{
_planMasterController->removeAll();
int seqNum = _missionController->insertSimpleMissionItem(mapCenterCoord, _missionController->visualItems()->count());
_missionController->insertSimpleMissionItem(mapCenterCoord.atDistanceAndAzimuth(50, 135), _missionController->visualItems()->count());
_missionController->insertSimpleMissionItem(mapCenterCoord.atDistanceAndAzimuth(50, -135), _missionController->visualItems()->count());
if (_planMasterController->managerVehicle()->fixedWing()) {
_missionController->insertComplexMissionItem(
MissionController::patternFWLandingName,
mapCenterCoord,
_missionController->visualItems()->count());
} else {
MissionSettingsItem* settingsItem = _missionController->visualItems()->value<MissionSettingsItem*>(0);
settingsItem->setMissionEndRTL(true);
}
_missionController->setCurrentPlanViewIndex(seqNum, false);
}
/****************************************************************************
*
* (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.
*
****************************************************************************/
#pragma once
#include "PlanCreator.h"
class CustomPlanCreator : public PlanCreator
{
Q_OBJECT
public:
CustomPlanCreator(PlanMasterController* planMasterController, QObject* parent = nullptr);
Q_INVOKABLE void createPlan(const QGeoCoordinate& mapCenterCoord) final;
};
...@@ -100,6 +100,7 @@ FixedWingLandingComplexItem::FixedWingLandingComplexItem(Vehicle* vehicle, bool ...@@ -100,6 +100,7 @@ FixedWingLandingComplexItem::FixedWingLandingComplexItem(Vehicle* vehicle, bool
connect(this, &FixedWingLandingComplexItem::altitudesAreRelativeChanged, this, &FixedWingLandingComplexItem::coordinateHasRelativeAltitudeChanged); connect(this, &FixedWingLandingComplexItem::altitudesAreRelativeChanged, this, &FixedWingLandingComplexItem::coordinateHasRelativeAltitudeChanged);
connect(this, &FixedWingLandingComplexItem::altitudesAreRelativeChanged, this, &FixedWingLandingComplexItem::exitCoordinateHasRelativeAltitudeChanged); connect(this, &FixedWingLandingComplexItem::altitudesAreRelativeChanged, this, &FixedWingLandingComplexItem::exitCoordinateHasRelativeAltitudeChanged);
connect(this, &FixedWingLandingComplexItem::landingCoordSetChanged, this, &FixedWingLandingComplexItem::readyForSaveStateChanged);
if (vehicle->apmFirmware()) { if (vehicle->apmFirmware()) {
// ArduPilot does not support camera commands // ArduPilot does not support camera commands
_stopTakingVideoFact.setRawValue(false); _stopTakingVideoFact.setRawValue(false);
...@@ -708,3 +709,8 @@ void FixedWingLandingComplexItem::_signalLastSequenceNumberChanged(void) ...@@ -708,3 +709,8 @@ void FixedWingLandingComplexItem::_signalLastSequenceNumberChanged(void)
{ {
emit lastSequenceNumberChanged(lastSequenceNumber()); emit lastSequenceNumberChanged(lastSequenceNumber());
} }
FixedWingLandingComplexItem::ReadyForSaveState FixedWingLandingComplexItem::readyForSaveState(void) const
{
return _landingCoordSet ? ReadyForSave : NotReadyForSaveData;
}
...@@ -74,7 +74,6 @@ public: ...@@ -74,7 +74,6 @@ public:
QString mapVisualQML (void) const final { return QStringLiteral("FWLandingPatternMapVisual.qml"); } QString mapVisualQML (void) const final { return QStringLiteral("FWLandingPatternMapVisual.qml"); }
// Overrides from VisualMissionItem // Overrides from VisualMissionItem
bool dirty (void) const final { return _dirty; } bool dirty (void) const final { return _dirty; }
bool isSimpleItem (void) const final { return false; } bool isSimpleItem (void) const final { return false; }
bool isStandaloneCoordinate (void) const final { return false; } bool isStandaloneCoordinate (void) const final { return false; }
...@@ -92,6 +91,7 @@ public: ...@@ -92,6 +91,7 @@ public:
void appendMissionItems (QList<MissionItem*>& items, QObject* missionItemParent) final; void appendMissionItems (QList<MissionItem*>& items, QObject* missionItemParent) final;
void applyNewAltitude (double newAltitude) final; void applyNewAltitude (double newAltitude) final;
double additionalTimeDelay (void) const final { return 0; } double additionalTimeDelay (void) const final { return 0; }
ReadyForSaveState readyForSaveState (void) const final;
bool coordinateHasRelativeAltitude (void) const final { return _altitudesAreRelative; } bool coordinateHasRelativeAltitude (void) const final { return _altitudesAreRelative; }
bool exitCoordinateHasRelativeAltitude (void) const final { return _altitudesAreRelative; } bool exitCoordinateHasRelativeAltitude (void) const final { return _altitudesAreRelative; }
......
...@@ -51,9 +51,10 @@ const char* MissionController::_jsonMavAutopilotKey = "MAV_AUTOPILOT"; ...@@ -51,9 +51,10 @@ const char* MissionController::_jsonMavAutopilotKey = "MAV_AUTOPILOT";
const int MissionController::_missionFileVersion = 2; const int MissionController::_missionFileVersion = 2;
const QString MissionController::patternFWLandingName (QT_TRANSLATE_NOOP("MissionController", "Fixed Wing Landing")); const QString MissionController::patternSurveyName (QT_TRANSLATE_NOOP("MissionController", "Survey"));
const QString MissionController::patternStructureScanName (QT_TRANSLATE_NOOP("MissionController", "Structure Scan")); const QString MissionController::patternFWLandingName (QT_TRANSLATE_NOOP("MissionController", "Fixed Wing Landing"));
const QString MissionController::patternCorridorScanName (QT_TRANSLATE_NOOP("MissionController", "Corridor Scan")); const QString MissionController::patternStructureScanName (QT_TRANSLATE_NOOP("MissionController", "Structure Scan"));
const QString MissionController::patternCorridorScanName (QT_TRANSLATE_NOOP("MissionController", "Corridor Scan"));
MissionController::MissionController(PlanMasterController* masterController, QObject *parent) MissionController::MissionController(PlanMasterController* masterController, QObject *parent)
: PlanElementController (masterController, parent) : PlanElementController (masterController, parent)
...@@ -64,7 +65,6 @@ MissionController::MissionController(PlanMasterController* masterController, QOb ...@@ -64,7 +65,6 @@ MissionController::MissionController(PlanMasterController* masterController, QOb
, _firstItemsFromVehicle (false) , _firstItemsFromVehicle (false)
, _itemsRequested (false) , _itemsRequested (false)
, _inRecalcSequence (false) , _inRecalcSequence (false)
, _surveyMissionItemName (tr("Survey"))
, _appSettings (qgcApp()->toolbox()->settingsManager()->appSettings()) , _appSettings (qgcApp()->toolbox()->settingsManager()->appSettings())
, _progressPct (0) , _progressPct (0)
, _currentPlanViewIndex (-1) , _currentPlanViewIndex (-1)
...@@ -417,7 +417,7 @@ int MissionController::insertComplexMissionItem(QString itemName, QGeoCoordinate ...@@ -417,7 +417,7 @@ int MissionController::insertComplexMissionItem(QString itemName, QGeoCoordinate
} }
int sequenceNumber = _nextSequenceNumber(); int sequenceNumber = _nextSequenceNumber();
if (itemName == _surveyMissionItemName) { if (itemName == patternSurveyName) {
newItem = new SurveyComplexItem(_controllerVehicle, _flyView, QString() /* kmlFile */, _visualItems /* parent */); newItem = new SurveyComplexItem(_controllerVehicle, _flyView, QString() /* kmlFile */, _visualItems /* parent */);
newItem->setCoordinate(mapCenterCoordinate); newItem->setCoordinate(mapCenterCoordinate);
} else if (itemName == patternFWLandingName) { } else if (itemName == patternFWLandingName) {
...@@ -438,7 +438,7 @@ int MissionController::insertComplexMissionItemFromKMLOrSHP(QString itemName, QS ...@@ -438,7 +438,7 @@ int MissionController::insertComplexMissionItemFromKMLOrSHP(QString itemName, QS
{ {
ComplexMissionItem* newItem; ComplexMissionItem* newItem;
if (itemName == _surveyMissionItemName) { if (itemName == patternSurveyName) {
newItem = new SurveyComplexItem(_controllerVehicle, _flyView, file, _visualItems); newItem = new SurveyComplexItem(_controllerVehicle, _flyView, file, _visualItems);
} else if (itemName == patternStructureScanName) { } else if (itemName == patternStructureScanName) {
newItem = new StructureScanComplexItem(_controllerVehicle, _flyView, file, _visualItems); newItem = new StructureScanComplexItem(_controllerVehicle, _flyView, file, _visualItems);
...@@ -987,7 +987,7 @@ bool MissionController::readyForSaveSend(void) const ...@@ -987,7 +987,7 @@ bool MissionController::readyForSaveSend(void) const
{ {
for (int i=0; i<_visualItems->count(); i++) { for (int i=0; i<_visualItems->count(); i++) {
VisualMissionItem* visualItem = qobject_cast<VisualMissionItem*>(_visualItems->get(i)); VisualMissionItem* visualItem = qobject_cast<VisualMissionItem*>(_visualItems->get(i));
if (!visualItem->readyForSave()) { if (visualItem->readyForSaveState() != VisualMissionItem::ReadyForSave) {
return false; return false;
} }
} }
...@@ -2006,7 +2006,7 @@ QStringList MissionController::complexMissionItemNames(void) const ...@@ -2006,7 +2006,7 @@ QStringList MissionController::complexMissionItemNames(void) const
{ {
QStringList complexItems; QStringList complexItems;
complexItems.append(_surveyMissionItemName); complexItems.append(patternSurveyName);
complexItems.append(patternCorridorScanName); complexItems.append(patternCorridorScanName);
if (_controllerVehicle->fixedWing()) { if (_controllerVehicle->fixedWing()) {
complexItems.append(patternFWLandingName); complexItems.append(patternFWLandingName);
...@@ -2112,7 +2112,6 @@ VisualMissionItem* MissionController::currentPlanViewItem(void) const ...@@ -2112,7 +2112,6 @@ VisualMissionItem* MissionController::currentPlanViewItem(void) const
void MissionController::setCurrentPlanViewIndex(int sequenceNumber, bool force) void MissionController::setCurrentPlanViewIndex(int sequenceNumber, bool force)
{ {
qDebug() << "setCurrentPlanViewIndex" << sequenceNumber << force << _currentPlanViewIndex;
if(_visualItems && (force || sequenceNumber != _currentPlanViewIndex)) { if(_visualItems && (force || sequenceNumber != _currentPlanViewIndex)) {
_splitSegment = nullptr; _splitSegment = nullptr;
_currentPlanViewItem = nullptr; _currentPlanViewItem = nullptr;
......
...@@ -180,7 +180,7 @@ public: ...@@ -180,7 +180,7 @@ public:
QGeoCoordinate plannedHomePosition (void) const; QGeoCoordinate plannedHomePosition (void) const;
VisualMissionItem* currentPlanViewItem (void) const; VisualMissionItem* currentPlanViewItem (void) const;
double progressPct (void) const { return _progressPct; } double progressPct (void) const { return _progressPct; }
QString surveyComplexItemName (void) const { return _surveyMissionItemName; } QString surveyComplexItemName (void) const { return patternSurveyName; }
QString corridorScanComplexItemName (void) const { return patternCorridorScanName; } QString corridorScanComplexItemName (void) const { return patternCorridorScanName; }
QString structureScanComplexItemName(void) const { return patternStructureScanName; } QString structureScanComplexItemName(void) const { return patternStructureScanName; }
...@@ -207,6 +207,7 @@ public: ...@@ -207,6 +207,7 @@ public:
static const QString patternFWLandingName; static const QString patternFWLandingName;
static const QString patternStructureScanName; static const QString patternStructureScanName;
static const QString patternCorridorScanName; static const QString patternCorridorScanName;
static const QString patternSurveyName;
signals: signals:
void visualItemsChanged (void); void visualItemsChanged (void);
...@@ -299,7 +300,6 @@ private: ...@@ -299,7 +300,6 @@ private:
bool _itemsRequested; bool _itemsRequested;
bool _inRecalcSequence; bool _inRecalcSequence;
MissionFlightStatus_t _missionFlightStatus; MissionFlightStatus_t _missionFlightStatus;
QString _surveyMissionItemName;
AppSettings* _appSettings; AppSettings* _appSettings;
double _progressPct; double _progressPct;
int _currentPlanViewIndex; int _currentPlanViewIndex;
......
/****************************************************************************
*
* (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.
*
****************************************************************************/
#include "PlanCreator.h"
#include "PlanMasterController.h"
PlanCreator::PlanCreator(PlanMasterController* planMasterController, QString name, QString imageResource, QObject* parent)
: QObject (parent)
, _planMasterController (planMasterController)
, _missionController (planMasterController->missionController())
, _name (name)
, _imageResource (imageResource)
{
}
/****************************************************************************
*
* (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.
*
****************************************************************************/
#pragma once
#include <QObject>
#include <QString>
#include "QGeoCoordinate"
class PlanMasterController;
class MissionController;
/// Base class for PlanCreator objects which are used to create a full plan in a single step.
class PlanCreator : public QObject
{
Q_OBJECT
public:
PlanCreator(PlanMasterController* planMasterController, QString name, QString imageResource, QObject* parent = nullptr);
Q_PROPERTY(QString name MEMBER _name CONSTANT)
Q_PROPERTY(QString imageResource MEMBER _imageResource CONSTANT)
Q_INVOKABLE virtual void createPlan(const QGeoCoordinate& mapCenterCoord) = 0;
protected:
PlanMasterController* _planMasterController;
MissionController* _missionController;
QString _name;
QString _imageResource;
};
...@@ -16,6 +16,10 @@ ...@@ -16,6 +16,10 @@
#include "JsonHelper.h" #include "JsonHelper.h"
#include "MissionManager.h" #include "MissionManager.h"
#include "KML.h" #include "KML.h"
#include "SurveyPlanCreator.h"
#include "StructureScanPlanCreator.h"
#include "CorridorScanPlanCreator.h"
#include "CustomPlanCreator.h"
#if defined(QGC_AIRMAP_ENABLED) #if defined(QGC_AIRMAP_ENABLED)
#include "AirspaceFlightPlanProvider.h" #include "AirspaceFlightPlanProvider.h"
#endif #endif
...@@ -50,6 +54,7 @@ PlanMasterController::PlanMasterController(QObject* parent) ...@@ -50,6 +54,7 @@ PlanMasterController::PlanMasterController(QObject* parent)
, _sendGeoFence (false) , _sendGeoFence (false)
, _sendRallyPoints (false) , _sendRallyPoints (false)
, _deleteWhenSendCompleted (false) , _deleteWhenSendCompleted (false)
, _planCreators (nullptr)
{ {
connect(&_missionController, &MissionController::dirtyChanged, this, &PlanMasterController::dirtyChanged); connect(&_missionController, &MissionController::dirtyChanged, this, &PlanMasterController::dirtyChanged);
connect(&_geoFenceController, &GeoFenceController::dirtyChanged, this, &PlanMasterController::dirtyChanged); connect(&_geoFenceController, &GeoFenceController::dirtyChanged, this, &PlanMasterController::dirtyChanged);
...@@ -79,6 +84,8 @@ void PlanMasterController::start(bool flyView) ...@@ -79,6 +84,8 @@ void PlanMasterController::start(bool flyView)
connect(_multiVehicleMgr, &MultiVehicleManager::activeVehicleChanged, this, &PlanMasterController::_activeVehicleChanged); connect(_multiVehicleMgr, &MultiVehicleManager::activeVehicleChanged, this, &PlanMasterController::_activeVehicleChanged);
_activeVehicleChanged(_multiVehicleMgr->activeVehicle()); _activeVehicleChanged(_multiVehicleMgr->activeVehicle());
_updatePlanCreatorsList();
#if defined(QGC_AIRMAP_ENABLED) #if defined(QGC_AIRMAP_ENABLED)
//-- This assumes there is one single instance of PlanMasterController in edit mode. //-- This assumes there is one single instance of PlanMasterController in edit mode.
if(!flyView) { if(!flyView) {
...@@ -115,12 +122,15 @@ void PlanMasterController::_activeVehicleChanged(Vehicle* activeVehicle) ...@@ -115,12 +122,15 @@ void PlanMasterController::_activeVehicleChanged(Vehicle* activeVehicle)
disconnect(_managerVehicle->missionManager(), &MissionManager::sendComplete, this, &PlanMasterController::_sendMissionComplete); disconnect(_managerVehicle->missionManager(), &MissionManager::sendComplete, this, &PlanMasterController::_sendMissionComplete);
disconnect(_managerVehicle->geoFenceManager(), &GeoFenceManager::sendComplete, this, &PlanMasterController::_sendGeoFenceComplete); disconnect(_managerVehicle->geoFenceManager(), &GeoFenceManager::sendComplete, this, &PlanMasterController::_sendGeoFenceComplete);
disconnect(_managerVehicle->rallyPointManager(), &RallyPointManager::sendComplete, this, &PlanMasterController::_sendRallyPointsComplete); disconnect(_managerVehicle->rallyPointManager(), &RallyPointManager::sendComplete, this, &PlanMasterController::_sendRallyPointsComplete);
disconnect(_managerVehicle, &Vehicle::vehicleTypeChanged, this, &PlanMasterController::_updatePlanCreatorsList);
} }
bool newOffline = false; bool newOffline = false;
if (activeVehicle == nullptr) { if (activeVehicle == nullptr) {
// Since there is no longer an active vehicle we use the offline controller vehicle as the manager vehicle // Since there is no longer an active vehicle we use the offline controller vehicle as the manager vehicle
_managerVehicle = _controllerVehicle; _managerVehicle = _controllerVehicle;
// The vehicle type can change on the offline vehicle. Keep the creators list in sync with that.
connect(_managerVehicle, &Vehicle::vehicleTypeChanged, this, &PlanMasterController::_updatePlanCreatorsList);
newOffline = true; newOffline = true;
} else { } else {
newOffline = false; newOffline = false;
...@@ -172,6 +182,8 @@ void PlanMasterController::_activeVehicleChanged(Vehicle* activeVehicle) ...@@ -172,6 +182,8 @@ void PlanMasterController::_activeVehicleChanged(Vehicle* activeVehicle)
_showPlanFromManagerVehicle(); _showPlanFromManagerVehicle();
} }
} }
_updatePlanCreatorsList();
} }
void PlanMasterController::loadFromVehicle(void) void PlanMasterController::loadFromVehicle(void)
...@@ -583,3 +595,26 @@ bool PlanMasterController::isEmpty(void) const ...@@ -583,3 +595,26 @@ bool PlanMasterController::isEmpty(void) const
_geoFenceController.isEmpty() && _geoFenceController.isEmpty() &&
_rallyPointController.isEmpty(); _rallyPointController.isEmpty();
} }
void PlanMasterController::_updatePlanCreatorsList(void)
{
if (!_flyView) {
if (!_planCreators) {
_planCreators = new QmlObjectListModel(this);
_planCreators->append(new SurveyPlanCreator(this, this));
_planCreators->append(new CorridorScanPlanCreator(this, this));
_planCreators->append(new CustomPlanCreator(this, this));
emit planCreatorsChanged(_planCreators);
}
if (_managerVehicle->fixedWing()) {
if (_planCreators->count() == 4) {
_planCreators->removeAt(_planCreators->count() - 2);
}
} else {
if (_planCreators->count() != 4) {
_planCreators->insert(_planCreators->count() - 1, new StructureScanPlanCreator(this, this));
}
}
}
}
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "Vehicle.h" #include "Vehicle.h"
#include "MultiVehicleManager.h" #include "MultiVehicleManager.h"
#include "QGCLoggingCategory.h" #include "QGCLoggingCategory.h"
#include "QmlObjectListModel.h"
Q_DECLARE_LOGGING_CATEGORY(PlanMasterControllerLog) Q_DECLARE_LOGGING_CATEGORY(PlanMasterControllerLog)