Skip to content

Commit

Permalink
Update src/transformations/correction/geometry_correction.jl
Browse files Browse the repository at this point in the history
Minor cleanups
  • Loading branch information
asinghvi17 committed Mar 22, 2024
1 parent 399161e commit 24cd37a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/primitives.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# # Primitive functions

export apply, applyreduce, TraitTarget

# This file mainly defines the [`apply`](@ref) function and its relatives.

#=
Expand Down
2 changes: 1 addition & 1 deletion src/transformations/correction/geometry_correction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function fix(geometry; corrections = GeometryCorrection[ClosedRing(),], kwargs..
for Trait in (GI.PointTrait, GI.MultiPointTrait, GI.LineStringTrait, GI.LinearRingTrait, GI.MultiLineStringTrait, GI.PolygonTrait, GI.MultiPolygonTrait)
available_corrections = findall(x -> x == Trait, traits)
isempty(available_corrections) && continue
println("Correcting for $(Trait)")
@debug "Correcting for $(Trait)"
net_function = reduce(, corrections[available_corrections])
final_geometry = apply(net_function, Trait, final_geometry; kwargs...)
end
Expand Down
2 changes: 1 addition & 1 deletion src/transformations/reproject.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function reproject end
# prints a suggestion if the Proj extension is not loaded.

function _reproject_error_hinter(io, exc, argtypes, kwargs)
if isnothing(Base.get_extension(GeometryOps, :GeometryOpsProjExt))
if isnothing(Base.get_extension(GeometryOps, :GeometryOpsProjExt)) && exc.f == reproject
print(io, "\n\nThe `reproject` method requires the Proj.jl package to be explicitly loaded.\n")
print(io, "You can do this by simply typing ")
printstyled(io, "using Proj"; color = :cyan, bold = true)
Expand Down
4 changes: 3 additions & 1 deletion src/transformations/simplify.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ usa_poly = GI.getgeom(usa_multipoly, findmax(GO.area.(GI.getgeom(usa_multipoly))
usa_centroid = GO.centroid(usa_poly)
usa_reflected = GO.apply(Translation(usa_centroid...) ∘ LinearMap(Makie.rotmatrix2d(π)) ∘ Translation((-).(usa_centroid)...) ∘ GO.Point2{Float64}, PointTrait, usa_poly)
f, a, p = plot(usa_poly; label = "Original"); plot!(usa_reflected; label = "Reflected")
```
This is the complex polygon we'll be benchmarking.
```@example benchmark
simplify_suite = BenchmarkGroup(["Simplify"])
singlepoly_suite = BenchmarkGroup(["Polygon", "title:Polygon simplify", "subtitle:Random blob"])
multipoly_suite = BenchmarkGroup(["MultiPolygon", "title:Multipolygon simplify", "subtitle:USA multipolygon"])
Expand Down

0 comments on commit 24cd37a

Please sign in to comment.