Skip to content

Commit 8674385

Browse files
author
masashiGMS
committed
feature request #683 (Android)
1 parent 4c51d7c commit 8674385

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

src/android/plugin/google/maps/PluginPolygon.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
package 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

58
import org.apache.cordova.CallbackContext;
69
import org.json.JSONArray;
710
import org.json.JSONException;
811
import 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

1515
public 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

Comments
 (0)