Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
1f3630fa02
22 changed files with 83 additions and 116 deletions
|
@ -9,7 +9,7 @@ public class RotatedTileBox {
|
|||
private float rotate;
|
||||
private float density;
|
||||
private int zoom;
|
||||
private double zoomScale;
|
||||
private double mapDensity = 1;
|
||||
private double zoomAnimation;
|
||||
private int cx;
|
||||
private int cy;
|
||||
|
@ -41,7 +41,7 @@ public class RotatedTileBox {
|
|||
this.lat = r.lat;
|
||||
this.lon = r.lon;
|
||||
this.zoom = r.zoom;
|
||||
this.zoomScale = r.zoomScale;
|
||||
this.mapDensity = r.mapDensity;
|
||||
this.zoomAnimation = r.zoomAnimation;
|
||||
this.rotate = r.rotate;
|
||||
this.density = r.density;
|
||||
|
@ -67,7 +67,7 @@ public class RotatedTileBox {
|
|||
}
|
||||
|
||||
public void calculateDerivedFields() {
|
||||
zoomFactor = Math.pow(2, zoomScale + zoomAnimation ) * 256;
|
||||
zoomFactor = Math.pow(2, zoomAnimation ) * 256 * mapDensity;
|
||||
double rad = Math.toRadians(this.rotate);
|
||||
rotateCos = Math.cos(rad);
|
||||
rotateSin = Math.sin(rad);
|
||||
|
@ -392,28 +392,26 @@ public class RotatedTileBox {
|
|||
MapUtils.getLongitudeFromTile(zoom, alignTile(tileRB.x)));
|
||||
}
|
||||
|
||||
public void setZoom(int zoom, double zoomScale) {
|
||||
this.zoom = zoom;
|
||||
this.zoomScale = zoomScale;
|
||||
public void setMapDensity(double mapDensity) {
|
||||
this.mapDensity = mapDensity;
|
||||
calculateDerivedFields();
|
||||
}
|
||||
|
||||
public double getMapDensity() {
|
||||
return mapDensity;
|
||||
}
|
||||
|
||||
public void setZoom(int zoom) {
|
||||
this.zoom = zoom;
|
||||
calculateDerivedFields();
|
||||
}
|
||||
|
||||
public void setZoom(int zoom, double zoomScale, double zoomToAnimate) {
|
||||
public void setZoomWithAnimate(int zoom,double zoomToAnimate) {
|
||||
this.zoom = zoom;
|
||||
this.zoomScale = zoomScale;
|
||||
this.zoomAnimation = zoomToAnimate;
|
||||
calculateDerivedFields();
|
||||
}
|
||||
|
||||
public double getZoomScale() {
|
||||
return zoomScale;
|
||||
}
|
||||
|
||||
public float getRotate() {
|
||||
return rotate;
|
||||
}
|
||||
|
@ -499,13 +497,17 @@ public class RotatedTileBox {
|
|||
return this;
|
||||
}
|
||||
|
||||
public RotatedTileBoxBuilder setZoomAndScale(int zoom, double scale) {
|
||||
tb.zoom = zoom;
|
||||
tb.zoomScale = scale;
|
||||
zoomSet = true;
|
||||
public RotatedTileBoxBuilder setMapDensity(double mapDensity) {
|
||||
tb.mapDensity = mapDensity;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RotatedTileBoxBuilder setZoom(int zoom) {
|
||||
tb.zoom = zoom;
|
||||
zoomSet = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RotatedTileBoxBuilder setLocation(double lat, double lon) {
|
||||
tb.lat = lat;
|
||||
tb.lon = lon;
|
||||
|
|
|
@ -101,7 +101,7 @@ public class MapRendererContext {
|
|||
}
|
||||
|
||||
protected float getDisplayDensityFactor() {
|
||||
return (float) Math.pow(2, Math.sqrt((app.getSettings().getSettingsZoomScale() + density)));
|
||||
return (float) (app.getSettings().MAP_DENSITY.get()) * Math.max(1, density);
|
||||
}
|
||||
|
||||
protected int getRasterTileSize() {
|
||||
|
@ -199,7 +199,8 @@ public class MapRendererContext {
|
|||
mapRendererView.removeSymbolsProvider(obfMapSymbolsProvider);
|
||||
}
|
||||
// Create new OBF map symbols provider
|
||||
obfMapSymbolsProvider = new MapObjectsSymbolsProvider(mapPrimitivesProvider, getReferenceTileSize());
|
||||
obfMapSymbolsProvider = new MapObjectsSymbolsProvider(mapPrimitivesProvider, getReferenceTileSize(),
|
||||
app.getSettings().TEXT_SCALE.get() / Math.max(1, density) );
|
||||
// If there's bound view, add new provider
|
||||
if (mapRendererView != null) {
|
||||
mapRendererView.addSymbolsProvider(obfMapSymbolsProvider);
|
||||
|
|
|
@ -716,16 +716,12 @@ public class OsmandSettings {
|
|||
TEXT_SCALE.setModeDefaultValue(ApplicationMode.CAR, 1.25f);
|
||||
}
|
||||
|
||||
public final CommonPreference<Float> MAP_ZOOM_SCALE_BY_DENSITY = new FloatPreference("map_zoom_scale_wo_density", 0f).makeProfile().cache();
|
||||
public final CommonPreference<Float> MAP_DENSITY = new FloatPreference("map_density_n", 1f).makeProfile().cache();
|
||||
{
|
||||
MAP_ZOOM_SCALE_BY_DENSITY.setModeDefaultValue(ApplicationMode.CAR, 0.5f);
|
||||
MAP_DENSITY.setModeDefaultValue(ApplicationMode.CAR, 1.5f);
|
||||
}
|
||||
|
||||
|
||||
public float getSettingsZoomScale(){
|
||||
return MAP_ZOOM_SCALE_BY_DENSITY.get() ;
|
||||
}
|
||||
|
||||
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public final OsmandPreference<Boolean> SHOW_POI_OVER_MAP = new BooleanPreference("show_poi_over_map", false).makeGlobal();
|
||||
|
|
|
@ -665,7 +665,7 @@ public class MapActivity extends AccessibleActivity {
|
|||
mapLayers.getMapInfoLayer().recreateControls();
|
||||
}
|
||||
mapLayers.updateLayers(mapView);
|
||||
mapView.setComplexZoom(mapView.getZoom(), mapView.getSettingsZoomScale());
|
||||
mapView.setComplexZoom(mapView.getZoom(), mapView.getSettingsMapDensity());
|
||||
app.getDaynightHelper().startSensorIfNeeded(new StateChangedListener<Boolean>() {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -69,7 +69,7 @@ public class AudioNotesLayer extends OsmandMapLayer implements IContextMenuProvi
|
|||
|
||||
public int getRadiusPoi(RotatedTileBox tb){
|
||||
int r = 0;
|
||||
if(tb.getZoom() + tb.getZoomScale() < startZoom){
|
||||
if(tb.getZoom() < startZoom){
|
||||
r = 0;
|
||||
} else {
|
||||
r = 15;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package net.osmand.plus.base;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import net.osmand.Location;
|
||||
|
@ -203,13 +201,14 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
|
|||
if (now - lastTimeAutoZooming > 4500 && (now - lastTimeAutoZooming > threshold || !isUserZoomed)) {
|
||||
isUserZoomed = false;
|
||||
lastTimeAutoZooming = now;
|
||||
double settingsZoomScale = mapView.getSettingsZoomScale();
|
||||
double complexZoom = tb.getZoom() + tb.getZoomScale() + zdelta;
|
||||
double settingsZoomScale = Math.log(mapView.getSettingsMapDensity()) / Math.log(2.0f);
|
||||
double zoomScale = Math.log(tb.getMapDensity()) / Math.log(2.0f);
|
||||
double complexZoom = tb.getZoom() + zoomScale + zdelta;
|
||||
// round to 0.33
|
||||
double newZoom = Math.round((complexZoom - settingsZoomScale) * 3) / 3f;
|
||||
int nz = (int)Math.round(newZoom);
|
||||
double nzscale = newZoom - nz + settingsZoomScale;
|
||||
mapView.setComplexZoom(nz, nzscale);
|
||||
int newIntegerZoom = (int)Math.round(newZoom);
|
||||
double nzscale = newZoom - newIntegerZoom + settingsZoomScale;
|
||||
mapView.setComplexZoom(newIntegerZoom, Math.pow(2, nzscale));
|
||||
// mapView.getAnimatedDraggingThread().startZooming(mapView.getFloatZoom() + zdelta, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ public class DashMapFragment extends DashBaseFragment implements IMapDownloader
|
|||
LatLon lm = getMyApplication().getSettings().getLastKnownMapLocation();
|
||||
int zm = getMyApplication().getSettings().getLastKnownMapZoom();
|
||||
osmandMapTileView.setLatLon(lm.getLatitude(), lm.getLongitude());
|
||||
osmandMapTileView.setComplexZoom(zm, osmandMapTileView.getSettingsZoomScale());
|
||||
osmandMapTileView.setComplexZoom(zm, osmandMapTileView.getSettingsMapDensity());
|
||||
osmandMapTileView.refreshMap(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
|
|||
|
||||
public int getRadiusBug(RotatedTileBox tb) {
|
||||
int z;
|
||||
final double zoom = tb.getZoom() + tb.getZoomScale();
|
||||
final double zoom = tb.getZoom();
|
||||
if (zoom < startZoom) {
|
||||
z = 0;
|
||||
} else if (zoom <= 12) {
|
||||
|
|
|
@ -107,7 +107,7 @@ public class OsMoPositionLayer extends OsmandMapLayer implements ContextMenuLaye
|
|||
|
||||
public int getRadiusPoi(RotatedTileBox tb){
|
||||
int r = 0;
|
||||
final double zoom = tb.getZoom() + tb.getZoomScale();
|
||||
final double zoom = tb.getZoom();
|
||||
if(zoom < startZoom){
|
||||
r = 0;
|
||||
} else if(zoom <= 11){
|
||||
|
|
|
@ -196,7 +196,7 @@ public class MapRenderRepositories {
|
|||
return true;
|
||||
}
|
||||
if (requestedBox.getZoom() != box.getZoom() ||
|
||||
requestedBox.getZoomScale() != box.getZoomScale()) {
|
||||
requestedBox.getMapDensity() != box.getMapDensity()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -667,10 +667,11 @@ public class MapRenderRepositories {
|
|||
if(renderingReq.searchRenderingAttribute("polygonMinSizeToDisplay")) {
|
||||
currentRenderingContext.polygonMinSizeToDisplay = renderingReq.getIntPropertyValue(renderingReq.ALL.R_ATTR_INT_VALUE);
|
||||
}
|
||||
final QuadPointDouble lt = requestedBox.getLeftTopTile(requestedBox.getZoom() + requestedBox.getZoomScale());
|
||||
final QuadPointDouble lt = requestedBox.getLeftTopTile(requestedBox.getZoom());
|
||||
lt.x *= requestedBox.getMapDensity();
|
||||
lt.y *= requestedBox.getMapDensity();
|
||||
// LatLon ltn = requestedBox.getLeftTopLatLon();
|
||||
final double tileDivisor = MapUtils.getPowZoom(31 - requestedBox.getZoom() -
|
||||
requestedBox.getZoomScale());
|
||||
final double tileDivisor = MapUtils.getPowZoom(31 - requestedBox.getZoom()) / requestedBox.getMapDensity();
|
||||
|
||||
currentRenderingContext.leftX = lt.x;
|
||||
currentRenderingContext.topY = lt.y;
|
||||
|
@ -680,7 +681,7 @@ public class MapRenderRepositories {
|
|||
currentRenderingContext.height = requestedBox.getPixHeight();
|
||||
currentRenderingContext.nightMode = nightMode;
|
||||
currentRenderingContext.preferredLocale = prefs.MAP_PREFERRED_LOCALE.get();
|
||||
final float mapDensity = (float) Math.pow(2, requestedBox.getZoomScale());
|
||||
final float mapDensity = (float) requestedBox.getMapDensity();
|
||||
currentRenderingContext.setDensityValue(mapDensity);
|
||||
//Text/icon scales according to mapDensity (so text is size of road)
|
||||
// currentRenderingContext.textScale = (requestedBox.getDensity()*app.getSettings().TEXT_SCALE.get());
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package net.osmand.plus.render;
|
||||
|
||||
import net.osmand.core.android.MapRendererView;
|
||||
import net.osmand.core.jni.IMapRenderer;
|
||||
import net.osmand.core.jni.PointI;
|
||||
import net.osmand.data.QuadPointDouble;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
|
@ -15,7 +14,6 @@ import android.graphics.Canvas;
|
|||
import android.graphics.Paint;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.RectF;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
public class MapVectorLayer extends BaseMapLayer {
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@ import java.util.List;
|
|||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.map.MapTileDownloader.DownloadRequest;
|
||||
import net.osmand.map.MapTileDownloader.IMapDownloaderCallback;
|
||||
import net.osmand.plus.GPXUtilities;
|
||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||
import net.osmand.plus.GPXUtilities.WptPt;
|
||||
import net.osmand.plus.GPXUtilities;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.render.MapVectorLayer;
|
||||
|
@ -114,7 +114,7 @@ public class SherpafyStageItineraryFragment extends SherpafyStageInfoFragment im
|
|||
tb.setZoom(tb.getZoom() - 1);
|
||||
}
|
||||
osmandMapTileView.setLatLon(tb.getCenterLatLon().getLatitude(), tb.getCenterLatLon().getLongitude());
|
||||
osmandMapTileView.setComplexZoom(tb.getZoom(), osmandMapTileView.getSettingsZoomScale());
|
||||
osmandMapTileView.setComplexZoom(tb.getZoom(), osmandMapTileView.getSettingsMapDensity());
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@ public class AnimateDraggingMapThread {
|
|||
private double targetLatitude = 0;
|
||||
private double targetLongitude = 0;
|
||||
private int targetIntZoom = 0;
|
||||
private double targetZoomScale = 0;
|
||||
|
||||
private boolean isAnimatingZoom;
|
||||
|
||||
|
@ -118,18 +117,14 @@ public class AnimateDraggingMapThread {
|
|||
|
||||
}
|
||||
|
||||
public void startMoving(final double finalLat, final double finalLon, final int endZoom, final boolean notifyListener){
|
||||
startMoving(finalLat, finalLon, endZoom, tileView.getZoomScale(), notifyListener);
|
||||
}
|
||||
|
||||
public void startMoving(final double finalLat, final double finalLon, final int endZoom, final double endZoomScale, final boolean notifyListener){
|
||||
public void startMoving(final double finalLat, final double finalLon, final int endZoom, final boolean notifyListener){
|
||||
stopAnimatingSync();
|
||||
double startLat = tileView.getLatitude();
|
||||
double startLon = tileView.getLongitude();
|
||||
float rotate = tileView.getRotate();
|
||||
final int startZoom = tileView.getZoom();
|
||||
final RotatedTileBox rb = tileView.getCurrentRotatedTileBox().copy();
|
||||
final double zoomScale = rb.getZoomScale();
|
||||
boolean skipAnimation = false;
|
||||
float mStX = rb.getPixXFromLatLon(startLat, startLon) - rb.getPixXFromLatLon(finalLat, finalLon);
|
||||
float mStY = rb.getPixYFromLatLon(startLat, startLon) - rb.getPixYFromLatLon(finalLat, finalLon);
|
||||
|
@ -146,7 +141,7 @@ public class AnimateDraggingMapThread {
|
|||
skipAnimation = skipAnimation || (Math.abs(moveZoom - startZoom) >= 3 || Math.abs(endZoom - moveZoom) > 3);
|
||||
if (skipAnimation) {
|
||||
tileView.setLatLonAnimate(finalLat, finalLon, notifyListener);
|
||||
tileView.setZoomAnimate(endZoom, endZoomScale, notifyListener);
|
||||
tileView.setZoomAnimate(endZoom, notifyListener);
|
||||
return;
|
||||
}
|
||||
final float mMoveX = rb.getPixXFromLatLon(startLat, startLon) - rb.getPixXFromLatLon(finalLat, finalLon);
|
||||
|
@ -158,9 +153,9 @@ public class AnimateDraggingMapThread {
|
|||
|
||||
@Override
|
||||
public void run() {
|
||||
setTargetValues(endZoom, endZoomScale, finalLat, finalLon);
|
||||
setTargetValues(endZoom, finalLat, finalLon);
|
||||
if(moveZoom != startZoom){
|
||||
animatingZoomInThread(startZoom + zoomScale, moveZoom, zoomScale, ZOOM_MOVE_ANIMATION_TIME, notifyListener);
|
||||
animatingZoomInThread(startZoom, moveZoom, ZOOM_MOVE_ANIMATION_TIME, notifyListener);
|
||||
}
|
||||
|
||||
if(!stopped){
|
||||
|
@ -171,13 +166,9 @@ public class AnimateDraggingMapThread {
|
|||
}
|
||||
|
||||
if (!stopped && moveZoom != endZoom) {
|
||||
animatingZoomInThread(moveZoom + zoomScale, endZoom, endZoomScale, ZOOM_MOVE_ANIMATION_TIME, notifyListener);
|
||||
}
|
||||
if(!stopped){
|
||||
tileView.setZoomAnimate(endZoom, endZoomScale, notifyListener);
|
||||
} else{
|
||||
tileView.setZoomAnimate(endZoom, endZoomScale, notifyListener);
|
||||
animatingZoomInThread(moveZoom, endZoom, ZOOM_MOVE_ANIMATION_TIME, notifyListener);
|
||||
}
|
||||
tileView.setZoomAnimate(endZoom, notifyListener);
|
||||
|
||||
pendingRotateAnimation();
|
||||
}
|
||||
|
@ -212,11 +203,11 @@ public class AnimateDraggingMapThread {
|
|||
|
||||
}
|
||||
|
||||
private void animatingZoomInThread(double zoomStart, int zoom, double zoomScale, float animationTime, boolean notifyListener){
|
||||
private void animatingZoomInThread(double zoomStart, int zoom, float animationTime, boolean notifyListener){
|
||||
try {
|
||||
isAnimatingZoom = true;
|
||||
double curZoom = zoomStart;
|
||||
double zoomEnd = (zoom + zoomScale);
|
||||
double zoomEnd = (zoom /*+ zoomScale*/);
|
||||
animationTime *= Math.abs(zoomEnd - zoomStart);
|
||||
// AccelerateInterpolator interpolator = new AccelerateInterpolator(1);
|
||||
LinearInterpolator interpolator = new LinearInterpolator();
|
||||
|
@ -237,7 +228,7 @@ public class AnimateDraggingMapThread {
|
|||
stopped = true;
|
||||
}
|
||||
}
|
||||
tileView.setZoomAnimate(zoom, zoomScale, notifyListener);
|
||||
tileView.setZoomAnimate(zoom, notifyListener);
|
||||
} finally {
|
||||
isAnimatingZoom = false;
|
||||
}
|
||||
|
@ -248,17 +239,13 @@ public class AnimateDraggingMapThread {
|
|||
}
|
||||
|
||||
public void startZooming(final int zoomEnd, final boolean notifyListener){
|
||||
startZooming(zoomEnd, tileView.getZoomScale(), notifyListener);
|
||||
}
|
||||
|
||||
public void startZooming(final int zoomEnd, final double zoomScale, final boolean notifyListener){
|
||||
final float animationTime = ZOOM_ANIMATION_TIME;
|
||||
startThreadAnimating(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
final double zoomStart = tileView.getZoom() + tileView.getZoomScale();
|
||||
setTargetValues(zoomEnd, zoomScale, tileView.getLatitude(), tileView.getLongitude());
|
||||
animatingZoomInThread(zoomStart, zoomEnd, zoomScale, animationTime, notifyListener);
|
||||
final double zoomStart = tileView.getZoom() ;
|
||||
setTargetValues(zoomEnd, tileView.getLatitude(), tileView.getLongitude());
|
||||
animatingZoomInThread(zoomStart, zoomEnd, animationTime, notifyListener);
|
||||
pendingRotateAnimation();
|
||||
}
|
||||
}); //$NON-NLS-1$
|
||||
|
@ -306,7 +293,6 @@ public class AnimateDraggingMapThread {
|
|||
|
||||
private void clearTargetValues(){
|
||||
targetIntZoom = 0;
|
||||
targetZoomScale = 0;
|
||||
}
|
||||
|
||||
private void suspendUpdate() {
|
||||
|
@ -323,9 +309,8 @@ public class AnimateDraggingMapThread {
|
|||
}
|
||||
}
|
||||
|
||||
private void setTargetValues(int zoom, double zoomScale, double lat, double lon){
|
||||
private void setTargetValues(int zoom, double lat, double lon){
|
||||
targetIntZoom = zoom;
|
||||
targetZoomScale = zoomScale;
|
||||
targetLatitude = lat;
|
||||
targetLongitude = lon;
|
||||
}
|
||||
|
@ -353,10 +338,6 @@ public class AnimateDraggingMapThread {
|
|||
return targetIntZoom;
|
||||
}
|
||||
|
||||
public double getTargetZoomScale() {
|
||||
return targetZoomScale;
|
||||
}
|
||||
|
||||
public double getTargetLatitude() {
|
||||
return targetLatitude;
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
|||
private int updatePaints(int color, boolean routePoints, DrawSettings nightMode, RotatedTileBox tileBox){
|
||||
RenderingRulesStorage rrs = view.getApplication().getRendererRegistry().getCurrentSelectedRenderer();
|
||||
final boolean isNight = nightMode != null && nightMode.isNightMode();
|
||||
int hsh = calculateHash(rrs, routePoints, isNight, tileBox.getZoomScale());
|
||||
int hsh = calculateHash(rrs, routePoints, isNight, tileBox.getMapDensity());
|
||||
if (hsh != cachedHash) {
|
||||
cachedHash = hsh;
|
||||
cachedColor = view.getResources().getColor(R.color.gpx_track);
|
||||
|
@ -140,7 +140,7 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
|||
}
|
||||
if (req.searchRenderingAttribute("gpx")) {
|
||||
RenderingContext rc = new OsmandRenderer.RenderingContext(view.getContext());
|
||||
rc.setDensityValue((float) Math.pow(2, tileBox.getZoomScale()));
|
||||
rc.setDensityValue((float) tileBox.getMapDensity());
|
||||
cachedColor = req.getIntPropertyValue(rrs.PROPS.R_COLOR);
|
||||
osmandRenderer.updatePaint(req, paint, 0, false, rc);
|
||||
isPaint2 = osmandRenderer.updatePaint(req, paint2, 1, false, rc);
|
||||
|
|
|
@ -222,8 +222,9 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
|||
dm = new DisplayMetrics();
|
||||
mgr.getDefaultDisplay().getMetrics(dm);
|
||||
currentViewport = new RotatedTileBox.RotatedTileBoxBuilder().
|
||||
setLocation(0, 0).setZoomAndScale(3, 0).setPixelDimensions(view.getWidth(), view.getHeight()).build();
|
||||
setLocation(0, 0).setZoom(3).setPixelDimensions(view.getWidth(), view.getHeight()).build();
|
||||
currentViewport.setDensity(dm.density);
|
||||
currentViewport.setMapDensity(getSettingsMapDensity());
|
||||
|
||||
}
|
||||
|
||||
|
@ -295,10 +296,11 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
|||
}
|
||||
}
|
||||
|
||||
public void setComplexZoom(int zoom, double scale) {
|
||||
public void setComplexZoom(int zoom, double mapDensity) {
|
||||
if (mainLayer != null && zoom <= mainLayer.getMaximumShownMapZoom() && zoom >= mainLayer.getMinimumShownMapZoom()) {
|
||||
animatedDraggingThread.stopAnimating();
|
||||
currentViewport.setZoom(zoom, scale, 0);
|
||||
currentViewport.setZoomWithAnimate(zoom, 0);
|
||||
currentViewport.setMapDensity(mapDensity);
|
||||
currentViewport.setRotate(zoom > LOWEST_ZOOM_TO_ROTATE ? rotate : 0);
|
||||
refreshMap();
|
||||
}
|
||||
|
@ -349,13 +351,10 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
|||
return currentViewport.getZoom();
|
||||
}
|
||||
|
||||
public double getSettingsZoomScale() {
|
||||
return getSettings().getSettingsZoomScale() + Math.sqrt(Math.max(0, getDensity() - 1));
|
||||
public double getSettingsMapDensity() {
|
||||
return (getSettings().MAP_DENSITY.get()) * Math.max(1, getDensity());
|
||||
}
|
||||
|
||||
public double getZoomScale() {
|
||||
return currentViewport.getZoomScale();
|
||||
}
|
||||
|
||||
public boolean isZooming() {
|
||||
return currentViewport.isZoomAnimated();
|
||||
|
@ -679,8 +678,8 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
|||
}
|
||||
}
|
||||
|
||||
protected void setZoomAnimate(int zoom, double zoomScale, boolean notify) {
|
||||
currentViewport.setZoom(zoom, zoomScale, 0);
|
||||
protected void setZoomAnimate(int zoom, boolean notify) {
|
||||
currentViewport.setZoomWithAnimate(zoom, 0);
|
||||
refreshMap();
|
||||
if (locationListener != null && notify) {
|
||||
locationListener.locationChanged(getLatitude(), getLongitude(), this);
|
||||
|
@ -690,7 +689,7 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
|||
// for internal usage
|
||||
protected void zoomToAnimate(double tzoom, boolean notify) {
|
||||
int zoom = getZoom();
|
||||
double zoomToAnimate = tzoom - zoom - getZoomScale();
|
||||
double zoomToAnimate = tzoom - zoom;
|
||||
if (zoomToAnimate >= 1) {
|
||||
zoom += (int) zoomToAnimate;
|
||||
zoomToAnimate -= (int) zoomToAnimate;
|
||||
|
@ -867,7 +866,7 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
|||
final RotatedTileBox calc = initialViewport.copy();
|
||||
calc.setLatLonCenter(initialCenterLatLon.getLatitude(), initialCenterLatLon.getLongitude());
|
||||
|
||||
double calcZoom = initialViewport.getZoom() + dz + initialViewport.getZoomScale();
|
||||
double calcZoom = initialViewport.getZoom() + dz ;
|
||||
float calcRotate = calc.getRotate() + angle;
|
||||
calc.setRotate(calcRotate);
|
||||
calc.setZoomAnimation(dz);
|
||||
|
|
|
@ -184,7 +184,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
|||
|
||||
public int getRadiusPoi(RotatedTileBox tb) {
|
||||
int r = 0;
|
||||
final double zoom = tb.getZoom() + tb.getZoomScale();
|
||||
final double zoom = tb.getZoom();
|
||||
if (zoom < startZoom) {
|
||||
r = 0;
|
||||
} else if (zoom <= 15) {
|
||||
|
|
|
@ -177,7 +177,7 @@ public class PointNavigationLayer extends OsmandMapLayer implements IContextMenu
|
|||
|
||||
public int getRadiusPoi(RotatedTileBox tb){
|
||||
int r = 0;
|
||||
final double zoom = tb.getZoom() + tb.getZoomScale();
|
||||
final double zoom = tb.getZoom();
|
||||
if(zoom <= 15){
|
||||
r = 10;
|
||||
} else if(zoom <= 16){
|
||||
|
|
|
@ -86,7 +86,7 @@ public class RouteLayer extends OsmandMapLayer {
|
|||
private void updatePaints(DrawSettings nightMode, RotatedTileBox tileBox){
|
||||
RenderingRulesStorage rrs = view.getApplication().getRendererRegistry().getCurrentSelectedRenderer();
|
||||
final boolean isNight = nightMode != null && nightMode.isNightMode();
|
||||
int hsh = calculateHash(rrs, isNight, tileBox.getZoomScale());
|
||||
int hsh = calculateHash(rrs, isNight, tileBox.getMapDensity());
|
||||
if (hsh != cachedHash) {
|
||||
cachedHash = hsh;
|
||||
// cachedColor = view.getResources().getColor(R.color.nav_track);
|
||||
|
@ -95,7 +95,7 @@ public class RouteLayer extends OsmandMapLayer {
|
|||
req.setBooleanFilter(rrs.PROPS.R_NIGHT_MODE, isNight);
|
||||
if (req.searchRenderingAttribute("route")) {
|
||||
RenderingContext rc = new OsmandRenderer.RenderingContext(view.getContext());
|
||||
rc.setDensityValue((float) Math.pow(2, tileBox.getZoomScale()));
|
||||
rc.setDensityValue((float) tileBox.getMapDensity());
|
||||
// cachedColor = req.getIntPropertyValue(rrs.PROPS.R_COLOR);
|
||||
osmandRenderer.updatePaint(req, paint, 0, false, rc);
|
||||
isPaint2 = osmandRenderer.updatePaint(req, paint2, 1, false, rc);
|
||||
|
|
|
@ -47,7 +47,7 @@ public class TransportInfoLayer extends OsmandMapLayer {
|
|||
}
|
||||
|
||||
public int getRadius(RotatedTileBox tb){
|
||||
final double zoom = tb.getZoom() + tb.getZoomScale();
|
||||
final double zoom = tb.getZoom();
|
||||
if(zoom <= 16) {
|
||||
return (int) (tb.getDensity() * 8);
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
|
|||
}
|
||||
|
||||
public int getRadiusPoi(RotatedTileBox tb){
|
||||
final double zoom = tb.getZoom() + tb.getZoomScale();
|
||||
final double zoom = tb.getZoom();
|
||||
int r;
|
||||
if(zoom < startZoom){
|
||||
r = 0;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package net.osmand.plus.views.controls;
|
||||
|
||||
import android.view.Gravity;
|
||||
import gnu.trove.list.array.TIntArrayList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -127,11 +126,10 @@ public class MapZoomControls extends MapControls {
|
|||
zoomShadow.draw(canvas);
|
||||
if (drawZoomLevel) {
|
||||
String zoomText = tb.getZoom() + "";
|
||||
double frac = tb.getZoomScale();
|
||||
double frac = tb.getMapDensity();
|
||||
if (frac != 0) {
|
||||
int ifrac = (int) (frac * 10);
|
||||
boolean pos = ifrac > 0;
|
||||
zoomText += (pos ? "+" : "-");
|
||||
zoomText += " ";
|
||||
zoomText += Math.abs(ifrac) / 10;
|
||||
if (ifrac % 10 != 0) {
|
||||
zoomText += "." + Math.abs(ifrac) % 10;
|
||||
|
@ -237,11 +235,10 @@ public class MapZoomControls extends MapControls {
|
|||
|
||||
@Override
|
||||
public boolean onLongClick(View notUseCouldBeNull) {
|
||||
final OsmandSettings.OsmandPreference<Float> zoomScale = view.getSettings().MAP_ZOOM_SCALE_BY_DENSITY;
|
||||
final OsmandSettings.OsmandPreference<Float> mapDensity = view.getSettings().MAP_DENSITY;
|
||||
final AlertDialog.Builder bld = new AlertDialog.Builder(view.getContext());
|
||||
float scale = zoomScale.get();// view.getZoomScale();
|
||||
int p = (int) ((scale > 0 ? 1 : -1) * Math.round(scale * scale * 100)) + 100;
|
||||
final TIntArrayList tlist = new TIntArrayList(new int[] {50, 75, 100, 150, 200, 300, 400, 500 });
|
||||
int p = (int) (mapDensity.get() * 100);
|
||||
final TIntArrayList tlist = new TIntArrayList(new int[] {33, 50, 75, 100, 150, 200, 300, 400 });
|
||||
final List<String> values = new ArrayList<String>();
|
||||
int i = -1;
|
||||
for (int k = 0; k <= tlist.size(); k++) {
|
||||
|
@ -269,15 +266,8 @@ public class MapZoomControls extends MapControls {
|
|||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
int p = tlist.get(which);
|
||||
float newScale;
|
||||
if (p >= 100) {
|
||||
newScale = (float) Math.sqrt((tlist.get(which) - 100f) / 100f);
|
||||
} else {
|
||||
newScale = -(float) Math.sqrt((100f - tlist.get(which)) / 100f);
|
||||
}
|
||||
zoomScale.set(newScale);
|
||||
view.getAnimatedDraggingThread().startZooming(view.getZoom(),
|
||||
view.getSettingsZoomScale(), false);
|
||||
mapDensity.set(p / 100.0f);
|
||||
view.setComplexZoom(view.getZoom(), view.getSettingsMapDensity());
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -58,9 +58,9 @@ public class RulerControl extends MapControls {
|
|||
// update cache
|
||||
if (view.isZooming()) {
|
||||
cacheRulerText = null;
|
||||
} else if((tb.getZoom() + tb.getZoomScale()) != cacheRulerZoom ||
|
||||
} else if((tb.getZoom()) != cacheRulerZoom ||
|
||||
Math.abs(tb.getCenterTileX() - cacheRulerTileX) + Math.abs(tb.getCenterTileY() - cacheRulerTileY) > 1){
|
||||
cacheRulerZoom = (tb.getZoom() + tb.getZoomScale());
|
||||
cacheRulerZoom = (tb.getZoom());
|
||||
cacheRulerTileX = tb.getCenterTileX();
|
||||
cacheRulerTileY = tb.getCenterTileY();
|
||||
final double dist = tb.getDistance(0, tb.getPixHeight() / 2, tb.getPixWidth(), tb.getPixHeight() / 2);
|
||||
|
|
Loading…
Reference in a new issue