Skip to content

Commit

Permalink
passing
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaqz committed Jan 7, 2024
1 parent 72c3737 commit 3dc63f3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/methods/centroid.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ repeat computation.
Returns the centroid of a given line segment, linear ring, polygon, or
mutlipolygon.
"""
centroid(geom; threaded=false) = centroid(GI.trait(geom), geom; threaded)
centroid(geom, ::Type{T} = Float64; threaded=false) where T =
centroid(GI.trait(geom), geom, T; threaded)

"""
centroid(
Expand All @@ -80,7 +81,7 @@ end
Returns the centroid of a polygon or multipolygon, which is calculated by
weighting edges by their `area component` by convention.
"""
centroid(trait, geom, T; threaded=false) =
centroid(trait, geom, ::Type{T}; threaded=false) where T =
centroid_and_area(geom, T; threaded)[1]

"""
Expand Down
5 changes: 2 additions & 3 deletions src/primitives.jl
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,11 @@ function _applyreduce(
_applyreduce(f, op, target, GI.getgeom(geom); threaded=false, init)
end
# Apply f to the target
function _applyreduce(f, op, ::Type{Target}, ::Trait, x; kw...) where {Target,Trait<:Target}
function _applyreduce(f, op, ::Type{Target}, ::Trait, x; kw...) where {Target<:GI.AbstractTrait,Trait<:Target}
f(x)
end
# Fail if we hit PointTrait
_applyreduce(f, op, target::Type, trait::GI.PointTrait, geom; kw...) =
throw(ArgumentError("target $target not found, but reached a `PointTrait` leaf"))
_applyreduce(f, op, target, trait, geom; kw...) = throw(ArgumentError("target $target not found"))
# Specific cases to avoid method ambiguity
for T in (
GI.PointTrait, GI.LinearRing, GI.LineString,
Expand Down

0 comments on commit 3dc63f3

Please sign in to comment.