public PolygonMarkers addPolygonToMapAsMarkers ( GoogleMapShapeMarkers shapeMarkers , GoogleMap map , PolygonOptions polygonOptions , MarkerOptions polygonMarkerOptions , MarkerOptions polygonMarkerHoleOptions , PolygonOptions globalPolygonOptions ) { PolygonMarkers polygonMarkers = new PolygonMarkers ( this ) ; if ( globalPolygonOptions != null ) { polygonOptions . fillColor ( globalPolygonOptions . getFillColor ( ) ) ; polygonOptions . strokeColor ( globalPolygonOptions . getStrokeColor ( ) ) ; polygonOptions . geodesic ( globalPolygonOptions . isGeodesic ( ) ) ; polygonOptions . visible ( globalPolygonOptions . isVisible ( ) ) ; polygonOptions . zIndex ( globalPolygonOptions . getZIndex ( ) ) ; polygonOptions . strokeWidth ( globalPolygonOptions . getStrokeWidth ( ) ) ; } com . google . android . gms . maps . model . Polygon polygon = addPolygonToMap ( map , polygonOptions ) ; polygonMarkers . setPolygon ( polygon ) ; List < Marker > markers = addPointsToMapAsMarkers ( map , polygon . getPoints ( ) , polygonMarkerOptions , true ) ; polygonMarkers . setMarkers ( markers ) ; for ( List < LatLng > holes : polygon . getHoles ( ) ) { List < Marker > holeMarkers = addPointsToMapAsMarkers ( map , holes , polygonMarkerHoleOptions , true ) ; PolygonHoleMarkers polygonHoleMarkers = new PolygonHoleMarkers ( polygonMarkers ) ; polygonHoleMarkers . setMarkers ( holeMarkers ) ; shapeMarkers . add ( polygonHoleMarkers ) ; polygonMarkers . addHole ( polygonHoleMarkers ) ; } return polygonMarkers ; }
Add a Polygon to the map as markers