Enum libreda_pnr::db::Geometry
source · [−]pub enum Geometry<T> {
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.
Edge(Edge<T>)
Edge.
Rect(Rect<T>)
Rect.
SimplePolygon(SimplePolygon<T>)
SimplePolygon.
SimpleRPolygon(SimpleRPolygon<T>)
SimpleRPolygon.
Polygon(Polygon<T>)
Polygon.
Path(Path<T>)
Path.
Text(Text<T, String>)
Text.
Implementations
sourceimpl<T> Geometry<T> where
T: CoordinateType,
impl<T> Geometry<T> where
T: CoordinateType,
sourcepub fn transformed(&self, tf: &SimpleTransform<T>) -> Geometry<T>
pub fn transformed(&self, tf: &SimpleTransform<T>) -> Geometry<T>
Create a transformed copy of the geometric object.
Trait Implementations
sourceimpl<'de, T> Deserialize<'de> for Geometry<T> where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Geometry<T> where
T: Deserialize<'de>,
sourcepub 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
sourceimpl<T> DoubledOrientedArea<T> for Geometry<T> where
T: CoordinateType + NumCast,
impl<T> DoubledOrientedArea<T> for Geometry<T> where
T: CoordinateType + NumCast,
sourcepub fn area_doubled_oriented(&self) -> T
pub fn area_doubled_oriented(&self) -> T
Area calculation.
sourceimpl<T> From<SimplePolygon<T>> for Geometry<T>
impl<T> From<SimplePolygon<T>> for Geometry<T>
sourcepub fn from(x: SimplePolygon<T>) -> Geometry<T>
pub fn from(x: SimplePolygon<T>) -> Geometry<T>
Performs the conversion.
sourceimpl<T> From<SimpleRPolygon<T>> for Geometry<T>
impl<T> From<SimpleRPolygon<T>> for Geometry<T>
sourcepub fn from(x: SimpleRPolygon<T>) -> Geometry<T>
pub fn from(x: SimpleRPolygon<T>) -> Geometry<T>
Performs the conversion.
sourceimpl<T> Serialize for Geometry<T> where
T: Serialize,
impl<T> Serialize for Geometry<T> where
T: Serialize,
sourcepub 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
sourceimpl<T> ToPolygon<T> for Geometry<T> where
T: CoordinateType + NumCast,
impl<T> ToPolygon<T> for Geometry<T> where
T: CoordinateType + NumCast,
sourcepub fn to_polygon(&self) -> Polygon<T>
pub fn to_polygon(&self) -> Polygon<T>
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())
sourceimpl<T> TryBoundingBox<T> for Geometry<T> where
T: Copy + PartialOrd<T> + Num,
impl<T> TryBoundingBox<T> for Geometry<T> where
T: Copy + PartialOrd<T> + Num,
sourcepub fn try_bounding_box(&self) -> Option<Rect<T>>
pub fn try_bounding_box(&self) -> Option<Rect<T>>
Calculate the bounding box of this geometrical shape by calling the bounding box method of the concrete type.
sourceimpl<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,
impl<T> Eq for Geometry<T> where
T: Eq,
impl<T> StructuralEq for Geometry<T>
impl<T> StructuralPartialEq for Geometry<T>
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more