@@ -195,12 +195,23 @@ Base.size(x::MeshMeta) = size(metafree(x))
195
195
196
196
197
197
"""
198
- `Feature` type acts same as Meta method
198
+
199
+ Feature(::type{T}, Names, Types)
200
+
201
+ Returns a `Feature` that holds a geometry and it's metadata
202
+
203
+ `Feature` acts the same as `Meta` method.
199
204
The difference lies in the fact that it is designed to handle
200
- heterogeneous types.
205
+ geometries and metadata of different/heterogeneous types.
206
+
207
+ eg: While a Point MetaGeometry is a `PointMeta`, the Feature representation is `Feature{Point}`
208
+ The downside being it's not subtyped to `AbstractPoint` like a `PointMeta` is.
201
209
202
- eg: A Point MetaGeometry is a `PointMeta`
203
- But a feature is represented as `Feature{Point}`
210
+ Example:
211
+ ```julia
212
+ julia> Feature(Point(1, 2), city = "Mumbai")
213
+ Feature{Point{2,Int64},(:city,),Tuple{String}}([1, 2], (city = "Mumbai",))
214
+ ```
204
215
"""
205
216
struct Feature{T, Names, Types}
206
217
main:: T
@@ -244,7 +255,7 @@ function StructArrays.createinstance(::Type{F}, x, args...) where {F<:Feature}
244
255
end
245
256
246
257
"""
247
- Accepts an Array/iterator of Features and put it into a StructArray
258
+ Accepts an iterable of Features and put it into a StructArray
248
259
"""
249
260
function collect_feature (iter)
250
261
cols = Tables. columntable (iter)
@@ -256,6 +267,6 @@ function collect_feature(main, meta::NamedTuple{names, types}) where {names, typ
256
267
return StructArray {F} (; main= main, meta... )
257
268
end
258
269
259
- Base. getindex (f :: Feature , idx:: Int ) = getindex (metafree (f ), idx)
260
- Base. size (f :: Feature ) = size (metafree (f ))
270
+ Base. getindex (x :: Feature , idx:: Int ) = getindex (metafree (x ), idx)
271
+ Base. size (x :: Feature ) = size (metafree (x ))
261
272
0 commit comments