From c7b8711743b1c68b7087424b351e0f03b3e9ed36 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Tue, 22 Jun 2010 08:27:10 +0000 Subject: [PATCH] show poi filter on map git-svn-id: https://osmand.googlecode.com/svn/trunk@195 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8 --- DataExtractionOSM/logging.properties | 2 +- .../src/com/osmand/ToDoConstants.java | 10 +++++----- OsmAnd/res/layout/searchpoi.xml | 1 + OsmAnd/res/values-ru-rRU/strings.xml | 1 + OsmAnd/res/values/strings.xml | 1 + .../src/com/osmand/AmenityIndexRepository.java | 3 ++- OsmAnd/src/com/osmand/OsmandSettings.java | 5 +++++ .../activities/search/SearchPOIActivity.java | 17 ++++++++++++++++- .../search/SearchPoiFilterActivity.java | 3 --- 9 files changed, 32 insertions(+), 11 deletions(-) diff --git a/DataExtractionOSM/logging.properties b/DataExtractionOSM/logging.properties index 3a224a64e4..7467774c61 100644 --- a/DataExtractionOSM/logging.properties +++ b/DataExtractionOSM/logging.properties @@ -7,7 +7,7 @@ com.osmand.level = ALL java.util.logging.FileHandler.pattern=%h/Application Data/Osmand/osmand.log java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter java.util.logging.FileHandler.append = true -java.util.logging.FileHandler.limit = 100000 +java.util.logging.FileHandler.limit = 5000000 java.util.logging.ConsoleHandler.level=ALL java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter \ No newline at end of file diff --git a/DataExtractionOSM/src/com/osmand/ToDoConstants.java b/DataExtractionOSM/src/com/osmand/ToDoConstants.java index ec931dcc49..2d3d6f2f67 100644 --- a/DataExtractionOSM/src/com/osmand/ToDoConstants.java +++ b/DataExtractionOSM/src/com/osmand/ToDoConstants.java @@ -23,10 +23,6 @@ public class ToDoConstants { // FUTURE RELEASES - // 33. Build transport locations. Create transport index (transport-stops) (investigate) - // DONE: Load transport routes in swing. - // IDEA TO HAVE : - // 54. Invent screen to update index from internet (from osmand.googlecode.com) // 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], ... @@ -40,7 +36,11 @@ public class ToDoConstants { // 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). // Internet using now for : edit POI osm, show osm bugs layer, download tiles. - // 47. Internet connectivity could be checked before trying to use + // 56. Investigate usage CloudMade API for calculating route. + // 33. Build transport locations. Create transport index (transport-stops) (investigate) + // DONE: Load transport routes in swing. + // IDEA TO HAVE : + // 47. Internet connectivity could be checked before trying to use (?) // 40. Support simple vector road rendering (require new index file) (?) // 26. Show the whole street on map (when it is chosen in search activity). Possibly extend that story to show layer with streets. (?) diff --git a/OsmAnd/res/layout/searchpoi.xml b/OsmAnd/res/layout/searchpoi.xml index 5fdb0be309..9de2fe81fb 100644 --- a/OsmAnd/res/layout/searchpoi.xml +++ b/OsmAnd/res/layout/searchpoi.xml @@ -4,6 +4,7 @@ android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> + diff --git a/OsmAnd/res/values-ru-rRU/strings.xml b/OsmAnd/res/values-ru-rRU/strings.xml index 710f9f3e96..deb439d96a 100644 --- a/OsmAnd/res/values-ru-rRU/strings.xml +++ b/OsmAnd/res/values-ru-rRU/strings.xml @@ -1,5 +1,6 @@ + Показать на карте Отредактирована избранная точка Не существует избранных точек Заменить diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 8235a3619e..d88cba5a9f 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -1,5 +1,6 @@ + Show on map Favorite point was edited None of favorite points exist Replace diff --git a/OsmAnd/src/com/osmand/AmenityIndexRepository.java b/OsmAnd/src/com/osmand/AmenityIndexRepository.java index a873ecd2cc..e7dee8e27d 100644 --- a/OsmAnd/src/com/osmand/AmenityIndexRepository.java +++ b/OsmAnd/src/com/osmand/AmenityIndexRepository.java @@ -146,6 +146,7 @@ public class AmenityIndexRepository { } boolean inside = cTopLatitude >= topLatitude && cLeftLongitude <= leftLongitude && cRightLongitude >= rightLongitude && cBottomLatitude <= bottomLatitude && zoom == cZoom; + boolean noNeedToSearch = inside && Algoritms.objectEquals(filterId, cFilterId); if((inside || fillFound) && toFill != null && Algoritms.objectEquals(filterId, cFilterId)){ for(Amenity a : cachedAmenities){ LatLon location = a.getLocation(); @@ -155,7 +156,7 @@ public class AmenityIndexRepository { } } } - return inside; + return noNeedToSearch; } public boolean checkCachedAmenities(double topLatitude, double leftLongitude, double bottomLatitude, double rightLongitude, int zoom, String filterId, List toFill){ return checkCachedAmenities(topLatitude, leftLongitude, bottomLatitude, rightLongitude, zoom, filterId, toFill, false); diff --git a/OsmAnd/src/com/osmand/OsmandSettings.java b/OsmAnd/src/com/osmand/OsmandSettings.java index ced7992374..58d44f05ca 100644 --- a/OsmAnd/src/com/osmand/OsmandSettings.java +++ b/OsmAnd/src/com/osmand/OsmandSettings.java @@ -63,6 +63,11 @@ public class OsmandSettings { SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); return prefs.getBoolean(SHOW_POI_OVER_MAP, false); } + + public static boolean setShowPoiOverMap(Context ctx, boolean val) { + SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); + return prefs.edit().putBoolean(SHOW_POI_OVER_MAP, val).commit(); + } // this value string is synchronized with settings_pref.xml preference name public static final String USER_NAME = "user_name"; //$NON-NLS-1$ diff --git a/OsmAnd/src/com/osmand/activities/search/SearchPOIActivity.java b/OsmAnd/src/com/osmand/activities/search/SearchPOIActivity.java index 256d74910e..ec6a02b9ca 100644 --- a/OsmAnd/src/com/osmand/activities/search/SearchPOIActivity.java +++ b/OsmAnd/src/com/osmand/activities/search/SearchPOIActivity.java @@ -40,11 +40,15 @@ public class SearchPOIActivity extends ListActivity { private Button searchPOILevel; + private Button showOnMap; private PoiFilter filter; private AmenityAdapter amenityAdapter; private LatLon lastKnownMapLocation; private TextView searchArea; + + + @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); @@ -64,7 +68,18 @@ public class SearchPOIActivity extends ListActivity { Bundle bundle = this.getIntent().getExtras(); String filterId = bundle.getString(AMENITY_FILTER); filter = PoiFiltersHelper.getFilterById(this, filterId); - + + showOnMap = (Button) findViewById(R.id.ShowOnMap); + showOnMap.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + OsmandSettings.setPoiFilterForMap(SearchPOIActivity.this, filter.getFilterId()); + OsmandSettings.setShowPoiOverMap(SearchPOIActivity.this, true); + Intent newIntent = new Intent(SearchPOIActivity.this, MapActivity.class); + startActivity(newIntent); + } + }); + showOnMap.setEnabled(filter != null); if (filter != null) { amenityAdapter = new AmenityAdapter(new ArrayList()); setListAdapter(amenityAdapter); diff --git a/OsmAnd/src/com/osmand/activities/search/SearchPoiFilterActivity.java b/OsmAnd/src/com/osmand/activities/search/SearchPoiFilterActivity.java index 0c2de9aa9c..c581067ad0 100644 --- a/OsmAnd/src/com/osmand/activities/search/SearchPoiFilterActivity.java +++ b/OsmAnd/src/com/osmand/activities/search/SearchPoiFilterActivity.java @@ -19,7 +19,6 @@ import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; -import com.osmand.OsmandSettings; import com.osmand.PoiFilter; import com.osmand.PoiFiltersHelper; import com.osmand.R; @@ -71,8 +70,6 @@ public class SearchPoiFilterActivity extends ListActivity { PoiFilter filter = ((AmenityAdapter) getListAdapter()).getItem(position); Bundle bundle = new Bundle(); Intent newIntent = new Intent(SearchPoiFilterActivity.this, SearchPOIActivity.class); - // folder selected - OsmandSettings.setPoiFilterForMap(this, filter.getFilterId()); bundle.putString(SearchPOIActivity.AMENITY_FILTER, filter.getFilterId()); newIntent.putExtras(bundle); startActivityForResult(newIntent, 0);