Fixed bug 678. House numbers were not properly assigned to streets.

Small bug from previous refactorings.
This commit is contained in:
Pavol Zibrita 2011-10-16 21:23:07 +02:00
parent 91e8071ea3
commit 279f0b1575
4 changed files with 17 additions and 3 deletions

View file

@ -18,6 +18,7 @@ import net.osmand.binary.BinaryMapIndexReader.MapIndex;
import net.osmand.binary.BinaryMapIndexReader.MapRoot;
import net.osmand.binary.BinaryMapPoiReaderAdapter.PoiRegion;
import net.osmand.binary.BinaryMapTransportReaderAdapter.TransportIndex;
import net.osmand.data.Building;
import net.osmand.data.City;
import net.osmand.data.Street;
import net.osmand.osm.MapUtils;
@ -34,7 +35,7 @@ public class BinaryInspector {
inspector(args);
// test cases show info
//inspector(new String[]{"/home/victor/projects/OsmAnd/data/osm-gen/saved/Belarus-newzooms-new-rt.obf"});
//inspector(new String[]{"-v","C:\\Users\\tpd\\osmand\\Slovakia.obf"});
// inspector(new String[]{"-v","C:\\Users\\tpd\\osmand\\Housenumbers.obf"});
// test case extract parts
@ -338,7 +339,17 @@ public class BinaryInspector {
index.preloadStreets(c, null);
System.out.println("\t\tCity:" + c.getName());
for (Street t : c.getStreets()) {
System.out.println("\t\t\t" + t.getName());
System.out.print("\t\t\t" + t.getName());
index.preloadBuildings(t, null);
List<Building> buildings = t.getBuildings();
if (buildings != null && !buildings.isEmpty()) {
System.out.print(" (");
for (Building b : buildings) {
System.out.print(b.getName() + ",");
}
System.out.print(")");
}
System.out.println();
}
}
for (City c : index.getVillages(region, null,null,false)) {

View file

@ -9,7 +9,6 @@ import java.util.Set;
import net.osmand.data.Building;
import net.osmand.data.City;
import net.osmand.data.preparation.DBStreetDAO.SimpleStreet;
import net.osmand.osm.Entity;
import net.osmand.osm.LatLon;
import net.osmand.osm.Way;

View file

@ -552,6 +552,8 @@ public class IndexAddressCreator extends AbstractIndexPartCreator{
//by default write city with cityPart of the city
long streetId = streetDAO.insertStreet(name, nameEn, location, city, cityPart);
values.add(streetId);
} else {
values.add(foundStreet.getId());
}
}
return values;

View file

@ -608,6 +608,8 @@ public class IndexCreator {
// do not delete first db connection
if (dbConn != null) {
dialect.commitDatabase(dbConn);
dialect.closeDatabase(dbConn);
dbConn = null;
}
if (deleteOsmDB) {
if (DBDialect.DERBY == dialect) {