PolylineSimplifier (API Reference)
Class PolylineSimplifier
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classControls the strategy ofsimplify(java.util.List<com.here.sdk.core.GeoCoordinates>, com.here.sdk.core.PolylineSimplifier.Options, com.here.sdk.core.PolylineSimplificationCallback)when reducing a size of polyline. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionsimplify(List<GeoCoordinates> polyline, PolylineSimplifier.Options simplificationParameters, PolylineSimplificationCallback callback) Reduces the number of points in the input polyline.
-
Constructor Details
-
PolylineSimplifier
Creates a new instance of
PolylineSimplifier.- Throws:
InstantiationErrorException-Indicates what went wrong when the instantiation was attempted.
-
-
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.
-