pub struct MapView {
pub center: Signal<LngLat>,
pub zoom: Signal<f64>,
pub bearing: Signal<f64>,
pub status: Signal<MapStatus>,
pub attribution: Signal<String>,
pub markers: Signal<Vec<(MarkerId, Marker)>>,
pub tap: Signal<Option<MapTap>>,
pub overlays: Signal<Vec<Overlay>>,
pub interaction: Signal<Interaction>,
pub request: Signal<Option<CameraRequest>>,
/* private fields */
}Expand description
The state of a map, shared between the piece and the app: where it looks and how close, which the app sets to move the map and reads to learn where the user took it, plus what the piece reports back about loading and drawing.
Fields§
§center: Signal<LngLat>Center in WGS84 degrees; longitude comes first.
zoom: Signal<f64>Web Mercator zoom with a 512-point world at zoom zero. Providers clamp to their limits.
bearing: Signal<f64>Clockwise heading in degrees; zero is north.
status: Signal<MapStatus>Provider loading state. Failure details are diagnostic, not localized UI text.
attribution: Signal<String>Provider credits, when supplied as text. Native SDKs retain their attribution controls.
markers: Signal<Vec<(MarkerId, Marker)>>Ordered annotations. Prefer the marker methods to preserve stable identities.
tap: Signal<Option<MapTap>>Last map or marker tap. Native SDKs may reserve double taps for zooming.
overlays: Signal<Vec<Overlay>>Geometry drawn above the basemap and below annotations, in list order.
interaction: Signal<Interaction>Which user camera gestures are enabled; programmatic moves remain available.
request: Signal<Option<CameraRequest>>Provider-facing command stream. Observe serial numbers; do not replay on remount.
Implementations§
Source§impl MapView
impl MapView
pub fn new(center: LngLat, zoom: f64) -> MapView
Sourcepub fn add_marker(&self, marker: Marker) -> MarkerId
pub fn add_marker(&self, marker: Marker) -> MarkerId
Put a marker on the map.
Sourcepub fn update_marker(&self, id: MarkerId, marker: Marker) -> bool
pub fn update_marker(&self, id: MarkerId, marker: Marker) -> bool
Replace a marker in place, keeping its id: a new title or position. false when id
is no longer on the map.
Sourcepub fn remove_marker(&self, id: MarkerId)
pub fn remove_marker(&self, id: MarkerId)
Take a marker off the map.
pub fn clear_markers(&self)
Sourcepub fn marker(&self, id: MarkerId) -> Option<Marker>
pub fn marker(&self, id: MarkerId) -> Option<Marker>
The marker with id, if it is still on the map.
Sourcepub fn fly_to(&self, center: LngLat, zoom: f64)
pub fn fly_to(&self, center: LngLat, zoom: f64)
Animate to center at zoom. The canvas renderer uses a one-second flight; native SDKs
choose their own trajectory and may approximate the requested duration.
Sourcepub fn fly_to_with(
&self,
center: LngLat,
zoom: f64,
bearing: Option<f64>,
duration: f64,
)
pub fn fly_to_with( &self, center: LngLat, zoom: f64, bearing: Option<f64>, duration: f64, )
MapView::fly_to with the bearing to arrive at (None keeps the current one) and
the requested duration in seconds; 0.0 jumps. MapKit uses its standard animation
timing for positive durations.
Sourcepub fn fit_bounds(&self, sw: LngLat, ne: LngLat, padding: f64)
pub fn fit_bounds(&self, sw: LngLat, ne: LngLat, padding: f64)
Glide to the north-up view that shows the box from sw to ne whole, with padding
points kept clear on every side.
Sourcepub fn rotate_to(&self, bearing: f64)
pub fn rotate_to(&self, bearing: f64)
Turn to bearing degrees (clockwise, 0.0 north up) over half a second, the position
at the center held.
Sourcepub fn reset_north(&self)
pub fn reset_north(&self)
Turn back to north up.
Sourcepub fn jump_to_with(&self, center: LngLat, zoom: f64, bearing: f64)
pub fn jump_to_with(&self, center: LngLat, zoom: f64, bearing: f64)
MapView::jump_to with the bearing too (0.0 is north up).