fix(style): render complex linestyles on the MapLibre path#19
Merged
Conversation
Since 2face3a the bake stores each complex-linestyle run UN-tessellated (tagged ls_style + color_token + width_px), so every client re-walks the run at its own display scale: replay.zig does it natively for the OpenCPN plugin, and the generated MapLibre style is supposed to do it via line-dasharray + symbol-placement:line layers. But c64de73 had stripped those style layers out (back when the bake tessellated into tiles), leaving only the dead complexLineLayer stub. Result: the ls_style runs fell through the lines-solid coalesce filter and drew as plain solid strokes — cables, the IALA/caution/restricted-area boundaries and anchorages lost their dashes and embedded chevrons on chartplotter-go. Restore the engine-side decoration (df39f97), which is where it belongs: everything renders from the engine style (/api/style.json), so the fix is one place and the OpenCPN plugin needs no change — both consume the same un-tessellated runs. - style.json gains one line-dasharray layer per analysed LineStyles id plus a line-placed symbol layer per embedded symbol (sprite permitting), filtered on ls_style; lines-solid now excludes ls_style so nothing double-draws. The analysed patterns ride "tile57:linestyles" metadata so a mariner rebuild from the template keeps the layers. - tile57_style_template + the `tile57 style` CLI feed the embedded catalogue's linestyles.json into the style (via bundle.linestylesBytes). The baker's ls_style gate (registry, period >= 0.5 at 2.8345 px/mm) is a strict subset of the ids linestylesJson keeps (period >= 0.5 at 3.7797 px/mm), so no baked run is ever left without a matching layer. Validated: `tile57 style --sprite` emits 64 dasharray line layers + 157 line-placed symbol layers incl. CTNARE51/ENTRES51/NAVARE51/RESARE51/ ACHARE51; the restored Go binding test drives the C ABI template + the BuildStyle mariner-rebuild round-trip through the metadata carrier.
…tlas size The restored linestyleLayers used ICON_SIZE for the symbol layers, but that expression is scale/0.08 read from a per-feature `scale` tile property — and the un-tessellated ls_style runs carry no such property, so it coalesced to 0.08/0.08 = 1.0 (full atlas size). The embedded chevrons/anchors drew ~2.8x too large on the MapLibre path. Pin them to LS_ICON_SIZE = SYMBOL_SCALE/0.08 (≈0.354), the ratio the sprite atlas is sized for, so the style-placed symbols match the tessellated ones (scene/linestyle.zig draws them at SYMBOL_SCALE). Re-applies 042dd5e, which landed after the df39f97 layers this branch restored.
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
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.
Complex (symbolised) linestyles — cables, IALA/caution/restricted-area
boundaries, anchorages — drew as plain solid strokes on chartplotter-go.
Since the bake stores each run un-tessellated (tagged
ls_style) for everyclient to re-walk at its own display scale, the generated MapLibre style is
what turns them into dashes + symbols — but those style layers had been
stripped out earlier, so the runs fell through
lines-solidand lost theirdashes and embedded marks.
Fix (engine-side only — everything renders from
/api/style.json):style.jsongains oneline-dasharraylayer per LineStyles id + asymbol-placement:linelayer per embedded symbol;lines-solidexcludesls_styleso nothing double-draws. Patterns ridetile57:linestylesmetadata so a mariner rebuild keeps them.
SYMBOL_SCALE/0.08(≈0.354), matching thetessellated ones — not the full atlas size.
tile57_style_template+tile57 stylefeed the embedded catalogue'slinestyles in.
Validated:
tile57 style --sprite→ 64 dasharray + 157 symbol layers(CTNARE51/ENTRES51/NAVARE51/RESARE51/ACHARE51); restored Go binding test
covers the C-ABI template +
BuildStyleround-trip.Known follow-up: native and MapLibre use different px-per-mm constants
(2.8345 vs 3.7797), so linestyle spacing differs between the two renderers.