<?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 Draw object - mouse last position used in Addvertex in ArcGIS API for Silverlight Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/draw-object-mouse-last-position-used-in-addvertex/m-p/41664#M1106</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We have a floatable window which when an 'Add' button is pressed takes two text coordinates and creates a new map point with the correct spatial reference.&amp;nbsp; This is passed to a geometry service for projection.&amp;nbsp; When this completes the point is added to the map.&amp;nbsp; This works well for a single point and the first point of a line.&amp;nbsp; However for the second point of a line as the mouse goes over the add button end of the line (that???s tracking the mouse) freezes (as expected).&amp;nbsp; When you press the add button its this frozen point that is used for the lines 2nd point.&amp;nbsp; The strange thing is if you break on this line:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;_DrawObject.AddVertex(resultMapPoint);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The resultMapPoint correlates to the user input (easy to check when no projection is required due to matching spatial references) Not the frozen point.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So at some point the draw object is using the last position of the lines endpoint to add a vertex.&amp;nbsp; Also note the point entered by the user appears to be used for another vertex (3rd one) but disappears when the mouse moves off of the button.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anyone explain this behaviour and offer a work around etc?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks, Matt&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 19 Jul 2011 09:29:49 GMT</pubDate>
    <dc:creator>MatthewPilgrim</dc:creator>
    <dc:date>2011-07-19T09:29:49Z</dc:date>
    <item>
      <title>Draw object - mouse last position used in Addvertex</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/draw-object-mouse-last-position-used-in-addvertex/m-p/41664#M1106</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We have a floatable window which when an 'Add' button is pressed takes two text coordinates and creates a new map point with the correct spatial reference.&amp;nbsp; This is passed to a geometry service for projection.&amp;nbsp; When this completes the point is added to the map.&amp;nbsp; This works well for a single point and the first point of a line.&amp;nbsp; However for the second point of a line as the mouse goes over the add button end of the line (that???s tracking the mouse) freezes (as expected).&amp;nbsp; When you press the add button its this frozen point that is used for the lines 2nd point.&amp;nbsp; The strange thing is if you break on this line:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;_DrawObject.AddVertex(resultMapPoint);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The resultMapPoint correlates to the user input (easy to check when no projection is required due to matching spatial references) Not the frozen point.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So at some point the draw object is using the last position of the lines endpoint to add a vertex.&amp;nbsp; Also note the point entered by the user appears to be used for another vertex (3rd one) but disappears when the mouse moves off of the button.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anyone explain this behaviour and offer a work around etc?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks, Matt&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jul 2011 09:29:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/draw-object-mouse-last-position-used-in-addvertex/m-p/41664#M1106</guid>
      <dc:creator>MatthewPilgrim</dc:creator>
      <dc:date>2011-07-19T09:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: Draw object - mouse last position used in Addvertex</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/draw-object-mouse-last-position-used-in-addvertex/m-p/41665#M1107</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am updating this sample to&amp;nbsp; mimic what you are trying to do in your Silverlight app: &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#Project" rel="nofollow noopener noreferrer" target="_blank"&gt;http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#Project&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I added the following resource:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;lt;esri:SimpleLineSymbol x:Key="DrawLineSymbol" Color="Green" Width="4" /&amp;gt;
&amp;lt;esri:SimpleFillSymbol x:Key="DrawFillSymbol" Fill="#3300FF00" BorderBrush="Green" BorderThickness="2" /&amp;gt;&amp;nbsp;&amp;nbsp; 
&amp;lt;esri:SimpleFillSymbol x:Key="DefaultFillSymbol" Fill="#33FF0000" BorderBrush="Red" BorderThickness="2" /&amp;gt;
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Added a button to complete draw: &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
 &amp;lt;Button Content="Complete" Margin="0,5,5,0" Click="Button_Click" /&amp;gt;
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And the following code InitializeComponent():&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
 draw = new Draw(MyMap)
 {
&amp;nbsp; LineSymbol = LayoutRoot.Resources["DrawLineSymbol"] as LineSymbol,
&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; FillSymbol = LayoutRoot.Resources["DrawFillSymbol"] as FillSymbol,
&amp;nbsp; DrawMode = DrawMode.Polygon,
&amp;nbsp; IsEnabled = true
 };
 draw.DrawComplete += draw_DrawComplete;
}

Draw draw;
void draw_DrawComplete(object sender, DrawEventArgs e)
{
 graphicsLayer.Graphics.Add
 (new Graphic()
 {
&amp;nbsp; Geometry = e.Geometry,
&amp;nbsp; Symbol = LayoutRoot.Resources["DefaultFillSymbol"] as Symbol
 });
 MyMap.PanTo(e.Geometry);&amp;nbsp;&amp;nbsp; 
}

