Esempio n. 1
0
 /**
  * @param time
  * @param block
  * @param empty
  * @param isConus
  * @param data
  * @param cols
  * @param rows
  */
 public void putImg(
     long time, int block, int empty[], boolean isConus, int data[], int cols, int rows) {
   if (!mPref.useAdsbWeather()) {
     return;
   }
   if (isConus) {
     mNexradConus.putImg(time, block, empty, isConus, data, cols, rows);
   } else {
     mNexrad.putImg(time, block, empty, isConus, data, cols, rows);
   }
 }
Esempio n. 2
0
  /*
   * ALL ADSB weather should be kaput after expiry
   */
  public void sweep() {
    long now = System.currentTimeMillis();
    int expiry = mPref.getExpiryTime() * 60 * 1000;

    /*
     * Go at them one by one
     * LinkedList saves against concurrent modification exception
     */
    LinkedList<String> keys;

    /*
     * Winds
     */
    keys = new LinkedList<String>();
    for (String key : mWinds.keySet()) {
      WindsAloft w = mWinds.get(key);
      long diff = (now - w.timestamp) - expiry;
      if (diff > 0) {
        keys.add(key);
      }
    }
    for (String key : keys) {
      mWinds.remove(key);
    }

    /*
     * Taf
     */
    keys = new LinkedList<String>();
    for (String key : mTaf.keySet()) {
      Taf f = mTaf.get(key);
      long diff = (now - f.timestamp) - expiry;
      if (diff > 0) {
        keys.add(key);
      }
    }
    for (String key : keys) {
      mTaf.remove(key);
    }

    /*
     * Metar
     */
    keys = new LinkedList<String>();
    for (String key : mMetar.keySet()) {
      Metar m = mMetar.get(key);
      long diff = (now - m.timestamp) - expiry;
      if (diff > 0) {
        keys.add(key);
      }
    }
    for (String key : keys) {
      mMetar.remove(key);
    }

    /*
     * Airep
     */
    keys = new LinkedList<String>();
    for (String key : mAirep.keySet()) {
      Airep a = mAirep.get(key);
      long diff = (now - a.timestamp) - expiry;
      if (diff > 0) {
        keys.add(key);
      }
    }
    for (String key : keys) {
      mAirep.remove(key);
    }

    /*
     * Nexrad
     */
    LinkedList<Integer> keyi = new LinkedList<Integer>();
    SparseArray<NexradBitmap> img = mNexrad.getImages();
    for (int i = 0; i < img.size(); i++) {
      NexradBitmap n = img.valueAt(i);
      long diff = (now - n.timestamp) - expiry;
      if (diff > 0) {
        keyi.add(img.keyAt(i));
      }
    }
    for (Integer key : keyi) {
      img.remove(key);
    }
  }