Esempio n. 1
0
  /** @param params */
  public void initParams(GpsParams params, StorageService service) {
    /*
     * Comes from storage service. This will do nothing for fresh start,
     * but it will load previous combo on re-activation
     */
    mService = service;

    mMovement = mService.getMovement();
    mImageDataSource = mService.getDBResource();
    if (null == mMovement) {
      mMovement = new Movement();
    }
    mPan = mService.getPan();
    if (null == mPan) {
      mPan = new Pan();
      mService.setPan(mPan);
    }
    if (null != params) {
      mGpsParams = params;
    } else if (null != mService.getDestination()) {
      mGpsParams = new GpsParams(mService.getDestination().getLocation());
    } else {
      mGpsParams = new GpsParams(null);
    }
    loadTiles();
    postInvalidate();

    // Tell the CDI the paint that we use for display tfr
    mService.getCDI().setSize(mPaint, Math.min(getWidth(), getHeight()));
    mService.getVNAV().setSize(mPaint, Math.min(getWidth(), getHeight()));

    // Tell the odometer how to access preferences
    mService.getOdometer().setPref(mPref);

    mService.getEdgeTape().setPaint(mPaint);

    // Resize our runway icon based upon the size of the display.
    // We want the icon no more than 1/3 the size of the screen. Since we show 2 images
    // of this icon, that means the total size is no more than 2/3 of the available space.
    // This leaves room to print the runway numbers with some real estate left over.
    Bitmap newRunway =
        Helper.getResizedBitmap(mRunwayBitmap.getBitmap(), getWidth(), getHeight(), (double) 1 / 3);

    // If a new bitmap was generated, then load it in.
    if (newRunway != mRunwayBitmap.getBitmap()) {
      mRunwayBitmap = new BitmapHolder(newRunway);
    }
  }
Esempio n. 2
0
 public void updateDestination() {
   /*
    * Comes from database
    */
   if (null == mService) {
     return;
   }
   if (null != mService.getDestination()) {
     if (mService.getDestination().isFound()) {
       /*
        * Set pan to zero since we entered new destination
        * and we want to show it without pan.
        */
       mPan = new Pan();
       mService.setPan(mPan);
       updateCoordinates();
     }
   }
 }
Esempio n. 3
0
 /**
  * * Draw the vertical approach slope indicator if we have a destination set
  *
  * @param canvas what to draw the data upon
  */
 private void drawVASI(Canvas canvas) {
   if (mPointProjection == null && mErrorStatus == null) {
     if (mPref.getShowCDI()) {
       Destination dest = mService.getDestination();
       if (dest != null) {
         mService.getVNAV().drawVNAV(canvas, getWidth(), getHeight(), dest);
       }
     }
   }
 }
Esempio n. 4
0
 /**
  * @param canvas
  * @param ctx
  */
 private void drawTrack(Canvas canvas, DrawingContext ctx) {
   TrackShape.draw(
       ctx,
       mService.getPlan(),
       mService.getDestination(),
       mGpsParams,
       mLineBitmap,
       mLineHeadingBitmap,
       mPointProjection == null);
 }
Esempio n. 5
0
 /**
  * @param canvas
  * @param ctx
  */
 private void drawRunways(Canvas canvas, DrawingContext ctx) {
   Runway.draw(
       ctx, mRunwayBitmap, mService.getDestination(), mGpsParams, mPointProjection == null);
 }