Struct geo_types::Polygon
[−]
[src]
pub struct Polygon<T> where
T: CoordinateType, { pub exterior: LineString<T>, pub interiors: Vec<LineString<T>>, }
A representation of an area. Its outer boundary is represented by a LineString
that is both closed and simple
It has one exterior ring or shell, and zero or more interior rings, representing holes.
Fields
exterior: LineString<T>
interiors: Vec<LineString<T>>
Methods
impl<T> Polygon<T> where
T: CoordinateType,
[src]
T: CoordinateType,
pub fn new(exterior: LineString<T>, interiors: Vec<LineString<T>>) -> Polygon<T>
[src]
Creates a new polygon.
use geo_types::{Point, LineString, Polygon}; let exterior = LineString(vec![Point::new(0., 0.), Point::new(1., 1.), Point::new(1., 0.), Point::new(0., 0.)]); let interiors = vec![LineString(vec![Point::new(0.1, 0.1), Point::new(0.9, 0.9), Point::new(0.9, 0.1), Point::new(0.1, 0.1)])]; let p = Polygon::new(exterior.clone(), interiors.clone()); assert_eq!(p.exterior, exterior); assert_eq!(p.interiors, interiors);
impl<T> Polygon<T> where
T: Float + Signed,
[src]
T: Float + Signed,
Trait Implementations
impl<T: PartialEq> PartialEq for Polygon<T> where
T: CoordinateType,
[src]
T: CoordinateType,
fn eq(&self, __arg_0: &Polygon<T>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Polygon<T>) -> bool
[src]
This method tests for !=
.
impl<T: Clone> Clone for Polygon<T> where
T: CoordinateType,
[src]
T: CoordinateType,
fn clone(&self) -> Polygon<T>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: Debug> Debug for Polygon<T> where
T: CoordinateType,
[src]
T: CoordinateType,
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more