Skip to content

feat: add POLYLINE marker support#73

Merged
fank merged 2 commits intomainfrom
feat/polyline-marker-support
Feb 3, 2026
Merged

feat: add POLYLINE marker support#73
fank merged 2 commits intomainfrom
feat/polyline-marker-support

Conversation

@fank
Copy link
Member

@fank fank commented Feb 3, 2026

Summary

  • Add support for recording POLYLINE markers (user-drawn lines on the map)
  • Previously, polyline markers were silently dropped because the handler expected a single [x,y,z] coordinate but received an array of points [[x1,y1],[x2,y2],...]

Changes

  • Add Position2D and Polyline types to core model
  • Add Polyline field to Marker structs (core and GORM)
  • Implement ParsePolyline() function in geo package
  • Update LogMarkerCreate handler to detect POLYLINE shape and parse coordinate array
  • Update export to output coordinate array format for polylines
  • Add conversion from geom.LineString to core.Polyline

Test plan

  • Unit tests for ParsePolyline() (valid input, edge cases, error handling)
  • Unit test for polyline marker export format
  • All existing marker tests pass (no regressions)
  • Manual test: Draw a line in Arma 3, verify it appears in exported JSON and renders in web UI

fank added 2 commits February 3, 2026 16:16
- Add Position2D and Polyline types to core model
- Add Polyline field to Marker structs (core and GORM)
- Implement ParsePolyline function in geo package
- Update LogMarkerCreate handler to detect and parse polylines
- Update export to output coordinate array for polylines
- Add conversion from geom.LineString to core.Polyline

Polyline markers are now recorded and exported in the format
expected by the OCAP2 web UI: [[x1,y1],[x2,y2],...]

Fixes issue where user-drawn lines were silently dropped because
the handler expected a single [x,y,z] coordinate but received
an array of points.
The frontend expects positions in frame-based format:
[[frameNum, pos, direction, alpha], ...]

For POLYLINE markers, pos should contain the coordinate array:
[[frameNum, [[x1,y1], [x2,y2], ...], direction, alpha]]

Previously we were outputting raw coordinates without the frame wrapper,
which caused the frontend to misinterpret the data.
@github-actions
Copy link

github-actions bot commented Feb 3, 2026

Merging this branch changes the coverage (3 decrease, 1 increase)

Impacted Packages Coverage Δ 🤖
github.com/OCAP2/extension/v5/internal/geo 16.35% (-0.77%) 👎
github.com/OCAP2/extension/v5/internal/handlers 1.24% (-0.01%) 👎
github.com/OCAP2/extension/v5/internal/model 0.00% (ø)
github.com/OCAP2/extension/v5/internal/model/convert 14.18% (-0.81%) 👎
github.com/OCAP2/extension/v5/internal/model/core 0.00% (ø)
github.com/OCAP2/extension/v5/internal/storage/memory 14.95% (+0.10%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/OCAP2/extension/v5/internal/geo/polyline.go 15.03% (+15.03%) 173 (+173) 26 (+26) 147 (+147) 🎉
github.com/OCAP2/extension/v5/internal/handlers/handlers.go 1.24% (-0.01%) 9286 (+73) 115 9171 (+73) 👎
github.com/OCAP2/extension/v5/internal/model/convert/convert.go 14.18% (-0.81%) 973 (+99) 138 (+7) 835 (+92) 👎
github.com/OCAP2/extension/v5/internal/model/core/marker.go 0.00% (ø) 0 0 0
github.com/OCAP2/extension/v5/internal/model/core/types.go 0.00% (ø) 0 0 0
github.com/OCAP2/extension/v5/internal/model/model.go 0.00% (ø) 473 0 473
github.com/OCAP2/extension/v5/internal/storage/memory/export.go 13.33% (+0.25%) 1613 (+61) 215 (+12) 1398 (+49) 👍

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/OCAP2/extension/v5/internal/geo/polyline_test.go
  • github.com/OCAP2/extension/v5/internal/storage/memory/export_test.go

@fank fank merged commit 2df1652 into main Feb 3, 2026
3 checks passed
@fank fank deleted the feat/polyline-marker-support branch February 3, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant