Trait galileo::layer::Layer

source ·
pub trait Layer: MaybeSend + MaybeSync {
    // Required methods
    fn render(&self, view: &MapView, canvas: &mut dyn Canvas);
    fn prepare(&self, view: &MapView);
    fn set_messenger(&mut self, messenger: Box<dyn Messenger>);
    fn as_any(&self) -> &dyn Any;
    fn as_any_mut(&mut self) -> &mut dyn Any;
}
Expand description

Layers specify a data source and the way the data should be rendered to the map.

There are currently 3 types of layers:

Required Methods§

source

fn render(&self, view: &MapView, canvas: &mut dyn Canvas)

Renders the layer to the given canvas.

source

fn prepare(&self, view: &MapView)

Prepares the layer for rendering with the given view. The preparation may include data downloading, decoding or other asynchronous operations which cannot be awaited for during render cycle..

source

fn set_messenger(&mut self, messenger: Box<dyn Messenger>)

Sets the messenger for the layer. Messenger is used to notify the application when the layer thinks it should be updated on the screen.

source

fn as_any(&self) -> &dyn Any

A map stores layers as trait objects. This method can be used to convert the trait object into the concrete type.

source

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

A map stores layers as trait objects. This method can be used to convert the trait object into the concrete type.

Implementations on Foreign Types§

source§

impl<T: Layer + 'static> Layer for Arc<RwLock<T>>

source§

fn render(&self, position: &MapView, canvas: &mut dyn Canvas)

source§

fn prepare(&self, view: &MapView)

source§

fn set_messenger(&mut self, messenger: Box<dyn Messenger>)

source§

fn as_any(&self) -> &dyn Any

source§

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

Implementors§

source§

impl<P, F, S> Layer for FeatureLayer<P, F, S, CartesianSpace2d>
where P: NewCartesianPoint2d + Clone + 'static, F: Feature + MaybeSend + MaybeSync + 'static, F::Geom: Geometry<Point = P>, S: Symbol<F> + MaybeSend + MaybeSync + 'static,

source§

impl<P, F, S> Layer for FeatureLayer<P, F, S, CartesianSpace3d>
where P: NewCartesianPoint3d + 'static, P::Num: AsPrimitive<f32>, F: Feature + MaybeSend + MaybeSync + 'static, F::Geom: Geometry<Point = P>, S: Symbol<F> + MaybeSend + MaybeSync + 'static,

source§

impl<P, F, S> Layer for FeatureLayer<P, F, S, GeoSpace2d>
where P: NewGeoPoint + 'static, F: Feature + MaybeSend + MaybeSync + 'static, F::Geom: Geometry<Point = P>, S: Symbol<F> + MaybeSend + MaybeSync + 'static,

source§

impl<Provider> Layer for RasterTileLayer<Provider>
where Provider: DataProvider<TileIndex, DecodedImage, ()> + MaybeSync + MaybeSend + 'static,

source§

impl<Provider: VectorTileProvider + 'static> Layer for VectorTileLayer<Provider>