示例#1
0
文件: Path.java 项目: kvv1/kvvmaps
 public float getLen() {
   List<LocationX> pms = getPlaceMarks();
   LocationX pm1 = null;
   float len = 0;
   for (LocationX pm : pms) {
     if (pm1 != null) len += pm.distanceTo(pm1);
     pm1 = pm;
   }
   return len;
 }
示例#2
0
文件: Path.java 项目: kvv1/kvvmaps
  public LocationX getNearest(LocationX l) {
    double dist = -1;
    LocationX pmNearest = null;

    for (LocationX pm : getPlaceMarks()) {
      //			double dx = pm.getLongitude() - l.getLongitude();
      //			double dy = pm.getLatitude() - l.getLatitude();
      //			double d = dx * dx + dy * dy;
      double d = l.distanceTo(pm);
      if (pmNearest == null || d < dist) {
        pmNearest = pm;
        dist = d;
      }
    }

    return pmNearest;
  }