Commit 1cac703d authored by Evan W. Patton's avatar Evan W. Patton Committed by Susan Rati Lane

Fix empty point, holepoints after polygon drag (#1898)

Change-Id: Ic56b10d6ca1df949a2bbf342b4bc7d3d473a6342
parent fca2c244
......@@ -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) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment