Small patch for issue 389

This commit is contained in:
Victor Shcherb 2011-04-24 23:55:29 +02:00
parent c1bd234931
commit e25c924a5a
2 changed files with 4 additions and 2 deletions

View file

@ -1046,7 +1046,7 @@ public class BinaryMapIndexReader {
public static void main(String[] args) throws IOException {
RandomAccessFile raf = new RandomAccessFile(new File("/home/victor/projects/OsmAnd/download/384/La_coruna.obf"), "r");
RandomAccessFile raf = new RandomAccessFile(new File("/home/victor/projects/OsmAnd/download/384/Spain_europe_1.obf"), "r");
BinaryMapIndexReader reader = new BinaryMapIndexReader(raf);
System.out.println("VERSION " + reader.getVersion()); //$NON-NLS-1$
long time = System.currentTimeMillis();

View file

@ -887,11 +887,13 @@ public class IndexCreator {
if (boundary != null && boundary.getCenterPoint() != null) {
LatLon point = boundary.getCenterPoint();
boolean cityFound = false;
boolean containsCityInside = false;
for (City c : cityManager.getClosestObjects(point.getLatitude(), point.getLongitude(), 3)) {
if (boundary.containsPoint(c.getLocation())) {
if (boundary.getName() == null || boundary.getName().equalsIgnoreCase(c.getName())) {
citiBoundaries.put(c, boundary);
cityFound = true;
containsCityInside = true;
}
}
}
@ -909,7 +911,7 @@ public class IndexCreator {
if (!cityFound && boundary.getName() != null) {
// / create new city for named boundary very rare case that's why do not proper generate id
// however it could be a problem
City nCity = new City(CityType.SUBURB);
City nCity = new City(containsCityInside ? CityType.CITY : CityType.SUBURB);
nCity.setLocation(point.getLatitude(), point.getLongitude());
nCity.setId(-boundary.getBoundaryId());
nCity.setName(boundary.getName());