Package org.oscim.utils
Class GeoPointUtils
java.lang.Object
org.oscim.utils.GeoPointUtils
The coordinate validation functions come from Mapsforge LatLongUtils class.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleMaximum possible latitude coordinate.static final doubleMinimum possible latitude coordinate.static final doubleMaximum possible longitude coordinate.static final doubleMinimum possible longitude coordinate. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanFind if the given point lies within this polygon.static doubledistanceSegmentPoint(double startX, double startY, double endX, double endY, double pointX, double pointY) Returns the distance between the given segment and point.static booleanisClosedWay(GeoPoint[] geoPoints) Find if this way is closed.static PointnearestSegmentPoint(double startX, double startY, double endX, double endY, double pointX, double pointY) Returns a point on the segment nearest to the specified point.static doublescaleForBounds(BoundingBox bbox, int viewWidth, int viewHeight) Calculates the scale that allows to display theBoundingBoxon a view with width and height.static doublevalidateLatitude(double latitude) static doublevalidateLongitude(double longitude)
-
Field Details
-
LATITUDE_MAX
public static final double LATITUDE_MAXMaximum possible latitude coordinate.- See Also:
-
LATITUDE_MIN
public static final double LATITUDE_MINMinimum possible latitude coordinate.- See Also:
-
LONGITUDE_MAX
public static final double LONGITUDE_MAXMaximum possible longitude coordinate.- See Also:
-
LONGITUDE_MIN
public static final double LONGITUDE_MINMinimum possible longitude coordinate.- See Also:
-
-
Method Details
-
contains
Find if the given point lies within this polygon.http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
- Returns:
- true if this polygon contains the given point, false otherwise.
-
distanceSegmentPoint
public static double distanceSegmentPoint(double startX, double startY, double endX, double endY, double pointX, double pointY) Returns the distance between the given segment and point.libGDX (Apache 2.0)
-
isClosedWay
Find if this way is closed.- Returns:
- true if this way is closed, false otherwise.
-
nearestSegmentPoint
public static Point nearestSegmentPoint(double startX, double startY, double endX, double endY, double pointX, double pointY) Returns a point on the segment nearest to the specified point.libGDX (Apache 2.0)
-
scaleForBounds
Calculates the scale that allows to display theBoundingBoxon a view with width and height.- Parameters:
bbox- theBoundingBoxto display.viewWidth- the width of the view.viewHeight- the height of the view.- Returns:
- the scale that allows to display the
BoundingBoxon a view with width and height.
-
validateLatitude
public static double validateLatitude(double latitude) - Parameters:
latitude- the latitude coordinate in degrees which should be validated.- Returns:
- the latitude value
- Throws:
IllegalArgumentException- if the latitude coordinate is invalid orDouble.NaN.
-
validateLongitude
public static double validateLongitude(double longitude) - Parameters:
longitude- the longitude coordinate in degrees which should be validated.- Returns:
- the longitude value
- Throws:
IllegalArgumentException- if the longitude coordinate is invalid orDouble.NaN.
-