Update style
This commit is contained in:
parent
38328dbc26
commit
d5d1aec624
3 changed files with 22 additions and 38 deletions
|
@ -29,6 +29,7 @@ import net.osmand.binary.BinaryMapIndexReader;
|
|||
import net.osmand.binary.BinaryMapIndexReader.MapIndex;
|
||||
import net.osmand.binary.BinaryMapIndexReader.SearchRequest;
|
||||
import net.osmand.binary.BinaryMapIndexReader.TagValuePair;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.QuadPoint;
|
||||
import net.osmand.data.QuadRect;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
|
@ -182,7 +183,8 @@ public class MapRenderRepositories {
|
|||
if (drawSettings.isUpdateVectorRendering()) {
|
||||
return true;
|
||||
}
|
||||
if (requestedBox.getZoom() != box.getZoom()) {
|
||||
if (requestedBox.getZoom() != box.getZoom() ||
|
||||
requestedBox.getZoomScale() != box.getZoomScale()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -558,11 +560,12 @@ public class MapRenderRepositories {
|
|||
currentRenderingContext.topY = lt.y ;
|
||||
currentRenderingContext.zoom = requestedBox.getZoom();
|
||||
currentRenderingContext.rotate = requestedBox.getRotate();
|
||||
currentRenderingContext.width = requestedBox.getPixWidth();
|
||||
currentRenderingContext.height = requestedBox.getPixHeight();
|
||||
final float mapDensity = (float) Math.pow(2, requestedBox.getZoomScale());
|
||||
currentRenderingContext.width = (int) (requestedBox.getPixWidth() / mapDensity);
|
||||
currentRenderingContext.height = (int) (requestedBox.getPixHeight() / mapDensity);
|
||||
currentRenderingContext.nightMode = nightMode;
|
||||
currentRenderingContext.useEnglishNames = prefs.USE_ENGLISH_NAMES.get();
|
||||
currentRenderingContext.setDensityValue(prefs.USE_HIGH_RES_MAPS.get(),
|
||||
currentRenderingContext.setDensityValue(prefs.USE_HIGH_RES_MAPS.get(),
|
||||
prefs.MAP_TEXT_SIZE.get(), renderer.getDensity());
|
||||
// init rendering context
|
||||
currentRenderingContext.tileDivisor = (float) MapUtils.getPowZoom(31 - requestedBox.getZoom());
|
||||
|
@ -594,8 +597,6 @@ public class MapRenderRepositories {
|
|||
this.bmp = bmp;
|
||||
this.bmpLocation = tileRect;
|
||||
|
||||
|
||||
|
||||
if(nativeLib != null) {
|
||||
renderer.generateNewBitmapNative(currentRenderingContext, nativeLib, cNativeObjects, bmp, renderingReq, notifyList);
|
||||
} else {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package net.osmand.plus.views;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
@ -117,23 +118,21 @@ public class AnimateDraggingMapThread {
|
|||
double startLat = tileView.getLatitude();
|
||||
double startLon = tileView.getLongitude();
|
||||
float rotate = tileView.getRotate();
|
||||
final float startZoom = tileView.getZoom() + tileView.getZoomScale();
|
||||
int tileSize = tileView.getSourceTileSize();
|
||||
|
||||
|
||||
float mZoom = startZoom;
|
||||
final int startZoom = tileView.getZoom();
|
||||
final RotatedTileBox rb = tileView.getCurrentRotatedTileBox().copy();
|
||||
final float zoomScale = rb.getZoomScale();
|
||||
boolean skipAnimation = false;
|
||||
float mStX = (float) ((MapUtils.getTileNumberX(mZoom, startLon) - MapUtils.getTileNumberX(mZoom, finalLon)) * tileSize);
|
||||
float mStY = (float) ((MapUtils.getTileNumberY(mZoom, startLat) - MapUtils.getTileNumberY(mZoom, finalLat)) * tileSize);
|
||||
float mStX = rb.getPixXFromLatLon(startLat, startLon) - rb.getPixXFromLatLon(finalLat, finalLon);
|
||||
float mStY = rb.getPixYFromLatLon(startLat, startLon) - rb.getPixYFromLatLon(finalLat, finalLon);
|
||||
while (Math.abs(mStX) + Math.abs(mStY) > 1200) {
|
||||
mZoom--;
|
||||
if(mZoom <= 4){
|
||||
rb.setZoom(rb.getZoom() - 1, zoomScale);
|
||||
if(rb.getZoom() <= 4){
|
||||
skipAnimation = true;
|
||||
}
|
||||
mStX = (float) ((MapUtils.getTileNumberX(mZoom, startLon) - MapUtils.getTileNumberX(mZoom, finalLon)) * tileSize);
|
||||
mStY = (float) ((MapUtils.getTileNumberY(mZoom, startLat) - MapUtils.getTileNumberY(mZoom, finalLat)) * tileSize);
|
||||
mStX = rb.getPixXFromLatLon(startLat, startLon) - rb.getPixXFromLatLon(finalLat, finalLon);
|
||||
mStY = rb.getPixYFromLatLon(startLat, startLon) - rb.getPixYFromLatLon(finalLat, finalLon);
|
||||
}
|
||||
final float moveZoom = mZoom;
|
||||
final int moveZoom = rb.getZoom();
|
||||
// check if animation needed
|
||||
skipAnimation = skipAnimation || (Math.abs(moveZoom - startZoom) >= 3 || Math.abs(endZoom - moveZoom) > 3);
|
||||
if (skipAnimation) {
|
||||
|
@ -141,9 +140,8 @@ public class AnimateDraggingMapThread {
|
|||
tileView.setZoomAnimate(endZoom, endZoomScale, notifyListener);
|
||||
return;
|
||||
}
|
||||
float rad = (float) Math.toRadians(rotate);
|
||||
final float mMoveX = FloatMath.cos(rad) * mStX - FloatMath.sin(rad) * mStY;
|
||||
final float mMoveY = FloatMath.sin(rad) * mStX + FloatMath.cos(rad) * mStY;
|
||||
final float mMoveX = rb.getPixXFromLatLon(startLat, startLon) - rb.getPixXFromLatLon(finalLat, finalLon);
|
||||
final float mMoveY = rb.getPixYFromLatLon(startLat, startLon) - rb.getPixYFromLatLon(finalLat, finalLon);
|
||||
|
||||
final float animationTime = Math.max(450, (Math.abs(mStX) + Math.abs(mStY)) / 1200f * MOVE_MOVE_ANIMATION_TIME);
|
||||
|
||||
|
@ -153,7 +151,7 @@ public class AnimateDraggingMapThread {
|
|||
public void run() {
|
||||
setTargetValues(endZoom, endZoomScale, finalLat, finalLon);
|
||||
if(moveZoom != startZoom){
|
||||
animatingZoomInThread(startZoom, (int) moveZoom, moveZoom - (int) moveZoom, ZOOM_MOVE_ANIMATION_TIME, notifyListener);
|
||||
animatingZoomInThread(startZoom + zoomScale, moveZoom, zoomScale, ZOOM_MOVE_ANIMATION_TIME, notifyListener);
|
||||
}
|
||||
|
||||
if(!stopped){
|
||||
|
@ -164,7 +162,7 @@ public class AnimateDraggingMapThread {
|
|||
}
|
||||
|
||||
if (!stopped && moveZoom != endZoom) {
|
||||
animatingZoomInThread(moveZoom, endZoom, endZoomScale, ZOOM_MOVE_ANIMATION_TIME, notifyListener);
|
||||
animatingZoomInThread(moveZoom + zoomScale, endZoom, endZoomScale, ZOOM_MOVE_ANIMATION_TIME, notifyListener);
|
||||
}
|
||||
if(!stopped){
|
||||
tileView.setZoomAnimate(endZoom, endZoomScale, notifyListener);
|
||||
|
|
|
@ -231,21 +231,6 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
|||
}
|
||||
|
||||
// ///////////////////////// NON UI PART (could be extracted in common) /////////////////////////////
|
||||
public int getSourceTileSize() {
|
||||
// TODO
|
||||
int r = 256;
|
||||
if (mainLayer instanceof MapTileLayer) {
|
||||
r = ((MapTileLayer) mainLayer).getSourceTileSize();
|
||||
}
|
||||
// that trigger allows to scale tiles for certain devices
|
||||
// for example for device with density > 1 draw tiles the same size as with density = 1
|
||||
// It makes text bigger but blurry, the settings could be introduced for that
|
||||
if (dm != null && dm.density > 1f && !getSettings().USE_HIGH_RES_MAPS.get()) {
|
||||
return (int) (r * dm.density);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
public void setIntZoom(int zoom) {
|
||||
if (mainLayer != null && zoom <= mainLayer.getMaximumShownMapZoom() && zoom >= mainLayer.getMinimumShownMapZoom()) {
|
||||
animatedDraggingThread.stopAnimating();
|
||||
|
|
Loading…
Reference in a new issue