Polygon enableDrawing & enableEditing in JS (before the next release)

Coordinator
Oct 29, 2009 at 7:01 AM
Edited Oct 29, 2009 at 7:05 AM

Hi there,

These days I was asked by Andrew how to enableDrawing and enableEditing for a polygon.
That functionality is not yet implemented and for sure will be in the next release, but by then you could achieve that using JS code.
GoogleMap Control has his own JS classes to wrap the Google Map API JS objects, like: map, marker, polygon etc.
In every GoogleMap control JS class I keep a reference to the original JS Google Maps API object and it can be used in cases like this to use some of the Goole Maps API functionality directly, when it is not yet implemented in GoogleMap control.

So, back to polygon.
The GoogleMap control Polygon JS class keep the reference to the Google Maps API polygon object in its GPolygon member.
Now, using that here is a simple JS sample of how enableDrawing & enableEditing can be invoked.
Let's say your GoogleMap control on the page has ID="GoogleMap1" and you want to enable those goodies for the first (maybe the only) polygon.
Here is how the code should look like:

 

function enableGoodies() {
    var poly = GoogleMap1.Polygons[0];
    
    poly.GPolygon.enableDrawing();
    poly.GPolygon.enableEditing();    
}

Hope this helps.

Regards

Coordinator
Nov 1, 2009 at 8:10 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
Nov 4, 2009 at 11:05 AM

This was implemented in the next planned release 4.1