Map fractional zoom, fix #487
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2012 Hannes Janetzek
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2016-2018 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -107,6 +107,26 @@ public class MapPosition {
|
||||
return scale;
|
||||
}
|
||||
|
||||
public MapPosition setScale(double scale) {
|
||||
this.zoomLevel = FastMath.log2((int) scale);
|
||||
this.scale = scale;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the fractional zoom.
|
||||
*/
|
||||
public double getZoom() {
|
||||
return Math.log(scale) / Math.log(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the fractional zoom.
|
||||
*/
|
||||
public void setZoom(double zoom) {
|
||||
setScale(Math.pow(2, zoom));
|
||||
}
|
||||
|
||||
public int getZoomLevel() {
|
||||
return zoomLevel;
|
||||
}
|
||||
@@ -117,12 +137,6 @@ public class MapPosition {
|
||||
return this;
|
||||
}
|
||||
|
||||
public MapPosition setScale(double scale) {
|
||||
this.zoomLevel = FastMath.log2((int) scale);
|
||||
this.scale = scale;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setPosition(GeoPoint geoPoint) {
|
||||
setPosition(geoPoint.getLatitude(), geoPoint.getLongitude());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user