This commit is contained in:
Victor Shcherb 2020-02-24 18:40:31 +01:00
parent 07671e16d9
commit 30c3898a5f
3 changed files with 13 additions and 33 deletions

View file

@ -37,6 +37,7 @@ public class Amenity extends MapObject {
public static final String CONTENT = "content";
public static final String CUISINE = "cuisine";
public static final String DISH = "dish";
public static final String REF = "ref";
public static final String OSM_DELETE_VALUE = "delete";
public static final String OSM_DELETE_TAG = "osmand_change";

View file

@ -864,10 +864,12 @@ public class SearchUICore {
if ((!topVisible1 && !topVisible2) || (topVisible1 && topVisible2)) {
if (o1.getUnknownPhraseMatchWeight() != o2.getUnknownPhraseMatchWeight()) {
return -Double.compare(o1.getUnknownPhraseMatchWeight(), o2.getUnknownPhraseMatchWeight());
} else if (o1.getFoundWordCount() != o2.getFoundWordCount()) {
} else {
if (o1.getFoundWordCount() != o2.getFoundWordCount()) {
return -Algorithms.compare(o1.getFoundWordCount(), o2.getFoundWordCount());
}
}
}
if (!sortByName) {
double s1 = o1.getSearchDistance(loc);
double s2 = o2.getSearchDistance(loc);

View file

@ -1,7 +1,5 @@
package net.osmand.search.core;
import com.jwetherell.openmap.common.LatLonPoint;
import com.jwetherell.openmap.common.UTMPoint;
import net.osmand.CollatorStringMatcher.StringMatcherMode;
import net.osmand.ResultMatcher;
@ -146,7 +144,7 @@ public class SearchCoreFactory {
SearchResultMatcher resultMatcher, SearchResult res, SearchBaseAPI api)
throws IOException {
phrase.countUnknownWordsMatch(res);
int cnt = resultMatcher.getCount();
// int cnt = resultMatcher.getCount();
List<String> ws = phrase.getUnknownSearchWords(res.otherWordsMatch);
if(!res.firstUnknownWordMatches) {
ws.add(phrase.getUnknownSearchWord());
@ -938,7 +936,12 @@ public class SearchCoreFactory {
}
if (phrase.isUnknownSearchWordPresent()
&& !(ns.matches(res.localeName) || ns.matches(res.otherNames))) {
String ref = object.getTagContent(Amenity.REF, null);
if(ref == null || !ns.matches(ref)) {
return false;
} else {
res.localeName += " " + ref;
}
}
res.object = object;
@ -1266,20 +1269,6 @@ public class SearchCoreFactory {
return false;
}
// newFormat = PointDescription.FORMAT_DEGREES;
// newFormat = PointDescription.FORMAT_MINUTES;
// newFormat = PointDescription.FORMAT_SECONDS;
public void testUTM() {
double northing = 0;
double easting = 0;
String zone = "";
char c = zone.charAt(zone.length() -1);
int z = Integer.parseInt(zone.substring(0, zone.length() - 1));
UTMPoint upoint = new UTMPoint(northing, easting, z, c);
LatLonPoint ll = upoint.toLatLonPoint();
LatLon loc = new LatLon(ll.getLatitude(), ll.getLongitude());
}
@Override
public boolean search(SearchPhrase phrase, SearchResultMatcher resultMatcher) throws IOException {
if (!phrase.isUnknownSearchWordPresent()) {
@ -1292,17 +1281,6 @@ public class SearchCoreFactory {
return super.search(phrase, resultMatcher);
}
private boolean isKindOfNumber(String s) {
for (int i = 0; i < s.length(); i ++) {
char c = s.charAt(i);
if (c >= '0' && c <= '9') {
} else if (c == ':' || c == '.' || c == '#' || c == ',' || c == '-' || c == '\'' || c == '"') {
} else {
return false;
}
}
return true;
}
LatLon parsePartialLocation(String s) {
s = s.trim();
@ -1342,8 +1320,7 @@ public class SearchCoreFactory {
searchLocation = sr.location;
}
break;
case CITY:
case VILLAGE:
default:
searchLocation = sr.location;
break;
}