diff --git a/DataExtractionOSM/src/com/osmand/ToDoConstants.java b/DataExtractionOSM/src/com/osmand/ToDoConstants.java index 32c899319f..cad6455b2b 100644 --- a/DataExtractionOSM/src/com/osmand/ToDoConstants.java +++ b/DataExtractionOSM/src/com/osmand/ToDoConstants.java @@ -9,12 +9,12 @@ package com.osmand; public class ToDoConstants { // 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 - // 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(?). - // 82. Add overzoom +2 for Mapnik - // 83. Add monitoring service to send locations to internet (?) + // Improvements // ! Download with wget @@ -24,6 +24,7 @@ public class ToDoConstants { // 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) // 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) // 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) (?) - // 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 // 9. Fix issues with big files (such as netherlands) - save memory (!) - very slow due to transport index ! diff --git a/OsmAnd/src/com/osmand/activities/YandexTrafficLayer.java b/OsmAnd/src/com/osmand/activities/YandexTrafficLayer.java index 3055c152de..0508595942 100644 --- a/OsmAnd/src/com/osmand/activities/YandexTrafficLayer.java +++ b/OsmAnd/src/com/osmand/activities/YandexTrafficLayer.java @@ -183,7 +183,7 @@ public class YandexTrafficLayer implements OsmandMapLayer { } protected void downloadTile(String tileId, int tileX, int tileY, int zoom, String timeStamp) throws IOException{ - if(zoom >= 17){ + if(zoom > 17){ 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$ diff --git a/OsmAnd/src/com/osmand/render/RenderMapsRepositories.java b/OsmAnd/src/com/osmand/render/RenderMapsRepositories.java index 20eb4bcca8..6e448b01e0 100644 --- a/OsmAnd/src/com/osmand/render/RenderMapsRepositories.java +++ b/OsmAnd/src/com/osmand/render/RenderMapsRepositories.java @@ -2,19 +2,81 @@ package com.osmand.render; import java.io.File; +import org.apache.commons.logging.Log; + +import android.database.sqlite.SQLiteDatabase; + import com.osmand.IProgress; +import com.osmand.LogUtil; +import com.osmand.data.index.IndexConstants; 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) { + 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; } 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() {