Skip to content

Commit

Permalink
Add multipoints
Browse files Browse the repository at this point in the history
  • Loading branch information
skygering committed Jan 23, 2024
1 parent ac0f4b8 commit 0070049
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 0 additions & 4 deletions src/GeometryOps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ const GB = GeometryBasics

const TuplePoint = Tuple{Float64,Float64}
const Edge = Tuple{TuplePoint,TuplePoint}
const MultiGeomTrait = Union{
GI.MultiPointTrait, GI.MultiCurveTrait,
GI.MultiPolygonTrait, GI.GeometryCollectionTrait}


include("primitives.jl")
include("utils.jl")
Expand Down
5 changes: 3 additions & 2 deletions src/methods/angles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ To provide an example, consider this rectangle:
```@example angles
using GeometryOps
using GeometryOps.GeometryBasics
using Makie
using Makie, CairoMakie
rect = Polygon([Point(0,0), Point(0,1), Point(1,1), Point(1,0), Point(0, 0)])
f, a, p = poly(rect; axis = (; aspect = DataAspect()))
f
```
This is clearly a rectangle, with angles of 90 degrees.
```@example angles
Expand Down Expand Up @@ -53,7 +54,7 @@ function angles(geom, ::Type{T} = Float64; threaded =false) where T <: AbstractF
end

# Points and single line segments have no angles
_angles(::Type{T}, ::Union{GI.PointTrait, GI.LineTrait}, geom) where T = T[]
_angles(::Type{T}, ::Union{GI.PointTrait, GI.MultiPointTrait, GI.LineTrait}, geom) where T = T[]

#= The angles of a linestring are the angles formed by the line. If the first and last point
are not explicitly repeated, the geom is not considered closed. The angles should all be on
Expand Down
2 changes: 2 additions & 0 deletions test/methods/angles.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pt1 = GI.Point((0.0, 0.0))
mpt1 = GI.MultiPoint([pt1, pt1])
l1 = GI.Line([(0.0, 0.0), (0.0, 1.0)])

concave_coords = [(0.0, 0.0), (0.0, 1.0), (-1.0, 1.0), (-1.0, 2.0), (2.0, 2.0), (2.0, 0.0), (0.0, 0.0)]
Expand All @@ -20,6 +21,7 @@ c1 = GI.GeometryCollection([pt1, l2, p2])

# Points and lines
@test isempty(GO.angles(pt1))
@test isempty(GO.angles(mpt1))
@test isempty(GO.angles(l1))

# LineStrings and Linear Rings
Expand Down

0 comments on commit 0070049

Please sign in to comment.