Exemplo n.º 1
0
 /**
  * @param name
  * @param type
  * @param pref
  * @param service
  */
 public Destination(String name, String type, Preferences pref, StorageService service) {
   GpsParams params = service.getGpsParams();
   mInited = false;
   if (null != params) {
     mLonInit = params.getLongitude();
     mLatInit = params.getLatitude();
     mInited = true;
   }
   mDbType = "";
   mFound = mLooking = false;
   mRunways = new LinkedList<Runway>();
   mService = service;
   mDataSource = mService.getDBResource();
   mTrackShape = new TrackShape();
   mPref = pref;
   mEte = new String("--:--");
   mEta = new String("--:--");
   mEteSec = Long.MAX_VALUE;
   mFuel = "-.-";
   mFuelGallons = Float.MAX_VALUE;
   mParams = new LinkedHashMap<String, String>();
   mFreq = new LinkedHashMap<String, String>();
   mAwos = new LinkedList<Awos>();
   mAfdFound = null;
   mName = name.toUpperCase(Locale.getDefault());
   mDestType = type;
   mLond = mLatd = 0;
 }
Exemplo 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);
    }
  }