Select to view content in your preferred language

Can I delete vertex on a graphic layer

1419
5
10-09-2010 05:00 PM
DanDong
Deactivated User
Hi all,

    I was coding the functions by using C# and silverlight, I draw a polygon on a graphic layer. Then I want to have a function to delete some of the vertex on the polygon or delete the last point when I am drawing the polygon. Can I do this on a graphic layer? or I must do this on a feature layer? Can you give me some sample codes or suggestion on that? Thank you very much!
0 Kudos
5 Replies
DanDong
Deactivated User
can anybody help me~~~~

I just went through 'editor', it can be used in graphic layer and feature layer. So my question is, I have drawn a polygon in a graphic layer with MyDrawObject.DrawMode = DrawMode.Polygon. I want to use editvertex function to edit this polygon, but I dont know how can implement this. If I can edit the polygon in the graphic layer, then I can double click the vertex than delete it. Thanks for everybody!
0 Kudos
JenniferNery
Esri Regular Contributor
If you want to undo the last vertex while drawing the graphic, this feature enhancement is still in the works for v2.1.

If you want to edit vertices of a graphic that has already been drawn, you should be able to do this on a GraphicsLayer with no problem. You can create a button and set its DataContext to an Editor.

It is similar to this except you are working with GraphicsLayer not FeatureLayer. Look at the button for "Edit Vertices"
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#EditToolsAutoSave
0 Kudos
CarolynWhite
Deactivated User
Where can I read about about this new feature in the draw class in 2.1?
0 Kudos
IgressT
Emerging Contributor
Where can I read about about this new feature in the draw class in 2.1?


This worked for me.
I created a graphics layer , set the editor graphics layer as this layer.
Created a new polygon graphic and selected the Edit Vertices in the editor which displayed all the vertices of the graphic.
I double clicked the vertex which i wanted to delete and the vertex was deleted

Not sure if thats what you want.
0 Kudos
JenniferNery
Esri Regular Contributor
If you are using Draw, you can read about these methods from here: http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Draw_metho...

You can modify this sample to include the following code. Be sure to wire up to Map.MouseClick and Map.KeyDown events.http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#DrawGraphics
MapPoint addPoint;
void MyMap_MouseClick(object sender, ESRI.ArcGIS.Client.Map.MouseEventArgs e)
{
 addPoint = e.MapPoint;
}

void MyMap_KeyDown(object sender, KeyEventArgs e)
{
 if (e.Key == Key.Delete)
  MyDrawObject.UndoLastVertex();
 else if (e.Key == Key.Insert)
  MyDrawObject.AddVertex(addPoint);
 else if (e.Key == Key.Enter)
  MyDrawObject.CompleteDraw();
}
0 Kudos