pub struct Transform { /* private fields */ }Implementations§
Source§impl Transform
impl Transform
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.
Source§impl Transform
impl Transform
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
Source§impl Transform
impl Transform
Sourcepub fn set_terrain(&mut self, terrain: Option<TerrainGround>)
pub fn set_terrain(&mut self, terrain: Option<TerrainGround>)
Sets the terrain the camera stands on, or None without terrain,
which turns off every rule of the camera over terrain. Once the
terrain goes, the view fits the flat map again, a clamped center
goes to sea level, keeping its location and zoom, and a gesture
holds the altitude from where that leaves it.
Sourcepub fn follow_terrain(&mut self) -> bool
pub fn follow_terrain(&mut self) -> bool
Moves the camera onto the terrain’s ground. While there is ground, the view’s near and far planes fit the lowest ground of the tile under the center, and a camera at rest whose center is clamped stands on the ground there, unless it is still loading. A camera that a command moves takes the altitude its frames give it, which ease onto the ground, and a gesture that holds the altitude lifts it just over the ground as it is now, eye and near plane. Once there is no ground, the planes fit the flat map again, and a clamped center goes back to sea level, once.
At rest it reads only the height and floor at the center
(Elevation::at and Elevation::min_at), which are what the
renderer compares to tell whether a frame’s camera stood on its
newest ground. The terrain moves the camera, not a command, so this
reports no camera change. Returns whether the view changed.
Source§impl Transform
impl Transform
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 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.
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 camera_options(&self, padding: Option<EdgeInsets>) -> CameraOptions
pub fn 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 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. The ground under
the cursor before the move follows it, on the plane at that ground’s
height, or on the globe the sphere: sea level on the flat map, the
drawn ground over terrain (Self::set_terrain); without an anchor,
or with one that grabs no ground, the map moves on the plane or the
sphere at the center’s altitude. On the globe, 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.
Sourcepub fn set_limits(&mut self, limits: CameraLimits) -> Result<(), Error>
pub fn set_limits(&mut self, limits: CameraLimits) -> Result<(), Error>
Sets the limits the camera moves within (see
TransformState::set_limits).
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 set_center_clamped_to_ground(&mut self, clamped: bool)
pub fn set_center_clamped_to_ground(&mut self, clamped: bool)
Sets whether the center stands on the terrain. The map hands the
setting to set_terrain on its next update.
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 is_camera_moving(&self) -> bool
pub fn is_camera_moving(&self) -> bool
Whether a gesture or a command moves the camera: the renderer draws such frames for speed rather than crispness.
pub fn 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 !RefUnwindSafe for Transform
impl !Send for Transform
impl !Sync for Transform
impl !UnwindSafe for Transform
impl Forget for Transform
impl Freeze 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.