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>),
SimpleRPolygon(SimpleRPolygon<T>),
Polygon(Polygon<T>),
Path(Path<T>),
Text(Text<T, String>),
}
Expand description
Abstracted geometrical shape.
Variants
Point(Point<T>)
Point.
Tuple Fields of Point
0: Point<T>
Edge(Edge<T>)
Edge.
Tuple Fields of Edge
0: Edge<T>
Rect(Rect<T>)
Rect.
Tuple Fields of Rect
0: Rect<T>
SimplePolygon(SimplePolygon<T>)
SimplePolygon.
Tuple Fields of SimplePolygon
0: SimplePolygon<T>
SimpleRPolygon(SimpleRPolygon<T>)
SimpleRPolygon.
Tuple Fields of SimpleRPolygon
0: SimpleRPolygon<T>
Polygon(Polygon<T>)
Polygon.
Tuple Fields of Polygon
0: Polygon<T>
Path(Path<T>)
Path.
Tuple Fields of Path
0: Path<T>
Text.
Implementations
Create a transformed copy of the geometric object.
Trait Implementations
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<Geometry<T>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<Geometry<T>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Area calculation.
Performs the conversion.
Performs the conversion.
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
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())
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,
impl<T, Dst> TryCastCoord<T, Dst> for Geometry<T> where
T: CoordinateType + NumCast,
Dst: CoordinateType + NumCast,
Auto Trait Implementations
impl<T> RefUnwindSafe for Geometry<T> where
T: RefUnwindSafe,
impl<T> UnwindSafe for Geometry<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more