pub struct BBox {
pub west: f64,
pub south: f64,
pub east: f64,
pub north: f64,
}
Expand description
Bounding box struct
Fields§
§west: f64
west/left boundary
south: f64
south/bottom boundary
east: f64
east/right boundary
north: f64
north/top boundary
Implementations§
Source§impl BBox
impl BBox
Sourcepub fn world_planet() -> Self
pub fn world_planet() -> Self
Returns a bounding box that covers the entire world.
pub fn clamp_web(&self) -> Self
pub fn clamp(&self, o: &BBox) -> Self
pub fn geo_wrap(&self) -> Self
pub fn is_antimeridian(&self) -> bool
Sourcepub fn crosses_antimeridian(&self) -> bool
pub fn crosses_antimeridian(&self) -> bool
Returns true if the bounding box crosses the antimeridian (the 180-degree meridian).
Sourcepub fn json_arr(&self) -> String
pub fn json_arr(&self) -> String
Returns the geojson tuple/array representation of the bounding box
Sourcepub fn projwin_str(&self) -> String
pub fn projwin_str(&self) -> String
Returns the gdal-ish string representation of the bounding box
Sourcepub fn contains_lnglat(&self, lnglat: &LngLat) -> bool
pub fn contains_lnglat(&self, lnglat: &LngLat) -> bool
Returns the center of the bounding box as a LngLat
Sourcepub fn contains_tile(&self, tile: &Tile) -> bool
pub fn contains_tile(&self, tile: &Tile) -> bool
Returns true if the current instance contains the given Tile
Sourcepub fn contains_bbox(&self, other: &BBox) -> bool
pub fn contains_bbox(&self, other: &BBox) -> bool
Returns true if the current instance contains the given BBox
Sourcepub fn contains(&self, other: &BBoxContainable) -> bool
pub fn contains(&self, other: &BBoxContainable) -> bool
Returns true if the current instance contains the given BBoxContainable
object.
Sourcepub fn is_within(&self, other: &BBox) -> bool
pub fn is_within(&self, other: &BBox) -> bool
Returns true if the current instance is within the given bounding box.
Sourcepub fn intersects(&self, other: &BBox) -> bool
pub fn intersects(&self, other: &BBox) -> bool
Returns true if the current instance intersects with the given bounding box.
Sourcepub fn bboxes(&self) -> Vec<BBox>
pub fn bboxes(&self) -> Vec<BBox>
Returns a vector of bounding boxes (BBox
) associated with the current instance.
If the instance crosses the antimeridian (the 180-degree meridian), this function
returns two BBox
instances:
- The first bounding box covers the area from the object’s western boundary to 180 degrees east.
- The second bounding box covers the area from -180 degrees west to the object’s eastern boundary.
If the instance does not cross the antimeridian, the function returns a vector
containing a single BBox
that represents the current instance itself.
§Returns
Vec<BBox>
: A vector containing one BBox
if the instance does not cross the antimeridian,
or two BBox
es if it does.
§Examples
use utiles_core::BBox;
let example = BBox::new(-10.0, -10.0, 10.0, 10.0);
let bboxes = example.bboxes();
assert_eq!(bboxes.len(), 1);
let bboxes_crosses = BBox::new(179.0, -89.0, -179.0, 89.0).bboxes();
assert_eq!(bboxes_crosses.len(), 2); // Split into two bounding boxes
Sourcepub fn mbt_bounds(&self) -> String
pub fn mbt_bounds(&self) -> String
Mbt metadata bounds string