@Override public void onRunAnimation() { final OpenStreetMapView mapview = OpenStreetMapViewController.this.mOsmv; final int stepDuration = this.mStepDuration; try { int newMapCenterLatE6; int newMapCenterLonE6; for (int i = 0; i < this.mSmoothness; i++) { final double delta = Math.pow(0.5, i + 1); final int deltaLatitudeE6 = (int) (this.mPanTotalLatitudeE6 * delta); final int detlaLongitudeE6 = (int) (this.mPanTotalLongitudeE6 * delta); newMapCenterLatE6 = mapview.getMapCenterLatitudeE6() - deltaLatitudeE6; newMapCenterLonE6 = mapview.getMapCenterLongitudeE6() - detlaLongitudeE6; mapview.setMapCenter(newMapCenterLatE6, newMapCenterLonE6); Thread.sleep(stepDuration); } mapview.setMapCenter(super.mTargetLatitudeE6, super.mTargetLongitudeE6); } catch (Exception e) { this.interrupt(); } }
@Override public void onRunAnimation() { final OpenStreetMapView mapview = OpenStreetMapViewController.this.mOsmv; final int stepDuration = this.mStepDuration; final float amountStretch = this.mAmountStretch; try { int newMapCenterLatE6; int newMapCenterLonE6; for (int i = 0; i < this.mSmoothness; i++) { final double delta = (this.mYOffset + Math.cos(this.mStepIncrement * i + this.mStart)) * amountStretch; final int deltaLatitudeE6 = (int) (this.mPanTotalLatitudeE6 * delta); final int deltaLongitudeE6 = (int) (this.mPanTotalLongitudeE6 * delta); newMapCenterLatE6 = mapview.getMapCenterLatitudeE6() - deltaLatitudeE6; newMapCenterLonE6 = mapview.getMapCenterLongitudeE6() - deltaLongitudeE6; mapview.setMapCenter(newMapCenterLatE6, newMapCenterLonE6); Thread.sleep(stepDuration); } mapview.setMapCenter(super.mTargetLatitudeE6, super.mTargetLongitudeE6); } catch (Exception e) { this.interrupt(); } }
@Override public void onRunAnimation() { final OpenStreetMapView mapview = OpenStreetMapViewController.this.mOsmv; final int panPerStepLatitudeE6 = this.mPanPerStepLatitudeE6; final int panPerStepLongitudeE6 = this.mPanPerStepLongitudeE6; final int stepDuration = this.mStepDuration; try { int newMapCenterLatE6; int newMapCenterLonE6; for (int i = this.mSmoothness; i > 0; i--) { newMapCenterLatE6 = mapview.getMapCenterLatitudeE6() - panPerStepLatitudeE6; newMapCenterLonE6 = mapview.getMapCenterLongitudeE6() - panPerStepLongitudeE6; mapview.setMapCenter(newMapCenterLatE6, newMapCenterLonE6); Thread.sleep(stepDuration); } } catch (Exception e) { this.interrupt(); } }