pub struct BBox<T = f64> {
pub left: T,
pub bottom: T,
pub right: T,
pub top: T,
}Expand description
A BBOX is defined in lon-lat space and helps with zooming motion to see the entire line or polygon The order is (left, bottom, right, top) If WM, then the projection is lon-lat If S2, then the projection is s-t
Fields§
§left: Tleft most longitude (WM) or S (S2)
bottom: Tbottom most latitude (WM) or T (S2)
right: Tright most longitude (WM) or T (S2)
top: Ttop most latitude (WM) or S (S2)
Implementations§
Source§impl<T> BBox<T>
impl<T> BBox<T>
Sourcepub fn point_overlap<P: GetXY>(&self, point: &P) -> bool
pub fn point_overlap<P: GetXY>(&self, point: &P) -> bool
Checks if a point is within the BBox
Sourcepub fn merge(&self, other: &Self) -> Selfwhere
T: PartialOrd + Copy,
pub fn merge(&self, other: &Self) -> Selfwhere
T: PartialOrd + Copy,
Merges another bounding box with this one
Sourcepub fn merge_in_place(&mut self, other: &Self)where
T: PartialOrd + Copy,
pub fn merge_in_place(&mut self, other: &Self)where
T: PartialOrd + Copy,
Merges in place another bounding box with this one
Sourcepub fn overlap(&self, other: &BBox<T>) -> Option<BBox<T>>where
T: PartialOrd + Copy,
pub fn overlap(&self, other: &BBox<T>) -> Option<BBox<T>>where
T: PartialOrd + Copy,
Checks if another bounding box overlaps with this one and returns the overlap
Source§impl BBox<f64>
impl BBox<f64>
Sourcepub fn from_point<P: GetXY>(point: &P) -> Self
pub fn from_point<P: GetXY>(point: &P) -> Self
Creates a new BBox from a point
Sourcepub fn from_linestring<P: GetXY>(line: &[P]) -> Self
pub fn from_linestring<P: GetXY>(line: &[P]) -> Self
Creates a new BBox from a linestring
Sourcepub fn from_multi_linestring<P: GetXY>(lines: &[Vec<P>]) -> Self
pub fn from_multi_linestring<P: GetXY>(lines: &[Vec<P>]) -> Self
Creates a new BBox from a multi-linestring
Sourcepub fn from_polygon<P: GetXY>(polygon: &[Vec<P>]) -> Self
pub fn from_polygon<P: GetXY>(polygon: &[Vec<P>]) -> Self
Creates a new BBox from a polygon
Sourcepub fn from_multi_polygon<P: GetXY>(polygons: &[Vec<Vec<P>>]) -> Self
pub fn from_multi_polygon<P: GetXY>(polygons: &[Vec<Vec<P>>]) -> Self
Creates a new BBox from a multi-polygon
Sourcepub fn extend_from_point<P: GetXY>(&mut self, point: &P)
pub fn extend_from_point<P: GetXY>(&mut self, point: &P)
Extends the bounding box with a point
Sourcepub fn from_uv_zoom(u: f64, v: f64, zoom: u8) -> Self
pub fn from_uv_zoom(u: f64, v: f64, zoom: u8) -> Self
Creates a new BBox from zoom-uv coordinates
Sourcepub fn from_st_zoom(s: f64, t: f64, zoom: u8) -> Self
pub fn from_st_zoom(s: f64, t: f64, zoom: u8) -> Self
Creates a new BBox from zoom-st coordinates