天天看点

根据两点数据,得到举行范围内的点的集合

public Vector GetCoordinate(double[] list){

BigDecimal b;

double min_lat = (double)(Math.round(Math.min(list[0], list[2])*10))/10; //截取小数点后一位

double max_lat = (double)(Math.round(Math.max(list[0], list[2])*10))/10;

double min_lon = (double)(Math.round(Math.min(list[1], list[3])*10))/10;

double max_lon = (double)(Math.round(Math.max(list[1], list[3])*10))/10;

long m = (Math.round((max_lat-min_lat)10)+1);

long n = (Math.round((max_lon-min_lon)10)+1);

Vector points = new Vector<>();

if (m > 1 | n > 1){

for(int i=0;i<m;i++){

for(int j=0;j<n;j++){

double x = min_lat+i0.1;

double y = min_lon+j0.1;

Point p = new Point(Double.parseDouble(String.format("%.1f", x)), Double.parseDouble(String.format("%.1f", y)));

points.add§;

}

}

return points;

}else{

points.add(new Point(min_lat, min_lon));

return points;

}

}

继续阅读