Map fractional zoom, fix #487

This commit is contained in:
Emux 2018-01-20 15:39:30 +02:00
parent 431790a638
commit b42973662e
No known key found for this signature in database
GPG Key ID: 89C6921D7AF2BDD0
2 changed files with 22 additions and 7 deletions

View File

@ -6,6 +6,7 @@
- vtm-mvt module with MVT tile decoder [#481](https://github.com/mapsforge/vtm/pull/481)
- OpenMapTiles MVT vector tiles [#482](https://github.com/mapsforge/vtm/issues/482)
- Improved theme styles [#479](https://github.com/mapsforge/vtm/pull/479)
- Map fractional zoom [#487](https://github.com/mapsforge/vtm/issues/487)
- Render theme fallback internal resources [#477](https://github.com/mapsforge/vtm/issues/477)
- Fix libGDX flickering [#148](https://github.com/mapsforge/vtm/issues/148) [#149](https://github.com/mapsforge/vtm/issues/149)
- JTS (LocationTech) [#484](https://github.com/mapsforge/vtm/issues/484)

View File

@ -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());
}