`KMLDataSource` should allow customization of default styles similar to `GeoJsonDataSource`
- Dominant language
- JavaScript
- Stars
- 15.8k
- Forks
- 3.9k
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 34
Description
The `load` method for `GeoJsonDataSource` takes a number of options that related to style defaults -- marker size, color, and symbol, stroke and fill options, etc. The current implementation for KML hard codes a lot of this and doesn't expose any way to override them -- [the code](https://github.com/CesiumGS/cesium/blob/master/Source/DataSources/KmlDataSource.js) has *nine* instances of the string `Color.WHITE`, for example, and billboards are built around a constant called `BILLBOARD_SIZE` that can't be modified. Technically, these properties can be modified after the fact by altering entities in the collection, but only by taking some liberties guessing what might have been derived from a default instead of specified in the source document. (My current workaround actually grabs the private `_pinBuilder`, because the only way to tell if the billboard is a default is to do an equality-comparison against the cached canvas!)
The original code wasn't really written with customization in mind (and is over 4k LOC in a single file!) so I haven't taken a crack at this myself yet. My fast-and-lose workaround lets me apply some customizations in a way that works well enough, for me, for now, but if anybody ever gets around to refactoring it, I'd like for them to keep this in mind.
Contributor guide
Research direction
Start with Source/DataSources/KmlDataSource.js and compare its load behavior with GeoJsonDataSource's style options. Define the customization scope and API for KML defaults, including Color.WHITE and BILLBOARD_SIZE, then add coverage showing defaults can be overridden without replacing styles explicitly specified in the KML document.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100