ui-map icon indicating copy to clipboard operation
ui-map copied to clipboard

Support for drawing tools

Open grtjn opened this issue 11 years ago • 2 comments

I have been using ui-map a lot so far, but now wanted to go a step further, and support polygon or rectangle drawing for arbitrary selections on the map. I copied code from this example:

https://developers.google.com/maps/documentation/javascript/examples/drawing-tools

That roughly works as expected, but I am not sure how to attach to the overlaycomplete event. Adding map-overlaycomplete to the ui-events attribute doesn't seem to do the trick, nor adding it inside the directives. Looks like it is an event on the drawingmanager, not on the map.

I would love to see DrawingManager to get integrated into this directive, with support of at least that overlaycomplete event..

grtjn avatar Nov 10 '14 15:11 grtjn

@grtjn , You might want to take a look at the https://angular-ui.github.io/angular-google-maps/ project instead, it has support for the drawing manager and attaching events to it already.

zacronos avatar Nov 10 '14 16:11 zacronos

vm.eventHandler = { overlaycomplete: function (dm, name, scope, objs) { console.log("You successfully placed a %s", dm.drawingMode); }, polygoncomplete: function (dm, name, scope, objs) { console.log("You finished drawing polygon to [%s]", objs[0].getPath().getArray().join(",")); } }; And my html is

ui-gmap-drawing-manager options="vm.drawingManagerOptions" control="vm.drawingManagerControl" events="vm.eventHandler" ng-model='item.vm.eventHandler'ui-gmap-drawing-manager

how do i get the array and bind it so that i could save in my db

dhamu9690 avatar Sep 19 '15 04:09 dhamu9690