From 1eb5f010c5eac14a7fb02c37e938c39f0e05be02 Mon Sep 17 00:00:00 2001 From: Alexander Plavin Date: Sat, 23 Aug 2025 18:15:22 -0400 Subject: [PATCH 1/2] make Extents a weakdep --- Project.toml | 6 ++++-- ext/ExtentsExt.jl | 16 ++++++++++++++++ src/GeometryBasics.jl | 1 - src/primitives/rectangles.jl | 9 --------- 4 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 ext/ExtentsExt.jl diff --git a/Project.toml b/Project.toml index 7d3903dc..c0ea992d 100644 --- a/Project.toml +++ b/Project.toml @@ -5,7 +5,6 @@ version = "0.5.10" [deps] EarCut_jll = "5ae413db-bbd1-5e63-b57d-d24a61df00f5" -Extents = "411431e0-e8b7-467b-b5e0-f676ba4f2910" IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" @@ -13,9 +12,11 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" [weakdeps] +Extents = "411431e0-e8b7-467b-b5e0-f676ba4f2910" GeoInterface = "cf35fbd7-0cd7-5166-be24-54bfbe79505f" [extensions] +ExtentsExt = "Extents" GeometryBasicsGeoInterfaceExt = "GeoInterface" [compat] @@ -35,6 +36,7 @@ julia = "1.10" [extras] Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" +Extents = "411431e0-e8b7-467b-b5e0-f676ba4f2910" GeoJSON = "61d90e0f-e114-555e-ac52-39dfb47a3ef9" GeoInterface = "cf35fbd7-0cd7-5166-be24-54bfbe79505f" OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" @@ -42,4 +44,4 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["Aqua", "GeoInterface", "GeoJSON", "OffsetArrays", "Random", "Test"] +test = ["Aqua", "Extents", "GeoInterface", "GeoJSON", "OffsetArrays", "Random", "Test"] diff --git a/ext/ExtentsExt.jl b/ext/ExtentsExt.jl new file mode 100644 index 00000000..a151054c --- /dev/null +++ b/ext/ExtentsExt.jl @@ -0,0 +1,16 @@ +module ExtentsExt + +import GeometryBasics +import Extents + +function Extents.extent(rect::GeometryBasics.Rect2) + (xmin, ymin), (xmax, ymax) = extrema(rect) + return Extents.Extent(X=(xmin, xmax), Y=(ymin, ymax)) +end + +function Extents.extent(rect::GeometryBasics.Rect3) + (xmin, ymin, zmin), (xmax, ymax, zmax) = extrema(rect) + return Extents.Extent(X=(xmin, xmax), Y=(ymin, ymax), Z=(zmin, zmax)) +end + +end diff --git a/src/GeometryBasics.jl b/src/GeometryBasics.jl index d01865ae..783dac5e 100644 --- a/src/GeometryBasics.jl +++ b/src/GeometryBasics.jl @@ -1,7 +1,6 @@ module GeometryBasics using IterTools, LinearAlgebra, StaticArrays -import Extents using EarCut_jll import Base: * diff --git a/src/primitives/rectangles.jl b/src/primitives/rectangles.jl index 912161a4..fa51a216 100644 --- a/src/primitives/rectangles.jl +++ b/src/primitives/rectangles.jl @@ -582,12 +582,3 @@ 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 From 1625e0ff88025b2b4740276cc1f361114575a2a1 Mon Sep 17 00:00:00 2001 From: Alexander Plavin Date: Sat, 23 Aug 2025 19:25:11 -0400 Subject: [PATCH 2/2] remove IterTools --- Project.toml | 2 -- src/GeometryBasics.jl | 2 +- src/primitives/spheres.jl | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Project.toml b/Project.toml index c0ea992d..c76db4a2 100644 --- a/Project.toml +++ b/Project.toml @@ -5,7 +5,6 @@ version = "0.5.10" [deps] EarCut_jll = "5ae413db-bbd1-5e63-b57d-d24a61df00f5" -IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" @@ -25,7 +24,6 @@ EarCut_jll = "2" Extents = "0.1" GeoInterface = "1.0.1" GeoJSON = "0.7, 0.8" -IterTools = "1.3.0" LinearAlgebra = "<0.0.1,1" OffsetArrays = "1" PrecompileTools = "1.0" diff --git a/src/GeometryBasics.jl b/src/GeometryBasics.jl index 783dac5e..39f015f2 100644 --- a/src/GeometryBasics.jl +++ b/src/GeometryBasics.jl @@ -1,6 +1,6 @@ module GeometryBasics -using IterTools, LinearAlgebra, StaticArrays +using LinearAlgebra, StaticArrays using EarCut_jll import Base: * diff --git a/src/primitives/spheres.jl b/src/primitives/spheres.jl index c29c6d4e..f4fff7e4 100644 --- a/src/primitives/spheres.jl +++ b/src/primitives/spheres.jl @@ -67,7 +67,7 @@ end function texturecoordinates(::Sphere, nvertices=24) ux = LinRange(0, 1, nvertices) - return ivec(((φ, θ) for θ in reverse(ux), φ in ux)) + return ((φ, θ) for φ in ux for θ in reverse(ux)) end function faces(::Sphere, nvertices=24)