Struct geo::LineString [] [src]

pub struct LineString<T>(pub Vec<Point<T>>)
where
    T: CoordinateType
;

An ordered collection of two or more Points, representing a path between locations

Create a LineString by calling it directly:

use geo_types::{LineString, Point};
let line = LineString(vec![Point::new(0., 0.), Point::new(10., 0.)]);

Converting a Vec of Point-like things:

let line: LineString<f32> = vec![(0., 0.), (10., 0.)].into();

Or collecting from a Point iterator

let mut points = vec![Point::new(0., 0.), Point::new(10., 0.)];
let line: LineString<f32> = points.into_iter().collect();

You can iterate over the points in the LineString

use geo_types::{LineString, Point};
let line = LineString(vec![Point::new(0., 0.), Point::new(10., 0.)]);
for point in line {
    println!("Point x = {}, y = {}", point.x(), point.y());
}

Methods

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

Important traits for Box<W>
[src]

Return an Line iterator that yields one Line for each line segment in the LineString.

Examples

use geo_types::{Line, LineString, Point};

let mut points = vec![(0., 0.), (5., 0.), (7., 9.)];
let linestring: LineString<f32> = points.into_iter().collect();

let mut lines = linestring.lines();
assert_eq!(
    Some(Line::new(Point::new(0., 0.), Point::new(5., 0.))),
    lines.next()
);
assert_eq!(
    Some(Line::new(Point::new(5., 0.), Point::new(7., 9.))),
    lines.next()
);
assert!(lines.next().is_none());

Important traits for Iter<'a, T>
[src]

Important traits for IterMut<'a, T>
[src]

Trait Implementations

impl<'de, T> Deserialize<'de> for LineString<T> where
    T: CoordinateType + Deserialize<'de>, 
[src]

[src]

Deserialize this value from the given Serde deserializer. Read more

impl<T> IntoIterator for LineString<T> where
    T: CoordinateType
[src]

Iterate over all the Points in this linestring

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

[src]

Creates an iterator from a value. Read more

impl<T> Serialize for LineString<T> where
    T: CoordinateType + Serialize
[src]

[src]

Serialize this value into the given Serde serializer. Read more

impl<T, IP> FromIterator<IP> for LineString<T> where
    IP: Into<Point<T>>,
    T: CoordinateType
[src]

Turn a Point-ish iterator into a LineString.

[src]

Creates a value from an iterator. Read more

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

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl<T, IP> From<Vec<IP>> for LineString<T> where
    IP: Into<Point<T>>,
    T: CoordinateType
[src]

Turn a Vec of Point-ish objects into a LineString.

[src]

Performs the conversion.

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

[src]

Performs the conversion.

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

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

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

[src]

Formats the value using the given formatter. Read more

impl<T> Centroid<T> for LineString<T> where
    T: Float
[src]

[src]

See: https://en.wikipedia.org/wiki/Centroid Read more

impl<T> Contains<Point<T>> for LineString<T> where
    T: Float
[src]

[src]

Checks if the geometry A is completely inside the B geometry. Read more

impl<T> Contains<LineString<T>> for Line<T> where
    T: Float
[src]

[src]

Checks if the geometry A is completely inside the B geometry. Read more

impl<T> Contains<Line<T>> for LineString<T> where
    T: Float
[src]

[src]

Checks if the geometry A is completely inside the B geometry. Read more

impl<T> Contains<LineString<T>> for Polygon<T> where
    T: Float
[src]

[src]

Checks if the geometry A is completely inside the B geometry. Read more

impl<T> Intersects<LineString<T>> for Line<T> where
    T: Float
[src]

[src]

Checks if the geometry A intersects the geometry B. Read more

impl<T> Intersects<Line<T>> for LineString<T> where
    T: Float
[src]

[src]

Checks if the geometry A intersects the geometry B. Read more

impl<T> Intersects<LineString<T>> for LineString<T> where
    T: Float
[src]

[src]

Checks if the geometry A intersects the geometry B. Read more

impl<T> Intersects<LineString<T>> for Polygon<T> where
    T: Float
[src]

[src]

Checks if the geometry A intersects the geometry B. Read more

impl<T> EuclideanLength<T> for LineString<T> where
    T: Float
[src]

[src]

Calculation of the length of a Line Read more

impl<T> EuclideanDistance<T, LineString<T>> for Point<T> where
    T: Float
[src]

[src]

Minimum distance from a Point to a LineString

impl<T> EuclideanDistance<T, Point<T>> for LineString<T> where
    T: Float
[src]

[src]

Minimum distance from a LineString to a Point

impl<T> BoundingBox<T> for LineString<T> where
    T: CoordinateType
[src]

[src]

Return the BoundingBox for a LineString

impl<T> Simplify<T> for LineString<T> where
    T: Float
[src]

[src]

Returns the simplified representation of a geometry, using the Ramer–Douglas–Peucker algorithm Read more

impl<T> SimplifyVWPreserve<T> for LineString<T> where
    T: Float + SpadeFloat
[src]

[src]

Returns the simplified representation of a geometry, using a topology-preserving variant of the Visvalingam-Whyatt algorithm. Read more

impl<T> SimplifyVW<T> for LineString<T> where
    T: Float
[src]

[src]

Returns the simplified representation of a geometry, using the Visvalingam-Whyatt algorithm Read more

impl<T> ConvexHull<T> for LineString<T> where
    T: Float
[src]

[src]

Returns the convex hull of a Polygon. The hull is always oriented counter-clockwise. Read more

impl<T> Rotate<T> for LineString<T> where
    T: Float
[src]

[src]

Rotate the LineString about its centroid by the given number of degrees

impl<T: CoordinateType, NT: CoordinateType> MapCoords<T, NT> for LineString<T>
[src]

[src]

Apply a function to all the coordinates in a geometric object, returning a new object. Read more

impl<T: CoordinateType, NT: CoordinateType> TryMapCoords<T, NT> for LineString<T>
[src]

[src]

Map a fallible function over all the coordinates in a geometry, returning a Result Read more

impl<T: CoordinateType> MapCoordsInplace<T> for LineString<T>
[src]

[src]

Apply a function to all the coordinates in a geometric object, in place Read more

impl<F: Float> ClosestPoint<F> for LineString<F>
[src]

[src]

Find the closest point between self and p.

impl<T> HaversineLength<T> for LineString<T> where
    T: Float + FromPrimitive
[src]

[src]

Calculation of the length of a Line Read more

impl<T> Winding<T> for LineString<T> where
    T: CoordinateType
[src]

[src]

Returns the winding order of this line None if the winding order is undefined.

Important traits for Box<W>
[src]

Iterate over the points in a clockwise order

The Linestring isn't changed, and the points are returned either in order, or in reverse order, so that the resultant order makes it appear clockwise

Important traits for Box<W>
[src]

Iterate over the points in a counter-clockwise order

The Linestring isn't changed, and the points are returned either in order, or in reverse order, so that the resultant order makes it appear counter-clockwise

[src]

Change this line's points so they are in clockwise winding order

[src]

Change this line's points so they are in counterclockwise winding order

[src]

True iff this clockwise

[src]

True iff this is wound counterclockwise

[src]

Return a clone of this object, but in the specified winding order

[src]

Change the winding order so that it is in this winding order

Auto Trait Implementations

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

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