Skip to content

Commit

Permalink
add Makie extension
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaqz committed Dec 27, 2023
1 parent d9910ba commit ba1139a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
1 change: 0 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ RecipesBase = "1"
Tables = "0.2, 1"
julia = "1.6"


[weakdeps]
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"

Expand Down
22 changes: 22 additions & 0 deletions ext/ShapefileMakie.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module ShapefileMakie
using GeoInterfaceMakie: GeoInterfaceMakie
using Shapefile: Shapefile
using Makie: Makie

GeoInterfaceMakie.@enable Shapefile.AbstractShape
GeoInterfaceMakie.@enable Shapefile.SubPolygon
GeoInterfaceMakie.@enable Shapefile.LinearRing

Makie.plottype(tbl::Shapefile.Table) = Makie.plottype(Shapefile.shapes(tbl))
Makie.plottype(shp::Shapefile.Handle) = Makie.plottype(Shapefile.shapes(shp))

for T in (Any, Union{Type{Any}, Type{<:Makie.AbstractPlot}}, Type{<:Makie.Poly}, Type{<:Makie.Lines}, Makie.PointBased)
@eval begin
Makie.convert_arguments(t::$T, tbl::Shapefile.Table) =
Makie.convert_arguments(t, Shapefile.shapes(tbl))
Makie.convert_arguments(t::$T, shp::Shapefile.Handle) =
Makie.convert_arguments(t, Shapefile.shapes(shp))
end
end

end

0 comments on commit ba1139a

Please sign in to comment.