Skip to content

refactor: make MultiCOGLayer extend RasterTileLayer - #499

Merged
kylebarron merged 5 commits into
mainfrom
kyle/multi-cog-extends-raster-tile-layer
May 4, 2026
Merged

kylebarron merged 5 commits into
mainfrom
kyle/multi-cog-extends-raster-tile-layer

Conversation

@kylebarron

@kylebarron kylebarron commented May 1, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Migrate MultiCOGLayer to extend RasterTileLayer instead of CompositeLayer. Drops ~165 lines of duplicated wiring (globe/mercator branching, signal combining, RasterLayer construction, RasterTileset2D factory subclass) — all already provided by RasterTileLayer.
  • Multi-source fetch + stitch + UV transform logic stays in MultiCOGLayer._getTileData (now consuming the base's combined options.signal instead of recomposing).
  • Rich per-band debug overlay (per-source tile outlines + tiered text labels) moves to a new protected _renderExtraSubLayers(tile, data) hook on RasterTileLayer that subclasses can override; default returns [].
  • No public API change. MultiCOGLayerProps and runtime behavior unchanged.

Spec: dev-docs/specs/2026-05-01-multi-cog-layer-extends-raster-tile-layer-design.md

See #417. First of three planned PRs (this one is the mechanical refactor; follow-ups will add the new getTileData/renderTile extension points and an NLCD animation example).

kylebarron and others added 3 commits May 1, 2026 12:02
Refs #417.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Adds a protected hook returning [] by default. Subclasses (next commit:
MultiCOGLayer) override it to render per-tile overlays that depend on the
fetched DataT, without overriding _renderSubLayers itself.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Drops ~165 lines of duplicated wiring (globe/mercator branching, signal
combining, RasterLayer construction, RasterTileset2D factory subclass)
that RasterTileLayer already provides. Multi-source fetch + stitch logic
stays in _getTileData (now consuming options.signal); rich per-band debug
overlay moves to the new _renderExtraSubLayers hook on the base class.
Public API unchanged.

Refs #417.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
kylebarron and others added 2 commits May 4, 2026 12:29
…t outline into it

Renames _renderExtraSubLayers -> _renderDebug and pulls the previously-
inline renderDebugTileOutline call into the hook's default body. Subclasses
that want to extend the debug overlay can now call super._renderDebug(...)
to get the primary outline, or override entirely. The hook is gated by
props.debug in the base, so subclass implementations don't repeat the check.

Side benefit: removes a minor regression where MultiCOGLayer was double-
stamping the primary tile outline (base inline + its own _renderDebugLayers
both drew it). The override now falls back to super for loading states and
delegates to _renderDebugLayers (which carries the rich per-band overlay)
once data is available.

The hook signature accepts data as DataT | null since it now fires
pre-data-arrival as well, so the default outline still renders during
loading.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@kylebarron kylebarron changed the title refactor: MultiCOGLayer extends RasterTileLayer refactor: make MultiCOGLayer extend RasterTileLayer May 4, 2026
@kylebarron
kylebarron enabled auto-merge (squash) May 4, 2026 17:32
@kylebarron
kylebarron merged commit c54ed06 into main May 4, 2026
6 checks passed
@kylebarron
kylebarron deleted the kyle/multi-cog-extends-raster-tile-layer branch May 4, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant