@@ -20,7 +20,7 @@ struct _True <: BoolsAsTypes end
20
20
struct _False <: BoolsAsTypes end
21
21
22
22
@inline _booltype (x:: Bool ):: BoolsAsTypes = x ? _True () : _False ()
23
- @inline _booltype (x:: BoolsAsTypes ) = x
23
+ @inline _booltype (x:: BoolsAsTypes ):: BoolsAsTypes = x
24
24
25
25
"""
26
26
TraitTarget{T}
@@ -260,21 +260,21 @@ If `threaded==true` threads will be used over arrays and iterables,
260
260
feature collections and nested geometries.
261
261
"""
262
262
@inline function applyreduce (
263
- f:: F , op, target, geom; threaded= false , init= nothing
264
- ) where F
263
+ f:: F , op:: O , target, geom; threaded= false , init= nothing
264
+ ) where {F, O}
265
265
threaded = _booltype (threaded)
266
266
_applyreduce (f, op, TraitTarget (target), geom; threaded, init)
267
267
end
268
268
269
- @inline _applyreduce (f:: F , op, target, geom; threaded, init) where F =
269
+ @inline _applyreduce (f:: F , op:: O , target, geom; threaded, init) where {F, O} =
270
270
_applyreduce (f, op, target, GI. trait (geom), geom; threaded, init)
271
271
# Maybe use threads recucing over arrays
272
- @inline function _applyreduce (f:: F , op, target, :: Nothing , A:: AbstractArray ; threaded, init) where F
272
+ @inline function _applyreduce (f:: F , op:: O , target, :: Nothing , A:: AbstractArray ; threaded, init) where {F, O}
273
273
applyreduce_array (i) = _applyreduce (f, op, target, A[i]; threaded= _False (), init)
274
274
_mapreducetasks (applyreduce_array, op, eachindex (A), threaded; init)
275
275
end
276
276
# Try to applyreduce over iterables
277
- @inline function _applyreduce (f:: F , op, target, :: Nothing , iterable; threaded, init) where F
277
+ @inline function _applyreduce (f:: F , op:: O , target, :: Nothing , iterable; threaded, init) where {F, O}
278
278
applyreduce_iterable (i) = _applyreduce (f, op, target, x; threaded= _False (), init)
279
279
if threaded # Try to `collect` and reduce over the vector with threads
280
280
_applyreduce (f, op, target, collect (iterable); threaded, init)
@@ -284,27 +284,27 @@ end
284
284
end
285
285
end
286
286
# Maybe use threads reducing over features of feature collections
287
- @inline function _applyreduce (f:: F , op, target, :: GI.FeatureCollectionTrait , fc; threaded, init) where F
287
+ @inline function _applyreduce (f:: F , op:: O , target, :: GI.FeatureCollectionTrait , fc; threaded, init) where {F, O}
288
288
applyreduce_fc (i) = _applyreduce (f, op, target, GI. getfeature (fc, i); threaded= _False (), init)
289
289
_mapreducetasks (applyreduce_fc, op, 1 : GI. nfeature (fc), threaded; init)
290
290
end
291
291
# Features just applyreduce to their geometry
292
- @inline _applyreduce (f:: F , op, target, :: GI.FeatureTrait , feature; threaded, init) where F =
292
+ @inline _applyreduce (f:: F , op:: O , target, :: GI.FeatureTrait , feature; threaded, init) where {F, O} =
293
293
_applyreduce (f, op, target, GI. geometry (feature); threaded, init)
294
294
# Maybe use threads over components of nested geometries
295
- @inline function _applyreduce (f:: F , op, target, trait, geom; threaded, init) where F
295
+ @inline function _applyreduce (f:: F , op:: O , target, trait, geom; threaded, init) where {F, O}
296
296
applyreduce_geom (i) = _applyreduce (f, op, target, GI. getgeom (geom, i); threaded= _False (), init)
297
297
_mapreducetasks (applyreduce_geom, op, 1 : GI. ngeom (geom), threaded; init)
298
298
end
299
299
# Don't thread over points it won't pay off
300
300
@inline function _applyreduce (
301
- f:: F , op, target, trait:: Union{GI.LinearRing,GI.LineString,GI.MultiPoint} , geom;
301
+ f:: F , op:: O , target, trait:: Union{GI.LinearRing,GI.LineString,GI.MultiPoint} , geom;
302
302
threaded, init
303
- ) where F
303
+ ) where {F, O}
304
304
_applyreduce (f, op, target, GI. getgeom (geom); threaded= _False (), init)
305
305
end
306
306
# Apply f to the target
307
- @inline function _applyreduce (f:: F , op, :: TraitTarget{Target} , :: Trait , x; kw... ) where {F,Target,Trait<: Target }
307
+ @inline function _applyreduce (f:: F , op:: O , :: TraitTarget{Target} , :: Trait , x; kw... ) where {F,O ,Target,Trait<: Target }
308
308
f (x)
309
309
end
310
310
# Fail if we hit PointTrait
@@ -315,7 +315,7 @@ for T in (
315
315
GI. PointTrait, GI. LinearRing, GI. LineString,
316
316
GI. MultiPoint, GI. FeatureTrait, GI. FeatureCollectionTrait
317
317
)
318
- @eval _applyreduce (f:: F , op, :: TraitTarget{<:$T} , trait:: $T , x; kw... ) where F = f (x)
318
+ @eval _applyreduce (f:: F , op:: O , :: TraitTarget{<:$T} , trait:: $T , x; kw... ) where {F, O} = f (x)
319
319
end
320
320
321
321
"""
0 commit comments