Geometry.CurvePolygon
(Geometry v1.2.0)
View Source
A curve-polygon struct, representing a 2D polygon with curved rings.
A CurvePolygon is like a polygon, with an outer ring and zero or more inner rings. The difference is that a ring can be a CircularString or CompoundCurve as well as a LineString.
Summary
Types
@type ring() :: Geometry.LineString.t() | Geometry.CircularString.t() | Geometry.CompoundCurve.t()
@type t() :: %Geometry.CurvePolygon{rings: [ring()], srid: Geometry.srid()}
Functions
@spec new() :: t()
Creates an empty CurvePolygon.
Examples
iex> Geometry.CurvePolygon.new()
%Geometry.CurvePolygon{rings: [], srid: 0}
@spec new([ring()], Geometry.srid()) :: t()
Creates a CurvePolygon from the given rings.
Examples
iex> Geometry.CurvePolygon.new([
...> Geometry.CircularString.new([
...> Geometry.Point.new(0, 0),
...> Geometry.Point.new(4, 0),
...> Geometry.Point.new(4, 4),
...> Geometry.Point.new(0, 4),
...> Geometry.Point.new(0, 0)
...> ])
...> ])
%Geometry.CurvePolygon{
rings: [
%Geometry.CircularString{
arcs: [[0, 0], [4, 0], [4, 4], [0, 4], [0, 0]],
srid: 0
}
],
srid: 0
}
iex> Geometry.CurvePolygon.new(
...> [
...> Geometry.LineString.new([
...> Geometry.Point.new(0, 0),
...> Geometry.Point.new(10, 0),
...> Geometry.Point.new(10, 10),
...> Geometry.Point.new(0, 0)
...> ])
...> ],
...> 4326
...> )
%Geometry.CurvePolygon{
rings: [
%Geometry.LineString{path: [[0, 0], [10, 0], [10, 10], [0, 0]], srid: 0}
],
srid: 4326
}