Skip to content

fix(CorridorScanComplexItem): emit specifiesCoordinateChanged when polyline validity changes - #14749

Merged
DonLakeFlyer merged 1 commit into
mavlink:masterfrom
DonLakeFlyer:CorridorScanSpecifiesCoordinate
Jul 30, 2026
Merged

fix(CorridorScanComplexItem): emit specifiesCoordinateChanged when polyline validity changes#14749
DonLakeFlyer merged 1 commit into
mavlink:masterfrom
DonLakeFlyer:CorridorScanSpecifiesCoordinate

Conversation

@DonLakeFlyer

Copy link
Copy Markdown
Contributor

Replaces #14725.

Description

CorridorScanComplexItem::specifiesCoordinate() is dynamic (_corridorPolyline.count() > 1) but the class never emitted the specifiesCoordinateChanged NOTIFY signal. MissionController only rebuilds waypoint connector lines on that signal (plus a one-shot isIncompleteChanged which is consumed during item construction), so after tracing a corridor the connector line from the previous waypoint to the corridor entry never appeared until some unrelated action forced a full recalc.

Why this approach instead of #14725

#14725 fixed the same bug but had a few weaknesses this PR addresses:

  • Emission is tied to the actual state change. specifiesCoordinate() depends on the polyline vertex count, so the new _updateSpecifiesCoordinate() slot is connected to QGCMapPolyline::countChanged rather than piggybacking the emit inside _rebuildCorridorPolygon(). The polygon-rebuild slot is also triggered by corridor width changes (which can never affect specifiesCoordinate()), and a future refactor of the rebuild logic can't silently drop the signal emission.
  • countChanged covers every mutation pathappendVertex, clear(), and setPath/JSON load all route through it (verified through QmlObjectListModel/ObjectItemModelBase, including the depth-counted model-reset path), so both the false→true and true→false transitions are always signaled.
  • No redundant constructor cache initialization. fix(CorridorScanComplexItem): Fix the signal emission logic for #14725 added a _specifiesCoordinate = specifiesCoordinate() line at a point where the polyline is guaranteed empty (the KML/SHP load runs after the signal connections). Instead the cache is anchored once after the connects via _updateSpecifiesCoordinate(), which keeps it correct regardless of future constructor reordering.
  • Regression test included. New _testSpecifiesCoordinateChanged unit test covers: no emission below 2 vertices, exactly one emission on the 1→2 transition, no spurious emission on 2→3 or corridor width changes, and the true→false transition on clear(). The test fails on master and passes with this fix.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Testing

  • Tested locally
  • Added/updated unit tests

Platforms Tested

  • macOS

By submitting this pull request, I confirm that my contribution is made under the terms of the project's dual license (Apache 2.0 and GPL v3).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a mission-line rendering issue by ensuring CorridorScanComplexItem::specifiesCoordinate() state transitions (driven by corridor polyline vertex count) correctly emit specifiesCoordinateChanged, allowing MissionController to recalculate connector flight-path segments when the corridor becomes coordinate-specified (or stops being so).

Changes:

  • Emit specifiesCoordinateChanged precisely on QGCMapPolyline::countChanged transitions by caching the previous specifiesCoordinate() value.
  • Initialize the cached state in the constructor to avoid dependence on constructor ordering.
  • Add a unit test verifying correct emission behavior across 0→1→2→3 vertices, corridor width changes, and clear().

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/MissionManager/CorridorScanComplexItem.h Adds _updateSpecifiesCoordinate slot and a cached _specifiesCoordinate state used to gate signal emission.
src/MissionManager/CorridorScanComplexItem.cc Connects polyline countChanged to _updateSpecifiesCoordinate, initializes cache, and emits specifiesCoordinateChanged only on state flips.
test/MissionManager/CorridorScanComplexItemTest.h Registers a new unit test slot for specifiesCoordinateChanged emission behavior.
test/MissionManager/CorridorScanComplexItemTest.cc Implements regression test validating emission correctness and avoiding spurious emissions.

@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 32.63%. Comparing base (f29efd3) to head (a2986cc).
⚠️ Report is 230 commits behind head on master.

Files with missing lines Patch % Lines
src/MissionManager/CorridorScanComplexItem.cc 75.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #14749      +/-   ##
==========================================
+ Coverage   25.47%   32.63%   +7.16%     
==========================================
  Files         769      784      +15     
  Lines       65912    67562    +1650     
  Branches    30495    31291     +796     
==========================================
+ Hits        16788    22052    +5264     
+ Misses      37285    30652    -6633     
- Partials    11839    14858    +3019     
Flag Coverage Δ
unittests 32.63% <75.00%> (+7.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/MissionManager/CorridorScanComplexItem.h 27.27% <ø> (ø)
src/MissionManager/CorridorScanComplexItem.cc 33.96% <75.00%> (+12.15%) ⬆️

... and 476 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 68787ab...a2986cc. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown
Contributor

Build Results

Platform Status

Platform Status Details
Linux Passed View
Windows Passed View
MacOS Passed View
Android Passed View

All builds passed.

Pre-commit

Check Status Details
pre-commit Failed (non-blocking) View

Pre-commit hooks: 0 passed, 0 failed, 0 skipped.

Test Results

linux-coverage-integration: 37 passed, 0 skipped
linux-coverage-unit: 116 passed, 0 skipped
linux-sanitizers-integration: 20 passed, 0 skipped
linux-sanitizers-unit: 116 passed, 0 skipped
Total: 289 passed, 0 skipped

Code Coverage

Coverage Baseline Change
69.4% 69.4% -0.0%

Artifact Sizes

Artifact Size Δ from master
QGroundControl 221.81 MB -4.39 MB (decrease)
QGroundControl-aarch64 179.34 MB No change
QGroundControl-installer-AMD64 137.84 MB -0.45 MB (decrease)
QGroundControl-installer-AMD64-ARM64 80.36 MB -0.22 MB (decrease)
QGroundControl-installer-ARM64 109.13 MB -0.00 MB (decrease)
QGroundControl-linux 87.04 MB -78.74 MB (decrease)
QGroundControl-mac 87.04 MB -0.00 MB (decrease)
QGroundControl-x86_64 191.58 MB +0.02 MB (increase)
Total size decreased by 83.78 MB

Updated: 2026-07-30 16:42:11 UTC • Commit: a2986cc • Triggered by: Android

@DonLakeFlyer
DonLakeFlyer merged commit 003228b into mavlink:master Jul 30, 2026
46 checks passed
@DonLakeFlyer
DonLakeFlyer deleted the CorridorScanSpecifiesCoordinate branch July 30, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants