fix yandex zoom

git-svn-id: https://osmand.googlecode.com/svn/trunk@412 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
Victor Shcherb 2010-07-29 13:17:09 +00:00
parent ca0248a8af
commit fe0d12fb96
3 changed files with 74 additions and 7 deletions

View file

@ -9,12 +9,12 @@ package com.osmand;
public class ToDoConstants { public class ToDoConstants {
// TODO // TODO
// 78. Add ruler to the main tile view (100m, 200m,...) // 78. Add ruler to the main tile view (100m, 200m,...)
// 82. Add overzoom +2 for Mapnik (!)
// 80. Export/import favorite points // 80. Export/import favorite points
// 81. Add some objects to POI to help navigation ( // 81. Add some objects to POI category (1) to add them into OSM 2) to help navigation)
// highway (?), traffic_calming (?), barrier(?), military(?-), landuse (?), office(?), man_made(?), power(?). // highway (?), traffic_calming (?), barrier(?), military(?-), landuse (?), office(?), man_made(?), power(?).
// 82. Add overzoom +2 for Mapnik
// 83. Add monitoring service to send locations to internet (?)
// Improvements // Improvements
// ! Download with wget // ! Download with wget
@ -24,6 +24,7 @@ public class ToDoConstants {
// 69. Add phone information to POI // 69. Add phone information to POI
// 70. Show building numbers over map (require changing address index - index 2 more columns lat/lon for fast search) // 70. Show building numbers over map (require changing address index - index 2 more columns lat/lon for fast search)
// 66. Transport routing (show next stop, total distance, show stop get out, voice) (needed ?). // 66. Transport routing (show next stop, total distance, show stop get out, voice) (needed ?).
// 83. Add monitoring service to send locations to internet (?)
// Unscheduled (complex) // Unscheduled (complex)
// 65. Intermediate points - for better control routing, to avoid traffic jams ...(?) // 65. Intermediate points - for better control routing, to avoid traffic jams ...(?)
@ -31,7 +32,11 @@ public class ToDoConstants {
// 63. Support simple offline routing(require new index file) (?) // 63. Support simple offline routing(require new index file) (?)
// BUGS Android // TODO BUGS Android
// 1. Alert no addresses (!)
// 2. GPS - network switch
// 3. different screens better support
// 4. save state yandex traffic
// TODO swing // TODO swing
// 9. Fix issues with big files (such as netherlands) - save memory (!) - very slow due to transport index ! // 9. Fix issues with big files (such as netherlands) - save memory (!) - very slow due to transport index !

View file

@ -183,7 +183,7 @@ public class YandexTrafficLayer implements OsmandMapLayer {
} }
protected void downloadTile(String tileId, int tileX, int tileY, int zoom, String timeStamp) throws IOException{ protected void downloadTile(String tileId, int tileX, int tileY, int zoom, String timeStamp) throws IOException{
if(zoom >= 17){ if(zoom > 17){
return; return;
} }
String u = "http://jgo.maps.yandex.net/tiles?l=trf&x="+tileX +"&y="+tileY+"&z="+zoom+"&tm="+timeStamp; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$ String u = "http://jgo.maps.yandex.net/tiles?l=trf&x="+tileX +"&y="+tileY+"&z="+zoom+"&tm="+timeStamp; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$

View file

@ -2,19 +2,81 @@ package com.osmand.render;
import java.io.File; import java.io.File;
import org.apache.commons.logging.Log;
import android.database.sqlite.SQLiteDatabase;
import com.osmand.IProgress; import com.osmand.IProgress;
import com.osmand.LogUtil;
import com.osmand.data.index.IndexConstants;
public class RenderMapsRepositories { public class RenderMapsRepositories {
private final static Log log = LogUtil.getLog(RenderMapsRepositories.class);
private SQLiteDatabase db;
private double cTopLatitude;
private double cBottomLatitude;
private int cZoom;
private double cLeftLongitude;
private double cRightLongitude;
public boolean initializeNewResource(final IProgress progress, File file) { public boolean initializeNewResource(final IProgress progress, File file) {
long start = System.currentTimeMillis();
// TODO should support multiple db
if(db != null){
// close previous db
db.close();
}
db = SQLiteDatabase.openOrCreateDatabase(file, null);
if(db.getVersion() != IndexConstants.MAP_TABLE_VERSION){
db.close();
db = null;
return false;
}
if (log.isDebugEnabled()) {
log.debug("Initializing db " + file.getAbsolutePath() + " " + (System.currentTimeMillis() - start) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
return true; return true;
} }
public void clearAllResources(){ public void clearAllResources(){
// TODO if(db != null){
// close previous db
db.close();
db = null;
}
}
/**
* @return true if no need to reevaluate map
*/
public boolean updateMap(double topLatitude, double leftLongitude, double bottomLatitude, double rightLongitude, int zoom){
if (db == null) {
return true;
}
boolean inside = cTopLatitude >= topLatitude && cLeftLongitude <= leftLongitude && cRightLongitude >= rightLongitude
&& cBottomLatitude <= bottomLatitude && cZoom == zoom;
return inside;
} }
public void loadMap(double topLatitude, double leftLongitude, double bottomLatitude, double rightLongitude, int zoom){
cTopLatitude = topLatitude + (topLatitude - bottomLatitude);
cBottomLatitude = bottomLatitude - (topLatitude -bottomLatitude);
cLeftLongitude = leftLongitude - (rightLongitude - leftLongitude);
cRightLongitude = rightLongitude + (rightLongitude - leftLongitude);
cZoom = zoom;
// TODO clear cache
loadingData();
// after prepare images
}
private void loadingData(){
}
public void clearCache() { public void clearCache() {