From 96be026e31cadf3cb009612d27ba6a5c6f21a05d Mon Sep 17 00:00:00 2001 From: "Viral B. Shah" Date: Tue, 1 Jul 2025 22:11:15 -0400 Subject: [PATCH 1/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a0b6738c..6d3a0048 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -[![Build Status](https://api.travis-ci.org/JuliaGeometry/GeometryBasics.jl.svg?branch=master)](https://travis-ci.com/JuliaGeometry/GeometryBasics.jl) +[![CI](https://github.com/JuliaGeometry/GeometryBasics.jl/actions/workflows/ci.yml/badge.svg)](https://github.com/JuliaGeometry/GeometryBasics.jl/actions/workflows/ci.yml) [![Codecov](https://codecov.io/gh/JuliaGeometry/GeometryBasics.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/JuliaGeometry/GeometryBasics.jl) [![Docs - stable](https://img.shields.io/badge/docs-stable-lightgrey.svg)](http://juliageometry.github.io/GeometryBasics.jl/stable/) From 874ab24473f239fe2b179bfe678c481d19469775 Mon Sep 17 00:00:00 2001 From: "Viral B. Shah" Date: Tue, 1 Jul 2025 22:13:05 -0400 Subject: [PATCH 2/7] Update ci.yml --- .github/workflows/ci.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e5a95e99..45adf358 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,21 +15,19 @@ jobs: fail-fast: false matrix: version: - - "1.6" - - "1" + - '1.6' + - '1' os: - ubuntu-latest - - macOS-latest - windows-latest arch: - x64 - - x86 - exclude: + include: - os: macOS-latest - arch: x86 + arch: aarch64 steps: - - uses: actions/checkout@v2 - - uses: julia-actions/setup-julia@v1 + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} @@ -47,7 +45,7 @@ jobs: env: JULIA_PKG_SERVER: "" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - run: sudo apt-get update && sudo apt-get install -y xorg-dev mesa-utils xvfb libgl1 freeglut3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev xsettingsd x11-xserver-utils - uses: julia-actions/setup-julia@v1 with: From 1f805e3980eb35442bc28f4ab380fd41951db548 Mon Sep 17 00:00:00 2001 From: "Viral B. Shah" Date: Tue, 1 Jul 2025 22:14:58 -0400 Subject: [PATCH 3/7] Update ci.yml --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 45adf358..0d3b80dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,7 @@ jobs: include: - os: macOS-latest arch: aarch64 + version: '1' steps: - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v2 From 251f00ea18d721f49741f8cf4f05313a0a7d1e85 Mon Sep 17 00:00:00 2001 From: "Viral B. Shah" Date: Tue, 1 Jul 2025 22:17:56 -0400 Subject: [PATCH 4/7] Update ci.yml --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d3b80dc..2aebb893 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,10 +22,14 @@ jobs: - windows-latest arch: - x64 + - x86 include: - os: macOS-latest arch: aarch64 version: '1' + - os: macOS-13 + aarch: x64 + version: '1' steps: - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v2 From 1fc23baacdedb8de68c72201eef655372a4c4d06 Mon Sep 17 00:00:00 2001 From: "Viral B. Shah" Date: Tue, 1 Jul 2025 22:21:19 -0400 Subject: [PATCH 5/7] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2aebb893..77487a29 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: arch: aarch64 version: '1' - os: macOS-13 - aarch: x64 + arch: x64 version: '1' steps: - uses: actions/checkout@v4 From e99d96f0a8c754b9aa7af6b57996082f333fd53a Mon Sep 17 00:00:00 2001 From: Rafael Schouten Date: Mon, 7 Jul 2025 23:10:15 +1000 Subject: [PATCH 6/7] Move GeoInterface.jl to an extension (#263) * move code to extension * test 1.10 not 1.6 * bump minimum julia version to 1.10 --- .github/workflows/ci.yml | 2 +- Project.toml | 12 ++++++--- .../GeometryBasicsGeoInterfaceExt.jl | 27 +++++++++---------- src/GeometryBasics.jl | 7 ++--- src/primitives/rectangles.jl | 9 +++++++ test/geointerface.jl | 7 ++++- 6 files changed, 42 insertions(+), 22 deletions(-) rename src/geointerface.jl => ext/GeometryBasicsGeoInterfaceExt.jl (97%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 77487a29..16ade19d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: fail-fast: false matrix: version: - - '1.6' + - '1.10' - '1' os: - ubuntu-latest diff --git a/Project.toml b/Project.toml index 459f5b57..84eca27d 100644 --- a/Project.toml +++ b/Project.toml @@ -6,13 +6,18 @@ version = "0.5.9" [deps] EarCut_jll = "5ae413db-bbd1-5e63-b57d-d24a61df00f5" Extents = "411431e0-e8b7-467b-b5e0-f676ba4f2910" -GeoInterface = "cf35fbd7-0cd7-5166-be24-54bfbe79505f" IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" +[weakdeps] +GeoInterface = "cf35fbd7-0cd7-5166-be24-54bfbe79505f" + +[extensions] +GeometryBasicsGeoInterfaceExt = "GeoInterface" + [compat] Aqua = "0.8" EarCut_jll = "2" @@ -26,14 +31,15 @@ PrecompileTools = "1.0" Random = "<0.0.1,1" StaticArrays = "0.6, 1" Test = "<0.0.1,1" -julia = "1.6" +julia = "1.10" [extras] Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" GeoJSON = "61d90e0f-e114-555e-ac52-39dfb47a3ef9" +GeoInterface = "cf35fbd7-0cd7-5166-be24-54bfbe79505f" OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["Aqua", "GeoJSON", "Test", "Random", "OffsetArrays"] +test = ["Aqua", "GeoInterface", "GeoJSON", "OffsetArrays", "Random", "Test"] diff --git a/src/geointerface.jl b/ext/GeometryBasicsGeoInterfaceExt.jl similarity index 97% rename from src/geointerface.jl rename to ext/GeometryBasicsGeoInterfaceExt.jl index f806fc27..ed5da70b 100644 --- a/src/geointerface.jl +++ b/ext/GeometryBasicsGeoInterfaceExt.jl @@ -1,3 +1,10 @@ +module GeometryBasicsGeoInterfaceExt + +using GeoInterface, GeometryBasics + +import GeometryBasics: geointerface_geomtype +using GeometryBasics: Ngon + # Implementation of trait based interface from https://github.com/JuliaGeo/GeoInterface.jl/ GeoInterface.isgeometry(::Type{<:AbstractGeometry}) = true @@ -104,12 +111,6 @@ function GeoInterface.convert(::Type{Point}, type::PointTrait, geom) return Point{2,T}(x, y) end end - -# without a function barrier you get a lot of allocations from runtime types -function _collect_with_type(::Type{PT}, geom) where {PT <: Point{2}} - return [PT(GeoInterface.x(p), GeoInterface.y(p)) for p in getgeom(geom)] -end - function GeoInterface.convert(::Type{LineString}, type::LineStringTrait, geom) g1 = getgeom(geom, 1) x, y = GeoInterface.x(g1), GeoInterface.y(g1) @@ -122,7 +123,6 @@ function GeoInterface.convert(::Type{LineString}, type::LineStringTrait, geom) return LineString(_collect_with_type(Point{2, T}, geom)) end end - function GeoInterface.convert(::Type{Polygon}, type::PolygonTrait, geom) t = LineStringTrait() exterior = GeoInterface.convert(LineString, t, GeoInterface.getexterior(geom)) @@ -133,7 +133,6 @@ function GeoInterface.convert(::Type{Polygon}, type::PolygonTrait, geom) return Polygon(exterior, interiors) end end - function GeoInterface.convert(::Type{MultiPoint}, type::MultiPointTrait, geom) g1 = getgeom(geom, 1) x, y = GeoInterface.x(g1), GeoInterface.y(g1) @@ -146,18 +145,18 @@ function GeoInterface.convert(::Type{MultiPoint}, type::MultiPointTrait, geom) return MultiPoint([Point{2,T}(GeoInterface.x(p), GeoInterface.y(p)) for p in getgeom(geom)]) end end - function GeoInterface.convert(::Type{MultiLineString}, type::MultiLineStringTrait, geom) t = LineStringTrait() return MultiLineString(map(l -> GeoInterface.convert(LineString, t, l), getgeom(geom))) end - function GeoInterface.convert(::Type{MultiPolygon}, type::MultiPolygonTrait, geom) t = PolygonTrait() return MultiPolygon(map(poly -> GeoInterface.convert(Polygon, t, poly), getgeom(geom))) end -function Extents.extent(rect::Rect2) - (xmin, ymin), (xmax, ymax) = extrema(rect) - return Extents.Extent(X=(xmin, xmax), Y=(ymin, ymax)) -end \ No newline at end of file +# without a function barrier you get a lot of allocations from runtime types +function _collect_with_type(::Type{PT}, geom) where {PT <: Point{2}} + return [PT(GeoInterface.x(p), GeoInterface.y(p)) for p in getgeom(geom)] +end + +end diff --git a/src/GeometryBasics.jl b/src/GeometryBasics.jl index 887e691c..d01865ae 100644 --- a/src/GeometryBasics.jl +++ b/src/GeometryBasics.jl @@ -1,7 +1,6 @@ module GeometryBasics using IterTools, LinearAlgebra, StaticArrays -using GeoInterface import Extents using EarCut_jll import Base: * @@ -27,8 +26,6 @@ include("triangulation.jl") include("lines.jl") include("boundingboxes.jl") -include("geointerface.jl") - export AbstractGeometry, GeometryPrimitive export Mat, Point, Vec export LineFace, Polytope, Line, NgonFace, convert_simplex @@ -71,4 +68,8 @@ if Base.VERSION >= v"1.8" include("precompiles.jl") end +# Needed for GeometryBasicsGeoInterfaceExt. +# In future this can go away as can use Module dispatch. +function geointerface_geomtype end + end # module diff --git a/src/primitives/rectangles.jl b/src/primitives/rectangles.jl index fa51a216..912161a4 100644 --- a/src/primitives/rectangles.jl +++ b/src/primitives/rectangles.jl @@ -582,3 +582,12 @@ function faces(::Rect3) (3, 4, 8, 7), (1, 3, 7, 5), (6, 8, 4, 2) ] end + +function Extents.extent(rect::Rect2) + (xmin, ymin), (xmax, ymax) = extrema(rect) + return Extents.Extent(X=(xmin, xmax), Y=(ymin, ymax)) +end +function Extents.extent(rect::Rect3) + (xmin, ymin, zmin), (xmax, ymax, zmax) = extrema(rect) + return Extents.Extent(X=(xmin, xmax), Y=(ymin, ymax), Z=(zmin, zmax)) +end diff --git a/test/geointerface.jl b/test/geointerface.jl index 31c7de38..1c62aee7 100644 --- a/test/geointerface.jl +++ b/test/geointerface.jl @@ -123,4 +123,9 @@ end ext = extent(rect) @test ext.X == (0.0f0, 1.0f0) @test ext.Y == (0.0f0, 1.0f0) -end \ No newline at end of file + rect = Rect3f(Vec3f(0), Vec3f(1.0)) + ext = extent(rect) + @test ext.X == (0.0f0, 1.0f0) + @test ext.Y == (0.0f0, 1.0f0) + @test ext.Z == (0.0f0, 1.0f0) +end From 86fc11c9f74987858a44abd80b4cc045c481f7c1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 7 Jul 2025 13:11:55 +0000 Subject: [PATCH 7/7] Set version to 0.5.10 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 84eca27d..7d3903dc 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "GeometryBasics" uuid = "5c1252a2-5f33-56bf-86c9-59e7332b4326" authors = ["SimonDanisch "] -version = "0.5.9" +version = "0.5.10" [deps] EarCut_jll = "5ae413db-bbd1-5e63-b57d-d24a61df00f5"