implement zoom tile for map
git-svn-id: https://osmand.googlecode.com/svn/trunk@98 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
parent
0515b1af84
commit
88a8da98b1
4 changed files with 30 additions and 17 deletions
|
@ -6,16 +6,15 @@ package com.osmand;
|
|||
*/
|
||||
public class ToDoConstants {
|
||||
|
||||
|
||||
/**
|
||||
* Write activity to show something about authors / donation ....
|
||||
*/
|
||||
public int DESCRIBE_ABOUT_AUTHORS = 8;
|
||||
|
||||
// TODO ANDROID
|
||||
// 25. POI search near to map location (show categories & type). Second cut. (implement incremental search)
|
||||
// 25. POI search near to map location (show categories & type). Second cut. (implement incremental search)
|
||||
|
||||
// 3. Revise osmand UI. Preparing new icons (revise UI 18, 2, ). Main application icon, back to location icon.
|
||||
// 3. Revise osmand UI. Preparing new icons (revise UI 18, 2, ). Main application icon, back to location icon.
|
||||
// 13. Save point as favorite & introduce favorite points dialog
|
||||
// 14. Show zoom level on map
|
||||
|
||||
|
@ -23,7 +22,6 @@ public class ToDoConstants {
|
|||
// 5. Search for city/streets/buildings
|
||||
// 15. Investigate interruption of any long running operation & implement where it is needed.
|
||||
// Fix progress information (loading indices).
|
||||
// 21. Implement zooming tile (if tile doesn't exist local, we can zoom in previous tile).
|
||||
|
||||
// 8. Enable change POI directly on map (requires OSM login)
|
||||
// 16. Support open street bugs api.
|
||||
|
@ -41,13 +39,13 @@ public class ToDoConstants {
|
|||
// TODO SWING:
|
||||
// 1. Download tiles without using dir tiles
|
||||
// 2. Configure file log & see log from file (add uncaught exception handling)
|
||||
// 5. Implement supress warning for duplicate id
|
||||
// 5. Implement suppress warning for duplicate id
|
||||
// 6. Implement renaming/deleting street/building/city
|
||||
// 7. Implement saving bundle of tiles in different folder
|
||||
|
||||
|
||||
|
||||
// DONE ANDROID :
|
||||
// 21. Implement zooming tile (if tile doesn't exist local, we can zoom in previous tile).
|
||||
// 11. Print out additional info speed, altitude, number of satellites
|
||||
// 19. Show how map is rotated where north/south on map (do not consider compass)
|
||||
// 23. Implement moving point from center to bottom (for rotating map)
|
||||
|
@ -56,7 +54,6 @@ public class ToDoConstants {
|
|||
// 2. Showing compass on the map : use device compass if exists(?)
|
||||
// 18. Implement go to point
|
||||
|
||||
|
||||
// DONE SWING
|
||||
|
||||
}
|
||||
|
|
|
@ -82,15 +82,19 @@ public class ResourceManager {
|
|||
|
||||
|
||||
public Bitmap getTileImageForMapAsync(ITileSource map, int x, int y, int zoom, boolean loadFromInternetIfNeeded) {
|
||||
return getTileImageForMap(map, x, y, zoom, loadFromInternetIfNeeded, false);
|
||||
return getTileImageForMap(map, x, y, zoom, loadFromInternetIfNeeded, false, true);
|
||||
}
|
||||
|
||||
public Bitmap getTileImageFromCache(ITileSource map, int x, int y, int zoom){
|
||||
return getTileImageForMap(map, x, y, zoom, false, false, false);
|
||||
}
|
||||
|
||||
public Bitmap getTileImageForMapSync(ITileSource map, int x, int y, int zoom, boolean loadFromInternetIfNeeded) {
|
||||
return getTileImageForMap(map, x, y, zoom, loadFromInternetIfNeeded, true);
|
||||
return getTileImageForMap(map, x, y, zoom, loadFromInternetIfNeeded, true, true);
|
||||
}
|
||||
|
||||
protected Bitmap getTileImageForMap(ITileSource map, int x, int y, int zoom,
|
||||
boolean loadFromInternetIfNeeded, boolean sync) {
|
||||
boolean loadFromInternetIfNeeded, boolean sync, boolean loadFromFs) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -98,7 +102,7 @@ public class ResourceManager {
|
|||
builder.append(map.getName()).append('/').append(zoom). append('/').append(x).
|
||||
append('/').append(y).append(map.getTileFormat()).append(".tile");
|
||||
String file = builder.toString();
|
||||
if (cacheOfImages.get(file) == null) {
|
||||
if (loadFromFs && cacheOfImages.get(file) == null) {
|
||||
String url = loadFromInternetIfNeeded ? map.getUrlToLoad(x, y, zoom) : null;
|
||||
TileLoadDownloadRequest req = new TileLoadDownloadRequest(dirWithTiles, file, url, new File(dirWithTiles, file),
|
||||
x, y, zoom);
|
||||
|
|
|
@ -164,11 +164,6 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat
|
|||
}
|
||||
|
||||
public void setLocation(Location location){
|
||||
// TODO remove that !!
|
||||
if(location != null){
|
||||
location.setSpeed(30);
|
||||
location.setBearing(90);
|
||||
}
|
||||
// Do very strange manipulation to call redraw only once
|
||||
|
||||
// show point view only if gps enabled
|
||||
|
|
|
@ -323,6 +323,8 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
|||
// used only to save space & reuse
|
||||
protected RectF tilesRect = new RectF();
|
||||
protected Rect boundsRect = new Rect();
|
||||
protected RectF bitmapToDraw = new RectF();
|
||||
protected Rect bitmapToZoom = new Rect();
|
||||
|
||||
public void refreshMap() {
|
||||
if (OsmandSettings.isUsingInternetToDownloadTiles(getContext())) {
|
||||
|
@ -353,9 +355,24 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
|||
for (int j = 0; j< height; j++) {
|
||||
float x1 = (i + left - tileX) * tileSize + w;
|
||||
float y1 = (j + top - tileY) * tileSize + h;
|
||||
// asking tile image async
|
||||
Bitmap bmp = mgr.getTileImageForMapAsync(map, left + i, top + j, zoom, useInternet);
|
||||
if (bmp == null) {
|
||||
drawEmptyTile(canvas, (int) x1, (int) y1);
|
||||
// asking if there is small version of the map (in cache)
|
||||
if(useInternet){
|
||||
bmp = mgr.getTileImageFromCache(map, (left + i) / 2, (top + j) / 2, zoom - 1);
|
||||
} else {
|
||||
bmp = mgr.getTileImageForMapAsync(map, (left + i) / 2, (top + j) / 2, zoom - 1, false);
|
||||
}
|
||||
if(bmp == null){
|
||||
drawEmptyTile(canvas, (int) x1, (int) y1);
|
||||
} else {
|
||||
int xZoom = (left + i) % 2 == 0 ? 0 : tileSize / 2;
|
||||
int yZoom = (top + j) % 2 == 0 ? 0 : tileSize / 2;;
|
||||
bitmapToZoom.set(xZoom, yZoom, xZoom + tileSize / 2, yZoom + tileSize / 2);
|
||||
bitmapToDraw.set(x1, y1, x1 + tileSize, y1 + tileSize);
|
||||
canvas.drawBitmap(bmp, bitmapToZoom, bitmapToDraw, paintBitmap);
|
||||
}
|
||||
} else {
|
||||
canvas.drawBitmap(bmp, x1, y1, paintBitmap);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue