PolylineSimplifier
public class PolylineSimplifier
extension PolylineSimplifier: NativeBase
extension PolylineSimplifier: Hashable
PolylineSimplifier helps to reduce the number of points
in the polyline by removing redundant elements using
Douglas–Peucker algorithm, so that result stays
within PolylineSimplifier.Options.
Typical use case is to perform input preparation step before invoking computationally heavy API. Such API have an upper limit on the input collection size and is subject to reduced performance when collection is huge. Examples of such API are:
TrafficEnginemethods which accept aGeoCorridor;RoutePrefetcher.prefetchGeoCorridor.
-
Creates a new instance of
PolylineSimplifier.Throws
InstantiationErrorIndicates what went wrong when the instantiation was attempted.Declaration
Swift
public init() throws -
Controls the strategy of
See morePolylineSimplifier.simplify(...)when reducing a size of polyline.Declaration
Swift
public struct Options -
Reduces the number of points in the input polyline. Does this by removing points which are not significant according to the passed
PolylineSimplifier.Options. Simplification process is performed on the device without connecting to the network and is computationally intensive.Declaration
Swift
public func simplify(polyline: [GeoCoordinates], simplificationParameters: PolylineSimplifier.Options, completion: @escaping PolylineSimplificationCompletionHandler) -> TaskHandleParameters
polylineInput polyline that should be reduced in size.
simplificationParametersStrategy, that controls the behavior of the underlying algorithm.
completionCallback, which will be invoked on the main thread, when operation is finished.
Return Value
Controls an asynchronous operation.