@@ -52,13 +52,26 @@ are present.
52
52
"""
53
53
abstract type CLibraryPlanarAlgorithm <: GeometryOpsCore.SingleManifoldAlgorithm{Planar} end
54
54
55
-
56
55
function (:: Type{T} )(; params... ) where {T <: CLibraryPlanarAlgorithm }
57
56
nt = NamedTuple (params)
58
57
return T (Planar (), nt)
59
58
end
60
- (T:: Type{<: CLibraryPlanarAlgorithm} )(params:: NamedTuple ) = T (Planar (), params)
59
+ (T:: Type{<: CLibraryPlanarAlgorithm} )(:: Planar , params:: NamedTuple ) = T (params)
60
+
61
+ manifold (alg:: CLibraryPlanarAlgorithm ) = Planar ()
62
+ best_manifold (alg:: CLibraryPlanarAlgorithm , input) = Planar ()
63
+
64
+ function rebuild (alg:: T , m:: Planar ) where {T <: CLibraryPlanarAlgorithm }
65
+ return T (m, alg. params)
66
+ end
61
67
68
+ function rebuild (alg:: T , m:: AutoManifold ) where {T <: CLibraryPlanarAlgorithm }
69
+ return T (Planar (), alg. params)
70
+ end
71
+
72
+ function rebuild (alg:: T , m:: M ) where {T <: CLibraryPlanarAlgorithm , M <: Manifold }
73
+ throw (GeometryOpsCore. WrongManifoldException {M, Planar, T} (" The algorithm `$(typeof (alg)) ` is only compatible with planar manifolds." ))
74
+ end
62
75
63
76
# These are definitions for convenience, so we don't have to type out
64
77
# `alg.params` every time.
@@ -105,7 +118,6 @@ This uses the [LibGEOS.jl](https://github.com/JuliaGeometry/LibGEOS.jl) package,
105
118
which is a Julia wrapper around the C library GEOS (https://trac.osgeo.org/geos).
106
119
"""
107
120
struct GEOS <: CLibraryPlanarAlgorithm # SingleManifoldAlgorithm{Planar}
108
- manifold:: Planar
109
121
params:: NamedTuple
110
122
end
111
123
@@ -130,7 +142,6 @@ This uses the [TGGeometry.jl](https://github.com/JuliaGeo/TGGeometry.jl) package
130
142
which is a Julia wrapper around the `tg` C library (https://github.com/tidwall/tg).
131
143
"""
132
144
struct TG <: CLibraryPlanarAlgorithm
133
- manifold:: Planar
134
145
params:: NamedTuple
135
146
end
136
147
@@ -144,13 +155,22 @@ to use the appropriate PROJ function via `Proj.jl` for the operation.
144
155
145
156
## Extended help
146
157
147
- This is the default algorithm for [`reproject`](@ref), and is also the default algorithm for
158
+ This is the default algorithm for [`reproject`](@ref), and will also be the default algorithm for
159
+ operations on geodesics like [`area`](@ref) and [`arclength`](@ref).
148
160
"""
149
161
struct PROJ{M <: Manifold } <: Algorithm{M}
150
162
manifold:: M
151
163
params:: NamedTuple
152
164
end
153
165
166
+ PROJ () = PROJ (Planar (), NamedTuple ())
167
+ PROJ (; params... ) = PROJ (Planar (), NamedTuple (params))
168
+ PROJ (m:: Manifold ) = PROJ (m, NamedTuple ())
169
+
170
+ manifold (alg:: PROJ ) = alg. manifold
171
+ rebuild (alg:: PROJ , m:: Manifold ) = PROJ (m, alg. params)
172
+ rebuild (alg:: PROJ , params:: NamedTuple ) = PROJ (alg. manifold, params)
173
+
154
174
# We repeat these functions here because PROJ does not subtype `CLibraryPlanarAlgorithm`.
155
175
156
176
Base. get (alg:: PROJ , key, value) = Base. get (alg. params, key, value)
0 commit comments