pub struct Transform { /* private fields */ }Implementations§
Source§impl Transform
impl Transform
pub fn new(constrain_mode: ConstrainMode, viewport_mode: ViewportMode) -> Self
Sourcepub fn drain_events(&mut self) -> Drain<'_, TransformEvent> ⓘ
pub fn drain_events(&mut self) -> Drain<'_, TransformEvent> ⓘ
Drains what the transform reported since the last call, oldest first. The transform keeps its buffer for what it reports next.
Sourcepub fn has_events(&self) -> bool
pub fn has_events(&self) -> bool
Whether the transform reported something that
drain_events hasn’t drained.
pub fn resize(&mut self, size: Size) -> Result<(), Error>
Sourcepub fn get_camera_options(&self, padding: Option<EdgeInsets>) -> CameraOptions
pub fn get_camera_options(&self, padding: Option<EdgeInsets>) -> CameraOptions
Returns the current camera options.
Sourcepub fn jump_to(&mut self, camera: &CameraOptions) -> CameraCommandId
pub fn jump_to(&mut self, camera: &CameraOptions) -> CameraCommandId
Change any combination of center, zoom, bearing, and pitch, without a transition. Omitted options keep their current animations.
Sourcepub fn ease_to(
&mut self,
camera: &CameraOptions,
animation: &AnimationOptions,
) -> CameraCommandId
pub fn ease_to( &mut self, camera: &CameraOptions, animation: &AnimationOptions, ) -> CameraCommandId
Change any combination of center, zoom, bearing, pitch and edgeInsets, with a smooth animation between old and new values. Omitted options keep their current animations and timing.
Sourcepub fn move_by(
&mut self,
offset: &ScreenCoordinate,
animation: &AnimationOptions,
) -> Result<CameraCommandId, Error>
pub fn move_by( &mut self, offset: &ScreenCoordinate, animation: &AnimationOptions, ) -> Result<CameraCommandId, Error>
Pans the map by the given amount.
Fails with ErrorKind::InvalidArgument for a NaN
or infinite offset.
Sourcepub fn move_by_with_anchor(
&mut self,
offset: &ScreenCoordinate,
anchor: Option<ScreenCoordinate>,
animation: &AnimationOptions,
) -> Result<CameraCommandId, Error>
pub fn move_by_with_anchor( &mut self, offset: &ScreenCoordinate, anchor: Option<ScreenCoordinate>, animation: &AnimationOptions, ) -> Result<CameraCommandId, Error>
Moves the map by offset. A drag on the globe turns the planet so
that the location under anchor follows the cursor. With the bearing
held, steps that follow one another, each starting at the anchor of
the one before with the camera as it left it, hold the location the
first of them grabbed, wherever
VerticalPerspectiveProjection::drag_center_holding has a center
that does. Fails as move_by does.
pub fn get_lat_lng(&self, wrap: WrapMode) -> LatLng
pub fn set_lat_lng_bounds(&mut self, bounds: LatLngBounds) -> Result<(), Error>
pub fn set_max_pitch(&mut self, max_pitch: f64)
pub fn get_pitch(&self) -> f64
pub fn set_projection_definition(&mut self, definition: &ProjectionDefinition)
pub fn set_constrain_mode(&mut self, mode: ConstrainMode)
pub fn set_viewport_mode(&mut self, mode: ViewportMode)
Sourcepub fn in_transition(&self) -> bool
pub fn in_transition(&self) -> bool
Whether any camera command is still animating.
Sourcepub fn update_transitions(&mut self, now: Option<Instant>)
pub fn update_transitions(&mut self, now: Option<Instant>)
Moves the camera to where its commands are at now, and ends the
ones that have run out; None, for a map without a clock, ends them all.
Sourcepub fn set_frame_time(&mut self, time: Option<Instant>)
pub fn set_frame_time(&mut self, time: Option<Instant>)
Puts the camera’s animations on the host’s frame clock: commands start
at the latest frame’s time rather than at Instant::now() when they are
made, and the map samples them at it. Each frame then shows its
animations exactly one frame further on, whenever the input or the
map’s update ran, and an animation started between frames moves by
that frame’s interval on the next one: no frame repeats the
camera, and none skips ahead. None goes back to Instant::now().
Orbis starts animations on the first frame after the call, which keeps the camera still for that frame; a glide that continues a drag would pause there.
Sourcepub fn cancel_transitions_with_id(&mut self, transition_id: u64) -> bool
pub fn cancel_transitions_with_id(&mut self, transition_id: u64) -> bool
Cancels the commands whose AnimationOptions::transition_id equals
transition_id, leaves the others running, and returns whether any
command ended.
Sourcepub fn close(&mut self)
pub fn close(&mut self)
Ends the running commands as closed, without a camera change. A map’s owner calls it before it drops the map, so that it hears every command’s end.
Sourcepub fn apply_camera_delta(
&mut self,
delta: &CameraDelta,
) -> Result<CameraCommandId, CameraError>
pub fn apply_camera_delta( &mut self, delta: &CameraDelta, ) -> Result<CameraCommandId, CameraError>
Moves the camera relative to where it is, as a gesture does
(the C API’s mln_map_apply_camera_delta). See
CameraDelta.
Sourcepub fn update_camera(&mut self, update: &CameraUpdate) -> CameraCommandId
pub fn update_camera(&mut self, update: &CameraUpdate) -> CameraCommandId
Moves the camera to absolute values, as a command or a gesture
(the C API’s mln_map_update_camera). See CameraUpdate.
pub fn is_gesture_in_progress(&self) -> bool
pub fn get_state(&self) -> &TransformState
pub fn lat_lng_to_screen_coordinate(&self, lat_lng: &LatLng) -> ScreenCoordinate
Sourcepub fn screen_coordinate_to_lat_lng(
&self,
point: &ScreenCoordinate,
wrap_mode: WrapMode,
) -> Result<LatLng, Error>
pub fn screen_coordinate_to_lat_lng( &self, point: &ScreenCoordinate, wrap_mode: WrapMode, ) -> Result<LatLng, Error>
The location under point, in screen coordinates (y down).
Fails with ErrorKind::InvalidArgument for a NaN
or infinite point.
Auto Trait Implementations§
impl !Freeze for Transform
impl !RefUnwindSafe for Transform
impl !Send for Transform
impl !Sync for Transform
impl !UnwindSafe for Transform
impl Forget for Transform
impl Move for Transform
impl Unpin for Transform
impl UnsafeUnpin for Transform
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> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.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 moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.