pub struct View {
pub center: LonLat,
pub zoom: f64,
pub bearing: f64,
pub pitch: f64,
}Expand description
Map camera state.
Fields§
§center: LonLat§zoom: f64Zoom level, fractional allowed.
bearing: f64Bearing in degrees clockwise from north.
pitch: f64Pitch (tilt) in degrees, 0 = top-down.
Implementations§
Source§impl View
impl View
pub fn new(center: LonLat, zoom: f64) -> Self
Sourcepub fn set_pitch(&mut self, pitch: f64)
pub fn set_pitch(&mut self, pitch: f64)
Set pitch in degrees, clamped to [0, 60] like the TS engine.
Sourcepub fn set_bearing(&mut self, bearing: f64)
pub fn set_bearing(&mut self, bearing: f64)
Set bearing, normalized to [0, 360).
Sourcepub fn project(&self, p: LonLat, viewport_w: f64, viewport_h: f64) -> (f64, f64)
pub fn project(&self, p: LonLat, viewport_w: f64, viewport_h: f64) -> (f64, f64)
Convert a lon/lat to screen pixels relative to the view center, given the viewport size. Bearing rotation is applied.
Trait Implementations§
impl Copy for View
impl StructuralPartialEq for View
Auto Trait Implementations§
impl Freeze for View
impl RefUnwindSafe for View
impl Send for View
impl Sync for View
impl Unpin for View
impl UnsafeUnpin for View
impl UnwindSafe for View
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more