/** @param force */ private void dbquery(boolean force) { if (mService == null) { return; } if (mImageDataSource == null) { return; } if (!mImageDataSource.isOpen()) { return; } if (null == mTiles) { return; } if (!force) { double offsets[] = new double[2]; double p[] = new double[2]; if (mImageDataSource.isWithin( mGpsParams.getLongitude(), mGpsParams.getLatitude(), offsets, p)) { /* * We are within same tile no need for query. */ mMovement = new Movement(offsets, p); postInvalidate(); return; } } /* * Do not overwhelm. */ if (null != mTileDrawTask) { if (!mTileDrawTask.getStatus().equals(AsyncTask.Status.FINISHED)) { /* * Always honor the latest query */ mTileDrawTask.cancel(true); } } mTileDrawTask = new TileDrawTask(); mTileDrawTask.execute(mGpsParams.getLongitude(), mGpsParams.getLatitude()); }