pub struct BBox { /* private fields */ }Expand description
A Bounding box
Implementations§
Source§impl BBox
impl BBox
Sourcepub fn new(top: f32, left: f32, bottom: f32, right: f32) -> Option<BBox>
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
Sourcepub fn new_from_points(topleft: &LatLon, bottomright: &LatLon) -> BBox
pub fn new_from_points(topleft: &LatLon, bottomright: &LatLon) -> BBox
Given two points, return the bounding box specified by those 2 points
Sourcepub fn new_from_tile(tile: &Tile) -> Self
pub fn new_from_tile(tile: &Tile) -> Self
Construct a BBox from a tile
Sourcepub fn contains_point(&self, point: &LatLon) -> bool
pub fn contains_point(&self, point: &LatLon) -> bool
Return true iff this point is in this bbox
Sourcepub fn overlaps_bbox(&self, other: &BBox) -> bool
pub fn overlaps_bbox(&self, other: &BBox) -> bool
Returns true iff this bbox and other share at least one point
Sourcepub fn tiles(&self) -> BBoxTilesIterator<'_> ⓘ
pub fn tiles(&self) -> BBoxTilesIterator<'_> ⓘ
Iterate over all the tiles from z0 onwards that this bbox is in
Sourcepub fn metatiles(&self, scale: u8) -> MetatilesIterator ⓘ
pub fn metatiles(&self, scale: u8) -> MetatilesIterator ⓘ
Iterate over all the metatiles from z0 onwards that this bbox is in
Sourcepub fn tiles_for_zoom(&self, zoom: u8) -> impl Iterator<Item = Tile>
pub fn tiles_for_zoom(&self, zoom: u8) -> impl Iterator<Item = Tile>
For this zoom level, return all the tiles that cover this bbox
Sourcepub fn centre_point(&self) -> LatLon
pub fn centre_point(&self) -> LatLon
Returns the LatLon for the centre of this bbox
Sourcepub fn center_point(&self) -> LatLon
pub fn center_point(&self) -> LatLon
Returns the LatLon for the centre of this bbox
Sourcepub fn nw_corner(&self) -> LatLon
pub fn nw_corner(&self) -> LatLon
Returns the LatLon of the top left, i.e. north west corner, of this bbot
Sourcepub fn ne_corner(&self) -> LatLon
pub fn ne_corner(&self) -> LatLon
Returns the LatLon of the top right, i.e. north east corner, of this bbox