|
1 |
| -struct Prepared{Pa,Pr} |
2 |
| - parent::Pa |
3 |
| - preparations::Pr |
4 |
| -end |
5 |
| - |
6 |
| -Base.parent(x::Prepared) = x.parent |
7 |
| -@inline getprep(p::Prepared, x::Symbol) = getproperty(p.preparations, x) |
8 |
| - |
9 |
| -GI.trait(p::Prepared) = GI.trait(parent(p)) |
10 |
| -GI.geomtrait(p::Prepared) = GI.geomtrait(parent(p)) |
11 |
| - |
12 |
| -GI.isgeometry(::Type{<:Prepared{T}}) where {T} = GI.isgeometry(T) |
13 |
| -GI.isfeature(::Type{<:Prepared{T}}) where {T} = GI.isfeature(T) |
14 |
| -GI.isfeaturecollection(::Type{<:Prepared{T}}) where {T} = GI.isfeaturecollection(T) |
15 |
| - |
16 |
| -GI.geometry(x::Prepared) = GI.geometry(parent(x)) |
17 |
| -GI.properties(x::Prepared) = GI.properties(parent(x)) |
18 |
| - |
19 |
| -for f in (:extent, :crs) |
20 |
| - @eval GI.$f(t::GI.AbstractTrait, x::Prepared) = GI.$f(t, parent(x)) |
21 |
| -end |
22 |
| -for f in (:coordnames, :is3d, :ismeasured, :isempty, :coordinates, :getgeom) |
23 |
| - @eval GI.$f(t::GI.AbstractGeometryTrait, geom::Prepared, args...) = GI.$f(t, parent(geom), args...) |
24 |
| -end |
25 |
| - |
26 |
| -for f in (:x, :y, :z, :m, :coordinates, :getcoord, :ngeom, :getgeom) |
27 |
| - @eval GI.$f(t::GI.AbstractPointTrait, geom::Prepared, args...) = GI.$f(t, parent(geom), args...) |
28 |
| -end |
29 |
| -for f in (:npoint, :getpoint, :startpoint, :endpoint, :npoint, :issimple, :isclosed, :isring) |
30 |
| - @eval GI.$f(t::GI.AbstractCurveTrait, geom::Prepared, args...) = GI.$f(t, parent(geom), args...) |
31 |
| -end |
32 |
| -for f in (:nring, :getring, :getexterior, :nhole, :gethole, :npoint, :getpoint, :startpoint, :endpoint) |
33 |
| - @eval GI.$f(t::GI.AbstractPolygonTrait, geom::Prepared, args...) = GI.$f(t, parent(geom), args...) |
34 |
| -end |
35 |
| -for f in (:npoint, :getpoint, :issimple) |
36 |
| - @eval GI.$f(t::GI.AbstractMultiPointTrait, geom::Prepared, args...) = GI.$f(t, parent(geom), args...) |
37 |
| - @eval GI.$f(t::GI.AbstractMultiCurveTrait, geom::Prepared, args...) = GI.$f(t, parent(geom), args...) |
38 |
| -end |
39 |
| -for f in (:nring, :getring, :npoint, :getpoint) |
40 |
| - @eval GI.$f(t::GI.AbstractMultiPolygonTrait, geom::Prepared, args...) = GI.$f(t, parent(geom), args...) |
41 |
| -end |
42 |
| - |
43 |
| -getpoint(t::GI.AbstractPolyhedralSurfaceTrait, geom::Prepared) = GI.getpoint(t, parent(geom)) |
44 |
| -isclosed(t::GI.AbstractMultiCurveTrait, geom::Prepared) = GI.isclosed(t, parent(geom)) |
45 |
| - |
46 |
| -for f in (:getfeature, :coordinates) |
47 |
| - @eval GI.$f(t::GI.AbstractFeatureTrait, geom::Prepared, args...) = $f(t, parent(geom), args...) |
48 |
| -end |
49 |
| - |
50 |
| -# Ambiguity |
51 |
| -for T in (:LineTrait, :TriangleTrait, :PentagonTrait, :HexagonTrait, :RectangleTrait, :QuadTrait) |
52 |
| - @eval GI.npoint(t::GI.$T, geom::Prepared) = GI.npoint(t, parent(geom)) |
53 |
| -end |
54 |
| -for T in (:RectangleTrait, :QuadTrait, :PentagonTrait, :HexagonTrait, :TriangleTrait) |
55 |
| - @eval GI.nring(t::GI.$T, geom::Prepared) = GI.nring(t, parent(geom)) |
56 |
| -end |
0 commit comments