Expand description
Drawing layer A layer for freeform drawing on the map.
§Example
use eframe::egui;
use egui_map_view::{layers::drawing::DrawingLayer, layers::drawing::DrawMode, Map, config::OpenStreetMapConfig};
struct MyApp {
map: Map,
}
impl Default for MyApp {
fn default() -> Self {
let mut map = Map::new(OpenStreetMapConfig::default());
map.add_layer("drawing", DrawingLayer::default());
if let Some(drawing_layer) = map.layer_mut::<DrawingLayer>("drawing") {
drawing_layer.draw_mode = DrawMode::Draw;
}
Self { map }
}
}
impl eframe::App for MyApp {
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
egui::CentralPanel::default().show(ctx, |ui| {
ui.add(&mut self.map);
});
}
}Structs§
- Drawing
Layer - Layer implementation that allows the user to draw polylines on the map.
- Polyline
- A polyline on the map.
Enums§
- Draw
Mode - The mode of the
DrawingLayer.