From 2c30496c454c4e128c92ab9bb075d1740571db65 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Tue, 2 Nov 2010 22:00:57 +0000 Subject: [PATCH] additional implementation git-svn-id: https://osmand.googlecode.com/svn/trunk@626 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8 --- DataExtractionOSM/src/net/osmand/data/Street.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/DataExtractionOSM/src/net/osmand/data/Street.java b/DataExtractionOSM/src/net/osmand/data/Street.java index 63367249a9..91c4001318 100644 --- a/DataExtractionOSM/src/net/osmand/data/Street.java +++ b/DataExtractionOSM/src/net/osmand/data/Street.java @@ -17,7 +17,7 @@ import net.osmand.osm.OSMSettings.OSMTagKey; public class Street extends MapObject { private List buildings = new ArrayList(); - private List wayNodes = new ArrayList(); + private List wayNodes = null; private final City city; public Street(City city, String name){ @@ -52,8 +52,10 @@ public class Street extends MapObject { protected void calculateCenter(){ List nodes = new ArrayList(); - for(Way w : wayNodes){ - nodes.addAll(w.getNodes()); + if (wayNodes != null) { + for (Way w : wayNodes) { + nodes.addAll(w.getNodes()); + } } LatLon c = MapUtils.getWeightCenterForNodes(nodes); @@ -121,10 +123,10 @@ public class Street extends MapObject { } location = MapUtils.getWeightCenter(nodes); } - if(location == null || (wayNodes.isEmpty() && buildings.isEmpty())){ + if(location == null || ((wayNodes == null || wayNodes.isEmpty()) && buildings.isEmpty())){ city.unregisterStreet(name); } - if (wayNodes.size() > 0) { + if (wayNodes != null && wayNodes.size() > 0) { this.id = wayNodes.get(0).getId(); } else if(buildings.size() > 0){ this.id = buildings.get(0).getId();