コード例 #1
0
ファイル: LocationView.java プロジェクト: fdinel/avare
  /** @param canvas */
  private void drawCornerTextsAndTrack(Canvas canvas) {

    /*
     * Misc text in the information text location on the view like GPS status,
     * Maps status, and point destination/destination bearing, altitude, ...
     * Add shadows for better viewing
     */
    mPaint.setShadowLayer(SHADOW, SHADOW, SHADOW, Color.BLACK);
    mPaint.setColor(Color.WHITE);

    mPaint.setTextAlign(Align.LEFT);
    /*
     * Speed
     */
    canvas.drawText(
        "" + Math.round(mGpsParams.getSpeed()) + "kt", 0, getHeight() / mTextDiv, mPaint);
    /*
     * Altitude
     */
    canvas.drawText(
        "" + Math.round(mGpsParams.getAltitude()) + "ft", 0, getHeight() - mFontHeight, mPaint);

    mPaint.setTextAlign(Align.RIGHT);

    /*
     * Heading
     */
    canvas.drawText(
        "" + Math.round(mGpsParams.getBearing()) + '\u00B0',
        getWidth(),
        getHeight() - mFontHeight,
        mPaint);

    /*
     * Status/destination top right
     */
    if (mErrorStatus != null) {
      mPaint.setColor(Color.RED);
      canvas.drawText(mErrorStatus, getWidth(), getHeight() / mTextDiv * 2, mPaint);
    }

    /*
     * Point above error status
     */
    mPaint.setColor(Color.WHITE);
    if (mPoint != null) {
      canvas.drawText(mPoint, getWidth(), getHeight() / mTextDiv, mPaint);
    } else if (mDestination != null) {
      canvas.drawText(mDestination.toString(), getWidth(), getHeight() / mTextDiv, mPaint);
      if (mDestination.isFound() && mPref.isTrackEnabled() && (!mPref.isSimulationMode())) {
        if (null != mTrackShape) {
          mPaint.setColor(Color.MAGENTA);
          mPaint.setStrokeWidth(4);
          mTrackShape.drawShape(canvas, mOrigin, mScale, mMovement, mPaint, mFace);
        }
      }
    }
  }
コード例 #2
0
ファイル: LocationView.java プロジェクト: fdinel/avare
 /** @param destination */
 public void updateDestination(Destination destination) {
   /*
    * Comes from database
    */
   mDestination = destination;
   if (null != destination) {
     if (destination.isFound()) {
       /*
        * Set pan to zero since we entered new destination
        * and we want to show it without pan.
        */
       mPan = new Pan();
       tfrReset();
       mTrackShape = new TrackShape(mDestination);
     }
   }
 }