pub struct Bounds {
pub ne_corner: Position,
pub sw_corner: Position,
}
Expand description
Represents a geographical area defined by its northeast and southwest corners.
The Bounds
struct is used to define rectangular areas on a map. It provides methods to calculate
the center, size, and check for containment or intersection with other bounds.
§Fields
ne_corner
: The northeast corner of the bounds.sw_corner
: The southwest corner of the bounds.
Fields§
§ne_corner: Position
§sw_corner: Position
Implementations§
Source§impl Bounds
impl Bounds
Sourcepub fn new(ne_corner: Position, sw_corner: Position) -> Self
pub fn new(ne_corner: Position, sw_corner: Position) -> Self
Creates a new Bounds
instance with the given northeast and southwest corners.
§Arguments
ne_corner
: The northeast corner of the bounds.sw_corner
: The southwest corner of the bounds.
Sourcepub fn get_center(&self) -> Position
pub fn get_center(&self) -> Position
Gets the center of the bounds.
Sourcepub fn get_bottom_left(&self) -> Position
pub fn get_bottom_left(&self) -> Position
Gets the southwest corner of the bounds.
Sourcepub fn get_top_right(&self) -> Position
pub fn get_top_right(&self) -> Position
Gets the northeast corner of the bounds.
Sourcepub fn get_top_left(&self) -> Position
pub fn get_top_left(&self) -> Position
Gets the northwest corner of the bounds.
Sourcepub fn get_bottom_right(&self) -> Position
pub fn get_bottom_right(&self) -> Position
Gets the southeast corner of the bounds.
Sourcepub fn contains(&self, position: Position) -> bool
pub fn contains(&self, position: Position) -> bool
Returns true if the rectangle contains the given bounds. A rectangle contains another bounds if it contains all of its points.
§Arguments
position
: The position to check for containment.
Sourcepub fn intersects(&self, other: Bounds) -> bool
pub fn intersects(&self, other: Bounds) -> bool
Returns true if the rectangle intersects the given bounds. Two bounds intersect if they have at least one point in common.
§Arguments
other
: The bounds to check for intersection.
Sourcepub fn overlaps(&self, other: Bounds) -> bool
pub fn overlaps(&self, other: Bounds) -> bool
Returns true if the rectangle overlaps the given bounds. Two bounds overlap if their intersection is an area.
§Arguments
other
: The bounds to check for overlap.
Sourcepub fn equals(&self, other: Bounds) -> bool
pub fn equals(&self, other: Bounds) -> bool
Checks if the bounds are equal to the given bounds.
pub fn as_lat_lng_bounds(&self) -> LatLngBounds
Trait Implementations§
Source§impl From<&Bounds> for LatLngBounds
impl From<&Bounds> for LatLngBounds
Source§impl From<Bounds> for LatLngBounds
impl From<Bounds> for LatLngBounds
impl Copy for Bounds
impl StructuralPartialEq for Bounds
Auto Trait Implementations§
impl Freeze for Bounds
impl RefUnwindSafe for Bounds
impl Send for Bounds
impl Sync for Bounds
impl Unpin for Bounds
impl UnwindSafe for Bounds
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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