@@ -52,13 +52,26 @@ are present.
5252"""
5353abstract type CLibraryPlanarAlgorithm <: GeometryOpsCore.SingleManifoldAlgorithm{Planar} end
5454
55-
5655function (:: Type{T} )(; params... ) where {T <: CLibraryPlanarAlgorithm }
5756 nt = NamedTuple (params)
5857 return T (Planar (), nt)
5958end
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
6167
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
6275
6376# These are definitions for convenience, so we don't have to type out
6477# `alg.params` every time.
@@ -105,7 +118,6 @@ This uses the [LibGEOS.jl](https://github.com/JuliaGeometry/LibGEOS.jl) package,
105118which is a Julia wrapper around the C library GEOS (https://trac.osgeo.org/geos).
106119"""
107120struct GEOS <: CLibraryPlanarAlgorithm # SingleManifoldAlgorithm{Planar}
108- manifold:: Planar
109121 params:: NamedTuple
110122end
111123
@@ -130,7 +142,6 @@ This uses the [TGGeometry.jl](https://github.com/JuliaGeo/TGGeometry.jl) package
130142which is a Julia wrapper around the `tg` C library (https://github.com/tidwall/tg).
131143"""
132144struct TG <: CLibraryPlanarAlgorithm
133- manifold:: Planar
134145 params:: NamedTuple
135146end
136147
@@ -144,13 +155,22 @@ to use the appropriate PROJ function via `Proj.jl` for the operation.
144155
145156## Extended help
146157
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).
148160"""
149161struct PROJ{M <: Manifold } <: Algorithm{M}
150162 manifold:: M
151163 params:: NamedTuple
152164end
153165
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+
154174# We repeat these functions here because PROJ does not subtype `CLibraryPlanarAlgorithm`.
155175
156176Base. get (alg:: PROJ , key, value) = Base. get (alg. params, key, value)
0 commit comments