-
Notifications
You must be signed in to change notification settings - Fork 23
Multi-polygon support with holes #1581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mattdawkins
wants to merge
12
commits into
main
Choose a base branch
from
multi-polygon-edits
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Add CSV format extension for multiple polygons and holes per detection - Format: (poly[:key][:hole[:index]]) coordinates - Backward compatible with existing (poly) format - Add UI buttons for "Add Hole" and "Add Polygon" in polygon edit mode - Fix polygon key matching to properly handle empty string keys - Add selectedKeyRef to LayerManager watcher for proper layer updates - Add track methods: getPolygonFeatures, addHoleToPolygon, removeHoleFromPolygon - Add auto-hole detection using ray casting algorithm - Support clicking on individual polygons to select for editing Still needs testing for: - Polygon merge for overlapping polygons - Boolean difference for holes partially outside polygons Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Always emit polygon-clicked/polygon-right-clicked events regardless of drawingOther flag, enabling polygon selection when rectangles are visible - Add polygon-right-clicked handler in LayerManager to properly set the selected key and update layers - Preserve selected key when deselecting handles to prevent key reset - Calculate bounding box from ALL polygons in detection, not just edited one Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Fix hole drawing by skipping polygon selection in creation mode - Render holes with darker color (50% darkened fill/stroke, 50% opacity) - Update VIAME CSV format: - Polygons: (poly) x y x y... - Holes: (hole) x y x y... - No labels/keys in output - Multiple (poly) entries auto-keyed internally when parsing - Holes associated with most recent polygon when parsing Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Change (poly:1) to (poly) for multiple polygons - Change (poly:hole:0) to (hole) for holes - Update expected key from "2" to "" since keys are now auto-generated Co-Authored-By: Claude Opus 4.5 <[email protected]>
Update test expectations to match the actual implementation which uses the simple (poly) and (hole) format as documented in the PR description, rather than the complex format with keys like (poly:1) and (poly:hole:0). Co-Authored-By: Claude Opus 4.5 <[email protected]>
Change coordinate parsing to use lists instead of tuples from zip() to ensure consistent JSON serialization with the Pydantic model expectations. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Print full actual vs expected JSON when test fails to identify the exact difference. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Reorder Union[bool, float, str] to Union[str, float, bool] in GeoJSONFeature.properties to prevent Pydantic from coercing numeric-looking strings like "1" to boolean True. Also remove debug output from test file. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Swap order of add polygon/add hole buttons so add polygon comes first. Recalculate bounding box from remaining polygons when deleting one. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Changes: - Return polygon data with hole included instead of modifying track directly, making the update flow consistent with add polygon mode - Use === undefined checks to distinguish "no key change" from "change to empty key" for proper mode transitions - Allow right-click to cancel creation and select polygons/holes - Add polygon-right-clicked-outside event for finalizing when clicking outside polygons - Add cancelCreation handler and update Handler interface This makes hole mode and polygon mode behave identically for: - Right-click finalization - Selection (click or right-click on polygons/holes) - Editing and deletion Co-Authored-By: Claude Opus 4.5 <[email protected]>
Left-clicks in creation mode should be handled by the edit layer for placing polygon/hole vertices. Only right-click should cancel creation mode and allow polygon selection. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Features
VIAME CSV Format
Updated format for multi-polygon and hole support:
(poly) x y x y...(hole) x y x y...(poly)entries per row supportedTechnical Changes
PolygonLayer.ts: Render holes with darker color, always emit polygon selection eventsEditAnnotationLayer.ts: Support polygon key selectionLayerManager.vue: Handle polygon selection events, prevent selection during hole drawingpolygonbase.ts: Calculate bounds from all polygons, support hole/polygon creation modestrack.ts: Add methods for managing multiple polygons and holesviame.py/viame.ts: Updated serialization for new formatTest plan
(poly)and(hole)entries🤖 Generated with Claude Code