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 {
|
public class Street extends MapObject {
|
||||||
|
|
||||||
private List<Building> buildings = new ArrayList<Building>();
|
private List<Building> buildings = new ArrayList<Building>();
|
||||||
private List<Way> wayNodes = new ArrayList<Way>();
|
private List<Way> wayNodes = null;
|
||||||
private final City city;
|
private final City city;
|
||||||
|
|
||||||
public Street(City city, String name){
|
public Street(City city, String name){
|
||||||
|
@ -52,9 +52,11 @@ public class Street extends MapObject {
|
||||||
|
|
||||||
protected void calculateCenter(){
|
protected void calculateCenter(){
|
||||||
List<Node> nodes = new ArrayList<Node>();
|
List<Node> nodes = new ArrayList<Node>();
|
||||||
|
if (wayNodes != null) {
|
||||||
for (Way w : wayNodes) {
|
for (Way w : wayNodes) {
|
||||||
nodes.addAll(w.getNodes());
|
nodes.addAll(w.getNodes());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LatLon c = MapUtils.getWeightCenterForNodes(nodes);
|
LatLon c = MapUtils.getWeightCenterForNodes(nodes);
|
||||||
double dist = Double.POSITIVE_INFINITY;
|
double dist = Double.POSITIVE_INFINITY;
|
||||||
|
@ -121,10 +123,10 @@ public class Street extends MapObject {
|
||||||
}
|
}
|
||||||
location = MapUtils.getWeightCenter(nodes);
|
location = MapUtils.getWeightCenter(nodes);
|
||||||
}
|
}
|
||||||
if(location == null || (wayNodes.isEmpty() && buildings.isEmpty())){
|
if(location == null || ((wayNodes == null || wayNodes.isEmpty()) && buildings.isEmpty())){
|
||||||
city.unregisterStreet(name);
|
city.unregisterStreet(name);
|
||||||
}
|
}
|
||||||
if (wayNodes.size() > 0) {
|
if (wayNodes != null && wayNodes.size() > 0) {
|
||||||
this.id = wayNodes.get(0).getId();
|
this.id = wayNodes.get(0).getId();
|
||||||
} else if(buildings.size() > 0){
|
} else if(buildings.size() > 0){
|
||||||
this.id = buildings.get(0).getId();
|
this.id = buildings.get(0).getId();
|
||||||
|
|
Loading…
Reference in a new issue