public class PolyUtil
extends java.lang.Object
| Constructor and Description |
|---|
PolyUtil() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
containsLocation(com.google.android.gms.maps.model.LatLng point,
java.util.List<com.google.android.gms.maps.model.LatLng> polygon,
boolean geodesic)
Computes whether the given point lies inside the specified polygon.
|
static java.util.List<com.google.android.gms.maps.model.LatLng> |
decode(java.lang.String encodedPath)
Decodes an encoded path string into a sequence of LatLngs.
|
static com.google.android.gms.maps.model.LatLng[] |
decodeAsArray(java.lang.String encodedPath)
Decodes an encoded path string into a sequence of LatLngs.
|
static double |
distanceToLine(com.google.android.gms.maps.model.LatLng p,
com.google.android.gms.maps.model.LatLng start,
com.google.android.gms.maps.model.LatLng end)
Computes the distance on the sphere between the point p and the line segment start to end.
|
static java.lang.String |
encode(java.util.List<com.google.android.gms.maps.model.LatLng> path)
Encodes a sequence of
LatLng into an encoded path string. |
static boolean |
isLocationOnEdge(com.google.android.gms.maps.model.LatLng point,
java.util.List<com.google.android.gms.maps.model.LatLng> polygon,
boolean geodesic)
Same as
isLocationOnEdge(LatLng, List, boolean, double)
with a default tolerance of 0.1 meters. |
static boolean |
isLocationOnEdge(com.google.android.gms.maps.model.LatLng point,
java.util.List<com.google.android.gms.maps.model.LatLng> polygon,
boolean geodesic,
double tolerance)
Computes whether the given point lies on or near the edge of a polygon, within a specified
tolerance in meters.
|
static boolean |
isLocationOnPath(com.google.android.gms.maps.model.LatLng point,
java.util.List<com.google.android.gms.maps.model.LatLng> polyline,
boolean geodesic)
|
static boolean |
isLocationOnPath(com.google.android.gms.maps.model.LatLng point,
java.util.List<com.google.android.gms.maps.model.LatLng> polyline,
boolean geodesic,
double tolerance)
Computes whether the given point lies on or near a polyline, within a specified
tolerance in meters.
|
public static boolean containsLocation(@NonNull
com.google.android.gms.maps.model.LatLng point,
@NonNull
java.util.List<com.google.android.gms.maps.model.LatLng> polygon,
boolean geodesic)
public static boolean isLocationOnEdge(@NonNull
com.google.android.gms.maps.model.LatLng point,
@NonNull
java.util.List<com.google.android.gms.maps.model.LatLng> polygon,
boolean geodesic,
double tolerance)
public static boolean isLocationOnEdge(@NonNull
com.google.android.gms.maps.model.LatLng point,
@NonNull
java.util.List<com.google.android.gms.maps.model.LatLng> polygon,
boolean geodesic)
isLocationOnEdge(LatLng, List, boolean, double)
with a default tolerance of 0.1 meters.public static boolean isLocationOnPath(@NonNull
com.google.android.gms.maps.model.LatLng point,
@NonNull
java.util.List<com.google.android.gms.maps.model.LatLng> polyline,
boolean geodesic,
double tolerance)
public static boolean isLocationOnPath(@NonNull
com.google.android.gms.maps.model.LatLng point,
@NonNull
java.util.List<com.google.android.gms.maps.model.LatLng> polyline,
boolean geodesic)
isLocationOnPath(LatLng, List, boolean, double)
with a default tolerance of 0.1 meters.
public static double distanceToLine(com.google.android.gms.maps.model.LatLng p,
com.google.android.gms.maps.model.LatLng start,
com.google.android.gms.maps.model.LatLng end)
p - the point to be measuredstart - the beginning of the line segmentend - the end of the line segment@NonNull
public static java.util.List<com.google.android.gms.maps.model.LatLng> decode(@NonNull
java.lang.String encodedPath)
@NonNull
public static com.google.android.gms.maps.model.LatLng[] decodeAsArray(@NonNull
java.lang.String encodedPath)
encodedPath - @NonNull
public static java.lang.String encode(@NonNull
java.util.List<com.google.android.gms.maps.model.LatLng> path)
LatLng into an encoded path string.path -