1

Closed

Polygon EnableDrawing & EnableEditing

description

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
Closed Nov 1, 2009 at 9:24 AM by

comments