Exemplo 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();
 }
Exemplo n.º 2
0
  /** Function that loads new tiles in background */
  private void loadTiles() {
    if (mService == null) {
      return;
    }

    if (mImageDataSource == null) {
      return;
    }

    TileMap map = mService.getTiles();
    map.loadTiles(
        mGpsParams.getLongitude(),
        mGpsParams.getLatitude(),
        mPan,
        mMacro,
        mScale,
        mGpsParams.getBearing(),
        new GenericCallback() {
          @Override
          public Object callback(Object map, Object tu) {
            TileMap.TileUpdate t = (TileMap.TileUpdate) tu;
            ((TileMap) map).flip();

            /*
             * Set move with pan after new tiles are finally loaded
             */
            mPan.setMove(
                (float) (mPan.getMoveX() * t.factor), (float) (mPan.getMoveY() * t.factor));

            int index = Integer.parseInt(mPref.getChartType());
            String type = Boundaries.getChartType(index);

            mGpsTile = t.gpsTile;
            mOnChart = type + "\n" + t.chart;
            /*
             * And pan
             */
            mPan.setTileMove(t.movex, t.movey);
            mMovement = new Movement(t.offsets);
            mService.setMovement(mMovement);
            mMacro = mScale.getMacroFactor();
            mScale.updateMacro();
            updateCoordinates();
            invalidate();

            return null;
          }
        });
  }
Exemplo n.º 3
0
 /**
  * @param canvas
  * @param ctx
  */
 private void drawTiles(Canvas canvas, DrawingContext ctx) {
   Tile.draw(ctx, mOnChart, mService.getTiles());
 }