pub struct MapProjectionHandle { /* private fields */ }Expand description
Owns one native handle.
A camera view for converting between screen points and coordinates.
See mln_map_projection in the
C API reference.
Implementations§
Source§impl MapProjectionHandle
impl MapProjectionHandle
Sourcepub fn create(view: &MapView) -> Result<MapProjectionHandle>
pub fn create(view: &MapView) -> Result<MapProjectionHandle>
Creates a projection that converts coordinates for one view of a map.
Create it from the view of an MapSnapshot or an RenderFrameResult.
The projection doesn’t follow the map, so create a new one after the
map’s camera or size changes.
See mln_map_projection_create in the
C API reference.
Sourcepub fn get_camera(&self) -> Result<MapProjectionCameraResult>
pub fn get_camera(&self) -> Result<MapProjectionCameraResult>
Reads the projection’s camera.
See mln_map_projection_get_camera in the
C API reference.
Sourcepub fn lat_lng_for_pixel(&self, point: ScreenPoint) -> Result<LatLng>
pub fn lat_lng_for_pixel(&self, point: ScreenPoint) -> Result<LatLng>
Finds the coordinate at a screen point.
The longitude stays between -180 and 180.
See mln_map_projection_lat_lng_for_pixel in the
C API reference.
Sourcepub fn lat_lng_for_pixel_unwrapped(&self, point: ScreenPoint) -> Result<LatLng>
pub fn lat_lng_for_pixel_unwrapped(&self, point: ScreenPoint) -> Result<LatLng>
Finds the coordinate at a screen point, without wrapping its longitude.
The longitude can fall outside -180 to 180, to show which copy of the world the point is in.
See mln_map_projection_lat_lng_for_pixel_unwrapped in the
C API reference.
Sourcepub fn lat_lngs_for_pixels(&self, points: &[ScreenPoint]) -> Result<Vec<LatLng>>
pub fn lat_lngs_for_pixels(&self, points: &[ScreenPoint]) -> Result<Vec<LatLng>>
Finds the coordinates at several screen points, as
MapProjectionHandle::lat_lng_for_pixel() does.
See mln_map_projection_lat_lngs_for_pixels in the
C API reference.
Sourcepub fn lat_lngs_for_pixels_unwrapped(
&self,
points: &[ScreenPoint],
) -> Result<Vec<LatLng>>
pub fn lat_lngs_for_pixels_unwrapped( &self, points: &[ScreenPoint], ) -> Result<Vec<LatLng>>
Finds the coordinates at several screen points, as
MapProjectionHandle::lat_lng_for_pixel_unwrapped() does.
See mln_map_projection_lat_lngs_for_pixels_unwrapped in the
C API reference.
Sourcepub fn meters_per_pixel_at_latitude(&self, latitude: f64) -> Result<f64>
pub fn meters_per_pixel_at_latitude(&self, latitude: f64) -> Result<f64>
Computes how many meters one screen pixel covers at latitude, at the
projection’s zoom.
The result ignores the camera’s pitch.
See mln_map_projection_meters_per_pixel_at_latitude in the
C API reference.
Sourcepub fn pixel_for_lat_lng(&self, coordinate: LatLng) -> Result<ScreenPoint>
pub fn pixel_for_lat_lng(&self, coordinate: LatLng) -> Result<ScreenPoint>
Finds the screen point of a coordinate.
The point is in the copy of the world nearest the camera’s center.
See mln_map_projection_pixel_for_lat_lng in the
C API reference.
Sourcepub fn pixels_for_lat_lngs(
&self,
coordinates: &[LatLng],
) -> Result<Vec<ScreenPoint>>
pub fn pixels_for_lat_lngs( &self, coordinates: &[LatLng], ) -> Result<Vec<ScreenPoint>>
Finds the screen points of several coordinates, as
MapProjectionHandle::pixel_for_lat_lng() does.
See mln_map_projection_pixels_for_lat_lngs in the
C API reference.
Sourcepub fn release(self) -> Result<(), ReleaseError<Self>>
pub fn release(self) -> Result<(), ReleaseError<Self>>
Releases a projection.
See mln_map_projection_release in the
C API reference.
Sourcepub fn set_camera(&self, camera: &CameraOptions) -> Result<()>
pub fn set_camera(&self, camera: &CameraOptions) -> Result<()>
Moves the projection’s camera, without changing the map.
Camera fields that camera doesn’t set keep their values.
See mln_map_projection_set_camera in the
C API reference.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MapProjectionHandle
impl RefUnwindSafe for MapProjectionHandle
impl Send for MapProjectionHandle
impl Sync for MapProjectionHandle
impl Unpin for MapProjectionHandle
impl UnsafeUnpin for MapProjectionHandle
impl UnwindSafe for MapProjectionHandle
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
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more