fix(data): apply StyleMap styles and fix four KML and GeoJSON style bugs - #1809
Merged
Merged
Conversation
- KmlLayer resolved StyleMap entries with their leading '#' while shared styles are keyed by bare id, so placemarks styled through a StyleMap were unstyled. - KmlLayer no longer throws on a shared Style or StyleMap without an id; they are skipped since nothing can reference them. - KmlLayer no longer throws on a GroundOverlay without a LatLonBox (for example gx:LatLonQuad); the overlay is skipped with a warning. - GeoJsonLineStringStyle.toPolylineOptions now keeps the pattern and the start and end caps. - KmlStyle random icon color mode now randomizes the marker color instead of its hue, so markers keep their color family. The regression tests from the data coverage tests are no longer ignored.
Contributor
Code Coverage
Files
|
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.
Summary
Fixes the five bugs documented by the tests in #1808. Stacked on #1808; GitHub will retarget this to
mainonce that merges. Each fix removes the matching@Ignore, so the tests that documented the bugs are now the regression tests.KmlLayerresolved a placemark's StyleMap to the normalstyleUrlwith its leading#("#red"), but shared styles are keyed by bare id ("red"), so placemarks styled through a StyleMap were unstyled. Google Earth exports put a StyleMap on almost every placemark.getStyleIdFromMapstill returns the URL as written ("#red").<Style>or<StyleMap>without anid. They are skipped, since nothing can reference them.<GroundOverlay>without a<LatLonBox>(for examplegx:LatLonQuad, which Google Earth writes for rotated overlays). The overlay is skipped with a log warning; drawing the quad's bounding box would show a rotated image unrotated and stretched.GeoJsonLineStringStyle.toPolylineOptionskeeps the pattern and caps. InsidePolylineOptions().apply { }, the unqualifiedgetPattern()and cap getters resolved to the new options instead of the style.KmlStylerandom icon color mode randomizes the color, not the hue. It passed the hue (0 to 360) tocomputeRandomColor, which expects ARGB, so a green marker turned blue. The style now keeps the marker's ARGB color (KML's default white when none is set).Bugs 2 and 3 are reachable with user-supplied KML.
Testing
./gradlew :data:testDebugUnitTest :data:apiCheck :data:lintDebug: 187 tests, 0 failures, 0 skipped (the five previously ignored tests now pass). The public API is unchanged.BEGIN_COMMIT_OVERRIDE
fix(data): apply styles referenced through a KML StyleMap
fix(data): do not crash on a KML Style or StyleMap without an id
fix(data): do not crash on a KML GroundOverlay without a LatLonBox
fix(data): keep the pattern and caps in GeoJsonLineStringStyle.toPolylineOptions
fix(data): randomize the marker color, not its hue, in KML random icon color mode
END_COMMIT_OVERRIDE