Fix empty point, holepoints after polygon drag
@@ -694,10 +694,8 @@ class NativeOpenStreetMapController implements MapController, MapListener {
}
((MapRectangle) component).updateBounds(north, west, south, east);
} else {
- ((MapPolygon) component).updatePoints(Collections.singletonList(polygon.getPoints()));
- List<List<GeoPoint>> holes = new ArrayList<List<GeoPoint>>();
- holes.addAll(polygon.getHoles());
- ((MapPolygon) component).updateHolePoints(Collections.singletonList(holes));
+ ((MapPolygon) component).updatePoints(((MultiPolygon) polygon).getMultiPoints());
+ ((MapPolygon) component).updateHolePoints(((MultiPolygon) polygon).getMultiHoles());
}
for (MapEventListener listener : eventListeners) {
listener.onFeatureStopDrag(component);
@@ -1343,6 +1341,14 @@ class NativeOpenStreetMapController implements MapController, MapListener {
}
}
+ public List<List<GeoPoint>> getMultiPoints() {
+ List<List<GeoPoint>> result = new ArrayList<>();
+ for (Polygon p : children) {
+ result.add(p.getPoints());
+ }
+ return result;
+ }
+
public void setMultiPoints(List<List<GeoPoint>> points) {
Iterator<Polygon> polygonIterator = children.iterator();
Iterator<List<GeoPoint>> pointIterator = points.iterator();
@@ -1367,6 +1373,15 @@ class NativeOpenStreetMapController implements MapController, MapListener {
}
}
+ @SuppressWarnings("unchecked") // upcasting nested ArrayList to List
+ public List<List<List<GeoPoint>>> getMultiHoles() {
+ List<List<List<GeoPoint>>> result = new ArrayList<>();
+ for (Polygon p : children) {
+ result.add((List) p.getHoles());
+ }
+ return result;
+ }
+
public void setMultiHoles(List<List<List<GeoPoint>>> holes) {
if (holes == null || holes.isEmpty()) {
for (Polygon child : children) {
