Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/MissionManager/CorridorScanComplexItem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ CorridorScanComplexItem::CorridorScanComplexItem(PlanMasterController* masterCon
{
_editorQml = "qrc:/qml/QGroundControl/PlanView/CorridorScanEditor.qml";

// specifiesCoordinate() depends on _corridorPolyline.count(), so cache the
// initial value before any signal connections fire to keep the cache in sync.
_specifiesCoordinate = specifiesCoordinate();

// We override the altitude to the mission default
if (_cameraCalc.isManualCamera() || !_cameraCalc.valueSetIsDistance()->rawValue().toBool()) {
_cameraCalc.distanceToSurface()->setRawValue(SettingsManager::instance()->appSettings()->defaultMissionItemAltitude()->rawValue());
Expand Down Expand Up @@ -211,6 +215,16 @@ void CorridorScanComplexItem::rotateEntryPoint(void)

void CorridorScanComplexItem::_rebuildCorridorPolygon(void)
{
// specifiesCoordinate() flips when the polyline crosses the 2-vertex threshold.
// MissionController only re-evaluates waypoint connector lines on this signal,
// so emit it here to link the corridor entry to the previous waypoint once the
// corridor polyline becomes valid.
const bool specifiesCoord = specifiesCoordinate();
if (specifiesCoord != _specifiesCoordinate) {
_specifiesCoordinate = specifiesCoord;
emit specifiesCoordinateChanged();
}

if (_corridorPolyline.count() < 2) {
_surveyAreaPolygon.clear();
return;
Expand Down
4 changes: 4 additions & 0 deletions src/MissionManager/CorridorScanComplexItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,9 @@ private slots:
QMap<QString, FactMetaData*> _metaDataMap;
SettingsFact _corridorWidthFact;

// Cache of the last specifiesCoordinate() value so we can emit
// specifiesCoordinateChanged when the polyline crosses the 2-vertex threshold.
bool _specifiesCoordinate = false;

static constexpr const char* _jsonEntryPointKey = "EntryPoint";
};
Loading