additional implementation
git-svn-id: https://osmand.googlecode.com/svn/trunk@626 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
parent
ac495120d9
commit
2c30496c45
1 changed files with 7 additions and 5 deletions
|
@ -17,7 +17,7 @@ import net.osmand.osm.OSMSettings.OSMTagKey;
|
|||
public class Street extends MapObject {
|
||||
|
||||
private List<Building> buildings = new ArrayList<Building>();
|
||||
private List<Way> wayNodes = new ArrayList<Way>();
|
||||
private List<Way> wayNodes = null;
|
||||
private final City city;
|
||||
|
||||
public Street(City city, String name){
|
||||
|
@ -52,9 +52,11 @@ public class Street extends MapObject {
|
|||
|
||||
protected void calculateCenter(){
|
||||
List<Node> nodes = new ArrayList<Node>();
|
||||
if (wayNodes != null) {
|
||||
for (Way w : wayNodes) {
|
||||
nodes.addAll(w.getNodes());
|
||||
}
|
||||
}
|
||||
|
||||
LatLon c = MapUtils.getWeightCenterForNodes(nodes);
|
||||
double dist = Double.POSITIVE_INFINITY;
|
||||
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue