Select to view content in your preferred language

Question about EditorWidget and Edit Vertices functionality.

3616
8
04-15-2011 01:08 AM
SanajyJadhav
Deactivated User
Hi,

We are using EditorWidget in our application since it gives cool user experience.It is really amazing control, I like it very much.Now,I want to give our user Edit Vertices (Edit Geometry) functionality that is built in within EditorWidget.

After going through the help documentation of API, I found that FeatureLayer's "IsReadOnly" property has to be false for this functionality.But this property itself is "Read Only".As per documentation,it is available once the feature layer is initialized.I tried it after the layer is initialized, but still I cannot use it.

So, my concern is how should I deal with this property to offer Edit Geometry functionality using EditorWidget.Using normal Editor is not a feasible option for us.

Any help would be really appreciated.

Thanks and regards,
Sanjay J.
0 Kudos
8 Replies
SanajyJadhav
Deactivated User
I debugged my code when I add my featurelayers to the map.I checked the value of "IsReadOnly" property of the FeatureLayer object.It was "False".That means, geometry of the features in my layer can be edited.

Then, what am I missing here? why can't I save the edits done to the vertices of the feature?Strange thing is, when I edit the vertices, the save changes to database button is never enabled, it's always grayed out.

This is very confusing.Am I missing some steps in this Edit Geometry functionality?Can anybody please tell me the correct workflow for editing the geometry of the feature?

Regards,
Sanjay.
0 Kudos
IgressT
Emerging Contributor
I debugged my code when I add my featurelayers to the map.I checked the value of "IsReadOnly" property of the FeatureLayer object.It was "False".That means, geometry of the features in my layer can be edited.

Then, what am I missing here? why can't I save the edits done to the vertices of the feature?Strange thing is, when I edit the vertices, the save changes to database button is never enabled, it's always grayed out.

This is very confusing.Am I missing some steps in this Edit Geometry functionality?Can anybody please tell me the correct workflow for editing the geometry of the feature?

Regards,
Sanjay.


You have to use a feature service to edit a feature layer.
0 Kudos
SanajyJadhav
Deactivated User
My featurelayer comes from featureservice only.I forgot to mention that all other functionalities like add new features,union,cut, change attribute values ,etc work just fine.

Issue is for Edit Geometry task only.

Is there anybody to help me out?

Thx,
Sanjay.
0 Kudos
JenniferNery
Esri Regular Contributor
Have you looked at the following SDK sample? http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#ToolkitEditorWidget

FeatureLayer.Url must come from feature service.
FeatureLayer.ID must be set.
At minimum, EditorWidget.Map must be set and this map should contain this FeatureLayer.
If EditorWidget.LayerIDs is also set, it must include this FeatureLayer.ID

If TemplatePicker part of the EditorWidget is working, try to add a feature and edit the geometry of this feature. It could be that the feature you are trying to edit is from the ArcGISDynamicMapServiceLayer and not from the FeatureLayer.

If Reshape/Cut/Union part of the EditorWidget are all working, try to edit the geometry of features these other commands work on.

If EditVertices part of the EditorWidget still fails, please check if you have updated EditorWidgetStyle. Kindly share some code with us too to help us reproduce the issue.

Thanks.
0 Kudos
SanajyJadhav
Deactivated User
Jennifer,

Thanks for getting back to me.As I had suspected,it seems that workflow was not correct while doing edit geometry task.

The right workflow should be as below (in my opinion)

1.Click on Edit Geometry option on widget.
2.Select the feature on the map.
3.Do the editing.
4.Double click on the feature to finish the task.
5.At this point,Save Edits option gets enabled.
6.Save edits.
7.I have subscribed to the FeatureLayer_EndSaveEdits event.In thar event, I execute the following code.
[PHP]
void fl_EndSaveEdits(object sender, ESRI.ArcGIS.Client.Tasks.EndEditEventArgs e)
        {
            FeatureLayer fL = sender as FeatureLayer;
            //fL.Update();
            fL.Refresh();
        }
[/PHP]

8. Now every thing seems fine except one issue.

I am now struggling for immediately reflecting changes on the map.Whenever any editing operation is done on the client, changes are not immediately reflected in the map.Could I get one single method to call, that would immediately reflect changes done to the user once the changes are saved? I guess it would be either FeatureLayer::Update() or FeatureLayer::Refresh().I am still working on it.

Thanks,
Sanjay J.
0 Kudos
JenniferNery
Esri Regular Contributor
Thank you for your feedback. We currently use double-click to delete a vertex and mouse left button down on the feature to complete the edit. I think that even if you want to use double-click to finalize the edit, this will raise a mouse left button down event first which means the edit will still be completed.

You may want to set FeatureLayer.DisableClientCaching to true: http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.FeatureLay...

I would not call Update() unless necessary. If the parameters of your query does not change, you don't need to call Update() on EndSaveEdits: http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.FeatureLay...
0 Kudos
SanajyJadhav
Deactivated User
Jenn,Thanks for the reply.

I inspected my data and found that it is not cleaned topologically.It contains overlaps, undershoots and all that stuff.So, when I say that if I edit the vertices of any polygon and it is not immediately getting reflected, it is mere data issue.The edits are getting reflected without calling FeatureLayer::Refresh or FeatureLayer::Update.I am not calling these methods anymore.

So, sorry for bothering you as this issue was data related.

All I can say that, my editing functionality would not have come into existence without your help.You,ESRI guys, are amazing on this forum.

All is set for editing now.

Thanks and regards,
Sanjay Jadahv.
0 Kudos
JenniferNery
Esri Regular Contributor
No worries. Glad you got everything figured out. 🙂
0 Kudos