Skip to content

KMLDataSource should allow customization of default styles similar to GeoJsonDataSource #9277

Open
@thw0rted

Description

@thw0rted

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 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions