Select to view content in your preferred language

Autp save Graphics Layer

671
2
11-20-2011 05:09 PM
Hwee_KiangSim
Emerging Contributor
Hi,
Does anyone know how to auto save edits on the graphics layer? I have some polygons on a graphic layer. I used EditGeometry to let user adjust the vertices. However, I realise the coordinates of the polygons are not updated until I call StopEdit of the EditGeometry. This is especially so when a vertice is added and the polygon coordinates are not updated immediately.

In addition, I need real time feedback of the update coordinates and actions, but the events captured by EditGeometry are "post-edit" i.e. Vertices_added, Vertices_moved etc, and not "OnMoved", "OnAdded".

Is there any nice solution out there or do I have to resort to writing my own edit class instead. Advance thanks for the help!
0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor
AutoSave is a property of FeatureLayer.

Have you looked at the following SDK samples?
AutoSave=True on FeatureLayer. Editor.EditVertices command completes when you click on the same feature or start an edit on another feature.
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#EditToolsAutoSave
Similar to the example above except AutoSave=False so SaveEdits() need to be called explicitly, this is handled by Editor.Save command.
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#EditToolsExplicitSave
This use GraphicsLayer but you can also use it with FeatureLayer. EditGeometry can complete interactively (mouse down on feature) or programmatically (StopEdit()). Upon completion though, you may need to simplify the geometry to ensure it is topologically correct.
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#EditToolsGeometry
To simplify: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#Simplify

If you are not seeing your committed geometry edits, subscribe to EndSaveEdits and SaveEditsFailed, check if save was successful. Also run Fiddler to monitor the web requests.
0 Kudos
Hwee_KiangSim
Emerging Contributor
Hi Jennifer,
Thanks so much for your reply.
My usage is slightly different here, firstly, my user may not have internet connection all the time, so I do not think I can use feature layer that requires a Url (i hope I understand correctly that I need to provide a url?) Unless I can point it to a local url?

I have a few polygons in my graphics layer. What I want is while I am adjusting the vertices of one polygon, I am able to capture the delta moved / vertices added and apply this change to the rest of the polygons (real time).
I tried capturing the vertice added event of geometry edit action, but the vertices added are not updated unless I call a StopEdit(). But this will enmake my whole editing process unsmooth since the user will have to reclick on the polygon again to enable edit.

Hope you understand what I meant. Any possible workaround or suggestions are welcomed. Thanks!
0 Kudos