Skip to content

Commit 1eb5f01

Browse files
committed
make Extents a weakdep
1 parent 86fc11c commit 1eb5f01

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

Project.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@ version = "0.5.10"
55

66
[deps]
77
EarCut_jll = "5ae413db-bbd1-5e63-b57d-d24a61df00f5"
8-
Extents = "411431e0-e8b7-467b-b5e0-f676ba4f2910"
98
IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e"
109
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1110
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
1211
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1312
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
1413

1514
[weakdeps]
15+
Extents = "411431e0-e8b7-467b-b5e0-f676ba4f2910"
1616
GeoInterface = "cf35fbd7-0cd7-5166-be24-54bfbe79505f"
1717

1818
[extensions]
19+
ExtentsExt = "Extents"
1920
GeometryBasicsGeoInterfaceExt = "GeoInterface"
2021

2122
[compat]
@@ -35,11 +36,12 @@ julia = "1.10"
3536

3637
[extras]
3738
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
39+
Extents = "411431e0-e8b7-467b-b5e0-f676ba4f2910"
3840
GeoJSON = "61d90e0f-e114-555e-ac52-39dfb47a3ef9"
3941
GeoInterface = "cf35fbd7-0cd7-5166-be24-54bfbe79505f"
4042
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
4143
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
4244
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
4345

4446
[targets]
45-
test = ["Aqua", "GeoInterface", "GeoJSON", "OffsetArrays", "Random", "Test"]
47+
test = ["Aqua", "Extents", "GeoInterface", "GeoJSON", "OffsetArrays", "Random", "Test"]

ext/ExtentsExt.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module ExtentsExt
2+
3+
import GeometryBasics
4+
import Extents
5+
6+
function Extents.extent(rect::GeometryBasics.Rect2)
7+
(xmin, ymin), (xmax, ymax) = extrema(rect)
8+
return Extents.Extent(X=(xmin, xmax), Y=(ymin, ymax))
9+
end
10+
11+
function Extents.extent(rect::GeometryBasics.Rect3)
12+
(xmin, ymin, zmin), (xmax, ymax, zmax) = extrema(rect)
13+
return Extents.Extent(X=(xmin, xmax), Y=(ymin, ymax), Z=(zmin, zmax))
14+
end
15+
16+
end

src/GeometryBasics.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
module GeometryBasics
22

33
using IterTools, LinearAlgebra, StaticArrays
4-
import Extents
54
using EarCut_jll
65
import Base: *
76

src/primitives/rectangles.jl

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -582,12 +582,3 @@ function faces(::Rect3)
582582
(3, 4, 8, 7), (1, 3, 7, 5), (6, 8, 4, 2)
583583
]
584584
end
585-
586-
function Extents.extent(rect::Rect2)
587-
(xmin, ymin), (xmax, ymax) = extrema(rect)
588-
return Extents.Extent(X=(xmin, xmax), Y=(ymin, ymax))
589-
end
590-
function Extents.extent(rect::Rect3)
591-
(xmin, ymin, zmin), (xmax, ymax, zmax) = extrema(rect)
592-
return Extents.Extent(X=(xmin, xmax), Y=(ymin, ymax), Z=(zmin, zmax))
593-
end

0 commit comments

Comments
 (0)