private static double x_pi = 3.14159265358979324 * 3000.0 / 180.0;
/**
* 将百度坐标转变成火星坐标
* @param repairDepotForm
*/
public void calculateCoordinate(RepairDepotForm repairDepotForm) {
double longitude = Double.valueOf(repairDepotForm.getLongitude());
double latitude = Double.valueOf(repairDepotForm.getLatitude());
double x = longitude - 0.0065, y = latitude - 0.006;
double z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi);
double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi);
repairDepotForm.setLongitude(String.valueOf(dataDigit(6,z * Math.cos(theta))));
repairDepotForm.setLatitude(String.valueOf(dataDigit(6,z * Math.sin(theta) )));
}
static double dataDigit(int digit,double in){
return new BigDecimal(in).setScale(6, BigDecimal.ROUND_HALF_UP).doubleValue();
}