Check interpolation method

This commit is contained in:
Victor Shcherb 2013-04-01 19:21:38 +02:00
parent e590fd0245
commit 1a633d641f

View file

@ -104,20 +104,12 @@ public class SearchBuildingByNameActivity extends SearchByNameAbstractActivity<B
@Override @Override
public void itemSelected(Building obj) { public void itemSelected(Building obj) {
String text = getText(obj); String text = getText(obj);
LatLon loc = obj.getLocation();
if(obj.getInterpolationInterval() > 0 || obj.getInterpolationType() != null){
String hno = getCurrentFilter(); String hno = getCurrentFilter();
LatLon loc = obj.getLocation();
float interpolation = obj.interpolation(hno); float interpolation = obj.interpolation(hno);
if (interpolation >= 0) { if(interpolation >= 0) {
loc = obj.getLocation(interpolation);
text = hno; text = hno;
if (interpolation > 0 && obj.getLatLon2() != null) {
double lat1 = loc.getLatitude();
double lat2 = obj.getLatLon2().getLatitude();
double lon1 = loc.getLongitude();
double lon2 = obj.getLatLon2().getLongitude();
loc = new LatLon(interpolation * (lat2 - lat1) + lat1, interpolation * (lon2 - lon1) + lon1);
}
}
} }
settings.setLastSearchedBuilding(text, loc); settings.setLastSearchedBuilding(text, loc);
finish(); finish();