From 279f0b157510bed30d581c7120ebca2247cef015 Mon Sep 17 00:00:00 2001 From: Pavol Zibrita Date: Sun, 16 Oct 2011 21:23:07 +0200 Subject: [PATCH] Fixed bug 678. House numbers were not properly assigned to streets. Small bug from previous refactorings. --- .../src/net/osmand/binary/BinaryInspector.java | 15 +++++++++++++-- .../data/preparation/CachedDBStreetDAO.java | 1 - .../data/preparation/IndexAddressCreator.java | 2 ++ .../net/osmand/data/preparation/IndexCreator.java | 2 ++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/DataExtractionOSM/src/net/osmand/binary/BinaryInspector.java b/DataExtractionOSM/src/net/osmand/binary/BinaryInspector.java index 0f71627385..ed7dac6561 100644 --- a/DataExtractionOSM/src/net/osmand/binary/BinaryInspector.java +++ b/DataExtractionOSM/src/net/osmand/binary/BinaryInspector.java @@ -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 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)) { diff --git a/DataExtractionOSM/src/net/osmand/data/preparation/CachedDBStreetDAO.java b/DataExtractionOSM/src/net/osmand/data/preparation/CachedDBStreetDAO.java index c5ea767d16..177849935d 100644 --- a/DataExtractionOSM/src/net/osmand/data/preparation/CachedDBStreetDAO.java +++ b/DataExtractionOSM/src/net/osmand/data/preparation/CachedDBStreetDAO.java @@ -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; diff --git a/DataExtractionOSM/src/net/osmand/data/preparation/IndexAddressCreator.java b/DataExtractionOSM/src/net/osmand/data/preparation/IndexAddressCreator.java index 0e9f68ff8c..e20b7a38db 100644 --- a/DataExtractionOSM/src/net/osmand/data/preparation/IndexAddressCreator.java +++ b/DataExtractionOSM/src/net/osmand/data/preparation/IndexAddressCreator.java @@ -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; diff --git a/DataExtractionOSM/src/net/osmand/data/preparation/IndexCreator.java b/DataExtractionOSM/src/net/osmand/data/preparation/IndexCreator.java index 248bb4551e..a259446551 100644 --- a/DataExtractionOSM/src/net/osmand/data/preparation/IndexCreator.java +++ b/DataExtractionOSM/src/net/osmand/data/preparation/IndexCreator.java @@ -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) {