Permalink
Browse files

Feature/#329 (#723)

Feature/#329 long based coordinates with max zoom 29
  • Loading branch information...
monsieurtanuki authored and spyhunter99 committed Oct 1, 2017
1 parent cf1f4a5 commit 0990b70fa88b63f8e2140fc91726401673716853
Showing with 1,568 additions and 757 deletions.
  1. BIN OpenStreetMapViewer/src/main/assets/Abstract/0/0/0.png
  2. BIN OpenStreetMapViewer/src/main/assets/Abstract/1/1/0.png
  3. BIN OpenStreetMapViewer/src/main/assets/Abstract/10/518/352.png
  4. BIN OpenStreetMapViewer/src/main/assets/Abstract/11/1037/704.png
  5. BIN OpenStreetMapViewer/src/main/assets/Abstract/12/2074/1409.png
  6. BIN OpenStreetMapViewer/src/main/assets/Abstract/13/4149/2818.png
  7. BIN OpenStreetMapViewer/src/main/assets/Abstract/14/8298/5636.png
  8. BIN OpenStreetMapViewer/src/main/assets/Abstract/15/16597/11273.png
  9. BIN OpenStreetMapViewer/src/main/assets/Abstract/16/33195/22547.png
  10. BIN OpenStreetMapViewer/src/main/assets/Abstract/17/66391/45094.png
  11. BIN OpenStreetMapViewer/src/main/assets/Abstract/18/132782/90188.png
  12. BIN OpenStreetMapViewer/src/main/assets/Abstract/19/265564/180377.png
  13. BIN OpenStreetMapViewer/src/main/assets/Abstract/2/2/1.png
  14. BIN OpenStreetMapViewer/src/main/assets/Abstract/20/531129/360754.png
  15. BIN OpenStreetMapViewer/src/main/assets/Abstract/21/1062258/721508.png
  16. BIN OpenStreetMapViewer/src/main/assets/Abstract/22/2124517/1443016.png
  17. BIN OpenStreetMapViewer/src/main/assets/Abstract/23/4249034/2886032.png
  18. BIN OpenStreetMapViewer/src/main/assets/Abstract/24/8498069/5772065.png
  19. BIN OpenStreetMapViewer/src/main/assets/Abstract/25/16996138/11544130.png
  20. BIN OpenStreetMapViewer/src/main/assets/Abstract/26/33992277/23088261.png
  21. BIN OpenStreetMapViewer/src/main/assets/Abstract/27/67984554/46176522.png
  22. BIN OpenStreetMapViewer/src/main/assets/Abstract/28/135969108/92353045.png
  23. BIN OpenStreetMapViewer/src/main/assets/Abstract/29/271938217/184706090.png
  24. BIN OpenStreetMapViewer/src/main/assets/Abstract/3/4/2.png
  25. BIN OpenStreetMapViewer/src/main/assets/Abstract/4/8/5.png
  26. BIN OpenStreetMapViewer/src/main/assets/Abstract/5/16/11.png
  27. BIN OpenStreetMapViewer/src/main/assets/Abstract/6/32/22.png
  28. BIN OpenStreetMapViewer/src/main/assets/Abstract/7/64/44.png
  29. BIN OpenStreetMapViewer/src/main/assets/Abstract/8/129/88.png
  30. BIN OpenStreetMapViewer/src/main/assets/Abstract/9/259/176.png
  31. +3 −2 OpenStreetMapViewer/src/main/java/org/osmdroid/StarterMapFragment.java
  32. +3 −0 OpenStreetMapViewer/src/main/java/org/osmdroid/samplefragments/SampleFactory.java
  33. +4 −3 OpenStreetMapViewer/src/main/java/org/osmdroid/samplefragments/events/SampleAnimateTo.java
  34. +58 −0 ...etMapViewer/src/main/java/org/osmdroid/samplefragments/tileproviders/SampleVeryHighZoomLevel.java
  35. +0 −91 osmdroid-android-it/src/main/java/org/osmdroid/TileSystemMathTest.java
  36. +46 −18 osmdroid-android-it/src/main/java/org/osmdroid/views/OpenStreetMapViewTest.java
  37. +12 −3 osmdroid-android/src/main/java/microsoft/mappoint/TileSystem.java
  38. +9 −7 osmdroid-android/src/main/java/org/osmdroid/tileprovider/MapTileProviderBase.java
  39. +0 −3 osmdroid-android/src/main/java/org/osmdroid/tileprovider/cachemanager/CacheManager.java
  40. +22 −21 osmdroid-android/src/main/java/org/osmdroid/util/GeoPoint.java
  41. +10 −5 osmdroid-android/src/main/java/org/osmdroid/util/GeometryMath.java
  42. +25 −0 osmdroid-android/src/main/java/org/osmdroid/util/MyMath.java
  43. +20 −0 osmdroid-android/src/main/java/org/osmdroid/util/PointL.java
  44. +58 −0 osmdroid-android/src/main/java/org/osmdroid/util/RectL.java
  45. +7 −18 osmdroid-android/src/main/java/org/osmdroid/util/TileLooper.java
  46. +190 −39 osmdroid-android/src/main/java/org/osmdroid/util/TileSystem.java
  47. +6 −26 osmdroid-android/src/main/java/org/osmdroid/views/MapController.java
  48. +105 −102 osmdroid-android/src/main/java/org/osmdroid/views/MapView.java
  49. +308 −113 osmdroid-android/src/main/java/org/osmdroid/views/Projection.java
  50. +2 −2 osmdroid-android/src/main/java/org/osmdroid/views/drawing/OsmBitmapShader.java
  51. +1 −1 osmdroid-android/src/main/java/org/osmdroid/views/overlay/Marker.java
  52. +20 −92 osmdroid-android/src/main/java/org/osmdroid/views/overlay/MinimapOverlay.java
  53. +16 −13 osmdroid-android/src/main/java/org/osmdroid/views/overlay/PathOverlay.java
  54. +36 −20 osmdroid-android/src/main/java/org/osmdroid/views/overlay/Polygon.java
  55. +15 −12 osmdroid-android/src/main/java/org/osmdroid/views/overlay/Polyline.java
  56. +27 −25 osmdroid-android/src/main/java/org/osmdroid/views/overlay/ScaleBarOverlay.java
  57. +47 −59 osmdroid-android/src/main/java/org/osmdroid/views/overlay/TilesOverlay.java
  58. +10 −7 osmdroid-android/src/main/java/org/osmdroid/views/overlay/mylocation/MyLocationNewOverlay.java
  59. +27 −24 osmdroid-android/src/main/java/org/osmdroid/views/util/PathProjection.java
  60. +5 −5 osmdroid-android/src/main/java/org/osmdroid/views/util/constants/MathConstants.java
  61. +108 −19 osmdroid-android/src/test/java/org/osmdroid/util/GeoPointTest.java
  62. +239 −0 osmdroid-android/src/test/java/org/osmdroid/util/ProjectionTest.java
  63. +129 −27 osmdroid-android/src/test/java/org/osmdroid/util/TileSystemTest.java
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
@@ -187,7 +187,7 @@ public void onActivityCreated(Bundle savedInstanceState) {
} else {
final double latitude = Double.valueOf(latitudeString);
final double longitude = Double.valueOf(longitudeString);
mMapView.setInitCenter(new GeoPoint(latitude, longitude));
mMapView.setCenter(new GeoPoint(latitude, longitude));
}
mLocationOverlay.enableMyLocation();
@@ -255,10 +255,11 @@ public void onResume() {
//sorry for the spaghetti code this is to filter out the compass on api 8
//Note: the compass overlay causes issues on API 8 devices. See https://github.com/osmdroid/osmdroid/issues/218
if (mPrefs.getBoolean(PREFS_SHOW_COMPASS, false)) {
if (mCompassOverlay!=null)
if (mCompassOverlay!=null) {
//this call is needed because onPause, the orientation provider is destroyed to prevent context leaks
this.mCompassOverlay.setOrientationProvider(new InternalCompassOrientationProvider(getActivity()));
this.mCompassOverlay.enableCompass();
}
}
}
@@ -59,6 +59,7 @@
import org.osmdroid.samplefragments.tileproviders.OfflinePickerSample;
import org.osmdroid.samplefragments.tileproviders.SampleAssetsOnly;
import org.osmdroid.samplefragments.tileproviders.SampleOfflineGemfOnly;
import org.osmdroid.samplefragments.tileproviders.SampleVeryHighZoomLevel;
import org.osmdroid.samplefragments.tilesources.NasaWms111Source;
import org.osmdroid.samplefragments.tilesources.NasaWms130Source;
import org.osmdroid.samplefragments.tilesources.NasaWmsSrs;
@@ -243,6 +244,8 @@ private SampleFactory() {
mSamples.add(GeopackageFeatures.class);
mSamples.add(GeopackageFeatureTiles.class);
}
// 60
mSamples.add(SampleVeryHighZoomLevel.class);
}
public void addSample(Class<? extends BaseSampleFragment> clz) {
@@ -4,6 +4,7 @@
import org.osmdroid.samplefragments.data.SampleGridlines;
import org.osmdroid.util.GeoPoint;
import org.osmdroid.util.TileSystem;
import java.util.Random;
import java.util.Timer;
@@ -68,10 +69,10 @@ private void runTask() {
@Override
public void run() {
if (rand != null && mMapView != null && getActivity() != null) {
double lat = rand.nextDouble() * 180 - 90;
double lon = rand.nextDouble() * 360 - 180;
final double lat = TileSystem.getRandomLatitude(rand.nextDouble(), TileSystem.MinLatitude);
final double lon = TileSystem.getRandomLongitude(rand.nextDouble());
mMapView.getController().animateTo(new GeoPoint(lat, lon));
//Toast.makeText(getActivity(), "Animate to " + SampleMapEventListener.df.format(lat) + "," + SampleMapEventListener.df.format(lon), Toast.LENGTH_SHORT).show();
Toast.makeText(getActivity(), "Animate to " + SampleMapEventListener.df.format(lat) + "," + SampleMapEventListener.df.format(lon), Toast.LENGTH_LONG).show();
}
}
});
@@ -0,0 +1,58 @@
package org.osmdroid.samplefragments.tileproviders;
import org.osmdroid.samplefragments.BaseSampleFragment;
import org.osmdroid.tileprovider.MapTileProviderArray;
import org.osmdroid.tileprovider.modules.MapTileApproximater;
import org.osmdroid.tileprovider.modules.MapTileAssetsProvider;
import org.osmdroid.tileprovider.modules.MapTileModuleProviderBase;
import org.osmdroid.tileprovider.tilesource.ITileSource;
import org.osmdroid.tileprovider.tilesource.XYTileSource;
import org.osmdroid.tileprovider.util.SimpleRegisterReceiver;
import org.osmdroid.util.GeoPoint;
import org.osmdroid.views.overlay.ScaleBarOverlay;
/**
* A lousy example of very high zoom levels.
* A nicer example would require very high zoom level tiles.
*
* @author Fabrice Fontaine
* @since 5.6.6
*/
public class SampleVeryHighZoomLevel extends BaseSampleFragment {
@Override
public String getSampleTitle() {
return "Offline abstract tiles for zoom levels 0 to 29";
}
@Override
public void addOverlays() {
mMapView.setUseDataConnection(false);
final ScaleBarOverlay scaleBarOverlay = new ScaleBarOverlay(mMapView);
scaleBarOverlay.setCentred(true);
scaleBarOverlay.setScaleBarOffset(200, 10);
mMapView.getOverlays().add(scaleBarOverlay);
final ITileSource tileSource = new XYTileSource(
"Abstract", 0, 29, 256, ".png", new String[]{"http://localhost/"}, "abstract data");
mMapView.setUseDataConnection(false);
final MapTileAssetsProvider assetsProvider = new MapTileAssetsProvider(new SimpleRegisterReceiver(getContext()), getActivity().getAssets(), tileSource);
final MapTileApproximater approximationProvider = new MapTileApproximater();
approximationProvider.addProvider(assetsProvider);
final MapTileProviderArray array = new MapTileProviderArray(
tileSource, new SimpleRegisterReceiver(getContext()),
new MapTileModuleProviderBase[]{assetsProvider, approximationProvider});
mMapView.setTileProvider(array);
mMapView.getController().setZoom(29.);
// cf. https://fr.wikipedia.org/wiki/Point_z%C3%A9ro_des_routes_de_France
// In English: starting point of all French roads
mMapView.setCenter(new GeoPoint(48.85340215825712, 2.348784611094743));
mMapView.invalidate();
}
}
@@ -78,97 +78,6 @@ public void test_PixelXYToLatLong() {
assertEquals("TODO describe test", 85.0297584051224, point.getLatitude(), delta);
}
/**
* Reference values from: http://msdn.microsoft.com/en-us/library/bb259689.aspx
*/
public void test_MapSize() {
assertEquals(512, TileSystem.MapSize(1));
assertEquals(1024, TileSystem.MapSize(2));
assertEquals(2048, TileSystem.MapSize(3));
assertEquals(4096, TileSystem.MapSize(4));
assertEquals(8192, TileSystem.MapSize(5));
assertEquals(16384, TileSystem.MapSize(6));
assertEquals(32768, TileSystem.MapSize(7));
assertEquals(65536, TileSystem.MapSize(8));
assertEquals(131072, TileSystem.MapSize(9));
assertEquals(262144, TileSystem.MapSize(10));
assertEquals(524288, TileSystem.MapSize(11));
assertEquals(1048576, TileSystem.MapSize(12));
assertEquals(2097152, TileSystem.MapSize(13));
assertEquals(4194304, TileSystem.MapSize(14));
assertEquals(8388608, TileSystem.MapSize(15));
assertEquals(16777216, TileSystem.MapSize(16));
assertEquals(33554432, TileSystem.MapSize(17));
assertEquals(67108864, TileSystem.MapSize(18));
assertEquals(134217728, TileSystem.MapSize(19));
assertEquals(268435456, TileSystem.MapSize(20));
assertEquals(536870912, TileSystem.MapSize(21));
assertEquals(1073741824, TileSystem.MapSize(22));
assertEquals(1073741824, TileSystem.MapSize(23));
}
/**
* Reference values from: http://msdn.microsoft.com/en-us/library/bb259689.aspx
*/
public void test_groundResolution() {
final double delta = 1e-4;
assertEquals(78271.5170, TileSystem.GroundResolution(0, 1), delta);
assertEquals(39135.7585, TileSystem.GroundResolution(0, 2), delta);
assertEquals(19567.8792, TileSystem.GroundResolution(0, 3), delta);
assertEquals(9783.9396, TileSystem.GroundResolution(0, 4), delta);
assertEquals(4891.9698, TileSystem.GroundResolution(0, 5), delta);
assertEquals(2445.9849, TileSystem.GroundResolution(0, 6), delta);
assertEquals(1222.9925, TileSystem.GroundResolution(0, 7), delta);
assertEquals(611.4962, TileSystem.GroundResolution(0, 8), delta);
assertEquals(305.7481, TileSystem.GroundResolution(0, 9), delta);
assertEquals(152.8741, TileSystem.GroundResolution(0, 10), delta);
assertEquals(76.4370, TileSystem.GroundResolution(0, 11), delta);
assertEquals(38.2185, TileSystem.GroundResolution(0, 12), delta);
assertEquals(19.1093, TileSystem.GroundResolution(0, 13), delta);
assertEquals(9.5546, TileSystem.GroundResolution(0, 14), delta);
assertEquals(4.7773, TileSystem.GroundResolution(0, 15), delta);
assertEquals(2.3887, TileSystem.GroundResolution(0, 16), delta);
assertEquals(1.1943, TileSystem.GroundResolution(0, 17), delta);
assertEquals(0.5972, TileSystem.GroundResolution(0, 18), delta);
assertEquals(0.2986, TileSystem.GroundResolution(0, 19), delta);
assertEquals(0.1493, TileSystem.GroundResolution(0, 20), delta);
assertEquals(0.0746, TileSystem.GroundResolution(0, 21), delta);
assertEquals(0.0373, TileSystem.GroundResolution(0, 22), delta);
assertEquals(0.0373, TileSystem.GroundResolution(0, 23), delta);
}
/**
* Reference values from: http://msdn.microsoft.com/en-us/library/bb259689.aspx
*/
public void test_groundMapScale() {
final double delta = 1e-2;
assertEquals(295829355.45, TileSystem.MapScale(0, 1, 96), delta);
assertEquals(147914677.73, TileSystem.MapScale(0, 2, 96), delta);
assertEquals(73957338.86, TileSystem.MapScale(0, 3, 96), delta);
assertEquals(36978669.43, TileSystem.MapScale(0, 4, 96), delta);
assertEquals(18489334.72, TileSystem.MapScale(0, 5, 96), delta);
assertEquals(9244667.36, TileSystem.MapScale(0, 6, 96), delta);
assertEquals(4622333.68, TileSystem.MapScale(0, 7, 96), delta);
assertEquals(2311166.84, TileSystem.MapScale(0, 8, 96), delta);
assertEquals(1155583.42, TileSystem.MapScale(0, 9, 96), delta);
assertEquals(577791.71, TileSystem.MapScale(0, 10, 96), delta);
assertEquals(288895.85, TileSystem.MapScale(0, 11, 96), delta);
assertEquals(144447.93, TileSystem.MapScale(0, 12, 96), delta);
assertEquals(72223.96, TileSystem.MapScale(0, 13, 96), delta);
assertEquals(36111.98, TileSystem.MapScale(0, 14, 96), delta);
assertEquals(18055.99, TileSystem.MapScale(0, 15, 96), delta);
assertEquals(9028.00, TileSystem.MapScale(0, 16, 96), delta);
assertEquals(4514.00, TileSystem.MapScale(0, 17, 96), delta);
assertEquals(2257.00, TileSystem.MapScale(0, 18, 96), delta);
assertEquals(1128.50, TileSystem.MapScale(0, 19, 96), delta);
assertEquals(564.25, TileSystem.MapScale(0, 20, 96), delta);
assertEquals(282.12, TileSystem.MapScale(0, 21, 96), delta);
assertEquals(141.06, TileSystem.MapScale(0, 22, 96), delta);
assertEquals(141.06, TileSystem.MapScale(0, 23, 96), delta);
}
/**
* Converts EPSG:900913 to pyramid pixel coordinates in given zoom level. Using google tile
* referencing where the origin [0,0] is the top-left corner.
@@ -52,45 +52,34 @@ protected void setUp() throws Exception {
*/
@UiThreadTest
public void test_toMapPixels_0_0() {
final int roundingTolerance = 1;
final int iterations = 100;
for (int i = 0 ; i < iterations ; i ++) {
final double zoom = getRandomZoom();
final GeoPoint zz = new GeoPoint(getRandomLatitude(), getRandomLongitude());
mOpenStreetMapView.getController().setZoom(zoom);
mOpenStreetMapView.getController().setCenter(zz);
final Projection projection = mOpenStreetMapView.getProjection();
final Point point = projection.toPixels(zz, null);
final int width_2 = mOpenStreetMapView.getWidth() / 2;
final int height_2 = mOpenStreetMapView.getHeight() / 2;
assertTrue("MapView does not have layout. Make sure device is unlocked.", width_2 > 0 && height_2 > 0);
final Point expected = new Point(width_2, height_2);
assertEquals("the geo center of the map is in the pixel center of the map (X)", expected.x, point.x, roundingTolerance);
assertEquals("the geo center of the map is in the pixel center of the map (Y)", expected.y, point.y, roundingTolerance);
checkCenter(null, null);
checkCenter(getRandomZoom(), getRandomGeoPoint());
checkCenter(getRandomZoom(), null);
checkCenter(null, getRandomGeoPoint());
}
}
/**
* @since 6.0.0
*/
private double getRandomLongitude() {
return getRandom(TileSystem.MinLongitude, TileSystem.MaxLongitude);
return TileSystem.getRandomLongitude(random.nextDouble());
}
/**
* @since 6.0.0
*/
private double getRandomLatitude() {
return getRandom(TileSystem.MinLatitude, TileSystem.MaxLatitude);
return TileSystem.getRandomLatitude(random.nextDouble(), TileSystem.MinLatitude);
}
/**
* @since 6.0.0
*/
private double getRandomZoom() {
return getRandom(mOpenStreetMapView.getMinZoomLevel(), mOpenStreetMapView.getMaxZoomLevel());
return getRandom(0, microsoft.mappoint.TileSystem.getMaximumZoomLevel());
}
/**
@@ -99,4 +88,43 @@ private double getRandomZoom() {
private double getRandom(final double pMin, final double pMax) {
return pMin + random.nextDouble() * (pMax - pMin);
}
/**
* @since 6.0.0
*/
private void checkCenter(final Double expectedZoom, final GeoPoint expectedCenter) {
if (expectedZoom != null) {
mOpenStreetMapView.setZoomLevel(expectedZoom);
}
if (expectedCenter != null) {
mOpenStreetMapView.getController().setCenter(expectedCenter);
}
final Projection projection = mOpenStreetMapView.getProjection();
if (expectedZoom != null) {
assertEquals("the zoom level is kept", 0 + expectedZoom, projection.getZoomLevel(), 0);
}
checkCenter(projection, (GeoPoint)mOpenStreetMapView.getMapCenter(), "computed");
if (expectedCenter != null) {
checkCenter(projection, expectedCenter, "assigned");
}
}
private void checkCenter(final Projection pProjection, final GeoPoint pCenter, final String tag) {
final double roundingTolerance = 2; // as double in order to have assertEquals work with doubles, not with floats
final int width_2 = mOpenStreetMapView.getWidth() / 2;
final int height_2 = mOpenStreetMapView.getHeight() / 2;
final Point point = pProjection.toPixels(pCenter, null);
assertTrue("MapView does not have layout. Make sure device is unlocked.", width_2 > 0 && height_2 > 0);
final Point expected = new Point(width_2, height_2);
assertEquals("the " + tag + " center of the map is in the pixel center of the map (X)", expected.x, point.x, roundingTolerance);
assertEquals("the " + tag + " center of the map is in the pixel center of the map (Y)", expected.y, point.y, roundingTolerance);
}
/**
* @since 6.0.0
*/
private GeoPoint getRandomGeoPoint() {
return new GeoPoint(getRandomLatitude(), getRandomLongitude());
}
}
@@ -25,15 +25,24 @@
private static final double MinLongitude = -180;
private static final double MaxLongitude = 180;
/**
* The maximum possible zoom for primary key of SQLite table is 29,
* because it gives enough space for y(29bits), x(29bits) and zoom(5bits in order to code 29),
* total: 63 bits used, just small enough for a `long` variable of 4 bytes
*/
private static final int primaryKeyMaxZoomLevel = 29;
public static final int projectionZoomLevel = primaryKeyMaxZoomLevel + 1;
/**
* Maximum Zoom Level - we use Integers to store zoom levels so overflow happens at 2^32 - 1,
* but we also have a tile size that is typically 2^8, so (32-1)-8-1 = 22
*/
private static int mMaxZoomLevel = 22;
private static int mMaxZoomLevel = primaryKeyMaxZoomLevel;
public static void setTileSize(final int tileSize) {
int pow2 = (int) (Math.log(tileSize) / Math.log(2));
mMaxZoomLevel = (32 - 1) - pow2 - 1;
int pow2 = (int) (0.5 + Math.log(tileSize) / Math.log(2));
mMaxZoomLevel = Math.min(primaryKeyMaxZoomLevel, (64 - 1) - pow2 - 1);
mTileSize = tileSize;
}
@@ -8,6 +8,8 @@
import org.osmdroid.tileprovider.modules.IFilesystemCache;
import org.osmdroid.tileprovider.modules.MapTileApproximater;
import org.osmdroid.tileprovider.tilesource.ITileSource;
import org.osmdroid.util.PointL;
import org.osmdroid.util.RectL;
import org.osmdroid.util.TileLooper;
import org.osmdroid.util.TileSystem;
import org.osmdroid.views.Projection;
@@ -298,16 +300,16 @@ public void rescaleCache(final Projection pProjection, final double pNewZoomLeve
Log.i(IMapView.LOGTAG,"rescale tile cache from "+ pOldZoomLevel + " to " + pNewZoomLevel);
Point topLeftMercator = pProjection.toMercatorPixels(pViewPort.left, pViewPort.top, null);
Point bottomRightMercator = pProjection.toMercatorPixels(pViewPort.right, pViewPort.bottom,
final PointL topLeftMercator = pProjection.toMercatorPixels(pViewPort.left, pViewPort.top, null);
final PointL bottomRightMercator = pProjection.toMercatorPixels(pViewPort.right, pViewPort.bottom,
null);
final Rect viewPort = new Rect(topLeftMercator.x, topLeftMercator.y, bottomRightMercator.x,
bottomRightMercator.y);
final RectL viewPortMercator = new RectL(
topLeftMercator.x, topLeftMercator.y, bottomRightMercator.x, bottomRightMercator.y);
final ScaleTileLooper tileLooper = pNewZoomLevel > pOldZoomLevel
? new ZoomInTileLooper()
: new ZoomOutTileLooper();
tileLooper.loop(pNewZoomLevel, viewPort, pOldZoomLevel, getTileSource().getTileSizePixels());
tileLooper.loop(pNewZoomLevel, viewPortMercator, pOldZoomLevel, getTileSource().getTileSizePixels());
final long endMs = System.currentTimeMillis();
Log.i(IMapView.LOGTAG,"Finished rescale in " + (endMs - startMs) + "ms");
@@ -329,13 +331,13 @@ public void rescaleCache(final Projection pProjection, final double pNewZoomLeve
protected Paint mDebugPaint;
private boolean isWorth;
public void loop(final double pZoomLevel, final Rect pViewPort, final double pOldZoomLevel, final int pTileSize) {
public void loop(final double pZoomLevel, final RectL pViewPortMercator, final double pOldZoomLevel, final int pTileSize) {
mSrcRect = new Rect();
mDestRect = new Rect();
mDebugPaint = new Paint();
mOldTileZoomLevel = TileSystem.getInputTileZoomLevel(pOldZoomLevel);
mTileSize = pTileSize;
loop(pZoomLevel, pViewPort);
loop(pZoomLevel, pViewPortMercator);
}
@Override
@@ -356,9 +356,6 @@ public boolean isTileToBeDownloaded(final ITileSource pTileSource, final MapTile
(((geoPoint.getLongitude() > prevPoint.getLongitude()) && (wayPoint.getLongitude() < geoPoint.getLongitude())) ||
((geoPoint.getLongitude() < prevPoint.getLongitude()) && (wayPoint.getLongitude() > geoPoint.getLongitude())))) {
final Point lastPoint = new Point();
TileSystem.LatLongToPixelXY(geoPoint.getLatitude(), geoPoint.getLongitude(), pZoomLevel, lastPoint);
final double prevLatRad = wayPoint.getLatitude() * Math.PI / 180.0;
final double prevLonRad = wayPoint.getLongitude() * Math.PI / 180.0;
Oops, something went wrong.

0 comments on commit 0990b70

Please sign in to comment.