Merge branch 'r3.7'

This commit is contained in:
Victor Shcherb 2020-05-24 17:30:55 +02:00
commit bdbf07e356
5 changed files with 26 additions and 32 deletions

View file

@ -45,27 +45,27 @@ public enum ObjectType {
return null;
}
public static double getTypeWeight(ObjectType t) {
public static int getTypeWeight(ObjectType t) {
if (t == null) {
return 1.0;
return 1;
}
switch (t) {
case CITY:
return 1.0;
return 1;
case VILLAGE:
return 1.0;
return 1;
case POSTCODE:
return 1.0;
return 1;
case STREET:
return 2.0;
return 2;
case HOUSE:
return 3.0;
return 3;
case STREET_INTERSECTION:
return 3.0;
return 3;
case POI:
return 2.0;
return 2;
default:
return 1.0;
return 1;
}
}
}

View file

@ -728,8 +728,9 @@ public class SearchPhrase {
for (int i = 0; i < unknownWords.size(); i++) {
if (unknownWordsMatcher.size() == i) {
unknownWordsMatcher.add(new NameStringMatcher(unknownWords.get(i),
i < unknownWords.size() - 1 || isLastUnknownSearchWordComplete() ? StringMatcherMode.CHECK_EQUALS_FROM_SPACE :
StringMatcherMode.CHECK_STARTS_FROM_SPACE));
i < unknownWords.size() - 1 || isLastUnknownSearchWordComplete()
? StringMatcherMode.CHECK_EQUALS_FROM_SPACE
: StringMatcherMode.CHECK_STARTS_FROM_SPACE));
}
NameStringMatcher ms = unknownWordsMatcher.get(i);
if (ms.matches(localeName) || ms.matches(otherNames)) {

View file

@ -33,20 +33,13 @@ public class SearchResult {
this.requiredSearchPhrase = sp;
}
public double getUnknownPhraseMatchWeight() {
return getUnknownPhraseMatchWeight(false);
}
private double getUnknownPhraseMatchWeight(boolean isHouse) {
double res = 0;
isHouse = isHouse || objectType == ObjectType.HOUSE;
public int getUnknownPhraseMatchWeight() {
if (unknownPhraseMatches) {
res = isHouse ? ObjectType.getTypeWeight(ObjectType.HOUSE) : ObjectType.getTypeWeight(objectType);
return ObjectType.getTypeWeight(objectType);
} else if (parentSearchResult != null) {
return parentSearchResult.getUnknownPhraseMatchWeight();
}
if (res == 0 && parentSearchResult != null) {
return parentSearchResult.getUnknownPhraseMatchWeight(isHouse);
}
return res;
return 0;
}
public int getFoundWordCount() {

View file

@ -16,7 +16,7 @@ import net.osmand.plus.quickaction.QuickActionType;
public class TerrainAction extends QuickAction {
public static final QuickActionType TYPE = new QuickActionType(30,
"contourlines.showhide", TerrainAction.class).
"terrain.showhide", TerrainAction.class).
nameRes(R.string.quick_action_show_hide_hillshade).iconRes(R.drawable.ic_action_hillshade_dark).nonEditable().
category(QuickActionType.CONFIGURE_MAP);