Skip to main content

BBox

Struct BBox 

Source
pub struct BBox { /* private fields */ }
Expand description

A Bounding box

Implementations§

Source§

impl BBox

Source

pub fn new(top: f32, left: f32, bottom: f32, right: f32) -> Option<BBox>

Construct a new BBox from the given max and min latitude and longitude. Returns None if the lat or lon is invalid, e.g. a lon of 200

Source

pub fn new_from_points(topleft: &LatLon, bottomright: &LatLon) -> BBox

Given two points, return the bounding box specified by those 2 points

Source

pub fn new_from_tile(tile: &Tile) -> Self

Construct a BBox from a tile

Source

pub fn contains_point(&self, point: &LatLon) -> bool

Return true iff this point is in this bbox

Source

pub fn overlaps_bbox(&self, other: &BBox) -> bool

Returns true iff this bbox and other share at least one point

Source

pub fn tiles(&self) -> BBoxTilesIterator<'_>

Iterate over all the tiles from z0 onwards that this bbox is in

Source

pub fn metatiles(&self, scale: u8) -> MetatilesIterator

Iterate over all the metatiles from z0 onwards that this bbox is in

Source

pub fn top(&self) -> f32

Return the top value of this bbox

Source

pub fn bottom(&self) -> f32

Return the bottom value of this bbox

Source

pub fn left(&self) -> f32

Return the left value of this bbox

Source

pub fn right(&self) -> f32

Return the right value of this bbox

Source

pub fn tiles_for_zoom(&self, zoom: u8) -> impl Iterator<Item = Tile>

For this zoom level, return all the tiles that cover this bbox

Source

pub fn centre_point(&self) -> LatLon

Returns the LatLon for the centre of this bbox

Source

pub fn center_point(&self) -> LatLon

Returns the LatLon for the centre of this bbox

Source

pub fn nw_corner(&self) -> LatLon

Returns the LatLon of the top left, i.e. north west corner, of this bbot

Source

pub fn ne_corner(&self) -> LatLon

Returns the LatLon of the top right, i.e. north east corner, of this bbox

Source

pub fn sw_corner(&self) -> LatLon

Returns the LatLon of the bottom left, i.e. south west corner, of this bbox

Source

pub fn se_corner(&self) -> LatLon

Returns the LatLon of the bottom right, i.e. south east corner, of this bbox.

Trait Implementations§

Source§

impl Clone for BBox

Source§

fn clone(&self) -> BBox

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BBox

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromStr for BBox

Source§

fn from_str(string: &str) -> Result<Self, Self::Err>

Given a string like “$MINLON $MINLAT $MAXLON $MAXLAT” parse that into a BBox. Returns None if there is no match.

Source§

type Err = &'static str

The associated error which can be returned from parsing.
Source§

impl PartialEq for BBox

Source§

fn eq(&self, other: &BBox) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for BBox

Auto Trait Implementations§

§

impl Freeze for BBox

§

impl RefUnwindSafe for BBox

§

impl Send for BBox

§

impl Sync for BBox

§

impl Unpin for BBox

§

impl UnsafeUnpin for BBox

§

impl UnwindSafe for BBox

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.