Skip to main content

CustomLayer

Trait CustomLayer 

Source
pub trait CustomLayer {
    // Required methods
    fn name(&self) -> &str;
    fn draw(&self, ctx: &mut DrawContext<'_>);

    // Provided methods
    fn pick(&self, _ctx: &PickContext<'_>) -> Vec<Pick> { ... }
    fn bounds(&self) -> Option<(f64, f64, f64, f64)> { ... }
}
Expand description

Something drawn on the map by your own code.

Required Methods§

Source

fn name(&self) -> &str

A short name, shown when inspecting its features.

Source

fn draw(&self, ctx: &mut DrawContext<'_>)

Add this layer’s lines, fills, markers and labels for the current view.

Provided Methods§

Source

fn pick(&self, _ctx: &PickContext<'_>) -> Vec<Pick>

Features of this layer under ctx.target, most specific first.

Source

fn bounds(&self) -> Option<(f64, f64, f64, f64)>

Lon/lat bounds (west, south, east, north), for fitting the view to the layer.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§