Trait libreda_db::layout::prelude::TryBoundingBox [−][src]
Try the calculation of the 'bounding box', i.e. the smallest rectangle that contains the geometrical object. In some cases this is not always possible, so the try might fail. For instance a set of polygons does not have a bounding box if the set is empty.
Required methods
pub fn try_bounding_box(&self) -> Option<Rect<T>>
[src]
Return the bounding box of this geometry if a bounding box is defined.
Implementors
impl<C: CoordinateType> TryBoundingBox<C> for Cell<C>
[src]
fn try_bounding_box(&self) -> Option<Rect<C>>
[src]
impl<T> TryBoundingBox<T> for Geometry<T> where
T: CoordinateType,
[src]
T: CoordinateType,
pub fn try_bounding_box(&self) -> Option<Rect<T>>
[src]
Calculate the bounding box of this geometrical shape by calling the bounding box method of the concrete type.
impl<T> TryBoundingBox<T> for Edge<T> where
T: CoordinateType,
[src]
T: CoordinateType,
pub fn try_bounding_box(&self) -> Option<Rect<T>>
[src]
Get bounding box of edge (always exists).
impl<T> TryBoundingBox<T> for Path<T> where
T: CoordinateType,
[src]
T: CoordinateType,
pub fn try_bounding_box(&self) -> Option<Rect<T>>
[src]
Compute the bounding box of this path. The returned bounding box is not necessarily the smallest bounding box.
TODO: Find a better approximation.
impl<T> TryBoundingBox<T> for PointString<T> where
T: CoordinateType,
[src]
T: CoordinateType,
pub fn try_bounding_box(&self) -> Option<Rect<T>>
[src]
Compute the bounding box of all the points in this string.
Returns None
if the string is empty.
Examples
use iron_shapes::point_string::PointString; use iron_shapes::traits::TryBoundingBox; use iron_shapes::rect::Rect; let coords = vec![(0, 0), (1, 0), (2, 1), (-1, -3)]; let point_string = PointString::new(coords); assert_eq!(point_string.try_bounding_box(), Some(Rect::new((2, 1), (-1, -3))));
impl<T> TryBoundingBox<T> for Polygon<T> where
T: CoordinateType,
[src]
T: CoordinateType,
pub fn try_bounding_box(&self) -> Option<Rect<T>>
[src]
impl<T> TryBoundingBox<T> for Rect<T> where
T: CoordinateType,
[src]
T: CoordinateType,
pub fn try_bounding_box(&self) -> Option<Rect<T>>
[src]
Get bounding box of rectangle (always exists).
impl<T> TryBoundingBox<T> for SimplePolygon<T> where
T: CoordinateType,
[src]
T: CoordinateType,
pub fn try_bounding_box(&self) -> Option<Rect<T>>
[src]
impl<T> TryBoundingBox<T> for SimpleRPolygon<T> where
T: CoordinateType,
[src]
T: CoordinateType,
pub fn try_bounding_box(&self) -> Option<Rect<T>>
[src]
impl<T, S> TryBoundingBox<T> for Text<T, S> where
T: CoordinateType,
[src]
T: CoordinateType,