public static void rectWithinCircle(Scanner in) { boolean postToMap = doPostToMap(in); GeoRect rect = getRect(in); System.out.println("Enter Center Point: "); double[][] cntr = getPoints(in, 1); double r = getRadius(in); System.out.println( " Rectangle " + (GeoUtils.rectWithinCircle( rect.minLon, rect.minLat, rect.maxLon, rect.maxLat, cntr[0][LON_INDEX], cntr[0][LAT_INDEX], r) ? "within" : "not within") + " circle"); if (postToMap) { // draw rectangle mapPoster.post(GeoMapPoster.toJSON(rect)); // convert point radius to poly List<double[]> polyPoints = GeoUtils.circleToPoly(cntr[0][LON_INDEX], cntr[0][LAT_INDEX], r); mapPoster.post(GeoMapPoster.toJSON(polyPoints)); } }
public static void pointRadiusToPolygon(Scanner in) { boolean postToMap = doPostToMap(in); double[][] point = getPoints(in, 1); double radius = getRadius(in); List<double[]> polyPoints = GeoUtils.circleToPoly(point[0][LON_INDEX], point[0][LAT_INDEX], radius); if (postToMap == true) { mapPoster.post(GeoMapPoster.toJSON(polyPoints)); } }