DrawableEntity

sealed interface DrawableEntity

The common contract every shape a user can draw must satisfy: it has a stable id and a visual style, and may carry a description and a zIndex. Code that manages entities generically (repository, undo/redo history, rendering) depends only on this contract, never on a specific shape type.

Sealed so the compiler can guarantee every when over a DrawableEntity handles all known shape kinds (see DrawnPolygon, DrawnPolyline, DrawnMarker) — adding a new shape type later will surface every place that needs updating as a compile error.

Inheritors

Properties

Link copied to clipboard
abstract val description: String?

Free text about the shape (what it is, a source, a note), for the host to show where it likes, for example in a popup when the shape is tapped. The library only keeps it: nothing is drawn from it. null is no description.

Link copied to clipboard
abstract val id: EntityId

The id that names this shape, stable for as long as it exists.

Link copied to clipboard
abstract val properties: Map<String, String>

Data attached to the shape, as named values: what a GeoJSON feature's properties or a KML placemark's ExtendedData hold (a population, a country code, a year, a source). The library only keeps it, it is not drawn, and it is carried through the file formats: nothing in it means anything to the engine, so a host may put what it needs there. Values are text; a number or a flag read from a file comes in as its text (5000000, true) and goes back out as a text. Empty when there is none.

Link copied to clipboard
abstract val style: ShapeStyle

How the shape looks (see ShapeStyle for what it means for each kind of shape).

Link copied to clipboard
abstract val zIndex: Int

Where the shape lies in the drawing order: a shape with a higher number is drawn over one with a lower number, whatever kind each of them is. Shapes with the same number keep the order of their kinds (polygons below lines below markers) and, within a kind, the order they were added in. A tap on a place where shapes overlap reaches the one that is drawn on top.

Functions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

This shape with another zIndex (see DrawableEntity.zIndex).