Bug fix: Polygon.getHoles() does not work properly
MODIFY
src/android/plugin/google/maps/PluginPolygon.java
src/android/plugin/google/maps/PluginPolygon.java
package plugin.google.maps;
-import android.util.Log;
-
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
import com.google.android.gms.maps.model.Polygon;
@@ -12,11 +10,8 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
-import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
import java.util.Set;
//Future implement
@@ -423,8 +418,6 @@ public class PluginPolygon extends MyPlugin implements MyPluginInterface {
hole.add(pointIndex, latLng);
self.objects.put(propertyId, holes);
- final ArrayList<LatLng> newHole = hole;
-
cordova.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {

MODIFY
www/Polygon.js
www/Polygon.js
@@ -56,7 +56,7 @@ var Polygon = function(map, polygonId, polygonOptions) {
var _holes = common.createMvcArray(holesProperty.getArray());
holesProperty.on('set_at', function(index) {
- var value = common.getLatLng(pointsProperty.getAt(index));
+ var value = common.getLatLng(holesProperty.getAt(index));
_holes.setAt(index,value);
});
holesProperty.on('remove_at', function(index) {
@@ -68,11 +68,11 @@ var Polygon = function(map, polygonId, polygonOptions) {
array = common.createMvcArray(array);
}
array.on('insert_at', function(idx) {
- var value = common.getLatLng(pointsProperty.getAt(index));
+ var value = common.getLatLng(array.getAt(idx));
exec(null, self.errorHandler, self.getPluginName(), 'insertPointOfHoleAt', [polygonId, index, idx, value]);
});
array.on('set_at', function(idx) {
- var value = common.getLatLng(pointsProperty.getAt(index));
+ var value = common.getLatLng(array.getAt(idx));
exec(null, self.errorHandler, self.getPluginName(), 'setPointOfHoleAt', [polygonId, index, idx, value]);
});
array.on('remove_at', function(idx) {

Bug fix: Polygon.getHoles() does not work properly