/**
* @ngdoc directive
* @name shape
* @requires Attr2Options
* @description
* Initialize a Google map shape in map with given options and register events
* The shapes are:
* . circle
* . polygon
* . polyline
* . rectangle
* . groundOverlay(or image)
*
* Requires: map directive
*
* Restrict To: Element
*
* @param {Boolean} centered if set, map will be centered with this marker
* @param {String} <OPTIONS>
* For circle, [any circle options](https://developers.google.com/maps/documentation/javascript/reference#CircleOptions)
* For polygon, [any polygon options](https://developers.google.com/maps/documentation/javascript/reference#PolygonOptions)
* For polyline, [any polyline options](https://developers.google.com/maps/documentation/javascript/reference#PolylineOptions)
* For rectangle, [any rectangle options](https://developers.google.com/maps/documentation/javascript/reference#RectangleOptions)
* For image, [any groundOverlay options](https://developers.google.com/maps/documentation/javascript/reference#GroundOverlayOptions)
* @param {String} <MapEvent> Any Shape events, https://developers.google.com/maps/documentation/javascript/reference
* @example
* Usage:
*
*
* Example:
*
*
*
*
*
*
*
*
*
*
*
* For full-working example, please visit
* [shape example](https://rawgit.com/allenhwkim/angularjs-google-maps/master/build/shape.html)
*/
ngMap.directive('shape', ['Attr2Options', function(Attr2Options) {
var parser = Attr2Options;
var getBounds = function(points) {
return new google.maps.LatLngBounds(points[0], points[1]);
};
var getShape = function(options, events) {
var shape;
var shapeName = options.name;
delete options.name; //remove name bcoz it's not for options
console.log("shape", shapeName, "options", options, 'events', events);
/**
* set options
*/
if (options.icons) {
for (var i=0; i