diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 0a02aae..d219b09 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -35,7 +35,7 @@ jobs: - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 - uses: julia-actions/julia-processcoverage@v1 - - uses: codecov/codecov-action@v2 + - uses: codecov/codecov-action@v3 with: files: lcov.info docs: diff --git a/Project.toml b/Project.toml index a6d8dbc..05852e4 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "TimeZoneFinder" uuid = "3ccf6684-3f25-4581-8c58-114637dcab4a" authors = ["Tom Gillam "] -version = "0.5.0" +version = "0.5.1" [deps] JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1" @@ -18,7 +18,7 @@ TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53" JSON3 = "1" LazyArtifacts = "1" Memoize = "0.4" -Meshes = "0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29" +Meshes = "0.32,0.33,0.34,0.35,0.36" PrecompileTools = "1" Scratch = "1" TimeZones = "1.10" diff --git a/docs/Project.toml b/docs/Project.toml index 28e8af1..a3c2072 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,3 +1,6 @@ [deps] Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" TimeZoneFinder = "3ccf6684-3f25-4581-8c58-114637dcab4a" + +[compat] +Documenter = "1" diff --git a/docs/make.jl b/docs/make.jl index 6eb5900..9889ede 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -14,14 +14,8 @@ makedocs(; edit_link="main", assets=String[], ), - pages=[ - "Home" => "index.md", - ], + pages=["Home" => "index.md"], checkdocs=:exports, - strict=true, ) -deploydocs(; - repo="github.com/tpgillam/TimeZoneFinder.jl", - devbranch="main", -) +deploydocs(; repo="github.com/tpgillam/TimeZoneFinder.jl", devbranch="main") diff --git a/src/TimeZoneFinder.jl b/src/TimeZoneFinder.jl index 6d86a73..fa27384 100644 --- a/src/TimeZoneFinder.jl +++ b/src/TimeZoneFinder.jl @@ -12,14 +12,35 @@ using Scratch using Serialization using TimeZones -function _get_points(coord_list)::Vector{Point{2,Float64}} - return [Point(Float64(x[1]), Float64(x[2])) for x in coord_list] +"""Get points that form a closed loop. + +The last point that is returned is assumed to be connected back to the first; it is expected +that in `coord_list` it will actually be repeated. +""" +function _get_ring_points(coord_list)::Vector{Point{2,Float64}} + # In the co-ordinate list, the first and last points _should_ be the same. We verify + # that this is the case. + first(coord_list) == last(coord_list) || throw(ArgumentError("Curve is not closed!")) + + return [Point(Float64(x[1]), Float64(x[2])) for x in coord_list[1:(end - 1)]] end function _get_polyarea(coordinates) - exterior = _get_points(first(coordinates)) - interiors = map(_get_points, coordinates[2:end]) - return PolyArea(exterior, interiors) + exterior = _get_ring_points(first(coordinates)) + interiors = map(_get_ring_points, coordinates[2:end]) + + return if hasmethod( + PolyArea, Tuple{AbstractVector{Point},AbstractVector{Point},AbstractVector{Point}} + ) + PolyArea(exterior, interiors...) + else + # This branch supports versions of Meshes.jl <0.35. + # We want to support 0.32 for a while, because this is the newest version that + # supports Julia 1.6. Later versions only support Julia 1.9. At some point we will + # delete all this and move to >=1.9; hopefully we can hold out until another LTS is + # released. + PolyArea(exterior, interiors) + end end function _get_polyareas(geometry)