<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How do I delete a vertex from an existing polyline? in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/how-do-i-delete-a-vertex-from-an-existing-polyline/m-p/651476#M8135</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Freddie,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Extending the Editor class worked like a charm. Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And fortunately there was no real additional code I needed to write to Delete the vertex. I just passed in the VertexPosition object from the extended Editor to the Delete command, and the selected vertex was deleted.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 Oct 2015 23:18:40 GMT</pubDate>
    <dc:creator>TomRippetoe</dc:creator>
    <dc:date>2015-10-13T23:18:40Z</dc:date>
    <item>
      <title>How do I delete a vertex from an existing polyline?</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/how-do-i-delete-a-vertex-from-an-existing-polyline/m-p/651473#M8132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to delete a vertex from an existing polyline, and I cannot seem to figure out the workflow to do it.&amp;nbsp; From a UX perspective, my idealized version of the workflow would be to start an edit operation on a polyline, select a particular vertex, right click to open a context menu, and then click a 'Delete' button.&amp;nbsp; That part of the workflow I can do, but I can't figure out what to do in the code after the 'Delete' button has been clicked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I get access to selected vertex?&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;There is a private property (m_VertexPosition) on the MapView.Editor object that I would like to access but can't get to directly. Ideally, that should be a public property that I could get to.&lt;/LI&gt;&lt;LI&gt;There is a VertexPosition property in the GeometryEditStatus event object that is passed into the 'Progess.ProgressChanged' event, but that event seems to be raised only after some edit action, e.g. move, etc, has been performed. And I am not sure how to manually raise the event with a fully populated GeometryEditStatus&lt;/LI&gt;&lt;LI&gt;I though about using a 'mousedown' event when the vertex is selected, and iterating over the Editor's input geometry to find a matching coordinate pair, but what happens if the user wants to delete a vertex that was added as part of the edit action and is not part of the input geometry&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So it seems like i am not on quite on the right path for now.&amp;nbsp; Any help or guidance would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sample Code&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Progress&amp;lt;GeometryEditStatus&amp;gt; progress = new Progress&amp;lt;GeometryEditStatus&amp;gt;();
progress.ProgressChanged += progress_ProgressChanged;
Geometry.Geometry newPolyline = await mv.Editor.EditGeometryAsync(g.Geometry, null, progress); 
progress.ProgressChanged -= progress_ProgressChanged;


void progress_ProgressChanged(object sender, GeometryEditStatus e)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (e.GeometryEditAction == GeometryEditAction.MovedVertex)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ICommand delete = mv.Editor.DeleteVertex;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; delete.Execute(e.VertexPosition);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:37:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/how-do-i-delete-a-vertex-from-an-existing-polyline/m-p/651473#M8132</guid>
      <dc:creator>TomRippetoe</dc:creator>
      <dc:date>2021-12-12T03:37:50Z</dc:date>
    </item>
    <item>
      <title>Re: How do I delete a vertex from an existing polyline?</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/how-do-i-delete-a-vertex-from-an-existing-polyline/m-p/651474#M8133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you tried extending the Editor class? I'm able to accomplish this with the logic shown below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;public class MyEditor : Editor
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; private VertexPosition _vertexPosition ;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public VertexPosition MyPosition { get { return this._vertexPosition; } set { this._vertexPosition = value; } }

&amp;nbsp;&amp;nbsp;&amp;nbsp; public MyEditor()
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _vertexPosition = null;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }

&amp;nbsp;&amp;nbsp;&amp;nbsp; protected override Symbol OnGenerateSymbol(GenerateSymbolInfo generateSymbolInfo)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (generateSymbolInfo.GenerateSymbolType == GenerateSymbolType.SelectedVertex)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _vertexPosition = generateSymbolInfo.VertexPosition;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return base.OnGenerateSymbol(generateSymbolInfo);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a result of geometries being immutable I don't believe you would be able to modify an existing geometry's vertices. Instead, you should be able to use the builder to create a new line or polygon with your needed change. For example, I use this approach to move the vertices for polygons to the current gps location. I use the following line to get an array of the vertices for my selected polygon.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var points = ((Polygon) EditGeometry).Parts[0].GetPoints().ToArray();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once I have the array of points I then use the index of the selected vertex to manipulate this array prior to calling the PolygonBuilder and creating a new polygon with my needed geometry.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:37:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/how-do-i-delete-a-vertex-from-an-existing-polyline/m-p/651474#M8133</guid>
      <dc:creator>FreddieGibson</dc:creator>
      <dc:date>2021-12-12T03:37:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I delete a vertex from an existing polyline?</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/how-do-i-delete-a-vertex-from-an-existing-polyline/m-p/651475#M8134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for the tip. I will give it a try and let you know how it goes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Oct 2015 20:23:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/how-do-i-delete-a-vertex-from-an-existing-polyline/m-p/651475#M8134</guid>
      <dc:creator>TomRippetoe</dc:creator>
      <dc:date>2015-10-12T20:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do I delete a vertex from an existing polyline?</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/how-do-i-delete-a-vertex-from-an-existing-polyline/m-p/651476#M8135</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Freddie,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Extending the Editor class worked like a charm. Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And fortunately there was no real additional code I needed to write to Delete the vertex. I just passed in the VertexPosition object from the extended Editor to the Delete command, and the selected vertex was deleted.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Oct 2015 23:18:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/how-do-i-delete-a-vertex-from-an-existing-polyline/m-p/651476#M8135</guid>
      <dc:creator>TomRippetoe</dc:creator>
      <dc:date>2015-10-13T23:18:40Z</dc:date>
    </item>
  </channel>
</rss>

