Formatting
This commit is contained in:
parent
893ef334a0
commit
0d06344869
1 changed files with 6 additions and 7 deletions
|
@ -153,35 +153,34 @@ public class OsmMapUtils {
|
||||||
}
|
}
|
||||||
boolean area = w.getFirstNodeId() == w.getLastNodeId();
|
boolean area = w.getFirstNodeId() == w.getLastNodeId();
|
||||||
// double check for area (could be negative all)
|
// double check for area (could be negative all)
|
||||||
if(area) {
|
if (area) {
|
||||||
Node fn = w.getFirstNode();
|
Node fn = w.getFirstNode();
|
||||||
Node ln = w.getLastNode();
|
Node ln = w.getLastNode();
|
||||||
if(fn != null && fn != null && MapUtils.getDistance(fn.getLatLon(), ln.getLatLon()) < 50) {
|
if (fn != null && fn != null && MapUtils.getDistance(fn.getLatLon(), ln.getLatLon()) < 50) {
|
||||||
area = true;
|
area = true;
|
||||||
} else {
|
} else {
|
||||||
area = false;
|
area = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LatLon ll = area ? getComplexPolyCenter(nodes, null) : getWeightCenterForNodes(nodes);
|
LatLon ll = area ? getComplexPolyCenter(nodes, null) : getWeightCenterForNodes(nodes);
|
||||||
if(ll == null) {
|
if (ll == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
double flat = ll.getLatitude();
|
double flat = ll.getLatitude();
|
||||||
double flon = ll.getLongitude();
|
double flon = ll.getLongitude();
|
||||||
if(!area || !MapAlgorithms.containsPoint(nodes, ll.getLatitude(), ll.getLongitude())) {
|
if (!area || !MapAlgorithms.containsPoint(nodes, ll.getLatitude(), ll.getLongitude())) {
|
||||||
double minDistance = Double.MAX_VALUE;
|
double minDistance = Double.MAX_VALUE;
|
||||||
for (Node n : nodes) {
|
for (Node n : nodes) {
|
||||||
if (n != null) {
|
if (n != null) {
|
||||||
double d = MapUtils.getDistance(n.getLatitude(), n.getLongitude(), ll.getLatitude(), ll.getLongitude());
|
double d = MapUtils.getDistance(n.getLatitude(), n.getLongitude(), ll.getLatitude(), ll.getLongitude());
|
||||||
if(d < minDistance) {
|
if (d < minDistance) {
|
||||||
flat = n.getLatitude();
|
flat = n.getLatitude();
|
||||||
flon = n.getLongitude();
|
flon = n.getLongitude();
|
||||||
minDistance = d;
|
minDistance = d;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new LatLon(flat, flon);
|
return new LatLon(flat, flon);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue