Implement PluginPolygon.js, PluginPolyline.js, and PluginCircle.js
MODIFY
src/browser/PluginCircle.js
src/browser/PluginCircle.js
@@ -139,7 +139,9 @@ PluginCircle.prototype.setZIndex = function(onSuccess, onError, args) {
var zIndex = args[1];
var circle = self.pluginMap.objects[overlayId];
if (circle) {
- circle.setZIndex(zIndex);
+ circle.setOptions({
+ 'zIndex': zIndex
+ });
}
onSuccess();
};

MODIFY
src/browser/PluginPolygon.js
src/browser/PluginPolygon.js
@@ -72,6 +72,23 @@ PluginPolygon.prototype._create = function(onSuccess, onError, args) {
});
};
+PluginPolygon.prototype.setFillColor = function(onSuccess, onError, args) {
+ var self = this;
+ var overlayId = args[0];
+ var fillColor = args[1];
+ var polygon = self.pluginMap.objects[overlayId];
+ if (polygon) {
+
+ if (Array.isArray(fillColor)) {
+ polygon.setOptions({
+ 'fillColor': 'rgb(' + fillColor[0] + ',' + fillColor[1] + ',' + fillColor[2] + ')',
+ 'fillOpacity': fillColor[3] / 256
+ });
+ }
+ }
+ onSuccess();
+};
+
PluginPolygon.prototype.setStrokeColor = function(onSuccess, onError, args) {
var self = this;
var overlayId = args[0];
@@ -108,7 +125,9 @@ PluginPolygon.prototype.setZIndex = function(onSuccess, onError, args) {
var zIndex = args[1];
var polygon = self.pluginMap.objects[overlayId];
if (polygon) {
- polygon.setZIndex(zIndex);
+ polygon.setOptions({
+ 'zIndex': zIndex
+ });
}
onSuccess();
};
@@ -155,7 +174,9 @@ PluginPolygon.prototype.setGeodesic = function(onSuccess, onError, args) {
var overlayId = args[0];
var polygon = self.pluginMap.objects[overlayId];
if (polygon) {
- polygon.setGeodesic(args[1] === true)
+ polygon.setOptions({
+ 'geodesic': args[1] === true
+ });
}
onSuccess();
};
@@ -192,6 +213,121 @@ PluginPolygon.prototype.removePointAt = function(onSuccess, onError, args) {
onSuccess();
};
+PluginPolygon.prototype.setHoles = function(onSuccess, onError, args) {
+ var self = this,
+ overlayId = args[0],
+ polygon = self.pluginMap.objects[overlayId];
+ if (polygon) {
+ var paths = polygon.getPaths(),
+ holeList = args[1],
+ newPaths = new google.maps.MVCArray([paths.getAt(0)]);
+
+ holeList.forEach(function(holeVertixes) {
+ var hole = new google.maps.MVCArray();
+ holeVertixes.forEach(function(vertix) {
+ hole.push(new google.maps.LatLng(vertix.lat, vertix.lng));
+ });
+ newPaths.push(hole);
+ });
+ polygon.setPaths(newPaths);
+ }
+ onSuccess();
+};
+
+PluginPolygon.prototype.insertPointOfHoleAt = function(onSuccess, onError, args) {
+ var self = this,
+ overlayId = args[0],
+ holeIndex = args[1],
+ pointIndex = args[2],
+ position = args[3],
+ polygon = self.pluginMap.objects[overlayId];
+
+ if (polygon) {
+ var index = args[1];
+ var latLng = new google.maps.LatLng(position.lat, position.lng);
+ polygon.getPaths().getAt(holeIndex).insertAt(pointIndex, latLng);
+ }
+ onSuccess();
+};
+
+PluginPolygon.prototype.setPointOfHoleAt = function(onSuccess, onError, args) {
+ var self = this,
+ overlayId = args[0],
+ holeIndex = args[1],
+ pointIndex = args[2],
+ position = args[3],
+ polygon = self.pluginMap.objects[overlayId];
+
+ if (polygon) {
+ var index = args[1];
+ var latLng = new google.maps.LatLng(position.lat, position.lng);
+ polygon.getPaths().getAt(holeIndex).setAt(pointIndex, latLng);
+ }
+ onSuccess();
+};
+
+PluginPolygon.prototype.removePointOfHoleAt = function(onSuccess, onError, args) {
+ var self = this,
+ overlayId = args[0],
+ holeIndex = args[1],
+ pointIndex = args[2],
+ polygon = self.pluginMap.objects[overlayId];
+
+ if (polygon) {
+ polygon.getPaths().getAt(holeIndex).removeAt(pointIndex);
+ }
+ onSuccess();
+};
+
+
+PluginPolygon.prototype.insertHoleAt = function(onSuccess, onError, args) {
+ var self = this,
+ overlayId = args[0],
+ holeIndex = args[1],
+ vertixes = args[2],
+ polygon = self.pluginMap.objects[overlayId];
+
+ if (polygon) {
+ var hole = new google.maps.MVCArray();
+ vertixes.forEach(function(vertix) {
+ hole.push(new google.maps.LatLng(vertix.lat, vertix.lng));
+ });
+ polygon.getPaths().insertAt(holeIndex, hole);
+ }
+ onSuccess();
+};
+
+
+
+PluginPolygon.prototype.setHoleAt = function(onSuccess, onError, args) {
+ var self = this,
+ overlayId = args[0],
+ holeIndex = args[1],
+ vertixes = args[2],
+ polygon = self.pluginMap.objects[overlayId];
+
+ if (polygon) {
+ var hole = new google.maps.MVCArray();
+ vertixes.forEach(function(vertix) {
+ hole.push(new google.maps.LatLng(vertix.lat, vertix.lng));
+ });
+ polygon.getPaths().setAt(holeIndex, hole);
+ }
+ onSuccess();
+};
+
+
+PluginPolygon.prototype.removeHoleAt = function(onSuccess, onError, args) {
+ var self = this,
+ overlayId = args[0],
+ holeIndex = args[1],
+ polygon = self.pluginMap.objects[overlayId];
+
+ if (polygon) {
+ polygon.getPaths().removeAt(holeIndex);
+ }
+ onSuccess();
+};
PluginPolygon.prototype.remove = function(onSuccess, onError, args) {
var self = this;
var overlayId = args[0];

MODIFY
src/browser/PluginPolyline.js
src/browser/PluginPolyline.js
@@ -59,7 +59,6 @@ PluginPolyline.prototype._create = function(onSuccess, onError, args) {
});
self.pluginMap.objects[polylineId] = polyline;
- self.pluginMap.objects['polyline_property_' + polylineId] = polylineOpts;
onSuccess({
'id': polylineId
@@ -75,11 +74,112 @@ PluginPolyline.prototype.remove = function(onSuccess, onError, args) {
polyline = undefined;
self.pluginMap.objects[overlayId] = undefined;
delete self.pluginMap.objects[overlayId];
- delete self.pluginMap.objects['polyline_property_' + overlayId];
}
onSuccess();
};
+PluginPolyline.prototype.setStrokeColor = function(onSuccess, onError, args) {
+ var self = this;
+ var overlayId = args[0];
+ var polyline = self.pluginMap.objects[overlayId];
+ var strokeColor = args[1];
+ if (polyline) {
+ if (Array.isArray(strokeColor)) {
+ polyline.setOptions({
+ 'strokeColor': 'rgb(' + strokeColor[0] + ',' + strokeColor[1] + ',' + strokeColor[2] + ')',
+ 'strokeOpacity': strokeColor[3] / 256
+ });
+ }
+ }
+ onSuccess();
+};
+
+PluginPolyline.prototype.setStrokeWidth = function(onSuccess, onError, args) {
+ var self = this;
+ var overlayId = args[0];
+ var width = args[1];
+ var polyline = self.pluginMap.objects[overlayId];
+ if (polyline) {
+ polyline.setOptions({
+ 'strokeWeight': width
+ });
+ }
+ onSuccess();
+};
+
+
+PluginPolyline.prototype.setZIndex = function(onSuccess, onError, args) {
+ var self = this;
+ var overlayId = args[0];
+ var zIndex = args[1];
+ var polyline = self.pluginMap.objects[overlayId];
+ if (polyline) {
+ polyline.setOptions({
+ 'zIndex': zIndex
+ });
+ }
+ onSuccess();
+};
+
+PluginPolyline.prototype.setPoints = function(onSuccess, onError, args) {
+ var self = this,
+ polylineId = args[0],
+ positionList = args[1],
+ polyline = self.pluginMap.objects[polylineId];
+ if (polyline) {
+ //------------------------
+ // Update the points list
+ //------------------------
+ polyline.setPath(positionList);
+ }
+ onSuccess();
+};
+
+PluginPolyline.prototype.setClickable = function(onSuccess, onError, args) {
+ var self = this;
+ var overlayId = args[0];
+ var clickable = args[1];
+ var polyline = self.pluginMap.objects[overlayId];
+ if (polyline) {
+ polyline.setOptions({
+ 'clickable': clickable === true
+ });
+ }
+ onSuccess();
+};
+
+PluginPolyline.prototype.setVisible = function(onSuccess, onError, args) {
+ var self = this;
+ var overlayId = args[0];
+ var polyline = self.pluginMap.objects[overlayId];
+ if (polyline) {
+ polyline.setVisible(args[1]);
+ }
+ onSuccess();
+};
+
+PluginPolyline.prototype.setGeodesic = function(onSuccess, onError, args) {
+ var self = this;
+ var overlayId = args[0];
+ var polyline = self.pluginMap.objects[overlayId];
+ if (polyline) {
+ polyline.setOptions({
+ 'geodesic': args[1] === true
+ });
+ }
+ onSuccess();
+};
+PluginPolyline.prototype.insertPointAt = function(onSuccess, onError, args) {
+ var self = this;
+ var overlayId = args[0];
+ var polyline = self.pluginMap.objects[overlayId];
+ if (polyline) {
+ var index = args[1];
+ var latLng = new google.maps.LatLng(args[2].lat, args[2].lng);
+ polyline.getPath().insertAt(index, latLng);
+ }
+ onSuccess();
+};
PluginPolyline.prototype.setPointAt = function(onSuccess, onError, args) {
var self = this;
var overlayId = args[0];
@@ -87,8 +187,17 @@ PluginPolyline.prototype.setPointAt = function(onSuccess, onError, args) {
if (polyline) {
var index = args[1];
var latLng = new google.maps.LatLng(args[2].lat, args[2].lng);
- var opts = self.pluginMap.objects['polyline_property_' + overlayId];
- opts.path.setAt(index, latLng);
+ polyline.getPath().setAt(index, latLng);
+ }
+ onSuccess();
+};
+PluginPolyline.prototype.removePointAt = function(onSuccess, onError, args) {
+ var self = this;
+ var overlayId = args[0];
+ var polyline = self.pluginMap.objects[overlayId];
+ if (polyline) {
+ var index = args[1];
+ polyline.getPath().removeAt(index, latLng);
}
onSuccess();
};

Implement PluginPolygon.js, PluginPolyline.js, and PluginCircle.js