Esempio n. 1
0
 /** Center to the location */
 public void center() {
   /*
    * On double tap, move to center
    */
   mPan = new Pan();
   if (mService != null) {
     mPan.setMove(0, (float) ((getHeight() * .25) / mScale.getScaleFactor()));
     mService.setPan(mPan);
     mService.getTiles().forceReload();
   }
   loadTiles();
   updateCoordinates();
   postInvalidate();
 }
Esempio n. 2
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. 3
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();
     }
   }
 }