fix filter by building and internet poi

This commit is contained in:
Kseniia 2021-01-05 15:11:14 +02:00
parent 3e9ef3914b
commit b9339cdab5

View file

@ -204,7 +204,6 @@ public class SearchUICore {
for (SearchResult rs : lstUnique) {
same = sameSearchResult(rs, r);
if (same) {
filterPoiByType(rs, r, lst);
break;
}
}
@ -219,24 +218,6 @@ public class SearchUICore {
}
}
private void filterPoiByType(SearchResult r1, SearchResult r2, List<SearchResult> list) {
if (r1.object instanceof Amenity) {
Amenity a1 = (Amenity) r1.object;
Amenity a2 = (Amenity) r2.object;
if (!(a2.getSubType().equals("building") || a2.getSubType().contains("internet"))
&& (a1.getSubType().equals("building") || a1.getSubType().contains("internet"))) {
int index = list.indexOf(r1);
if (list.contains(r1)) {
list.set(index, r2);
}
}
}
}
public boolean sameSearchResult(SearchResult r1, SearchResult r2) {
if (r1.location != null && r2.location != null &&
!ObjectType.isTopVisible(r1.objectType) && !ObjectType.isTopVisible(r2.objectType)) {
@ -275,6 +256,7 @@ public class SearchUICore {
}
return false;
}
if (type1.equals("natural")) {
similarityRadius = 50000;
} else if (subType1.equals(subType2)) {
@ -1012,16 +994,20 @@ public class SearchUICore {
// here 2 points are amenity
Amenity a1 = (Amenity) o1.object;
Amenity a2 = (Amenity) o2.object;
String type1 = a1.getType().getKeyName();
String type2 = a2.getType().getKeyName();
int cmp = c.collator.compare(type1, type2);
if (cmp != 0) {
return cmp;
}
String subType1 = a1.getSubType() == null ? "" : a1.getSubType();
String subType2 = a2.getSubType() == null ? "" : a2.getSubType();
int cmp;
if(subType1.equals("building") || subType1.contains("internet")) {
cmp = 1;
} else if(subType2.equals("building") || subType2.contains("internet")) {
cmp = -1;
} else {
cmp = c.collator.compare(subType1, subType2);
}
if (cmp != 0) {
return cmp;
}