|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectopenlr.map.utils.GeometryUtils
public final class GeometryUtils
The GeometryUtils offer methods for the calculation of distances of points and bearings of lines.
OpenLR is a trade mark of TomTom International B.V.
email: software@openlr.org
| Nested Class Summary | |
|---|---|
static class |
GeometryUtils.BearingDirection
The Enum BearingDirection defines the direction off a line being used for the bearing calculation. |
| Field Summary | |
|---|---|
static int |
FULL_CIRCLE_DEGREE
degree in a full circle |
static double |
HALF_CIRCLE
The Constant HALF_CIRCLE. |
static float |
MAX_LAT
The Constant MAX_LAT. |
static float |
MAX_LON
The Constant MAX_LON. |
static float |
MIN_LAT
The Constant MIN_LAT. |
static float |
MIN_LON
The Constant MIN_LON. |
static double |
QUARTER_CIRCLE
The Constant QUARTER_CIRCLE. |
static double |
THREE_QUARTER_CIRCLE
The Constant QUARTER_CIRCLE. |
static double |
ZERO_CIRCLE
The Constant ZERO_CIRCLE. |
| Method Summary | |
|---|---|
static double |
bearing(double p1Longitude,
double p1Latitude,
double p2Longitude,
double p2Latitude)
Return the bearing (degrees clockwise from North) of p2 from p1 (the direction that must be traveled from p1 in order to arrive at p2). |
static double |
bearing(GeoCoordinates coord1,
GeoCoordinates coord2)
Return the bearing (degrees clockwise from North) of p2 from p1 (the direction that must be traveled from p1 in order to arrive at p2). |
static double |
calculateLineBearing(Line line,
GeometryUtils.BearingDirection dir,
int pointDistance,
int projectionAlongLine)
Calculates and returns the line bearing. |
static boolean |
checkCoordinateBounds(double lon,
double lat)
Check coordinate bounds. |
static GeoCoordinates |
determineCoordinateInDistance(double lon,
double lat,
int angle,
double distanceKm)
Determine coordinate in distance. |
static GeoCoordinates |
determineCoordinateInDistance(GeoCoordinates coord,
int angle,
double distanceKm)
Determine coordinate in distance. |
static double |
distance(double longitude1,
double latitude1,
double longitude2,
double latitude2)
Returns the distance in meters between two points specified in degrees longitude (x) and latitude (y). |
static double |
distance(GeoCoordinates coord1,
GeoCoordinates coord2)
Returns the distance in meters between two points specified in degrees longitude (x) and latitude (y). |
static GeoCoordinates |
intersectStraights(double longitude1,
double latitude1,
double bear1,
double longitude2,
double latitude2,
double bear2)
Intersects two straights given by rsp. |
static GeoCoordinates |
intersectStraights(GeoCoordinates coord1,
double bear1,
GeoCoordinates coord2,
double bear2)
Intersects two straights given by rsp. |
static boolean |
lineIntersection(GeoCoordinates gc1Start,
GeoCoordinates gc1End,
GeoCoordinates gc2Start,
GeoCoordinates gc2End)
Line intersection. |
static GeoCoordinates |
pointAlongLine(double longitudeA,
double latitudeA,
double longitudeB,
double latitudeB,
double offset)
Calculates a point on the straight line defined by point a and b. |
static GeoCoordinates |
pointAlongLine(GeoCoordinates coord1,
GeoCoordinates coord2,
double offset)
Calculates a point on the straight line defined by point a and b. |
static double |
round(double val)
Round. |
static double |
round(double val,
int decimalPlaces)
Rounds a coordinate value (longitude or latitude) to a specific precision. |
static GeoCoordinates |
scaleUpperRightCoordinate(double lowerLeftLon,
double lowerLeftLat,
double upperRightLon,
double upperRightLat,
double xfactor,
double yfactor)
Scale the upperright point of a rectangle given by lowerleft and upperright wrt to given factors in x- and y-direction. |
static GeoCoordinates |
scaleUpperRightCoordinate(GeoCoordinates lowerLeft,
GeoCoordinates upperRight,
double xfactor,
double yfactor)
Scale the upperright point of a rectangle given by lowerleft and upperright wrt to given factors in x- and y-direction. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final float MAX_LAT
public static final float MIN_LAT
public static final float MAX_LON
public static final float MIN_LON
public static final double ZERO_CIRCLE
public static final double HALF_CIRCLE
public static final double QUARTER_CIRCLE
public static final double THREE_QUARTER_CIRCLE
public static final int FULL_CIRCLE_DEGREE
| Method Detail |
|---|
public static double distance(GeoCoordinates coord1,
GeoCoordinates coord2)
coord1 - the GeoCoordinate of the first pointcoord2 - the GeoCoordinate of the second point
public static double distance(double longitude1,
double latitude1,
double longitude2,
double latitude2)
longitude1 - the longitude of the first pointlatitude1 - the latitude of the first pointlongitude2 - the longitude of the second pointlatitude2 - the latitude of the second point
public static double bearing(GeoCoordinates coord1,
GeoCoordinates coord2)
coord1 - the GeoCoordinates of the first pointcoord2 - the GeoCoordinates of the second point
public static double bearing(double p1Longitude,
double p1Latitude,
double p2Longitude,
double p2Latitude)
p1Longitude - the longitude of the first pointp1Latitude - the latitude of the first pointp2Longitude - the longitude of the second pointp2Latitude - the latitude of the second point
public static double calculateLineBearing(Line line,
GeometryUtils.BearingDirection dir,
int pointDistance,
int projectionAlongLine)
GeometryUtils.BearingDirection indicates
the direction for the measurement.
line - the linedir - the direction of the line being usedpointDistance - the point distance of the second pointprojectionAlongLine - the projection along line in meter
public static boolean checkCoordinateBounds(double lon,
double lat)
lon - the lonlat - the lat
public static GeoCoordinates intersectStraights(GeoCoordinates coord1,
double bear1,
GeoCoordinates coord2,
double bear2)
throws InvalidMapDataException
coord1 - the GeoCoordinates of the first straight's start pointbear1 - the bearing angle of the first straightcoord2 - the GeoCoordinates of the second straight's start pointbear2 - the bearing angle of the second straight
InvalidMapDataException - the invalid map data exception
public static GeoCoordinates intersectStraights(double longitude1,
double latitude1,
double bear1,
double longitude2,
double latitude2,
double bear2)
throws InvalidMapDataException
longitude1 - the longitude of the first straight's start pointlatitude1 - the latitude of the first straight's start pointbear1 - the bearing angle of the first straightlongitude2 - the longitude of the second straight's start pointlatitude2 - the latitude of the second straigth's start pointbear2 - the bearing angle of the second straight
InvalidMapDataException - the invalid map data exception
public static boolean lineIntersection(GeoCoordinates gc1Start,
GeoCoordinates gc1End,
GeoCoordinates gc2Start,
GeoCoordinates gc2End)
gc1Start - the gc1 startgc1End - the gc1 endgc2Start - the gc2 startgc2End - the gc2 end
public static GeoCoordinates pointAlongLine(GeoCoordinates coord1,
GeoCoordinates coord2,
double offset)
throws InvalidMapDataException
offset defines the position of the desired point
on that line relative to point a. If it is above 0 it will deliver a
point in direction to point 2 or above. The offset can even be negative-
it then defines a point in the opposite direction.
coord1 - the GeoCoordinates of the straight's start pointcoord2 - the GeoCoordinates of the straight's end pointoffset - The offset on the line from a to b measured from a. Can be in
negative or positive direction.
InvalidMapDataException - If the calculation results in an invalid geo coordinate
according to WGS84.
public static GeoCoordinates pointAlongLine(double longitudeA,
double latitudeA,
double longitudeB,
double latitudeB,
double offset)
throws InvalidMapDataException
offset defines the position of the desired point
on that line relative to point a. If it is above 0 it will deliver a
point in direction to point 2 or above. The offset can even be negative-
it then defines a point in the opposite direction.
longitudeA - the longitude of the straight's start pointlatitudeA - the latitude of the straight's start pointlongitudeB - the longitude of the straight's end pointlatitudeB - the latitude of the straight's end pointoffset - The offset on the line from a to b measured from a. Can be in
negative or positive direction.
InvalidMapDataException - If the calculation results in an invalid geo coordinate
according to WGS84.
public static GeoCoordinates scaleUpperRightCoordinate(GeoCoordinates lowerLeft,
GeoCoordinates upperRight,
double xfactor,
double yfactor)
throws InvalidMapDataException
lowerLeft - the lower left GeoCoordinatesupperRight - the upper right GeoCoordinatesxfactor - the scaling factor in x-directionyfactor - the scaling factor in y-direction
InvalidMapDataException - the invalid map data exception
public static GeoCoordinates scaleUpperRightCoordinate(double lowerLeftLon,
double lowerLeftLat,
double upperRightLon,
double upperRightLat,
double xfactor,
double yfactor)
throws InvalidMapDataException
lowerLeftLon - the longitude of the leftmostlowerLeftLat - the latitude of the leftmostupperRightLon - the longitude of the rightmostupperRightLat - the latitude of the rightmostxfactor - the scaling factor in x-directionyfactor - the scaling factor in y-direction
InvalidMapDataException - the invalid map data exceptionpublic static double round(double val)
val - the val
public static double round(double val,
int decimalPlaces)
val - The coordinate value.decimalPlaces - The number of decimal place to round to.
public static GeoCoordinates determineCoordinateInDistance(GeoCoordinates coord,
int angle,
double distanceKm)
throws InvalidMapDataException
coord - the GeoCoordinates the lonangle - the angledistanceKm - the distance in kilometers
InvalidMapDataException - the invalid map data exception
public static GeoCoordinates determineCoordinateInDistance(double lon,
double lat,
int angle,
double distanceKm)
throws InvalidMapDataException
lon - the lonlat - the latangle - the angledistanceKm - the distance in kilometers
InvalidMapDataException - the invalid map data exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||