getPolygonsWithList static method

List<Polygon> getPolygonsWithList(
  1. Geometry geom,
  2. List<Polygon> list
)

Extracts the {@link Polygon} elements from a single {@link Geometry} and adds them to the provided {@link List}.

@param geom the geometry from which to extract @param list the list to add the extracted elements to

Implementation

static List<Polygon> getPolygonsWithList(Geometry geom, List<Polygon> list) {
  if (geom is Polygon) {
    list.add(geom);
  } else if (geom is GeometryCollection) {
    geom.applyGF(PolygonExtracter(list));
  }
  // skip non-Polygonal elemental geometries

  return list;
}