fix(SurfaceAttributes): parse multi-channel attribute layer ranges - #2
Open
haraldsteinlechner wants to merge 1 commit into
Open
fix(SurfaceAttributes): parse multi-channel attribute layer ranges#2haraldsteinlechner wants to merge 1 commit into
haraldsteinlechner wants to merge 1 commit into
Conversation
ChannelsDefinedRange / ChannelsActualRange of a Map attribute layer were read with Range1d.Parse, which only understands a single "[min, max]". Multi-channel layers (normals, gravity vectors, lon/lat/radius) declare one range per channel: [[-0.000039896, 0.000040985], [-0.000046144, 0.000046183], [-0.000050788, 0.000050736]] so parsing threw and the whole *.opcx failed to load. Both forms are accepted now. ScalarLayer has room for exactly one Range1d and its consumers refer to the layer's first channel - the false colour legend, and mapping sampled texture values back to physical ones, since attribute textures are read through ChannelReference.ChannelWithIndex 0 - so the first channel's range is kept. Unioning the channels would widen it (by ~25% for the Gravity layer above) and skew everything derived from it. An unparsable range now fails with the layer name and the offending text instead of Range1d.Parse's opaque error.
This was referenced Aug 13, 2026
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.
Fixes #1.
SurfaceAttributes.parseMapread aMapattribute layer's range withRange1d.Parse, which only understands a single[min, max]. Multi-channel layers declare one range per channel:so parsing threw and the whole
*.opcxfailed to load. Both forms are accepted now.Which range is kept
ScalarLayerhas room for exactly oneRange1d, and its consumers refer to the layer's first channel — the false-colour legend, and mapping sampled texture values back to physical ones (attribute textures are read throughChannelReference.ChannelWithIndex 0). So the first channel's range is kept. Unioning the channels would widen it — by ~25% for theGravitylayer above — and skew everything derived from it.parseChannelRangesis public, so callers that need all channels can get them.An unparsable range now fails with the layer name and the offending text rather than
Range1d.Parse's opaque error.Verification
OPCViewer.Basebuilds. The equivalent change was verified in PRo3D, which carries a copy of this module: fed the unpatched*.opcxof a HERA/Dimorphos DTM export, the parser now yields ranges identical to the hand-patched file, layer for layer —There is no test project in this repo; the covering tests live in PRo3D (
OpcSidecarTests.opcx attribute layers) and include the single-channel form, the multi-channel form, and an unparsable range.