geo::algorithm::bounding_rect

Trait BoundingRect

Source
pub trait BoundingRect<T: CoordNum> {
    type Output: Into<Option<Rect<T>>>;

    // Required method
    fn bounding_rect(&self) -> Self::Output;
}
Expand description

Calculation of the bounding rectangle of a geometry.

Required Associated Types§

Required Methods§

Source

fn bounding_rect(&self) -> Self::Output

Return the bounding rectangle of a geometry

§Examples
use geo::BoundingRect;
use geo::line_string;

let line_string = line_string![
    (x: 40.02f64, y: 116.34),
    (x: 42.02f64, y: 116.34),
    (x: 42.02f64, y: 118.34),
];

let bounding_rect = line_string.bounding_rect().unwrap();

assert_eq!(40.02f64, bounding_rect.min().x);
assert_eq!(42.02f64, bounding_rect.max().x);
assert_eq!(116.34, bounding_rect.min().y);
assert_eq!(118.34, bounding_rect.max().y);

Implementors§

Source§

impl<T> BoundingRect<T> for Geometry<T>
where T: CoordNum,

Source§

impl<T> BoundingRect<T> for Coord<T>
where T: CoordNum,

Source§

impl<T> BoundingRect<T> for GeometryCollection<T>
where T: CoordNum,

Source§

impl<T> BoundingRect<T> for Line<T>
where T: CoordNum,

Source§

impl<T> BoundingRect<T> for LineString<T>
where T: CoordNum,

Source§

impl<T> BoundingRect<T> for MultiLineString<T>
where T: CoordNum,

Source§

impl<T> BoundingRect<T> for MultiPoint<T>
where T: CoordNum,

Source§

impl<T> BoundingRect<T> for MultiPolygon<T>
where T: CoordNum,

Source§

impl<T> BoundingRect<T> for Point<T>
where T: CoordNum,

Source§

impl<T> BoundingRect<T> for Polygon<T>
where T: CoordNum,

Source§

impl<T> BoundingRect<T> for Rect<T>
where T: CoordNum,

Source§

impl<T> BoundingRect<T> for Triangle<T>
where T: CoordNum,

Source§

impl<T: GeoNum> BoundingRect<T> for MonoPoly<T>