11package plugin .google .maps ;
22
3- import java .util .List ;
3+ import com .google .android .gms .maps .model .LatLng ;
4+ import com .google .android .gms .maps .model .LatLngBounds ;
5+ import com .google .android .gms .maps .model .Polygon ;
6+ import com .google .android .gms .maps .model .PolygonOptions ;
47
58import org .apache .cordova .CallbackContext ;
69import org .json .JSONArray ;
710import org .json .JSONException ;
811import org .json .JSONObject ;
912
10- import com .google .android .gms .maps .model .LatLng ;
11- import com .google .android .gms .maps .model .LatLngBounds ;
12- import com .google .android .gms .maps .model .Polygon ;
13- import com .google .android .gms .maps .model .PolygonOptions ;
13+ import java .util .List ;
1414
1515public class PluginPolygon extends MyPlugin implements MyPluginInterface {
1616
@@ -36,6 +36,18 @@ private void createPolygon(final JSONArray args, final CallbackContext callbackC
3636 builder .include (path .get (i ));
3737 }
3838 }
39+
40+ if (opts .has ("holes" )) {
41+ JSONArray holes = opts .getJSONArray ("holes" );
42+ int i , j ;
43+ JSONArray latLngArray ;
44+ JSONObject pointJSON ;
45+ for (i = 0 ; i < holes .length (); i ++) {
46+ latLngArray = holes .getJSONArray (i );
47+ polygonOptions .addHole (PluginUtil .JSONArray2LatLngList (latLngArray ));
48+ }
49+
50+ }
3951 if (opts .has ("strokeColor" )) {
4052 color = PluginUtil .parsePluginColor (opts .getJSONArray ("strokeColor" ));
4153 polygonOptions .strokeColor (color );
0 commit comments