Class PolylineSimplifier

java.lang.Object
com.here.NativeBase
com.here.sdk.core.PolylineSimplifier

public final class PolylineSimplifier extends NativeBase

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:

  • TrafficEngine methods which accept a GeoCorridor;
  • RoutePrefetcher.prefetchGeoCorridor.
  • Constructor Details

  • Method Details

    • simplify

      @NonNull public TaskHandle simplify(@NonNull List<GeoCoordinates> polyline, @NonNull PolylineSimplifier.Options simplificationParameters, @NonNull PolylineSimplificationCallback callback)

      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.

      Parameters:
      polyline -

      Input polyline that should be reduced in size.

      simplificationParameters -

      Strategy, that controls the behavior of the underlying algorithm.

      callback -

      Callback, which will be invoked on the main thread, when operation is finished.

      Returns:

      Controls an asynchronous operation.