BoundingBox

Struct BoundingBox 

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

Bounding box of a Zerometry.

The bounding box is a rectangle that contains the Zerometry. It is represented by two coordinates: the bottom-left and top-right corners.

The coordinates are stored in a Coords struct, which is a slice of f64 values. The first coordinate is the bottom-left corner, and the second coordinate is the top-right corner.

Implementations§

Source§

impl BoundingBox

Source

pub unsafe fn from_bytes(data: &[u8]) -> &Self

§Safety

The data must be generated from the Self::write_from_geometry method and be aligned on 64 bits

Source

pub unsafe fn from_slice(data: &[f64]) -> &Self

Create the bounding box from a slice of f64

§Safety

The data must be generated from the Self::write_from_geometry method and be aligned on 64 bits

Source

pub unsafe fn from_slice_mut(data: &mut [f64]) -> &mut Self

§Safety

The data must be generated from the Self::write_from_geometry method and be aligned on 64 bits

Source

pub unsafe fn from_coords(coords: &Coords) -> &Self

§Safety

The Coords must:

  • Contains at least two elements
  • Be aligned on 64 bits
  • Have it’s first coordinate smaller than the second one
Source

pub unsafe fn from_coords_mut(coords: &mut Coords) -> &mut Self

§Safety

The Coords must:

  • Contains at least two elements
  • Be aligned on 64 bits
  • Have it’s first coordinate smaller than the second one
Source

pub fn write_from_geometry( writer: &mut impl Write, points: impl Iterator<Item = Point<f64>>, ) -> Result<(), Error>

Write the bounding boxe that contains all the specified points to a buffer.

Source

pub fn coords(&self) -> &Coords

Return the internal coords

Source

pub fn bottom_left(&self) -> &Coord

Return the bottom left coord

Source

pub fn top_right(&self) -> &Coord

Return the top right coord

Source

pub fn bottom(&self) -> f64

Return the bottom latitude

Source

pub fn top(&self) -> f64

Return the top latitude

Source

pub fn left(&self) -> f64

Return the left longitude

Source

pub fn right(&self) -> f64

Return the right longitude

Source

pub fn horizontal_range(&self) -> RangeInclusive<f64>

Return the longitude range contained in the bounding box

Source

pub fn vertical_range(&self) -> RangeInclusive<f64>

Return the latitude range contained in the bounding box

Source

pub fn contains_coord(&self, coord: &Coord) -> bool

Return true if the coord is contained in the bounding box

Source

pub fn to_geo(&self) -> Rect<f64>

Convert the bounding box to a geo_types::Rect. Note: Converting that back to a crate::Zerometry will produce a crate::Zolygon

Trait Implementations§

Source§

impl Debug for BoundingBox

Source§

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

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

impl RelationBetweenShapes<BoundingBox> for BoundingBox

Source§

fn relation( &self, other: &BoundingBox, relation: InputRelation, ) -> OutputRelation

Return the relation between two shapes. The InputRelation lets you specify the kind of relation you want to retrieve. Read more
Source§

fn all_relation(&self, other: &Other) -> OutputRelation

Return all relations with no early return.
Source§

fn any_relation(&self, other: &Other) -> OutputRelation

Return the first relation we find with early return.
Source§

fn contains(&self, other: &Other) -> bool

Return true if Self contains Other.
Source§

fn strict_contains(&self, other: &Other) -> bool

Return true if Self strictly contains Other.
Source§

fn contained(&self, other: &Other) -> bool

Return true if Self is contained in Other.
Source§

fn strict_contained(&self, other: &Other) -> bool

Return true if Self is strictly contained in Other.
Source§

fn intersects(&self, other: &Other) -> bool

Return true if Self intersects with Other.
Source§

fn disjoint(&self, other: &Other) -> bool

Return true if Self is disjoint of Other.
Source§

impl RelationBetweenShapes<Coord> for BoundingBox

Source§

fn relation(&self, other: &Coord, relation: InputRelation) -> OutputRelation

Return the relation between two shapes. The InputRelation lets you specify the kind of relation you want to retrieve. Read more
Source§

fn all_relation(&self, other: &Other) -> OutputRelation

Return all relations with no early return.
Source§

fn any_relation(&self, other: &Other) -> OutputRelation

Return the first relation we find with early return.
Source§

fn contains(&self, other: &Other) -> bool

Return true if Self contains Other.
Source§

fn strict_contains(&self, other: &Other) -> bool

Return true if Self strictly contains Other.
Source§

fn contained(&self, other: &Other) -> bool

Return true if Self is contained in Other.
Source§

fn strict_contained(&self, other: &Other) -> bool

Return true if Self is strictly contained in Other.
Source§

fn intersects(&self, other: &Other) -> bool

Return true if Self intersects with Other.
Source§

fn disjoint(&self, other: &Other) -> bool

Return true if Self is disjoint of Other.

Auto Trait Implementations§

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