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§
Sourcefn handle_input(
&mut self,
response: &Response,
projection: &MapProjection,
) -> bool
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.
Sourcefn draw(&self, painter: &Painter, projection: &MapProjection)
fn draw(&self, painter: &Painter, projection: &MapProjection)
Draws the layer.
Sourcefn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Gets the layer as a mutable dyn Any.
Provided Methods§
Sourcefn opacity(&self) -> f32
fn opacity(&self) -> f32
The opacity of the layer, from 0.0 (completely transparent) to 1.0 (completely opaque).
Sourcefn set_opacity(&mut self, _opacity: f32)
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".