Update way methods

This commit is contained in:
vshcherb 2013-09-24 00:36:25 +02:00
parent b60c74993c
commit b268eff282

View file

@ -8,6 +8,7 @@ import java.util.List;
import java.util.Map;
import net.osmand.data.LatLon;
import net.osmand.data.QuadRect;
public class Way extends Entity {
@ -145,6 +146,31 @@ public class Way extends Entity {
}
}
}
public QuadRect getLatLonBBox() {
QuadRect qr = null;
if(nodes != null) {
for(Node n : nodes){
if(qr == null) {
qr.left = (float) n.getLongitude();
qr.right = (float) n.getLongitude();
qr.top = (float) n.getLatitude();
qr.bottom = (float) n.getLatitude();
}
if(n.getLongitude() < qr.left) {
qr.left = (float) n.getLongitude();
} else if(n.getLongitude() > qr.right) {
qr.right = (float) n.getLongitude();
}
if(n.getLatitude() > qr.top) {
qr.top = (float) n.getLatitude();
} else if(n.getLatitude() < qr.bottom) {
qr.bottom = (float) n.getLatitude();
}
}
}
return qr;
}
@Override
public LatLon getLatLon() {