add condition for BuildingInterpolation.ALPHABETIC

This commit is contained in:
Kseniia 2021-01-12 17:52:03 +02:00
parent 318ae3d3cf
commit 925e42546d

View file

@ -106,25 +106,32 @@ public class Building extends MapObject {
public float interpolation(String hno) { public float interpolation(String hno) {
if(getInterpolationType() != null || getInterpolationInterval() > 0 if (getInterpolationType() != null || getInterpolationInterval() > 0
//|| checkNameAsInterpolation() // disable due to situation in NL #4284 // || checkNameAsInterpolation() // disable due to situation in NL #4284
) { ) {
int num = Algorithms.extractFirstIntegerNumber(hno); int num = Algorithms.extractFirstIntegerNumber(hno);
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) { if (num >= numB) {
String sname = getName2(); String sname = getName2();
if(fname.contains("-") && sname == null){ if (getInterpolationType() == BuildingInterpolation.ALPHABETIC) {
char ch = hno.charAt(hno.length() - 1);
char chF = fname.charAt(fname.length() - 1);
if (chF < ch) {
return -1;
}
}
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());
} }
if (sname != null) { if (sname != null) {
numT = Algorithms.extractFirstIntegerNumber(sname); numT = Algorithms.extractFirstIntegerNumber(sname);
if(numT < num) { if (numT < num) {
return -1; return -1;
} }
} }
if (getInterpolationType() == BuildingInterpolation.EVEN && num % 2 == 1) { if (getInterpolationType() == BuildingInterpolation.EVEN && num % 2 == 1) {
return -1; return -1;
} }
@ -137,8 +144,8 @@ public class Building extends MapObject {
} else { } else {
return -1; return -1;
} }
if(numT > numB){ if (numT > numB) {
return ((float)num - numB) / (((float)numT - numB)); return ((float) num - numB) / (((float) numT - numB));
} }
return 0; return 0;
} }