Skip to content

Commit

Permalink
Merge pull request #39 from tpgillam/tg/compat_stuff
Browse files Browse the repository at this point in the history
Update to latest Meshes version
  • Loading branch information
tpgillam authored Nov 27, 2023
2 parents ef7a759 + 45a9d9d commit 367cad2
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "TimeZoneFinder"
uuid = "3ccf6684-3f25-4581-8c58-114637dcab4a"
authors = ["Tom Gillam <tpgillam@googlemail.com>"]
version = "0.5.0"
version = "0.5.1"

[deps]
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
Expand All @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
TimeZoneFinder = "3ccf6684-3f25-4581-8c58-114637dcab4a"

[compat]
Documenter = "1"
10 changes: 2 additions & 8 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
31 changes: 26 additions & 5 deletions src/TimeZoneFinder.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

2 comments on commit 367cad2

@tpgillam
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/96002

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.5.1 -m "<description of version>" 367cad2bddf6e95565cddf2712ce2610f6dfcfc0
git push origin v0.5.1

Please sign in to comment.