private void Button_Click(object sender, RoutedEventArgs e)
{
 draw.CompleteDraw();
 draw.IsEnabled = false;
}
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I modified the code to add vertex instead of adding graphic to the map:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
draw.AddVertex(resultMapPoint);
//graphicsLayer.Graphics.Add(resultGraphic);
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think this is what you are trying to do but I did not get application to freeze.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:36:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/draw-object-mouse-last-position-used-in-addvertex/m-p/41665#M1107</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2021-12-10T21:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: Draw object - mouse last position used in Addvertex</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/draw-object-mouse-last-position-used-in-addvertex/m-p/41666#M1108</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jennifer,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for taking time to try this.&amp;nbsp; My drawmode is polyline.&amp;nbsp; Also can you confirm that you are taking the value typed in, projecting it and then using the resulting projection as the resultMapPoint.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So you should get this behaviour:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1) type in co-ords and press Add.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Line started on screen - moving the mouse moves the loose end of the line (point 2).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3) move mouse over co-ord dialog - as you do the line stops redrawing (freeze as expected)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4) change X co-ord and press Add.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;5) you should get a second point to make a horizontal line, with the free end of the line (now point three) following the mouse (when not over the dialog).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For step 5 I get: a point (2nd) where the line froze in step 3 and 3rd point corresponding to the co-ord specified in step 4.&amp;nbsp; When I move the mouse the last point disappears.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I do not have a complete button yet!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Matt&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2011 09:06:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/draw-object-mouse-last-position-used-in-addvertex/m-p/41666#M1108</guid>
      <dc:creator>MatthewPilgrim</dc:creator>
      <dc:date>2011-07-20T09:06:56Z</dc:date>
    </item>
    <item>
      <title>Re: Draw object - mouse last position used in Addvertex</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/draw-object-mouse-last-position-used-in-addvertex/m-p/41667#M1109</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I still cannot get the app to freeze by following your steps. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But I do see that MouseMove, updates the location of added vertex. This seems like a bug. We'll try to fix this in future versions of the API. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you can, please try to follow the code changes in my previous post and let me know if the app still freezes. To have this sample to work with Polyline, you need to change DrawMode and add a DefaultLineSymbol in your resources.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Jul 2011 00:06:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/draw-object-mouse-last-position-used-in-addvertex/m-p/41667#M1109</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2011-07-23T00:06:51Z</dc:date>
    </item>
    <item>
      <title>Re: Draw object - mouse last position used in Addvertex</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/draw-object-mouse-last-position-used-in-addvertex/m-p/41668#M1110</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I apologize if the term �??freeze�?? has misled you.&amp;nbsp; By this I meant when the mouse pointer moves over the dialog I use to enter the coordinates it no longer update the line been drawn (from the last point to the mouse). i.e. the line freezes not the application.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for acknowledging the other issue and offering to fix it in a forthcoming version.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can I suggest that the Draw object is extended a little to make it more flexible?&amp;nbsp; For example adding events for before and after a point being added.&amp;nbsp; Where they offer the ability to cancel the point or mark it as handled.&amp;nbsp; Also exposing the temporary collection of vertex that are being added would be useful in all events.&amp;nbsp; Scenarios where this help include:&lt;/SPAN&gt;&lt;BR /&gt;&lt;OL&gt;&lt;BR /&gt;&lt;LI&gt;Writing your own �??snap�?? code where the point the user clicks is changed to a point on top of some other geometry (either in a BeforeAdd event by changing the e.NewPoint or in an AfterAdd event by removing the last point and adding another.&amp;nbsp; Note I�??ve tried the latter approach and without access to the vertices it�??s hard to know if it the first point or not - so you could also add a flag for FirstPoint and LastPoint.&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Writing a coordinate type-in where at any point during the draw process (including the first point) the user can type in an x/y pair and hit a button.&amp;nbsp; This would call draw.addVertex as describe in the thread above.&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Validating the users input, i.e. require a 5 sided polygon or a shape with an area &amp;gt; x miles.&amp;nbsp; This could be checked on AddPoint event and the point rejected if it is not valid.&lt;/LI&gt;&lt;BR /&gt;&lt;/OL&gt;&lt;SPAN&gt;Hope this helps the development effort,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Matt&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jul 2011 08:51:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/draw-object-mouse-last-position-used-in-addvertex/m-p/41668#M1110</guid>
      <dc:creator>MatthewPilgrim</dc:creator>
      <dc:date>2011-07-25T08:51:13Z</dc:date>
    </item>
  </channel>
</rss>

