Enum sfcgal::CoordSeq

source ·
pub enum CoordSeq<T> {
    Point(T),
    Linestring(Vec<T>),
    Polygon(Vec<Vec<T>>),
    Multipoint(Vec<T>),
    Multilinestring(Vec<Vec<T>>),
    Multipolygon(Vec<Vec<Vec<T>>>),
    Geometrycollection(Vec<CoordSeq<T>>),
    Polyhedralsurface(Vec<Vec<Vec<T>>>),
    Triangulatedsurface(Vec<Vec<T>>),
    Triangle(Vec<T>),
    Solid(Vec<Vec<Vec<Vec<T>>>>),
    Multisolid(Vec<Vec<Vec<Vec<Vec<T>>>>>),
}
Expand description

Coordinates corresponding to the shapes described by SFCGAL Geometry types.

Used to construct SFCGeometry from coordinates or to retrieve coordinates from SFCGeometry.

use sfcgal::{CoordSeq, ToSFCGAL};

let coordinates = CoordSeq::Linestring(vec![(-0.5, -0.5, 2.5), (0., 0., 4.0)]);
let line_3d = coordinates.to_sfcgal().unwrap();
assert!(line_3d.is_valid().unwrap());
use sfcgal::{SFCGeometry, CoordSeq, Point3d, ToCoordinates};

let line_3d = SFCGeometry::new("LINESTRING (3.5 5.6 1.0,4.8 10.5 1.0)").unwrap();
let coordinates = line_3d.to_coordinates::<Point3d>().unwrap();
// assert_eq!(coordinates, CoordSeq::Linestring(vec![(3.5, 5.6, 1.0), (4.8, 10.5, 1.0)]));

Variants§

§

Point(T)

A Point is described by a tuple of 2 or 3 coordinates.

§

Linestring(Vec<T>)

A Linestring is described by Vec of Point.

§

Polygon(Vec<Vec<T>>)

A Polygon is described by a Vec of closed Linestring : the first one is the exterior ring and the others are interior rings.

§

Multipoint(Vec<T>)

A Multipoint is described by a Vec of Points.

§

Multilinestring(Vec<Vec<T>>)

A Multilinestring is described by a Vec of Linestrings.

§

Multipolygon(Vec<Vec<Vec<T>>>)

A Multipolygon is described by a Vec of Polygons.

§

Geometrycollection(Vec<CoordSeq<T>>)

A Geometrycollection is described by a Vec of any of these CoordSeq geometries.

§

Polyhedralsurface(Vec<Vec<Vec<T>>>)

A Polyhedralsurface is described by a Vec of Polygons.

§

Triangulatedsurface(Vec<Vec<T>>)

A Triangulatedsurface is described by a Vec of Triangles.

§

Triangle(Vec<T>)

A Triangle is described by a Vec of 3 Points.

§

Solid(Vec<Vec<Vec<Vec<T>>>>)

A Solid is described by a Vec of Polyhedralsurfaces : the first one is the exterior shell and the others are interior shells.

§

Multisolid(Vec<Vec<Vec<Vec<Vec<T>>>>>)

A Multisolid is described by a Vec of Solids.

Trait Implementations§

source§

impl<T: Clone> Clone for CoordSeq<T>

source§

fn clone(&self) -> CoordSeq<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug> Debug for CoordSeq<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: Hash> Hash for CoordSeq<T>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<T: PartialEq> PartialEq for CoordSeq<T>

source§

fn eq(&self, other: &CoordSeq<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<U> ToGeoJSON for CoordSeq<U>
where U: FromSlice + CoordType + ToVec + FromSFCGALGeom,

source§

type Err = Error

source§

fn to_geojson<T: FromSlice + CoordType + ToVec + FromSFCGALGeom>( &self, ) -> Result<GeometryValue>

source§

impl<T: ToSFCGALGeom + CoordType> ToSFCGAL for CoordSeq<T>

Convert coordinates (tuple of 2 or 3 members) to SFCGeometry using the corresponding CoordSeq variant of the wanted geometry.

source§

fn to_sfcgal(&self) -> Result<SFCGeometry>

Convert the coordinates of this CoordSeq to SFCGeometry.

source§

impl TryInto<Geometry> for CoordSeq<Point2d>

Implements conversion from CoordSeq to geo_types::Geometry (better use TryInto<geo_types::Geometry> for SFCGeometry if the intend is to convert SFCGAL Geometries to geo_types ones)

source§

impl<T> StructuralPartialEq for CoordSeq<T>

Auto Trait Implementations§

§

impl<T> Freeze for CoordSeq<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for CoordSeq<T>
where T: RefUnwindSafe,

§

impl<T> Send for CoordSeq<T>
where T: Send,

§

impl<T> Sync for CoordSeq<T>
where T: Sync,

§

impl<T> Unpin for CoordSeq<T>
where T: Unpin,

§

impl<T> UnwindSafe for CoordSeq<T>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.