Fix show on map search by name filter
This commit is contained in:
parent
f6a856d374
commit
aeaa012f4e
5 changed files with 15 additions and 9 deletions
|
@ -73,7 +73,7 @@ public class NominatimPoiFilter extends PoiUIFilter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<Amenity> searchAmenitiesInternal(double lat, double lon, double topLatitude,
|
protected List<Amenity> searchAmenitiesInternal(double lat, double lon, double topLatitude,
|
||||||
double bottomLatitude, double leftLongitude, double rightLongitude, ResultMatcher<Amenity> matcher) {
|
double bottomLatitude, double leftLongitude, double rightLongitude, int zoom, ResultMatcher<Amenity> matcher) {
|
||||||
final int deviceApiVersion = android.os.Build.VERSION.SDK_INT;
|
final int deviceApiVersion = android.os.Build.VERSION.SDK_INT;
|
||||||
String NOMINATIM_API;
|
String NOMINATIM_API;
|
||||||
if (deviceApiVersion >= android.os.Build.VERSION_CODES.GINGERBREAD) {
|
if (deviceApiVersion >= android.os.Build.VERSION_CODES.GINGERBREAD) {
|
||||||
|
|
|
@ -203,6 +203,12 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable<PoiUIFilter>
|
||||||
distanceInd = 0;
|
distanceInd = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clearCurrentResults() {
|
||||||
|
if (currentSearchResult != null) {
|
||||||
|
currentSearchResult = new ArrayList<>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<Amenity> initializeNewSearch(double lat, double lon, int firstTimeLimit, ResultMatcher<Amenity> matcher) {
|
public List<Amenity> initializeNewSearch(double lat, double lon, int firstTimeLimit, ResultMatcher<Amenity> matcher) {
|
||||||
clearPreviousZoom();
|
clearPreviousZoom();
|
||||||
List<Amenity> amenityList = searchAmenities(lat, lon, matcher);
|
List<Amenity> amenityList = searchAmenities(lat, lon, matcher);
|
||||||
|
@ -236,7 +242,7 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable<PoiUIFilter>
|
||||||
double bottomLatitude = Math.max(lat - (distance / baseDistY), -84.);
|
double bottomLatitude = Math.max(lat - (distance / baseDistY), -84.);
|
||||||
double leftLongitude = Math.max(lon - (distance / baseDistX), -180);
|
double leftLongitude = Math.max(lon - (distance / baseDistX), -180);
|
||||||
double rightLongitude = Math.min(lon + (distance / baseDistX), 180);
|
double rightLongitude = Math.min(lon + (distance / baseDistX), 180);
|
||||||
return searchAmenitiesInternal(lat, lon, topLatitude, bottomLatitude, leftLongitude, rightLongitude, matcher);
|
return searchAmenitiesInternal(lat, lon, topLatitude, bottomLatitude, leftLongitude, rightLongitude, -1, matcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Amenity> searchAmenities(double top, double left, double bottom, double right, int zoom,
|
public List<Amenity> searchAmenities(double top, double left, double bottom, double right, int zoom,
|
||||||
|
@ -254,8 +260,8 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable<PoiUIFilter>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<Amenity> amenities = app.getResourceManager().searchAmenities(this, top, left, bottom, right, zoom,
|
List<Amenity> amenities = searchAmenitiesInternal(top / 2 + bottom / 2, left / 2 + right / 2,
|
||||||
wrapResultMatcher(matcher));
|
top, bottom, left, right, zoom, matcher);
|
||||||
results.addAll(amenities);
|
results.addAll(amenities);
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
@ -265,9 +271,9 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable<PoiUIFilter>
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List<Amenity> searchAmenitiesInternal(double lat, double lon, double topLatitude,
|
protected List<Amenity> searchAmenitiesInternal(double lat, double lon, double topLatitude,
|
||||||
double bottomLatitude, double leftLongitude, double rightLongitude, final ResultMatcher<Amenity> matcher) {
|
double bottomLatitude, double leftLongitude, double rightLongitude, int zoom, final ResultMatcher<Amenity> matcher) {
|
||||||
return app.getResourceManager().searchAmenities(this,
|
return app.getResourceManager().searchAmenities(this,
|
||||||
topLatitude, leftLongitude, bottomLatitude, rightLongitude, -1, wrapResultMatcher(matcher));
|
topLatitude, leftLongitude, bottomLatitude, rightLongitude, zoom, wrapResultMatcher(matcher));
|
||||||
}
|
}
|
||||||
|
|
||||||
public AmenityNameFilter getNameFilter(String filter) {
|
public AmenityNameFilter getNameFilter(String filter) {
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class SearchByNameFilter extends PoiUIFilter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<Amenity> searchAmenitiesInternal(double lat, double lon, double topLatitude,
|
protected List<Amenity> searchAmenitiesInternal(double lat, double lon, double topLatitude,
|
||||||
double bottomLatitude, double leftLongitude, double rightLongitude, final ResultMatcher<Amenity> matcher) {
|
double bottomLatitude, double leftLongitude, double rightLongitude, int zoom, final ResultMatcher<Amenity> matcher) {
|
||||||
currentSearchResult = new ArrayList<Amenity>();
|
currentSearchResult = new ArrayList<Amenity>();
|
||||||
final int limit = distanceInd == 0 ? 500 : -1;
|
final int limit = distanceInd == 0 ? 500 : -1;
|
||||||
List<Amenity> result = Collections.emptyList();
|
List<Amenity> result = Collections.emptyList();
|
||||||
|
|
|
@ -219,9 +219,10 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
||||||
} else if (searchPhrase.isNoSelectedType() || searchPhrase.isLastWord(ObjectType.POI_TYPE)) {
|
} else if (searchPhrase.isNoSelectedType() || searchPhrase.isLastWord(ObjectType.POI_TYPE)) {
|
||||||
PoiUIFilter filter;
|
PoiUIFilter filter;
|
||||||
if (searchPhrase.isNoSelectedType()) {
|
if (searchPhrase.isNoSelectedType()) {
|
||||||
filter = new PoiUIFilter(null, app, "");
|
filter = app.getPoiFilters().getSearchByNamePOIFilter();
|
||||||
if (!Algorithms.isEmpty(searchPhrase.getUnknownSearchWord())) {
|
if (!Algorithms.isEmpty(searchPhrase.getUnknownSearchWord())) {
|
||||||
filter.setFilterByName(searchPhrase.getUnknownSearchWord());
|
filter.setFilterByName(searchPhrase.getUnknownSearchWord());
|
||||||
|
filter.clearCurrentResults();
|
||||||
}
|
}
|
||||||
} else if (searchPhrase.getLastSelectedWord().getResult().object instanceof AbstractPoiType) {
|
} else if (searchPhrase.getLastSelectedWord().getResult().object instanceof AbstractPoiType) {
|
||||||
if (searchPhrase.isNoSelectedType()) {
|
if (searchPhrase.isNoSelectedType()) {
|
||||||
|
|
|
@ -80,7 +80,6 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
||||||
private Bitmap poiBackgroundSmall;
|
private Bitmap poiBackgroundSmall;
|
||||||
|
|
||||||
private OsmandMapTileView view;
|
private OsmandMapTileView view;
|
||||||
private final static int MAXIMUM_SHOW_AMENITIES = 5;
|
|
||||||
|
|
||||||
private RoutingHelper routingHelper;
|
private RoutingHelper routingHelper;
|
||||||
private Set<PoiUIFilter> filters = new TreeSet<>();
|
private Set<PoiUIFilter> filters = new TreeSet<>();
|
||||||
|
|
Loading…
Reference in a new issue