/** * {@inheritDoc} */ @Override public Object clone() { final Position inst = new Point(this.latitude, this.longitude); return inst; }
System.out.println("neighbors:" + neighbors); double[] coordinates = GeoHashExtensions.decodeAndRound(alterTeichwegGeohash); Point alterTeichweg = new Point(coordinates[0], coordinates[1]); Point ludwigsburg = new Point(48.894169, 9.191870); for (Point point : getExtremePointsFrom(ludwigsburg, 300.00))
/** * Returns an array of two extreme points corresponding to center point and the distance from * the center point. These extreme points are the points with max/min latitude and longitude. * * @param point * the point * @param distance * the distance * @return the extreme points from */ public static Point[] getExtremePointsFrom(final Point point, final Double distance) { double longDiff = getExtremeLongitudesDiffForPoint(point, distance); double latDiff = getExtremeLatitudesDiffForPoint(point, distance); Point p1 = new Point(point.getLatitude() - latDiff, point.getLongitude() - longDiff); Point p2 = new Point(point.getLatitude() + latDiff, point.getLatitude() + longDiff); return new Point[] { p1, p2 }; }
/** * Returns an array of two extreme points corresponding to center point and the distance from * the center point. These extreme points are the points with max/min latitude and longitude. * * @param point * the point * @param distance * the distance * @return the extreme points from */ public static Point[] getExtremePointsFrom(final Point point, final Double distance) { double longDiff = getExtremeLongitudesDiffForPoint(point, distance); double latDiff = getExtremeLatitudesDiffForPoint(point, distance); Point p1 = new Point(point.getLatitude() - latDiff, point.getLongitude() - longDiff); Point p2 = new Point(point.getLatitude() + latDiff, point.getLatitude() + longDiff); return new Point[] { p1, p2 }; }