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
Sourcepub fn clip(&self, axis: Axis, k1: T, k2: T) -> BBox<T>where
T: PartialOrd + Copy,
pub fn clip(&self, axis: Axis, k1: T, k2: T) -> BBox<T>where
T: PartialOrd + Copy,
Clips the bounding box along an axis
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
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for BBox<T>where
T: Deserialize<'de> + Copy,
impl<'de, T> Deserialize<'de> for BBox<T>where
T: Deserialize<'de> + Copy,
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl<T: Interpolate> Interpolate for BBox<T>
impl<T: Interpolate> Interpolate for BBox<T>
Source§fn interpolate(&self, other: &Self, t: f64) -> Self
fn interpolate(&self, other: &Self, t: f64) -> Self
Source§impl<T: PartialOrd> PartialOrd for BBox<T>
impl<T: PartialOrd> PartialOrd for BBox<T>
impl<T: Copy> Copy for BBox<T>
impl<T> MValueCompatible for BBox<T>
impl<T> StructuralPartialEq for BBox<T>
Auto Trait Implementations§
impl<T> Freeze for BBox<T>where
T: Freeze,
impl<T> RefUnwindSafe for BBox<T>where
T: RefUnwindSafe,
impl<T> Send for BBox<T>where
T: Send,
impl<T> Sync for BBox<T>where
T: Sync,
impl<T> Unpin for BBox<T>where
T: Unpin,
impl<T> UnwindSafe for BBox<T>where
T: UnwindSafe,
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)