Package mil.nga.geopackage.map
Class MapUtils
- java.lang.Object
-
- mil.nga.geopackage.map.MapUtils
-
public class MapUtils extends Object
Map utilities- Since:
- 2.0.0
-
-
Constructor Summary
Constructors Constructor Description MapUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BoundingBoxbuildClickBoundingBox(LatLng latLng, View view, GoogleMap map, float screenClickPercentage)Build a bounding box using the click location, map view, map, and screen percentage tolerance.static LatLngBoundingBoxbuildClickLatLngBoundingBox(LatLng latLng, View view, GoogleMap map, float screenClickPercentage)Build a lat lng bounding box using the click location, map view, map, and screen percentage tolerance.static LatLngBoundsbuildClickLatLngBounds(LatLng latLng, View view, GoogleMap map, float screenClickPercentage)Build a lat lng bounds using the click location, map view, map, and screen percentage tolerance.static BoundingBoxgetBoundingBox(GoogleMap map)Get the WGS84 bounding box of the current map view screen.static floatgetCurrentZoom(GoogleMap map)Get the current zoom level of the mapstatic doublegetToleranceDistance(View view, GoogleMap map)Get the tolerance distance meters in the current region of the mapstatic doublegetToleranceDistance(LatLng latLng, View view, GoogleMap map, float screenClickPercentage)Get the allowable tolerance distance in meters from the click location on the map view and map with the screen percentage tolerance.static booleanisPointNearMarker(LatLng point, MarkerOptions shapeMarker, double tolerance)Is the point near the shape markerstatic booleanisPointNearMultiLatLng(LatLng point, MultiLatLng multiLatLng, double tolerance)Is the point near any points in the multi lat lngstatic booleanisPointNearPoint(LatLng point, LatLng shapePoint, double tolerance)Is the point near the shape pointstatic booleanisPointOnMultiPolygon(LatLng point, MultiPolygonOptions multiPolygon, boolean geodesic, double tolerance)Is the point on the multi polygonstatic booleanisPointOnMultiPolyline(LatLng point, MultiPolylineOptions multiPolyline, boolean geodesic, double tolerance)Is the point on the multi polylinestatic booleanisPointOnPolygon(LatLng point, PolygonOptions polygon, boolean geodesic, double tolerance)Is the point of the polygonstatic booleanisPointOnPolyline(LatLng point, PolylineOptions polyline, boolean geodesic, double tolerance)Is the point on the polylinestatic booleanisPointOnShape(LatLng point, GoogleMapShape shape, boolean geodesic, double tolerance)Is the point on or near the shape
-
-
-
Method Detail
-
getCurrentZoom
public static float getCurrentZoom(GoogleMap map)
Get the current zoom level of the map- Parameters:
map- google map- Returns:
- current zoom level
-
getToleranceDistance
public static double getToleranceDistance(View view, GoogleMap map)
Get the tolerance distance meters in the current region of the map- Parameters:
view- viewmap- google map- Returns:
- tolerance distance in meters
-
getBoundingBox
public static BoundingBox getBoundingBox(GoogleMap map)
Get the WGS84 bounding box of the current map view screen. The max longitude will be larger than the min resulting in values larger than 180.0.- Parameters:
map- google map- Returns:
- current bounding box
-
buildClickBoundingBox
public static BoundingBox buildClickBoundingBox(LatLng latLng, View view, GoogleMap map, float screenClickPercentage)
Build a bounding box using the click location, map view, map, and screen percentage tolerance. The bounding box can be used to query for features that were clicked- Parameters:
latLng- click locationview- viewmap- Google mapscreenClickPercentage- screen click percentage between 0.0 and 1.0 for how close a feature on the screen must be to be included in a click query- Returns:
- bounding box
-
buildClickLatLngBounds
public static LatLngBounds buildClickLatLngBounds(LatLng latLng, View view, GoogleMap map, float screenClickPercentage)
Build a lat lng bounds using the click location, map view, map, and screen percentage tolerance. The bounding box can be used to query for features that were clicked- Parameters:
latLng- click locationview- viewmap- Google mapscreenClickPercentage- screen click percentage between 0.0 and 1.0 for how close a feature on the screen must be to be included in a click query- Returns:
- bounding box
-
getToleranceDistance
public static double getToleranceDistance(LatLng latLng, View view, GoogleMap map, float screenClickPercentage)
Get the allowable tolerance distance in meters from the click location on the map view and map with the screen percentage tolerance.- Parameters:
latLng- click locationview- map viewmap- mapscreenClickPercentage- screen click percentage between 0.0 and 1.0 for how close a feature on the screen must be to be included in a click query- Returns:
- tolerance distance in meters
-
buildClickLatLngBoundingBox
public static LatLngBoundingBox buildClickLatLngBoundingBox(LatLng latLng, View view, GoogleMap map, float screenClickPercentage)
Build a lat lng bounding box using the click location, map view, map, and screen percentage tolerance. The bounding box can be used to query for features that were clicked- Parameters:
latLng- click locationview- map viewmap- mapscreenClickPercentage- screen click percentage between 0.0 and 1.0 for how close a feature on the screen must be to be included in a click query- Returns:
- lat lng bounding box
-
isPointOnShape
public static boolean isPointOnShape(LatLng point, GoogleMapShape shape, boolean geodesic, double tolerance)
Is the point on or near the shape- Parameters:
point- lat lng pointshape- map shapegeodesic- geodesic check flagtolerance- distance tolerance- Returns:
- true if point is on shape
-
isPointNearMarker
public static boolean isPointNearMarker(LatLng point, MarkerOptions shapeMarker, double tolerance)
Is the point near the shape marker- Parameters:
point- pointshapeMarker- shape markertolerance- distance tolerance- Returns:
- true if near
-
isPointNearPoint
public static boolean isPointNearPoint(LatLng point, LatLng shapePoint, double tolerance)
Is the point near the shape point- Parameters:
point- pointshapePoint- shape pointtolerance- distance tolerance- Returns:
- true if near
-
isPointNearMultiLatLng
public static boolean isPointNearMultiLatLng(LatLng point, MultiLatLng multiLatLng, double tolerance)
Is the point near any points in the multi lat lng- Parameters:
point- pointmultiLatLng- multi lat lngtolerance- distance tolerance- Returns:
- true if near
-
isPointOnPolyline
public static boolean isPointOnPolyline(LatLng point, PolylineOptions polyline, boolean geodesic, double tolerance)
Is the point on the polyline- Parameters:
point- pointpolyline- polylinegeodesic- geodesic check flagtolerance- distance tolerance- Returns:
- true if on the line
-
isPointOnMultiPolyline
public static boolean isPointOnMultiPolyline(LatLng point, MultiPolylineOptions multiPolyline, boolean geodesic, double tolerance)
Is the point on the multi polyline- Parameters:
point- pointmultiPolyline- multi polylinegeodesic- geodesic check flagtolerance- distance tolerance- Returns:
- true if on the multi line
-
isPointOnPolygon
public static boolean isPointOnPolygon(LatLng point, PolygonOptions polygon, boolean geodesic, double tolerance)
Is the point of the polygon- Parameters:
point- pointpolygon- polygongeodesic- geodesic check flagtolerance- distance tolerance- Returns:
- true if on the polygon
-
isPointOnMultiPolygon
public static boolean isPointOnMultiPolygon(LatLng point, MultiPolygonOptions multiPolygon, boolean geodesic, double tolerance)
Is the point on the multi polygon- Parameters:
point- pointmultiPolygon- multi polygongeodesic- geodesic check flagtolerance- distance tolerance- Returns:
- true if on the multi polygon
-
-