From d25981a18de2b9403184db4f72ed8497d6861652 Mon Sep 17 00:00:00 2001 From: Kseniia Date: Fri, 15 Jan 2021 19:35:20 +0200 Subject: [PATCH] fix interpolation for alphabetic --- .../src/main/java/net/osmand/data/Building.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/data/Building.java b/OsmAnd-java/src/main/java/net/osmand/data/Building.java index 379b399fe9..67870ec383 100644 --- a/OsmAnd-java/src/main/java/net/osmand/data/Building.java +++ b/OsmAnd-java/src/main/java/net/osmand/data/Building.java @@ -116,14 +116,17 @@ public class Building extends MapObject { String sname = getName2(); if (getInterpolationType() == BuildingInterpolation.ALPHABETIC && num == numB) { - char ch = hno.charAt(hno.length() - 1); - char chF = fname.charAt(fname.length() - 1); - char chS = sname.charAt(sname.length() - 1); - if (chS < chF && chF < ch) { - return -1; + char hCh = hno.charAt(hno.length() - 1); + char fCh = fname.charAt(fname.length() - 1); + char sCh = sname.charAt(sname.length() - 1); + int h = Character.getNumericValue(hCh); + int f = Character.getNumericValue(fCh); + int s = Character.getNumericValue(sCh); + if (sCh > fCh) { + return ((float) h - f) / (((float) s - f)); } - if (chS > chF && ch < chF) { - return -1; + if (sCh < fCh) { + return ((float) f - h) / (((float) f - s)); } } if (num >= numB) {