PolygonDataSource
public class PolygonDataSource
extension PolygonDataSource: NativeBase
extension PolygonDataSource: Hashable
Polygon data source allows the rendering engine access to the user provided polygons geometry and their attributes.
Polygon segments are rendered following the shortest path between their end points.
Note: This is a beta release of this feature, so there could be a few bugs and unexpected behavior. Related APIs may change for new releases without a deprecation process.
-
Called for each polygon, allowing inspection, removal or update of coordinates and attributes.
Declaration
Swift
public typealias PolygonDataProcessor = (_ polygonAccessor: PolygonDataAccessor) -> BoolParameters
polygonAccessorthe polygon data accessor.
Return Value
value indicating the result of the processing.
-
Adds a new polygon to the data source.
Declaration
Swift
public func add(_ polygon: PolygonData)Parameters
polygonPolygon to add.
-
Adds new polygons to the data source.
Declaration
Swift
public func add(_ polygons: [PolygonData])Parameters
polygonsPolygons to add.
-
Removes all polygons from the data source.
Declaration
Swift
public func removeAll() -
Iterates through all the polygons from the data source and passes them to the given processor, one by one. The processor can update the polygon data.
The iteration stops after all polygons have been processed or the processor returns false from the process call.
Declaration
Swift
public func forEach(_ processor: @escaping PolygonDataSource.PolygonDataProcessor)Parameters
processorPolygon processor.
-
Iterates through all the polygons from the data source and passes them to the given inspector, one by one. All polygons for which the inspector returns
trueget removed from the data source. The inspector cannot update the polygon data.Declaration
Swift
public func removeIf(_ inspector: @escaping PolygonDataSource.PolygonDataProcessor)Parameters
inspectorPolygon data processor.