Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
  public boolean addCompact(LocationX pm) {
    boolean compacted = false;
    LocationX compactedPm = pm;
    for (int zoom = Utils.MAX_ZOOM; zoom >= Utils.MIN_ZOOM; zoom--) {
      compactedPm = pathsInZooms[zoom].addCompacted(compactedPm, pm);
      if (zoom == Utils.MAX_ZOOM && compactedPm != null) compacted = true;
    }
    if (rect == null) rect = new RectX(pm.getLongitude(), pm.getLatitude(), 0, 0);
    else rect.union(pm.getLongitude(), pm.getLatitude());

    if (compacted && doc != null) Saver.save(this);

    return compacted;
  }
Exemplo n.º 3
0
  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;
  }