public Builder<T> addHole(@NonNull Iterable<LatLng> points) { this.polygonOptions.addHole(points); return this; }
/** * Adds a DataPolygon to the map as a Polygon * * @param polygonOptions * @param polygon contains coordinates for the Polygon * @return Polygon object created from given DataPolygon */ protected Polygon addPolygonToMap(PolygonOptions polygonOptions, DataPolygon polygon) { // First array of coordinates are the outline polygonOptions.addAll(polygon.getOuterBoundaryCoordinates()); // Following arrays are holes List<List<LatLng>> innerBoundaries = polygon.getInnerBoundaryCoordinates(); for (List<LatLng> innerBoundary : innerBoundaries) { polygonOptions.addHole(innerBoundary); } Polygon addedPolygon = mMap.addPolygon(polygonOptions); addedPolygon.setClickable(polygonOptions.isClickable()); return addedPolygon; }
public PolygonOptions addHole(Iterable<LatLng> points) { real.addHole(points); return this; }
/** * Adds a GeoJsonPolygon to the map as a Polygon * * @param polygonStyle contains relevant styling properties for the Polygon * @param polygon contains coordinates for the Polygon * @return Polygon object created from given GeoJsonPolygon */ private Polygon addPolygonToMap(GeoJsonPolygonStyle polygonStyle, GeoJsonPolygon polygon) { PolygonOptions polygonOptions = polygonStyle.toPolygonOptions(); // First array of coordinates are the outline polygonOptions.addAll(polygon.getCoordinates().get(POLYGON_OUTER_COORDINATE_INDEX)); // Following arrays are holes for (int i = POLYGON_INNER_COORDINATE_INDEX; i < polygon.getCoordinates().size(); i++) { polygonOptions.addHole(polygon.getCoordinates().get(i)); } Polygon addedPolygon = mMap.addPolygon(polygonOptions); addedPolygon.setClickable(true); return addedPolygon; }
/** * Adds a KML Polygon to the map as a Polygon by combining the styling and coordinates * * @param polygon contains coordinates for the Polygon * @param style contains relevant styling properties for the Polygon * @return Polygon object */ private Polygon addPolygonToMap(KmlPolygon polygon, KmlStyle style, KmlStyle inlineStyle) { PolygonOptions polygonOptions = style.getPolygonOptions(); polygonOptions.addAll(polygon.getOuterBoundaryCoordinates()); for (ArrayList<LatLng> innerBoundary : polygon.getInnerBoundaryCoordinates()) { polygonOptions.addHole(innerBoundary); } if (inlineStyle != null) { setInlinePolygonStyle(polygonOptions, inlineStyle); } else if (style.isPolyRandomColorMode()) { polygonOptions.fillColor(KmlStyle.computeRandomColor(polygonOptions.getFillColor())); } return mMap.addPolygon(polygonOptions); }