show poi filter on map

git-svn-id: https://osmand.googlecode.com/svn/trunk@195 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
Victor Shcherb 2010-06-22 08:27:10 +00:00
parent 8cbd93d122
commit c7b8711743
9 changed files with 32 additions and 11 deletions

View file

@ -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

View file

@ -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. (?)

View file

@ -4,6 +4,7 @@
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content">
<Button android:text="@string/show_poi_on_map" android:id="@+id/ShowOnMap" android:layout_height="wrap_content" android:layout_width="wrap_content"></Button>
<Button android:text="@string/search_POI_level_btn" android:id="@+id/SearchPOILevelButton" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_weight="1"></Button>
<TextView android:layout_width="wrap_content" android:text="" android:id="@+id/SearchAreaText" android:layout_height="wrap_content"/>

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="show_poi_on_map">Показать на карте</string>
<string name="fav_points_edited">Отредактирована избранная точка</string>
<string name="fav_points_not_exist">Не существует избранных точек</string>
<string name="update_existing">Заменить</string>

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="show_poi_on_map">Show on map</string>
<string name="fav_points_edited">Favorite point was edited</string>
<string name="fav_points_not_exist">None of favorite points exist</string>
<string name="update_existing">Replace</string>

View file

@ -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<Amenity> toFill){
return checkCachedAmenities(topLatitude, leftLongitude, bottomLatitude, rightLongitude, zoom, filterId, toFill, false);

View file

@ -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$

View file

@ -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<Amenity>());
setListAdapter(amenityAdapter);

View file

@ -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);