Fix zoom scale for high density phones (glitch 200-300%)
This commit is contained in:
parent
85a64d0d65
commit
b6273d00c1
15 changed files with 57 additions and 59 deletions
|
@ -9,8 +9,8 @@ public class RotatedTileBox {
|
||||||
private float rotate;
|
private float rotate;
|
||||||
private float density;
|
private float density;
|
||||||
private int zoom;
|
private int zoom;
|
||||||
private float zoomScale;
|
private double zoomScale;
|
||||||
private float zoomAnimation;
|
private double zoomAnimation;
|
||||||
private int cx;
|
private int cx;
|
||||||
private int cy;
|
private int cy;
|
||||||
private int pixWidth;
|
private int pixWidth;
|
||||||
|
@ -67,7 +67,7 @@ public class RotatedTileBox {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void calculateDerivedFields() {
|
public void calculateDerivedFields() {
|
||||||
zoomFactor = Math.pow(2, zoomScale + zoomAnimation) * 256;
|
zoomFactor = Math.pow(2, zoomScale + zoomAnimation ) * 256;
|
||||||
double rad = Math.toRadians(this.rotate);
|
double rad = Math.toRadians(this.rotate);
|
||||||
rotateCos = Math.cos(rad);
|
rotateCos = Math.cos(rad);
|
||||||
rotateSin = Math.sin(rad);
|
rotateSin = Math.sin(rad);
|
||||||
|
@ -330,16 +330,16 @@ public class RotatedTileBox {
|
||||||
return zoomAnimation != 0;
|
return zoomAnimation != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getZoomAnimation() {
|
public double getZoomAnimation() {
|
||||||
return zoomAnimation;
|
return zoomAnimation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setZoomAnimation(float z) {
|
public void setZoomAnimation(double z) {
|
||||||
this.zoomAnimation = z;
|
this.zoomAnimation = z;
|
||||||
calculateDerivedFields();
|
calculateDerivedFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setZoomAndAnimation(int zoom, float zoomAnimation) {
|
public void setZoomAndAnimation(int zoom, double zoomAnimation) {
|
||||||
this.zoomAnimation = zoomAnimation;
|
this.zoomAnimation = zoomAnimation;
|
||||||
this.zoom = zoom;
|
this.zoom = zoom;
|
||||||
calculateDerivedFields();
|
calculateDerivedFields();
|
||||||
|
@ -358,12 +358,13 @@ public class RotatedTileBox {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public QuadPointDouble getLeftTopTile(float zoom) {
|
public QuadPointDouble getLeftTopTile(double zoom) {
|
||||||
checkTileRectangleCalculated();
|
checkTileRectangleCalculated();
|
||||||
return new QuadPointDouble((tileLT.x * MapUtils.getPowZoom(zoom - this.zoom)),
|
return new QuadPointDouble((tileLT.x * MapUtils.getPowZoom(zoom - this.zoom)),
|
||||||
(tileLT.y * MapUtils.getPowZoom(zoom - this.zoom)));
|
(tileLT.y * MapUtils.getPowZoom(zoom - this.zoom)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public QuadPointDouble getRightBottomTile(float zoom) {
|
public QuadPointDouble getRightBottomTile(float zoom) {
|
||||||
checkTileRectangleCalculated();
|
checkTileRectangleCalculated();
|
||||||
return new QuadPointDouble((tileRB.x * MapUtils.getPowZoom(zoom - this.zoom)),
|
return new QuadPointDouble((tileRB.x * MapUtils.getPowZoom(zoom - this.zoom)),
|
||||||
|
@ -383,7 +384,7 @@ public class RotatedTileBox {
|
||||||
MapUtils.getLongitudeFromTile(zoom, alignTile(tileRB.x)));
|
MapUtils.getLongitudeFromTile(zoom, alignTile(tileRB.x)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setZoom(int zoom, float zoomScale) {
|
public void setZoom(int zoom, double zoomScale) {
|
||||||
this.zoom = zoom;
|
this.zoom = zoom;
|
||||||
this.zoomScale = zoomScale;
|
this.zoomScale = zoomScale;
|
||||||
calculateDerivedFields();
|
calculateDerivedFields();
|
||||||
|
@ -394,14 +395,14 @@ public class RotatedTileBox {
|
||||||
calculateDerivedFields();
|
calculateDerivedFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setZoom(int zoom, float zoomScale, float zoomToAnimate) {
|
public void setZoom(int zoom, double zoomScale, double zoomToAnimate) {
|
||||||
this.zoom = zoom;
|
this.zoom = zoom;
|
||||||
this.zoomScale = zoomScale;
|
this.zoomScale = zoomScale;
|
||||||
this.zoomAnimation = zoomToAnimate;
|
this.zoomAnimation = zoomToAnimate;
|
||||||
calculateDerivedFields();
|
calculateDerivedFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getZoomScale() {
|
public double getZoomScale() {
|
||||||
return zoomScale;
|
return zoomScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,7 +491,7 @@ public class RotatedTileBox {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RotatedTileBoxBuilder setZoomAndScale(int zoom, float scale) {
|
public RotatedTileBoxBuilder setZoomAndScale(int zoom, double scale) {
|
||||||
tb.zoom = zoom;
|
tb.zoom = zoom;
|
||||||
tb.zoomScale = scale;
|
tb.zoomScale = scale;
|
||||||
zoomSet = true;
|
zoomSet = true;
|
||||||
|
|
|
@ -226,11 +226,11 @@ public class MapUtils {
|
||||||
return getDistance(ll, ll2) ;
|
return getDistance(ll, ll2) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getLongitudeFromTile(float zoom, double x) {
|
public static double getLongitudeFromTile(double zoom, double x) {
|
||||||
return x / getPowZoom(zoom) * 360.0 - 180.0;
|
return x / getPowZoom(zoom) * 360.0 - 180.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getPowZoom(float zoom){
|
public static double getPowZoom(double zoom){
|
||||||
if(zoom >= 0 && zoom - Math.floor(zoom) < 0.001f){
|
if(zoom >= 0 && zoom - Math.floor(zoom) < 0.001f){
|
||||||
return 1 << ((int)zoom);
|
return 1 << ((int)zoom);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -198,12 +198,12 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
|
||||||
}
|
}
|
||||||
if (now - lastTimeAutoZooming > 4500) {
|
if (now - lastTimeAutoZooming > 4500) {
|
||||||
lastTimeAutoZooming = now;
|
lastTimeAutoZooming = now;
|
||||||
float settingsZoomScale = mapView.getSettingsZoomScale();
|
double settingsZoomScale = mapView.getSettingsZoomScale();
|
||||||
float complexZoom = tb.getZoom() + tb.getZoomScale() + zdelta;
|
double complexZoom = tb.getZoom() + tb.getZoomScale() + zdelta;
|
||||||
// round to 0.33
|
// round to 0.33
|
||||||
float newZoom = Math.round((complexZoom - settingsZoomScale) * 3) / 3f;
|
double newZoom = Math.round((complexZoom - settingsZoomScale) * 3) / 3f;
|
||||||
int nz = (int)Math.round(newZoom);
|
int nz = (int)Math.round(newZoom);
|
||||||
float nzscale = newZoom - nz + settingsZoomScale;
|
double nzscale = newZoom - nz + settingsZoomScale;
|
||||||
mapView.setComplexZoom(nz, nzscale);
|
mapView.setComplexZoom(nz, nzscale);
|
||||||
// mapView.getAnimatedDraggingThread().startZooming(mapView.getFloatZoom() + zdelta, false);
|
// mapView.getAnimatedDraggingThread().startZooming(mapView.getFloatZoom() + zdelta, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,7 +146,7 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
|
||||||
|
|
||||||
public int getRadiusBug(RotatedTileBox tb) {
|
public int getRadiusBug(RotatedTileBox tb) {
|
||||||
int z;
|
int z;
|
||||||
final float zoom = tb.getZoom() + tb.getZoomScale();
|
final double zoom = tb.getZoom() + tb.getZoomScale();
|
||||||
if (zoom < startZoom) {
|
if (zoom < startZoom) {
|
||||||
z = 0;
|
z = 0;
|
||||||
} else if (zoom <= 12) {
|
} else if (zoom <= 12) {
|
||||||
|
|
|
@ -104,7 +104,7 @@ public class OsMoPositionLayer extends OsmandMapLayer implements ContextMenuLaye
|
||||||
|
|
||||||
public int getRadiusPoi(RotatedTileBox tb){
|
public int getRadiusPoi(RotatedTileBox tb){
|
||||||
int r = 0;
|
int r = 0;
|
||||||
final float zoom = tb.getZoom() + tb.getZoomScale();
|
final double zoom = tb.getZoom() + tb.getZoomScale();
|
||||||
if(zoom < startZoom){
|
if(zoom < startZoom){
|
||||||
r = 0;
|
r = 0;
|
||||||
} else if(zoom <= 11){
|
} else if(zoom <= 11){
|
||||||
|
|
|
@ -22,19 +22,19 @@ import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import net.osmand.IProgress;
|
import net.osmand.IProgress;
|
||||||
import net.osmand.ResultMatcher;
|
|
||||||
import net.osmand.NativeLibrary.NativeSearchResult;
|
import net.osmand.NativeLibrary.NativeSearchResult;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
|
import net.osmand.ResultMatcher;
|
||||||
import net.osmand.access.AccessibleToast;
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.binary.BinaryMapDataObject;
|
import net.osmand.binary.BinaryMapDataObject;
|
||||||
import net.osmand.binary.BinaryMapIndexReader;
|
import net.osmand.binary.BinaryMapIndexReader;
|
||||||
import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteTypeRule;
|
|
||||||
import net.osmand.binary.RouteDataObject;
|
|
||||||
import net.osmand.binary.BinaryMapIndexReader.MapIndex;
|
import net.osmand.binary.BinaryMapIndexReader.MapIndex;
|
||||||
import net.osmand.binary.BinaryMapIndexReader.SearchRequest;
|
import net.osmand.binary.BinaryMapIndexReader.SearchRequest;
|
||||||
import net.osmand.binary.BinaryMapIndexReader.TagValuePair;
|
import net.osmand.binary.BinaryMapIndexReader.TagValuePair;
|
||||||
import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteRegion;
|
import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteRegion;
|
||||||
import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteSubregion;
|
import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteSubregion;
|
||||||
|
import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteTypeRule;
|
||||||
|
import net.osmand.binary.RouteDataObject;
|
||||||
import net.osmand.data.QuadPointDouble;
|
import net.osmand.data.QuadPointDouble;
|
||||||
import net.osmand.data.QuadRect;
|
import net.osmand.data.QuadRect;
|
||||||
import net.osmand.data.RotatedTileBox;
|
import net.osmand.data.RotatedTileBox;
|
||||||
|
@ -611,8 +611,6 @@ public class MapRenderRepositories {
|
||||||
|
|
||||||
// prevent editing
|
// prevent editing
|
||||||
requestedBox = new RotatedTileBox(tileRect);
|
requestedBox = new RotatedTileBox(tileRect);
|
||||||
|
|
||||||
|
|
||||||
// calculate data box
|
// calculate data box
|
||||||
QuadRect dataBox = requestedBox.getLatLonBounds();
|
QuadRect dataBox = requestedBox.getLatLonBounds();
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
|
@ -660,21 +658,20 @@ public class MapRenderRepositories {
|
||||||
if(renderingReq.searchRenderingAttribute("polygonMinSizeToDisplay")) {
|
if(renderingReq.searchRenderingAttribute("polygonMinSizeToDisplay")) {
|
||||||
currentRenderingContext.polygonMinSizeToDisplay = renderingReq.getIntPropertyValue(renderingReq.ALL.R_ATTR_INT_VALUE);
|
currentRenderingContext.polygonMinSizeToDisplay = renderingReq.getIntPropertyValue(renderingReq.ALL.R_ATTR_INT_VALUE);
|
||||||
}
|
}
|
||||||
final QuadPointDouble lt = requestedBox.getLeftTopTile(requestedBox.getZoom());
|
final QuadPointDouble lt = requestedBox.getLeftTopTile(requestedBox.getZoom() + requestedBox.getZoomScale());
|
||||||
// LatLon ltn = requestedBox.getLeftTopLatLon();
|
// LatLon ltn = requestedBox.getLeftTopLatLon();
|
||||||
final float mapDensity = (float) Math.pow(2, requestedBox.getZoomScale());
|
|
||||||
final double tileDivisor = MapUtils.getPowZoom(31 - requestedBox.getZoom() -
|
final double tileDivisor = MapUtils.getPowZoom(31 - requestedBox.getZoom() -
|
||||||
requestedBox.getZoomScale());
|
requestedBox.getZoomScale());
|
||||||
currentRenderingContext.leftX = lt.x * MapUtils.getPowZoom(requestedBox.getZoomScale());
|
|
||||||
// MapUtils.get31TileNumberX(ltn.getLongitude()) / tileDivisor;
|
currentRenderingContext.leftX = lt.x;
|
||||||
currentRenderingContext.topY = lt.y * MapUtils.getPowZoom(requestedBox.getZoomScale());
|
currentRenderingContext.topY = lt.y;
|
||||||
//MapUtils.get31TileNumberY(ltn.getLatitude()) / tileDivisor;
|
|
||||||
currentRenderingContext.zoom = requestedBox.getZoom();
|
currentRenderingContext.zoom = requestedBox.getZoom();
|
||||||
currentRenderingContext.rotate = requestedBox.getRotate();
|
currentRenderingContext.rotate = requestedBox.getRotate();
|
||||||
currentRenderingContext.width = requestedBox.getPixWidth();
|
currentRenderingContext.width = requestedBox.getPixWidth();
|
||||||
currentRenderingContext.height = requestedBox.getPixHeight();
|
currentRenderingContext.height = requestedBox.getPixHeight();
|
||||||
currentRenderingContext.nightMode = nightMode;
|
currentRenderingContext.nightMode = nightMode;
|
||||||
currentRenderingContext.preferredLocale = prefs.MAP_PREFERRED_LOCALE.get();
|
currentRenderingContext.preferredLocale = prefs.MAP_PREFERRED_LOCALE.get();
|
||||||
|
final float mapDensity = (float) Math.pow(2, requestedBox.getZoomScale());
|
||||||
currentRenderingContext.setDensityValue(mapDensity);
|
currentRenderingContext.setDensityValue(mapDensity);
|
||||||
//Text/icon scales according to mapDensity (so text is size of road)
|
//Text/icon scales according to mapDensity (so text is size of road)
|
||||||
// currentRenderingContext.textScale = (requestedBox.getDensity()*app.getSettings().TEXT_SCALE.get());
|
// currentRenderingContext.textScale = (requestedBox.getDensity()*app.getSettings().TEXT_SCALE.get());
|
||||||
|
|
|
@ -547,10 +547,10 @@ public class OsmandRenderer {
|
||||||
rc.pointCount ++;
|
rc.pointCount ++;
|
||||||
double tx = xt / rc.tileDivisor;
|
double tx = xt / rc.tileDivisor;
|
||||||
double ty = yt / rc.tileDivisor;
|
double ty = yt / rc.tileDivisor;
|
||||||
float dTileX = (float) (tx - rc.leftX);
|
double dTileX = (tx - rc.leftX);
|
||||||
float dTileY = (float) (ty - rc.topY);
|
double dTileY = (ty - rc.topY);
|
||||||
float x = rc.cosRotateTileSize * dTileX - rc.sinRotateTileSize * dTileY;
|
float x = (float) (rc.cosRotateTileSize * dTileX - rc.sinRotateTileSize * dTileY);
|
||||||
float y = rc.sinRotateTileSize * dTileX + rc.cosRotateTileSize * dTileY;
|
float y = (float) (rc.sinRotateTileSize * dTileX + rc.cosRotateTileSize * dTileY);
|
||||||
rc.tempPoint.set(x, y);
|
rc.tempPoint.set(x, y);
|
||||||
if(rc.tempPoint.x >= 0 && rc.tempPoint.x < rc.width &&
|
if(rc.tempPoint.x >= 0 && rc.tempPoint.x < rc.width &&
|
||||||
rc.tempPoint.y >= 0 && rc.tempPoint.y < rc.height){
|
rc.tempPoint.y >= 0 && rc.tempPoint.y < rc.height){
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class AnimateDraggingMapThread {
|
||||||
private double targetLatitude = 0;
|
private double targetLatitude = 0;
|
||||||
private double targetLongitude = 0;
|
private double targetLongitude = 0;
|
||||||
private int targetIntZoom = 0;
|
private int targetIntZoom = 0;
|
||||||
private float targetZoomScale = 0;
|
private double targetZoomScale = 0;
|
||||||
|
|
||||||
private boolean isAnimatingZoom;
|
private boolean isAnimatingZoom;
|
||||||
|
|
||||||
|
@ -118,14 +118,14 @@ public class AnimateDraggingMapThread {
|
||||||
startMoving(finalLat, finalLon, endZoom, tileView.getZoomScale(), notifyListener);
|
startMoving(finalLat, finalLon, endZoom, tileView.getZoomScale(), notifyListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startMoving(final double finalLat, final double finalLon, final int endZoom, final float endZoomScale, final boolean notifyListener){
|
public void startMoving(final double finalLat, final double finalLon, final int endZoom, final double endZoomScale, final boolean notifyListener){
|
||||||
stopAnimatingSync();
|
stopAnimatingSync();
|
||||||
double startLat = tileView.getLatitude();
|
double startLat = tileView.getLatitude();
|
||||||
double startLon = tileView.getLongitude();
|
double startLon = tileView.getLongitude();
|
||||||
float rotate = tileView.getRotate();
|
float rotate = tileView.getRotate();
|
||||||
final int startZoom = tileView.getZoom();
|
final int startZoom = tileView.getZoom();
|
||||||
final RotatedTileBox rb = tileView.getCurrentRotatedTileBox().copy();
|
final RotatedTileBox rb = tileView.getCurrentRotatedTileBox().copy();
|
||||||
final float zoomScale = rb.getZoomScale();
|
final double zoomScale = rb.getZoomScale();
|
||||||
boolean skipAnimation = false;
|
boolean skipAnimation = false;
|
||||||
float mStX = rb.getPixXFromLatLon(startLat, startLon) - rb.getPixXFromLatLon(finalLat, finalLon);
|
float mStX = rb.getPixXFromLatLon(startLat, startLon) - rb.getPixXFromLatLon(finalLat, finalLon);
|
||||||
float mStY = rb.getPixYFromLatLon(startLat, startLon) - rb.getPixYFromLatLon(finalLat, finalLon);
|
float mStY = rb.getPixYFromLatLon(startLat, startLon) - rb.getPixYFromLatLon(finalLat, finalLon);
|
||||||
|
@ -208,11 +208,11 @@ public class AnimateDraggingMapThread {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void animatingZoomInThread(float zoomStart, int zoom, float zoomScale, float animationTime, boolean notifyListener){
|
private void animatingZoomInThread(double zoomStart, int zoom, double zoomScale, float animationTime, boolean notifyListener){
|
||||||
try {
|
try {
|
||||||
isAnimatingZoom = true;
|
isAnimatingZoom = true;
|
||||||
float curZoom = zoomStart;
|
double curZoom = zoomStart;
|
||||||
float zoomEnd = zoom + zoomScale;
|
double zoomEnd = (zoom + zoomScale);
|
||||||
animationTime *= Math.abs(zoomEnd - zoomStart);
|
animationTime *= Math.abs(zoomEnd - zoomStart);
|
||||||
// AccelerateInterpolator interpolator = new AccelerateInterpolator(1);
|
// AccelerateInterpolator interpolator = new AccelerateInterpolator(1);
|
||||||
LinearInterpolator interpolator = new LinearInterpolator();
|
LinearInterpolator interpolator = new LinearInterpolator();
|
||||||
|
@ -247,12 +247,12 @@ public class AnimateDraggingMapThread {
|
||||||
startZooming(zoomEnd, tileView.getZoomScale(), notifyListener);
|
startZooming(zoomEnd, tileView.getZoomScale(), notifyListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startZooming(final int zoomEnd, final float zoomScale, final boolean notifyListener){
|
public void startZooming(final int zoomEnd, final double zoomScale, final boolean notifyListener){
|
||||||
final float animationTime = ZOOM_ANIMATION_TIME;
|
final float animationTime = ZOOM_ANIMATION_TIME;
|
||||||
startThreadAnimating(new Runnable(){
|
startThreadAnimating(new Runnable(){
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
final float zoomStart = tileView.getZoom() + tileView.getZoomScale();
|
final double zoomStart = tileView.getZoom() + tileView.getZoomScale();
|
||||||
setTargetValues(zoomEnd, zoomScale, tileView.getLatitude(), tileView.getLongitude());
|
setTargetValues(zoomEnd, zoomScale, tileView.getLatitude(), tileView.getLongitude());
|
||||||
animatingZoomInThread(zoomStart, zoomEnd, zoomScale, animationTime, notifyListener);
|
animatingZoomInThread(zoomStart, zoomEnd, zoomScale, animationTime, notifyListener);
|
||||||
pendingRotateAnimation();
|
pendingRotateAnimation();
|
||||||
|
@ -305,7 +305,7 @@ public class AnimateDraggingMapThread {
|
||||||
targetZoomScale = 0;
|
targetZoomScale = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setTargetValues(int zoom, float zoomScale, double lat, double lon){
|
private void setTargetValues(int zoom, double zoomScale, double lat, double lon){
|
||||||
targetIntZoom = zoom;
|
targetIntZoom = zoom;
|
||||||
targetZoomScale = zoomScale;
|
targetZoomScale = zoomScale;
|
||||||
targetLatitude = lat;
|
targetLatitude = lat;
|
||||||
|
@ -335,7 +335,7 @@ public class AnimateDraggingMapThread {
|
||||||
return targetIntZoom;
|
return targetIntZoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getTargetZoomScale() {
|
public double getTargetZoomScale() {
|
||||||
return targetZoomScale;
|
return targetZoomScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -307,7 +307,7 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setComplexZoom(int zoom, float scale) {
|
public void setComplexZoom(int zoom, double scale) {
|
||||||
if (mainLayer != null && zoom <= mainLayer.getMaximumShownMapZoom() && zoom >= mainLayer.getMinimumShownMapZoom()) {
|
if (mainLayer != null && zoom <= mainLayer.getMaximumShownMapZoom() && zoom >= mainLayer.getMinimumShownMapZoom()) {
|
||||||
animatedDraggingThread.stopAnimating();
|
animatedDraggingThread.stopAnimating();
|
||||||
currentViewport.setZoom(zoom, scale, 0);
|
currentViewport.setZoom(zoom, scale, 0);
|
||||||
|
@ -361,11 +361,11 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
||||||
return currentViewport.getZoom();
|
return currentViewport.getZoom();
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getSettingsZoomScale() {
|
public double getSettingsZoomScale() {
|
||||||
return getSettings().getSettingsZoomScale() + (float)Math.sqrt(Math.max(0, getDensity() - 1));
|
return getSettings().getSettingsZoomScale() + Math.sqrt(Math.max(0, getDensity() - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getZoomScale() {
|
public double getZoomScale() {
|
||||||
return currentViewport.getZoomScale();
|
return currentViewport.getZoomScale();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -678,7 +678,7 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setZoomAnimate(int zoom, float zoomScale, boolean notify) {
|
protected void setZoomAnimate(int zoom, double zoomScale, boolean notify) {
|
||||||
currentViewport.setZoom(zoom, zoomScale, 0);
|
currentViewport.setZoom(zoom, zoomScale, 0);
|
||||||
refreshMap();
|
refreshMap();
|
||||||
if (locationListener != null && notify) {
|
if (locationListener != null && notify) {
|
||||||
|
@ -687,9 +687,9 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
||||||
}
|
}
|
||||||
|
|
||||||
// for internal usage
|
// for internal usage
|
||||||
protected void zoomToAnimate(float tzoom, boolean notify) {
|
protected void zoomToAnimate(double tzoom, boolean notify) {
|
||||||
int zoom = getZoom();
|
int zoom = getZoom();
|
||||||
float zoomToAnimate = tzoom - zoom - getZoomScale();
|
double zoomToAnimate = tzoom - zoom - getZoomScale();
|
||||||
if (zoomToAnimate >= 1) {
|
if (zoomToAnimate >= 1) {
|
||||||
zoom += (int) zoomToAnimate;
|
zoom += (int) zoomToAnimate;
|
||||||
zoomToAnimate -= (int) zoomToAnimate;
|
zoomToAnimate -= (int) zoomToAnimate;
|
||||||
|
@ -852,13 +852,13 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
||||||
final RotatedTileBox calc = initialViewport.copy();
|
final RotatedTileBox calc = initialViewport.copy();
|
||||||
calc.setLatLonCenter(initialCenterLatLon.getLatitude(), initialCenterLatLon.getLongitude());
|
calc.setLatLonCenter(initialCenterLatLon.getLatitude(), initialCenterLatLon.getLongitude());
|
||||||
|
|
||||||
float calcZoom = initialViewport.getZoom() + dz + initialViewport.getZoomScale();
|
double calcZoom = initialViewport.getZoom() + dz + initialViewport.getZoomScale();
|
||||||
float calcRotate = calc.getRotate() + angle;
|
float calcRotate = calc.getRotate() + angle;
|
||||||
calc.setRotate(calcRotate);
|
calc.setRotate(calcRotate);
|
||||||
calc.setZoomAnimation(dz);
|
calc.setZoomAnimation(dz);
|
||||||
final LatLon r = calc.getLatLonFromPixel(cp.x + dx, cp.y + dy);
|
final LatLon r = calc.getLatLonFromPixel(cp.x + dx, cp.y + dy);
|
||||||
setLatLon(r.getLatitude(), r.getLongitude());
|
setLatLon(r.getLatitude(), r.getLongitude());
|
||||||
zoomToAnimate(calcZoom, true);
|
zoomToAnimate((float) calcZoom, true);
|
||||||
rotateToAnimate(calcRotate);
|
rotateToAnimate(calcRotate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
||||||
|
|
||||||
public int getRadiusPoi(RotatedTileBox tb) {
|
public int getRadiusPoi(RotatedTileBox tb) {
|
||||||
int r = 0;
|
int r = 0;
|
||||||
final float zoom = tb.getZoom() + tb.getZoomScale();
|
final double zoom = tb.getZoom() + tb.getZoomScale();
|
||||||
if (zoom < startZoom) {
|
if (zoom < startZoom) {
|
||||||
r = 0;
|
r = 0;
|
||||||
} else if (zoom <= 15) {
|
} else if (zoom <= 15) {
|
||||||
|
|
|
@ -177,7 +177,7 @@ public class PointNavigationLayer extends OsmandMapLayer implements IContextMenu
|
||||||
|
|
||||||
public int getRadiusPoi(RotatedTileBox tb){
|
public int getRadiusPoi(RotatedTileBox tb){
|
||||||
int r = 0;
|
int r = 0;
|
||||||
final float zoom = tb.getZoom() + tb.getZoomScale();
|
final double zoom = tb.getZoom() + tb.getZoomScale();
|
||||||
if(zoom <= 15){
|
if(zoom <= 15){
|
||||||
r = 10;
|
r = 10;
|
||||||
} else if(zoom <= 16){
|
} else if(zoom <= 16){
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class TransportInfoLayer extends OsmandMapLayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRadius(RotatedTileBox tb){
|
public int getRadius(RotatedTileBox tb){
|
||||||
final float zoom = tb.getZoom() + tb.getZoomScale();
|
final double zoom = tb.getZoom() + tb.getZoomScale();
|
||||||
if(zoom <= 16) {
|
if(zoom <= 16) {
|
||||||
return (int) (tb.getDensity() * 8);
|
return (int) (tb.getDensity() * 8);
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRadiusPoi(RotatedTileBox tb){
|
public int getRadiusPoi(RotatedTileBox tb){
|
||||||
final float zoom = tb.getZoom() + tb.getZoomScale();
|
final double zoom = tb.getZoom() + tb.getZoomScale();
|
||||||
int r;
|
int r;
|
||||||
if(zoom < startZoom){
|
if(zoom < startZoom){
|
||||||
r = 0;
|
r = 0;
|
||||||
|
|
|
@ -124,7 +124,7 @@ public class MapZoomControls extends MapControls {
|
||||||
zoomShadow.draw(canvas);
|
zoomShadow.draw(canvas);
|
||||||
if (drawZoomLevel) {
|
if (drawZoomLevel) {
|
||||||
String zoomText = tb.getZoom() + "";
|
String zoomText = tb.getZoom() + "";
|
||||||
float frac = tb.getZoomScale();
|
double frac = tb.getZoomScale();
|
||||||
if (frac != 0) {
|
if (frac != 0) {
|
||||||
int ifrac = (int) (frac * 10);
|
int ifrac = (int) (frac * 10);
|
||||||
boolean pos = ifrac > 0;
|
boolean pos = ifrac > 0;
|
||||||
|
|
|
@ -17,7 +17,7 @@ import android.widget.FrameLayout;
|
||||||
public class RulerControl extends MapControls {
|
public class RulerControl extends MapControls {
|
||||||
|
|
||||||
ShadowText cacheRulerText = null;
|
ShadowText cacheRulerText = null;
|
||||||
float cacheRulerZoom = 0;
|
double cacheRulerZoom = 0;
|
||||||
double cacheRulerTileX = 0;
|
double cacheRulerTileX = 0;
|
||||||
double cacheRulerTileY = 0;
|
double cacheRulerTileY = 0;
|
||||||
float cacheRulerTextLen = 0;
|
float cacheRulerTextLen = 0;
|
||||||
|
|
Loading…
Reference in a new issue