From c1f5534c32a0f1c96c059d8fec3edef662b36796 Mon Sep 17 00:00:00 2001 From: MadWasp79 Date: Sat, 20 Jun 2020 16:31:47 +0300 Subject: [PATCH] simplify center calc for 4-point polygons --- .../src/main/java/net/osmand/osm/edit/OsmMapUtils.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OsmAnd-java/src/main/java/net/osmand/osm/edit/OsmMapUtils.java b/OsmAnd-java/src/main/java/net/osmand/osm/edit/OsmMapUtils.java index 5be470ac4d..cf9def40cf 100644 --- a/OsmAnd-java/src/main/java/net/osmand/osm/edit/OsmMapUtils.java +++ b/OsmAnd-java/src/main/java/net/osmand/osm/edit/OsmMapUtils.java @@ -87,6 +87,12 @@ public class OsmMapUtils { } public static LatLon getComplexPolyCenter(Collection outer, List> inner) { + if (outer.size() <= 5 && inner == null) { + List sub = new ArrayList<>(outer); + + return getWeightCenterForNodes(sub.subList(0, sub.size()-1)); + } + final List> rings = new ArrayList<>(); List outerRing = new ArrayList<>();