Beispiel #1
0
  public void setLayerType(String type) {
    mLayerType = type;
    if (mService == null) {

    } else if (mLayerType.equals("NEXRAD")) {
      mService.getRadarLayer().parse();
    } else if (mLayerType.equals("METAR")) {
      mService.getMetarLayer().parse();
    }

    invalidate();
  }
Beispiel #2
0
  /**
   * @param canvas
   * @param ctx
   */
  private void drawLayers(Canvas canvas, DrawingContext ctx) {
    if (mLayerType == null || null != mPointProjection || 0 == mPref.showLayer()) {
      return;
    }

    if (ctx.pref.useAdsbWeather()) {
      if (mLayerType.equals("NEXRAD")) {
        NexradBitmap.draw(
            ctx,
            mService.getAdsbWeather().getNexrad(),
            mService.getAdsbWeather().getNexradConus(),
            null == mPointProjection);
      } else if (mLayerType.equals("METAR")) {
        AdsbWeatherCache.drawMetars(
            ctx, mService.getAdsbWeather().getAllMetars(), null == mPointProjection);
      }
    } else {

      if (mLayerType.equals("NEXRAD")) {
        // draw nexrad
        mLayer = mService.getRadarLayer();
      } else if (mLayerType.equals("METAR")) {
        // draw metar flight catergory
        mLayer = ctx.service.getMetarLayer();
      } else {
        mLayer = null;
        return;
      }

      /*
       * layer is way too old.
       */
      if (mLayer.isOld(ctx.pref.getExpiryTime())) {
        return;
      }

      mPaint.setAlpha(mPref.showLayer());
      mLayer.draw(canvas, mPaint, mOrigin);
      mPaint.setAlpha(255);
    }
  }