Enum libreda_db::layout::prelude::Geometry[][src]

pub enum Geometry<T> where
    T: CoordinateType
{ Point(Point<T>), Edge(Edge<T>), Rect(Rect<T>), SimplePolygon(SimplePolygon<T>), Polygon(Polygon<T>), Path(Path<T>), Text(Text<T, String>), }

Abstracted geometrical shape.

Variants

Point(Point<T>)

Point.

Edge(Edge<T>)

Edge.

Rect(Rect<T>)

Rect.

SimplePolygon(SimplePolygon<T>)

SimplePolygon.

Polygon(Polygon<T>)

Polygon.

Path(Path<T>)

Path.

Text(Text<T, String>)

Text.

Implementations

impl<T> Geometry<T> where
    T: CoordinateType
[src]

pub fn transformed(&self, tf: &SimpleTransform<T>) -> Geometry<T>[src]

Create a transformed copy of the geometric object.

Trait Implementations

impl<T> Clone for Geometry<T> where
    T: CoordinateType + Clone
[src]

impl<T> Debug for Geometry<T> where
    T: CoordinateType + Debug
[src]

impl<T> DoubledOrientedArea<T> for Geometry<T> where
    T: CoordinateType + NumCast
[src]

pub fn area_doubled_oriented(&self) -> T[src]

Area calculation.

impl<T> Eq for Geometry<T> where
    T: CoordinateType + Eq
[src]

impl<T> From<Edge<T>> for Geometry<T> where
    T: CoordinateType
[src]

impl<T> From<Path<T>> for Geometry<T> where
    T: CoordinateType
[src]

impl<T> From<Point<T>> for Geometry<T> where
    T: CoordinateType
[src]

impl<T> From<Polygon<T>> for Geometry<T> where
    T: CoordinateType
[src]

impl<T> From<Rect<T>> for Geometry<T> where
    T: CoordinateType
[src]

impl<T> From<SimplePolygon<T>> for Geometry<T> where
    T: CoordinateType
[src]

impl<T> From<Text<T, String>> for Geometry<T> where
    T: CoordinateType
[src]

impl<T> Hash for Geometry<T> where
    T: CoordinateType + Hash
[src]

impl<T> Into<Polygon<T>> for Geometry<T> where
    T: CoordinateType + NumCast
[src]

pub fn into(self) -> Polygon<T>[src]

Convert a geometry into a polygon.

impl<T> PartialEq<Geometry<T>> for Geometry<T> where
    T: CoordinateType + PartialEq<T>, 
[src]

impl<T> StructuralEq for Geometry<T> where
    T: CoordinateType
[src]

impl<T> StructuralPartialEq for Geometry<T> where
    T: CoordinateType
[src]

impl<T> ToPolygon<T> for Geometry<T> where
    T: CoordinateType + NumCast
[src]

pub fn to_polygon(&self) -> Polygon<T>[src]

Convert a geometry into a polygon.

The coordinate type must implement NumCast because there is currently no way to convert a Path into a polygon without converting it to a float type first.

Examples

use iron_shapes::prelude::*;
let rect = Rect::new((0, 0), (1, 2));
// Convert the rectangle to a `Geometry`.
let g: Geometry<_> = rect.into();
assert_eq!(g.to_polygon(), rect.to_polygon())

impl<T> TryBoundingBox<T> for Geometry<T> where
    T: CoordinateType
[src]

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, Dst> TryCastCoord<T, Dst> for Geometry<T> where
    T: CoordinateType + NumCast,
    Dst: CoordinateType + NumCast
[src]

type Output = Geometry<Dst>

Output type of the cast. This is likely the same geometrical type just with other coordinate types. Read more

Auto Trait Implementations

impl<T> RefUnwindSafe for Geometry<T> where
    T: RefUnwindSafe

impl<T> Send for Geometry<T> where
    T: Send

impl<T> Sync for Geometry<T> where
    T: Sync

impl<T> Unpin for Geometry<T> where
    T: Unpin

impl<T> UnwindSafe for Geometry<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> TextType for T where
    T: Clone + Eq + Debug + Hash
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.