165
165
Base. show (io:: IO , x:: LineP ) = print (io, " Line(" , x[1 ], " => " , x[2 ], " )" )
166
166
167
167
"""
168
+ LineString(points::AbstractVector{<:AbstractPoint})
169
+
168
170
A LineString is a geometry of connected line segments
169
171
"""
170
172
struct LineString{
177
179
178
180
coordinates (x:: LineString ) = x. points
179
181
182
+ Base. copy (x:: LineString ) = LineString (copy (x. points))
180
183
Base. size (x:: LineString ) = size (coordinates (x))
181
184
Base. getindex (x:: LineString , i) = getindex (coordinates (x), i)
182
185
@@ -231,6 +234,12 @@ function LineString(points::AbstractVector{<: AbstractPoint}, indices::AbstractV
231
234
return LineString (points, faces)
232
235
end
233
236
237
+
238
+ """
239
+ Polygon(exterior::AbstractVector{<:Point})
240
+ Polygon(exterior::AbstractVector{<:Point}, interiors::Vector{<:AbstractVector{<:AbstractPoint}})
241
+
242
+ """
234
243
struct Polygon{
235
244
Dim, T <: Real ,
236
245
P <: AbstractPoint{Dim, T} ,
@@ -241,6 +250,8 @@ struct Polygon{
241
250
interiors:: V
242
251
end
243
252
253
+ Base. copy (x:: Polygon ) = Polygon (copy (x. exterior), copy (x. interiors))
254
+
244
255
Base.:(== )(a:: Polygon , b:: Polygon ) = (a. exterior == b. exterior) && (a. interiors == b. interiors)
245
256
246
257
function Polygon (exterior:: E , interiors:: AbstractVector{E} ) where E <: AbstractVector{LineP{Dim, T, P}} where {Dim, T, P}
@@ -261,7 +272,9 @@ function Polygon(exterior::AbstractVector{P}, faces::AbstractVector{<: LineFace}
261
272
return Polygon (LineString (exterior, faces))
262
273
end
263
274
264
-
275
+ """
276
+ MultiPolygon(polygons::AbstractPolygon)
277
+ """
265
278
struct MultiPolygon{
266
279
Dim, T <: Real ,
267
280
Element <: AbstractPolygon{Dim, T} ,
0 commit comments