Add route view distance to settings

This commit is contained in:
vshcherb 2013-10-06 22:41:28 +03:00
parent 1ce0e3cb0e
commit 5223c2e96d
3 changed files with 14 additions and 18 deletions

View file

@ -164,10 +164,6 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
double distToSee = speed * time;
float zoomDelta = (float) (Math.log(visibleDist / distToSee) / Math.log(2.0f));
// check if 17, 18 is correct?
final float zoomScale = tb.getZoom() + tb.getZoomScale();
if (zoomDelta + zoomScale >= 18 ) {
return 18 - zoomScale ;
}
return zoomDelta;
}
@ -176,21 +172,20 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
long now = System.currentTimeMillis();
final RotatedTileBox tb = mapView.getCurrentRotatedTileBox();
float zdelta = defineZoomFromSpeed(tb, location.getSpeed());
if (Math.abs(zdelta) >= OsmandMapTileView.ZOOM_DELTA_1) {
if (Math.abs(zdelta) >= 0.5/*?Math.sqrt(0.5)*/) {
// prevent ui hysteresis (check time interval for autozoom)
if (zdelta >= 2) {
// decrease a bit
zdelta -= 3 * OsmandMapTileView.ZOOM_DELTA_1;
zdelta -= 1;
} else if (zdelta <= -2) {
// decrease a bit
zdelta += 3 * OsmandMapTileView.ZOOM_DELTA_1;
zdelta += 1;
}
if (now - lastTimeAutoZooming > 4500) {
lastTimeAutoZooming = now;
float complexZoom = tb.getZoom() + tb.getZoomScale();
float newZoom = Math.round((complexZoom + zdelta) * OsmandMapTileView.ZOOM_DELTA)
* OsmandMapTileView.ZOOM_DELTA_1;
// TODO test round final int tz = Math.round(newZoom);
float complexZoom = tb.getZoom() + tb.getZoomScale() + zdelta;
// round to 0.5
float newZoom = Math.round(complexZoom * 2) * 0.5f;
final int tz = (int)newZoom;
mapView.setComplexZoom(tz, newZoom - tz);
// mapView.getAnimatedDraggingThread().startZooming(mapView.getFloatZoom() + zdelta, false);

View file

@ -206,9 +206,15 @@ public class MapControlsLayer extends OsmandMapLayer {
private void drawZoomLevel(Canvas canvas, RotatedTileBox tb) {
String zoomText = tb.getZoom() + "";
float frac = tb.getZoomScale();
while(frac > OsmandMapTileView.ZOOM_DELTA_1) {
frac -= OsmandMapTileView.ZOOM_DELTA_1;
if (frac != 0) {
zoomText += "'";
if(frac >= 1){
int ifrac = ((int) frac);
zoomText += ifrac;
if(frac != ifrac) {
zoomText += "." + ((int) ((frac - ifrac) * 10f));
}
}
}
float length = zoomTextPaint.measureText(zoomText);
if (zoomShadow.getBounds().width() == 0) {

View file

@ -59,11 +59,6 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
protected static final int emptyTileDivisor = 16;
public static final float ZOOM_DELTA = 3;
public static final float ZOOM_DELTA_1 = 1/3f;
public interface OnTrackBallListener {
public boolean onTrackBallEvent(MotionEvent e);