visibleFeaturesInRect$2 method
- CGRect rect, {
- NSSet? inStyleLayersWithIdentifiers,
- NSPredicate? predicate,
Returns an array of rendered map features that intersect with the given rectangle, restricted to the given style layers and filtered by the given predicate.
Each object in the returned array represents a feature rendered by the
current style and provides access to attributes specified by the relevant map
content sources. The returned array includes features loaded by
MLNShapeSource and MLNShapeSource objects but does not include
anything from MLNRasterTileSource objects, or from video or canvas sources,
which are unsupported by this SDK.
The returned features are drawn by a style layer in the current style. For
example, suppose the current style uses a particular source,
but none of the specified style layers includes features that have the maki
property set to bus. If you pass a rectangle containing the location of a bus
stop into this method, the bus stop feature does not appear in the resulting
array. On the other hand, if the style does include bus stops, an MLNFeature
object representing that bus stop is returned and its featureAttributes
dictionary has the maki key set to bus (along with other attributes). The
dictionary contains only the attributes provided by the tile source; it does
not include computed attribute values or rules about how the feature is
rendered by the current style.
The returned array is sorted by z-order, starting with the topmost rendered feature and ending with the bottommost rendered feature. A feature that is rendered multiple times due to wrapping across the antimeridian at low zoom levels is included only once, subject to the caveat that follows.
Features come from tiled vector data or GeoJSON data that is converted to tiles internally, so feature geometries are clipped at tile boundaries and features may appear duplicated across tiles. For example, suppose the specified rectangle intersects with a road that spans the screen. The resulting array includes those parts of the road that lie within the map tiles covering the specified rectangle, even if the road extends into other tiles. The portion of the road within each map tile is included individually.
To find out the layer names in a particular style, view the style in Maputnik.
Only visible features are returned. To obtain features regardless of
visibility, use the
MLNVectorTileSource/featuresInSourceLayersWithIdentifiers:predicate: and
MLNShapeSource/featuresMatchingPredicate: methods on the relevant sources.
@param rect A rectangle expressed in the map view’s coordinate system.
@param styleLayerIdentifiers A set of strings that correspond to the names of
layers defined in the current style. Only the features contained in these
layers are included in the returned array.
@param predicate A predicate to filter the returned features.
@return An array of objects conforming to the MLNFeature protocol that
represent features in the sources used by the current style.
Implementation
objc.NSArray visibleFeaturesInRect$2(objc.CGRect rect, {objc.NSSet? inStyleLayersWithIdentifiers,NSPredicate? predicate}) {
final _ret = _objc_msgSend_1o8sa9u(this.ref.pointer, _sel_visibleFeaturesInRect_inStyleLayersWithIdentifiers_predicate_, rect, inStyleLayersWithIdentifiers?.ref.pointer ?? ffi.nullptr, predicate?.ref.pointer ?? ffi.nullptr);
return objc.NSArray.castFromPointer(_ret, retain: true, release: true);
}