1010 */
1111public class LocationCoord {
1212 // 经纬度均使用百度经纬度坐标(bd09ll),
13- public String address ;
1413 public double latitude , longitude ;
15- public static final String FORMAT_VERSION = "1" ;
14+ public boolean isCustom = false ;
1615
1716 public static LocationCoord from (LocationObject locationObject ) {
1817 LocationCoord locationCoord = new LocationCoord ();
1918 locationCoord .latitude = locationObject .latitude ;
2019 locationCoord .longitude = locationObject .longitude ;
21- locationCoord .address = locationObject .address ;
20+ locationCoord .isCustom = locationObject .type == LocationObject . Type . newCustom ;
2221 return locationCoord ;
2322 }
2423
@@ -30,7 +29,7 @@ public static LocationCoord parse(String coord) {
3029 try {
3130 result .latitude = Double .parseDouble (parts [0 ]);
3231 result .longitude = Double .parseDouble (parts [1 ]);
33- result .address = parts .length > 2 ? parts [2 ] : "不详" ;
32+ result .isCustom = parts .length > 2 && !( "0" . equals ( parts [2 ]. trim ())) ;
3433 } catch (Throwable e ) {
3534 Log .e ("LocationCoord" , "invalid coord format" , e );
3635 return null ;
@@ -43,8 +42,6 @@ public static LocationCoord parse(String coord) {
4342
4443 @ Override
4544 public String toString () {
46- return String .format ("%.4f,%.4f" , latitude , longitude );
47- // String output = String.format("%f,%f", latitude, longitude);
48- // return output;
45+ return String .format ("%f,%f,%d" , latitude , longitude , (isCustom ?1 :0 ));
4946 }
5047}
0 commit comments