Fix #3958 issue with interpolation

This commit is contained in:
Victor Shcherb 2017-06-26 00:21:30 +02:00
parent cc362703c8
commit 28f830098d
2 changed files with 17 additions and 2 deletions

View file

@ -103,7 +103,7 @@ public class Building extends MapObject {
public float interpolation(String hno) { public float interpolation(String hno) {
if(getInterpolationType() != null || getInterpolationInterval() > 0 || super.getName().contains("-")) { if(getInterpolationType() != null || getInterpolationInterval() > 0 || checkNameAsInterpolation()) {
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);
@ -139,6 +139,22 @@ public class Building extends MapObject {
} }
return -1; return -1;
} }
private boolean checkNameAsInterpolation() {
String nm = super.getName();
boolean interpolation = nm.contains("-");
if(interpolation) {
for(int i = 0; i < nm.length(); i++) {
if(nm.charAt(i) >= '0' && nm.charAt(i) <= '9' || nm.charAt(i) == '-') {
} else {
interpolation = false;
break;
}
}
}
return interpolation;
}
public boolean belongsToInterpolation(String hno) { public boolean belongsToInterpolation(String hno) {
return interpolation(hno) >= 0; return interpolation(hno) >= 0;
} }

View file

@ -11,7 +11,6 @@ import net.osmand.data.LatLon;
import net.osmand.data.QuadPoint; import net.osmand.data.QuadPoint;
import net.osmand.router.BinaryRoutePlanner.RouteSegment; import net.osmand.router.BinaryRoutePlanner.RouteSegment;
import net.osmand.router.BinaryRoutePlanner.RouteSegmentPoint; import net.osmand.router.BinaryRoutePlanner.RouteSegmentPoint;
import net.osmand.router.GeneralRouter.GeneralRouterProfile;
import net.osmand.util.MapUtils; import net.osmand.util.MapUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;