tripkit-android / com.skedgo.tripkit.common.util / PolyUtil

PolyUtil

open class PolyUtil

Functions

Name Summary
containsLocation open static fun containsLocation(point:TripKitLatLng!, polygon:MutableList<TripKitLatLng!>!, geodesic:Boolean):Boolean
Computes whether the given point lies inside the specified polygon. The polygon is always considered closed, regardless of whether the last point equals the first or not. Inside is defined as not containing the South Pole -- the South Pole is always outside. The polygon is formed of great circle segments if geodesic is true, and of rhumb (loxodromic) segments otherwise.open static fun containsLocation(latitude:Double, longitude:Double, polygon:MutableList<TripKitLatLng!>!, geodesic:Boolean):Boolean
decode Decodes an encoded path string into a sequence of TripKitLatLngs.open static fun decode(encodedPath:String!):MutableList<TripKitLatLng!>!
distanceToLine Computes the distance on the sphere between the point p and the line segment start to end.open static fun distanceToLine(p:TripKitLatLng!, start:TripKitLatLng!, end:TripKitLatLng!):Double
encode Encodes a sequence of TripKitLatLngs into an encoded path string.open static fun encode(path:MutableList<TripKitLatLng!>!):String!
isClosedPolygon Returns true if the provided list of points is a closed polygon (i.e., the first and last points are the same), and false if it is notopen static fun isClosedPolygon(poly:MutableList<TripKitLatLng!>!):Boolean
isLocationOnEdge Computes whether the given point lies on or near the edge of a polygon, within a specified tolerance in meters. The polygon edge is composed of great circle segments if geodesic is true, and of Rhumb segments otherwise. The polygon edge is implicitly closed -- the closing segment between the first point and the last point is included.open static fun isLocationOnEdge(point:TripKitLatLng!, polygon:MutableList<TripKitLatLng!>!, geodesic:Boolean, tolerance:Double):Boolean
Same as `[#isLocationOnEdge(TripKitLatLng, List, boolean, double)](is-location-on-edge.md) with a default tolerance of 0.1 meters.open static fun isLocationOnEdge(point: [TripKitLatLng](../-trip-kit-lat-lng/index.md)!, polygon: [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)<[TripKitLatLng](../-trip-kit-lat-lng/index.md)!>!, geodesic: [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)): [Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
isLocationOnPath Computes whether the given point lies on or near a polyline, within a specified tolerance in meters. The polyline is composed of great circle segments if geodesic is true, and of Rhumb segments otherwise. The polyline is not closed -- the closing segment between the first point and the last point is not included.open static fun isLocationOnPath(point:TripKitLatLng!, polyline:MutableList<TripKitLatLng!>!, geodesic:Boolean, tolerance:Double):Boolean
Same as `[#isLocationOnPath(TripKitLatLng, List, boolean, double)](is-location-on-path.md)open static fun isLocationOnPath(point: [TripKitLatLng](../-trip-kit-lat-lng/index.md)!, polyline: [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)<[TripKitLatLng](../-trip-kit-lat-lng/index.md)!>!, geodesic: [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)): [Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
locationIndexOnEdgeOrPath Computes whether (and where) a given point lies on or near a polyline, within a specified tolerance. If closed, the closing segment between the last and first points of the polyline is not considered.open static fun locationIndexOnEdgeOrPath(point:TripKitLatLng!, poly:MutableList<TripKitLatLng!>!, closed:Boolean, geodesic:Boolean, toleranceEarth:Double):Int
locationIndexOnPath Computes whether (and where) a given point lies on or near a polyline, within a specified tolerance. The polyline is not closed -- the closing segment between the first point and the last point is not included.open static fun locationIndexOnPath(point:TripKitLatLng!, poly:MutableList<TripKitLatLng!>!, geodesic:Boolean, tolerance:Double):Int
Same as `[#locationIndexOnPath(TripKitLatLng, List, boolean, double)](location-index-on-path.md)open static fun locationIndexOnPath(point: [TripKitLatLng](../-trip-kit-lat-lng/index.md)!, polyline: [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)<[TripKitLatLng](../-trip-kit-lat-lng/index.md)!>!, geodesic: [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)): [Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)
simplify Simplifies the given poly (polyline or polygon) using the Douglas-Peucker decimation algorithm. Increasing the tolerance will result in fewer points in the simplified polyline or polygon. open static fun simplify(poly:MutableList<TripKitLatLng!>!, tolerance:Double):MutableList<TripKitLatLng!>!