@Test public void testGetPolygons() { List<GeoJsonPolygon> polygons = new ArrayList<>(); List<ArrayList<LatLng>> polygon = new ArrayList<>(); polygon.add( new ArrayList<>( Arrays.asList( new LatLng(0, 0), new LatLng(20, 20), new LatLng(60, 60), new LatLng(0, 0)))); polygons.add(new GeoJsonPolygon(polygon)); polygon = new ArrayList<>(); polygon.add( new ArrayList<>( Arrays.asList( new LatLng(0, 0), new LatLng(50, 80), new LatLng(10, 15), new LatLng(0, 0)))); polygon.add( new ArrayList<>( Arrays.asList( new LatLng(0, 0), new LatLng(20, 20), new LatLng(60, 60), new LatLng(0, 0)))); polygons.add(new GeoJsonPolygon(polygon)); mp = new GeoJsonMultiPolygon(polygons); assertEquals(polygons, mp.getPolygons()); polygons = new ArrayList<>(); mp = new GeoJsonMultiPolygon(polygons); assertEquals(new ArrayList<GeoJsonPolygon>(), mp.getPolygons()); try { mp = new GeoJsonMultiPolygon(null); fail(); } catch (IllegalArgumentException e) { assertEquals("Geometries cannot be null", e.getMessage()); } }
public List<GeoJsonPolygon> getPolygons() { List<Geometry> geometryList = getGeometryObject(); ArrayList<GeoJsonPolygon> geoJsonPolygon = new ArrayList<GeoJsonPolygon>(); for (Geometry geometry : geometryList) { GeoJsonPolygon polygon = (GeoJsonPolygon) geometry; geoJsonPolygon.add(polygon); } return geoJsonPolygon; }
GeoJsonMultiPolygon extends MultiGeometry { public List<GeoJsonPolygon> getPolygons() { List<Geometry> geometryList = getGeometryObject(); ArrayList<GeoJsonPolygon> geoJsonPolygon = new ArrayList<GeoJsonPolygon>(); for (Geometry geometry : geometryList) { GeoJsonPolygon polygon = (GeoJsonPolygon) geometry; geoJsonPolygon.add(polygon); } return geoJsonPolygon; } }
GeoJsonMultiPolygon extends MultiGeometry { public List<GeoJsonPolygon> getPolygons() { List<Geometry> geometryList = getGeometryObject(); ArrayList<GeoJsonPolygon> geoJsonPolygon = new ArrayList<GeoJsonPolygon>(); for (Geometry geometry : geometryList) { GeoJsonPolygon polygon = (GeoJsonPolygon) geometry; geoJsonPolygon.add(polygon); } return geoJsonPolygon; } GeoJsonMultiPolygon(List<GeoJsonPolygon> geoJsonPolygons); }
GeoJsonMultiPolygon extends MultiGeometry { public List<GeoJsonPolygon> getPolygons() { List<Geometry> geometryList = getGeometryObject(); ArrayList<GeoJsonPolygon> geoJsonPolygon = new ArrayList<GeoJsonPolygon>(); for (Geometry geometry : geometryList) { GeoJsonPolygon polygon = (GeoJsonPolygon) geometry; geoJsonPolygon.add(polygon); } return geoJsonPolygon; } GeoJsonMultiPolygon(List<GeoJsonPolygon> geoJsonPolygons); String getType(); List<GeoJsonPolygon> getPolygons(); }
GeoJsonMultiPolygon extends MultiGeometry { public List<GeoJsonPolygon> getPolygons() { List<Geometry> geometryList = getGeometryObject(); ArrayList<GeoJsonPolygon> geoJsonPolygon = new ArrayList<GeoJsonPolygon>(); for (Geometry geometry : geometryList) { GeoJsonPolygon polygon = (GeoJsonPolygon) geometry; geoJsonPolygon.add(polygon); } return geoJsonPolygon; } GeoJsonMultiPolygon(List<GeoJsonPolygon> geoJsonPolygons); String getType(); List<GeoJsonPolygon> getPolygons();  }