update polygon points

Topics: Windows Forms
Nov 4, 2012 at 11:28 PM



So, I've goy a polygon made from a list of PointLatLng over the map. I change the coordinates of one of those points, and I'd like to update the polygon's points without removing the "old" polygon and adding a new one?


Nov 5, 2012 at 11:03 AM


Nov 6, 2012 at 2:45 AM



Thanks for your answer.

I knew that function, but I think my problem is not how to update the draw after editing the points but how to update the edited point's list.

As I understand for your reply, being the points collection read only and setted at the "new" procedure, I have three choices: 

1) keeping in memory a list of the points which I use to build the polygon object:

Dim MiPoly as GMapPolygon
MiPoly=New GMapPolygon(ListOfPoints, "my name")
So that, "ListOfPoints" should be always in memory and edited if I want to modify the polygon; after I edit that list y call UpdatePOlygonLocalPosition. I just tried that and it didin't seemed to work (actually it didn't worked, I'm looking if i made some mistake). It's not a memory-nice solution if I have (as I have) many polygons at the same time.

2) Accessing the GMapPolygon's list directly, finding the point I want to modify (by index or building custom classes to include list of points with ID), modify it and call the UpdatePolygonLocalPosition

3) cooking the source code to remove the readonly set of the points property, replacing the points list with a new one and then call UpdatePolygonLocalPosition.


So, as modifying a polygon's points, i think, is a common issue, is that i think there should be a simplier solution i'm missing....




Nov 6, 2012 at 5:03 AM

yes, quite right