Skip to main content

Layer

Trait Layer 

Source
pub trait Layer: Any {
    // Required methods
    fn handle_input(
        &mut self,
        response: &Response,
        projection: &MapProjection,
    ) -> bool;
    fn draw(&self, painter: &Painter, projection: &MapProjection);
    fn as_any(&self) -> &dyn Any;
    fn as_any_mut(&mut self) -> &mut dyn Any;

    // Provided methods
    fn opacity(&self) -> f32 { ... }
    fn set_opacity(&mut self, _opacity: f32) { ... }
}
Expand description

A trait for map layers.

Required Methods§

Source

fn handle_input( &mut self, response: &Response, projection: &MapProjection, ) -> bool

Handles user input for the layer. Returns true if the input was handled and should not be processed further by the map.

Source

fn draw(&self, painter: &Painter, projection: &MapProjection)

Draws the layer.

Source

fn as_any(&self) -> &dyn Any

Gets the layer as a dyn Any.

Source

fn as_any_mut(&mut self) -> &mut dyn Any

Gets the layer as a mutable dyn Any.

Provided Methods§

Source

fn opacity(&self) -> f32

The opacity of the layer, from 0.0 (completely transparent) to 1.0 (completely opaque).

Source

fn set_opacity(&mut self, _opacity: f32)

Sets the opacity of the layer.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§