Merge pull request #10564 from osmandapp/T7525

Add condition for BuildingInterpolation.ALPHABETIC
This commit is contained in:
vshcherb 2021-01-15 20:16:04 +01:00 committed by GitHub
commit 67c122ce03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -113,8 +113,25 @@ public class Building extends MapObject {
String fname = super.getName(); String fname = super.getName();
int numB = Algorithms.extractFirstIntegerNumber(fname); int numB = Algorithms.extractFirstIntegerNumber(fname);
int numT = numB; int numT = numB;
if (num >= numB) {
String sname = getName2(); String sname = getName2();
if (getInterpolationType() == BuildingInterpolation.ALPHABETIC) {
if (num != numB) {
// currently not supported
return -1;
}
int hint = (int) hno.charAt(hno.length() - 1);
int fch = (int) fname.charAt(fname.length() - 1);
int sch = sname.charAt(sname.length() - 1);
if (fch == sch) {
return -1;
}
float res = ((float) hint - fch) / (((float) sch - fch));
if (res > 1 || res < -1) {
return -1;
}
return res;
}
if (num >= numB) {
if (fname.contains("-") && sname == null) { if (fname.contains("-") && sname == null) {
int l = fname.indexOf('-'); int l = fname.indexOf('-');
sname = fname.substring(l + 1, fname.length()); sname = fname.substring(l + 1, fname.length());