From 643d3230e979f25681143386a8fbcb36c21670f2 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Mon, 21 Jun 2010 11:44:59 +0000 Subject: [PATCH] fix small issues git-svn-id: https://osmand.googlecode.com/svn/trunk@190 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8 --- .../src/com/osmand/ToDoConstants.java | 27 ++++++++----------- .../data/index/GoogleCodeUploadIndex.java | 12 +++++++++ DataExtractionOSM/src/messages.properties | 4 +-- DataExtractionOSM/src/messages_ru.properties | 6 ++--- OsmAnd/res/xml/settings_pref.xml | 3 +-- .../com/osmand/activities/MapActivity.java | 20 +++++--------- .../com/osmand/activities/RoutingHelper.java | 8 +++--- .../osmand/activities/SettingsActivity.java | 7 ----- OsmAnd/src/com/osmand/views/RouteLayer.java | 10 ++++--- 9 files changed, 47 insertions(+), 50 deletions(-) diff --git a/DataExtractionOSM/src/com/osmand/ToDoConstants.java b/DataExtractionOSM/src/com/osmand/ToDoConstants.java index d53483e66f..fd1cc3befd 100644 --- a/DataExtractionOSM/src/com/osmand/ToDoConstants.java +++ b/DataExtractionOSM/src/com/osmand/ToDoConstants.java @@ -21,23 +21,24 @@ public class ToDoConstants { // DONE : back end (POI filter object, save, delete, read) // TODO : activity to create/edit new index, activity to read both user defined/osm standard, add actions to remove/create -// 33. Build transport locations. Create transport index (transport-stops) (investigate) -// GOT : Victor -// DONE: Load transport routes in swing. -// TODO: Create transport index, create transport activity - - // FUTURE RELEASES + // 33. Build transport locations. Create transport index (transport-stops) (investigate) + // DONE: Load transport routes in swing. + // IDEA TO HAVE : + // 48. Enable change favorite point : (for example fav - "car") means last point you left car. It is not static point, // you can always use the same name for different locations. // 51. Implement console application that prepare indexes to upload on server... // 0) run in background 1) download from internet 2) generates indices for Europe (take care about memory) 3) upload? - // 50. Invent opening hours editor in order to edit POI hours better on device - // 52. Make good distribution of POI on map (when POI a lot they are coupling in one place on the south) - // 43. Enable poi filter by name // 46. Implement downloading strategy for tiles : select max zoom to download [16,15,14,...] // That means you can save internet because from [16 -> zoom -> 18], [14 -> zoom -> 16 - suitable for speed > 40], ... + // 50. Invent opening hours editor in order to edit POI hours better on device + // 52. Make good distribution of POI on map (when POI a lot they are coupling in one place on the south) + // 53. Add progress bars (for search adresses activity - show that something is loaded in background), + // to internet communication activities [editing/commiting/deleting poi], do not hide edit poi dialog if operation failed + // [move close buttons from alertdialog to own view] + // 43. Enable poi filter by name // 45. Get clear settings. Move that setting on top settings screen. // That setting should rule all activities that use internet. It should ask whenever internet is used // (would you like to use internet for that operation - if using internet is not checked). @@ -59,13 +60,7 @@ public class ToDoConstants { // BUGS Swing // DONE ANDROID : - // 49. Calculate route from specified point (not from your location only) - // 37. Get rid of exit button (!). Think about when notification should go & how clear resources if it is necessary - // DONE : add to app settings preference (Refresh indexes). - // 31. Translation. - // 34. Suppport navigation for calculated route (example of get route from internet is in swing app). - // DONE : MiniMap done, Routing settings done, RouteLayer done, RoutingHelper done. - // 44. Show gps status (possibly open existing gps-compass app (free) or suggest to install it - no sense to write own activity) + // DONE SWING diff --git a/DataExtractionOSM/src/com/osmand/data/index/GoogleCodeUploadIndex.java b/DataExtractionOSM/src/com/osmand/data/index/GoogleCodeUploadIndex.java index 1bc29fbfaa..fb6b417e43 100644 --- a/DataExtractionOSM/src/com/osmand/data/index/GoogleCodeUploadIndex.java +++ b/DataExtractionOSM/src/com/osmand/data/index/GoogleCodeUploadIndex.java @@ -248,4 +248,16 @@ public class GoogleCodeUploadIndex { this.labels = labels; } + public static void main(String[] args) throws IOException { + GoogleCodeUploadIndex uploadIndex = new GoogleCodeUploadIndex(); + uploadIndex.setLabels(""); + uploadIndex.setProjectName("osmand"); +// uploadIndex.setFileName(_); +// uploadIndex.setTargetFileName(_); +// uploadIndex.setUserName(_); +// uploadIndex.setSummary(_); +// uploadIndex.setPassword(_); + uploadIndex.upload(); + } + } \ No newline at end of file diff --git a/DataExtractionOSM/src/messages.properties b/DataExtractionOSM/src/messages.properties index ba70f879a5..ec1acb1cb0 100644 --- a/DataExtractionOSM/src/messages.properties +++ b/DataExtractionOSM/src/messages.properties @@ -23,9 +23,9 @@ amenity_type_tourism = Tourism amenity_type_transportation = Transportation -indexing_address = Indexing address +indexing_address = Indexing address -indexing_poi = Indexing POI +indexing_poi = Indexing POI km = km diff --git a/DataExtractionOSM/src/messages_ru.properties b/DataExtractionOSM/src/messages_ru.properties index fc91125b60..a1b60f59f1 100644 --- a/DataExtractionOSM/src/messages_ru.properties +++ b/DataExtractionOSM/src/messages_ru.properties @@ -23,9 +23,9 @@ amenity_type_tourism = \u0422\u0443\u0440\u0438\u0437\u043C amenity_type_transportation = \u0422\u0440\u0430\u043D\u0441\u043F\u043E\u0440\u0442 -indexing_address = \u0418\u043D\u0434\u0435\u043A\u0441\u0438\u0440\u0443\u0435\u0442\u0441\u044F \u0430\u0434\u0440\u0435\u0441 +indexing_address = \u0418\u043D\u0434\u0435\u043A\u0441\u0438\u0440\u0443\u0435\u0442\u0441\u044F \u0430\u0434\u0440\u0435\u0441 -indexing_poi = \u0418\u043D\u0434\u0435\u043A\u0441\u0438\u0440\u0443\u044E\u0442\u0441\u044F POI +indexing_poi = \u0418\u043D\u0434\u0435\u043A\u0441\u0438\u0440\u0443\u044E\u0442\u0441\u044F POI km = \u043A\u043C @@ -37,7 +37,7 @@ poi_filter_car_aid = \u0410\u0432\u0442\u043E\u043F\u043E\u043C\u043E\u0449\u044 poi_filter_closest_poi = \u0411\u043B\u0438\u0436\u0430\u0439\u0448\u0438\u0435 poi -poi_filter_custom_filter = \u0414\u0440\u0443\u0433\u043E\u0439 \u0444\u0438\u043B\u044C\u0442\u0440 +poi_filter_custom_filter = \u041D\u043E\u0432\u044B\u0439 \u0444\u0438\u043B\u044C\u0442\u0440 poi_filter_food_shop = \u041F\u0440\u043E\u0434\u0443\u043A\u0442\u043E\u0432\u044B\u0435 \u043C\u0430\u0433\u0430\u0437\u0438\u043D\u044B diff --git a/OsmAnd/res/xml/settings_pref.xml b/OsmAnd/res/xml/settings_pref.xml index da7b6efb9e..c996980a92 100644 --- a/OsmAnd/res/xml/settings_pref.xml +++ b/OsmAnd/res/xml/settings_pref.xml @@ -3,8 +3,7 @@ xmlns:android="http://schemas.android.com/apk/res/android"> - - + diff --git a/OsmAnd/src/com/osmand/activities/MapActivity.java b/OsmAnd/src/com/osmand/activities/MapActivity.java index fc97ea3a3b..1b4988d932 100644 --- a/OsmAnd/src/com/osmand/activities/MapActivity.java +++ b/OsmAnd/src/com/osmand/activities/MapActivity.java @@ -88,7 +88,7 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat private OsmBugsLayer osmBugsLayer; private SavingTrackHelper savingTrackHelper; private RoutingHelper routingHelper; - private boolean calculateRouteOnGps = true; + private boolean calculateRouteOnGps = false; private RouteLayer routeLayer; private WakeLock wakeLock; @@ -162,13 +162,8 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat locationLayer.setAppMode(OsmandSettings.getApplicationMode(this)); LatLon pointToNavigate = OsmandSettings.getPointToNavigate(this); - if(OsmandSettings.isUsingInternetToCalculateRoute(this)){ - routingHelper.setAppMode(OsmandSettings.getApplicationMode(this)); - calculateRouteOnGps = true; - routingHelper.setFinalLocation(pointToNavigate); - } else { - routingHelper.setFinalLocation(null); - } + routingHelper.setAppMode(OsmandSettings.getApplicationMode(this)); + routingHelper.setFinalAndCurrentLocation(pointToNavigate, null); navigationLayer.setPointToNavigate(pointToNavigate); SharedPreferences prefs = getSharedPreferences(OsmandSettings.SHARED_PREFERENCES_NAME, MODE_WORLD_READABLE); @@ -396,11 +391,9 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat } else { OsmandSettings.clearPointToNavigate(this); } - if(OsmandSettings.isUsingInternetToCalculateRoute(this)){ - calculateRouteOnGps = true; - routingHelper.setFinalLocation(point); - } else { - routingHelper.setFinalLocation(null); + routingHelper.setFinalAndCurrentLocation(point, null); + if(point == null){ + calculateRouteOnGps = false; } navigationLayer.setPointToNavigate(point); updateNavigateToPointMenu(); @@ -655,7 +648,6 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat builder.setPositiveButton(R.string.follow, new DialogInterface.OnClickListener(){ @Override public void onClick(DialogInterface dialog, int which) { - routingHelper.setFinalLocation(navigationLayer.getPointToNavigate()); Location map = new Location("map"); //$NON-NLS-1$ map.setLatitude(lat); map.setLongitude(lon); diff --git a/OsmAnd/src/com/osmand/activities/RoutingHelper.java b/OsmAnd/src/com/osmand/activities/RoutingHelper.java index e0251a779e..847ad979a6 100644 --- a/OsmAnd/src/com/osmand/activities/RoutingHelper.java +++ b/OsmAnd/src/com/osmand/activities/RoutingHelper.java @@ -69,15 +69,17 @@ public class RoutingHelper { } - public void setFinalAndCurrentLocation(LatLon finalLocation, Location currentLocation){ + public synchronized void setFinalAndCurrentLocation(LatLon finalLocation, Location currentLocation){ this.finalLocation = finalLocation; + this.routeNodes.clear(); + listDistance = null; evalWaitInterval = 3000; // to update route setCurrentLocation(currentLocation); } public void setFinalLocation(LatLon finalLocation){ - setFinalAndCurrentLocation(finalLocation, getLastFixedLocation()); + setFinalAndCurrentLocation(finalLocation, getCurrentLocation()); } public void setAppMode(ApplicationMode mode){ @@ -113,7 +115,7 @@ public class RoutingHelper { return false; } - public Location getLastFixedLocation() { + public Location getCurrentLocation() { return lastFixedLocation; } diff --git a/OsmAnd/src/com/osmand/activities/SettingsActivity.java b/OsmAnd/src/com/osmand/activities/SettingsActivity.java index b290e1b41f..f42f5da18c 100644 --- a/OsmAnd/src/com/osmand/activities/SettingsActivity.java +++ b/OsmAnd/src/com/osmand/activities/SettingsActivity.java @@ -43,7 +43,6 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference private ListPreference applicationMode; private CheckBoxPreference autoZoom; private EditTextPreference userPassword; - private CheckBoxPreference useInternetToCalculateRoute; private Preference reloadIndexes; @Override @@ -55,8 +54,6 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference applicationMode =(ListPreference) screen.findPreference(OsmandSettings.APPLICATION_MODE); applicationMode.setOnPreferenceChangeListener(this); - useInternetToCalculateRoute = (CheckBoxPreference) screen.findPreference(OsmandSettings.USE_INTERNET_TO_CALCULATE_ROUTE); - useInternetToCalculateRoute.setOnPreferenceChangeListener(this); useInternetToDownloadTiles = (CheckBoxPreference) screen.findPreference(OsmandSettings.USE_INTERNET_TO_DOWNLOAD_TILES); useInternetToDownloadTiles.setOnPreferenceChangeListener(this); showPoiOnMap =(CheckBoxPreference) screen.findPreference(OsmandSettings.SHOW_POI_OVER_MAP); @@ -102,7 +99,6 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference } public void updateAllSettings(){ - useInternetToCalculateRoute.setChecked(OsmandSettings.isUsingInternetToCalculateRoute(this)); useInternetToDownloadTiles.setChecked(OsmandSettings.isUsingInternetToDownloadTiles(this)); showPoiOnMap.setChecked(OsmandSettings.isShowingPoiOverMap(this)); rotateMapToBearing.setChecked(OsmandSettings.isRotateMapToBearing(this)); @@ -176,9 +172,6 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference } else if(preference == showPoiOnMap){ edit.putBoolean(OsmandSettings.SHOW_POI_OVER_MAP, (Boolean) newValue); edit.commit(); - } else if(preference == useInternetToCalculateRoute){ - edit.putBoolean(OsmandSettings.USE_INTERNET_TO_CALCULATE_ROUTE, (Boolean) newValue); - edit.commit(); } else if(preference == useInternetToDownloadTiles){ edit.putBoolean(OsmandSettings.USE_INTERNET_TO_DOWNLOAD_TILES, (Boolean) newValue); edit.commit(); diff --git a/OsmAnd/src/com/osmand/views/RouteLayer.java b/OsmAnd/src/com/osmand/views/RouteLayer.java index 7654d217aa..a8670040b7 100644 --- a/OsmAnd/src/com/osmand/views/RouteLayer.java +++ b/OsmAnd/src/com/osmand/views/RouteLayer.java @@ -62,8 +62,12 @@ public class RouteLayer implements OsmandMapLayer { long time = System.currentTimeMillis(); int w = view.getWidth(); int h = view.getHeight(); - boundsRect = new Rect(-w / 2, -h, 3 * w / 2, h); -// boundsRect = new Rect(0, 0, w, h); + if(helper.getCurrentLocation() != null && + view.isPointOnTheRotatedMap(helper.getCurrentLocation().getLatitude(), helper.getCurrentLocation().getLongitude())){ + boundsRect = new Rect(-w / 2, -h, 3 * w / 2, h); + } else { + boundsRect = new Rect(0, -h, w, h); + } view.calculateTileRectangle(boundsRect, view.getCenterPointX(), view.getCenterPointY(), view.getXTile(), view.getYTile(), tileRect); double topLatitude = MapUtils.getLatitudeFromTile(view.getZoom(), tileRect.top); @@ -71,7 +75,7 @@ public class RouteLayer implements OsmandMapLayer { double bottomLatitude = MapUtils.getLatitudeFromTile(view.getZoom(), tileRect.bottom); double rightLongitude = MapUtils.getLongitudeFromTile(view.getZoom(), tileRect.right); helper.fillLocationsToShow(topLatitude, leftLongitude, bottomLatitude, rightLongitude, points); - if((System.currentTimeMillis() - time) > 40){ + if((System.currentTimeMillis() - time) > 80){ Log.e(LogUtil.TAG, "Calculate route layer " + (System.currentTimeMillis() - time)); //$NON-NLS-1$ }