Clearing Shapes from the Map

Last post 3/13/2009 4:00:42 AM by Chris Pietschmann. 1 replies. << Back to Web.Maps.VE v2.0 General
2/19/2009 3:49:02 AM
ctadlock

Clearing Shapes from the Map

It seems that clearing shapes from the map is very buggy or else I just dont understand how it works. Does it only clear shapes that were created on the server?

Here is my workflow...

1. Load the page, server draws a polygon on the map.
2. On the client side, user can delete the polygon and draw a new one.
3. When user is done drawing the polygon, and asyc postback reloads the page.
4. On this async reload, the server clears the existing shapes using this.Map.MyLayer.Shapes.Clear(). It then creates a new shapes and add it to the layer.
5. When the client gets the response, both shapes are in the layer! Yet only the server shape should be there since we cleared the one created on the client.

Notes
- I have AsyncPostbackPassShapes="true".
- When debugging the server I can watch the client shape be passed in the collection (count=1), I see that MyLayer.Shapes.Clear() clears the collection (Count = 0), and then I add a new shape to the collection the shape count is 1.

What am I missing here?

CT
3/13/2009 4:00:42 AM
Chris Pietschmann

Re:Clearing Shapes from the Map

Have you tried removing the ShapeLayer from the Map? This would essentially do the same thing by removing all the layers shapes from display, but would be handled differently by the control internally. Let me know if this helps the issue.