<?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: Polygon insertPoint with setTimeout in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/polygon-insertpoint-with-settimeout/m-p/635920#M59400</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Robert,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm actually REALLY trying to not have to clone, alter, and re-add the object.&amp;nbsp; My sample code is to simply show the error, however what I'm really trying to do is automate the drawing of a graphic on the screen.&amp;nbsp; similar to a car driving around New York.&amp;nbsp; I'm actually using setInterval, not setTimeout... but the issue is the same.&amp;nbsp; Since I know the distance and rate of travel I can determine the time (or milliseconds) it will take to move along the line, I can set the interval time to approximately match the true MPH of the car on the road.&amp;nbsp; My issue with cloning the graphics object&amp;nbsp; is that it's VERY expensive in processing time and throws off my calculation by adding to the milliseconds.&amp;nbsp; &amp;nbsp;Would be a lot faster processing time if I could just update the existing geometry.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Shad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 02 Feb 2019 01:21:34 GMT</pubDate>
    <dc:creator>ShadCampbell</dc:creator>
    <dc:date>2019-02-02T01:21:34Z</dc:date>
    <item>
      <title>Polygon insertPoint with setTimeout</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/polygon-insertpoint-with-settimeout/m-p/635918#M59398</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Trying to insert a point into a polygon graphic on a time delay using setTimeout.&amp;nbsp; The code works as expected if I insert the point immediately when the page loads, but if I wait three seconds nothing draws, but the data &lt;EM&gt;has&lt;/EM&gt; been updated.&amp;nbsp; &lt;A href="https://jsfiddle.net/shadc/7ef5dtu0/"&gt;This JSFiddle example&lt;/A&gt;&amp;nbsp;has&amp;nbsp;a function called start.&amp;nbsp; When I call the function directly it works, but when I call it after a 3 seconds delay using setTimeout it does not update the graphic.&amp;nbsp; Is this a bug or am I missing something?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, if I change the time to 700 milliseconds it works... 900 it does not.&amp;nbsp; In between it works randomly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function start() {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;polylineGraphic.geometry.insertPoint(0, 0, [-112.3, 53.68]);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start(); // Works&lt;BR /&gt; //setTimeout(function () { start(); }, 3000); // Does not work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Feb 2019 23:31:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/polygon-insertpoint-with-settimeout/m-p/635918#M59398</guid>
      <dc:creator>ShadCampbell</dc:creator>
      <dc:date>2019-02-01T23:31:16Z</dc:date>
    </item>
    <item>
      <title>Re: Polygon insertPoint with setTimeout</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/polygon-insertpoint-with-settimeout/m-p/635919#M59399</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Shad,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;This is the way to do it:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;      &lt;SPAN class="comment token"&gt;// Works&lt;/SPAN&gt;
      &lt;SPAN class="token function"&gt;setTimeout&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
        view&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;graphics&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;remove&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;polylineGraphic&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; gClone &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; polylineGraphic&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;clone&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
        gClone&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;geometry&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;insertPoint&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;new&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;Point&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;x&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;112.3&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; y&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;53.68&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
        view&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;graphics&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;add&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;gClone&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
        console&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;info&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;gClone&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
      &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;3000&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:02:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/polygon-insertpoint-with-settimeout/m-p/635919#M59399</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-12T03:02:47Z</dc:date>
    </item>
    <item>
      <title>Re: Polygon insertPoint with setTimeout</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/polygon-insertpoint-with-settimeout/m-p/635920#M59400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Robert,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm actually REALLY trying to not have to clone, alter, and re-add the object.&amp;nbsp; My sample code is to simply show the error, however what I'm really trying to do is automate the drawing of a graphic on the screen.&amp;nbsp; similar to a car driving around New York.&amp;nbsp; I'm actually using setInterval, not setTimeout... but the issue is the same.&amp;nbsp; Since I know the distance and rate of travel I can determine the time (or milliseconds) it will take to move along the line, I can set the interval time to approximately match the true MPH of the car on the road.&amp;nbsp; My issue with cloning the graphics object&amp;nbsp; is that it's VERY expensive in processing time and throws off my calculation by adding to the milliseconds.&amp;nbsp; &amp;nbsp;Would be a lot faster processing time if I could just update the existing geometry.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Shad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Feb 2019 01:21:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/polygon-insertpoint-with-settimeout/m-p/635920#M59400</guid>
      <dc:creator>ShadCampbell</dc:creator>
      <dc:date>2019-02-02T01:21:34Z</dc:date>
    </item>
    <item>
      <title>Re: Polygon insertPoint with setTimeout</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/polygon-insertpoint-with-settimeout/m-p/635921#M59401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Shad,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;I am not sure if it has changed in the API but in the past you could not just update a graphics geometry you had to remove and re-add it to get it to update.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Feb 2019 01:45:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/polygon-insertpoint-with-settimeout/m-p/635921#M59401</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2019-02-02T01:45:19Z</dc:date>
    </item>
    <item>
      <title>Re: Polygon insertPoint with setTimeout</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/polygon-insertpoint-with-settimeout/m-p/635922#M59402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Shad,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;OK I checked and the compatibility matrix still says this:&lt;/P&gt;&lt;TABLE style="color: #4c4c4c; background-color: #ffffff; border: 1px solid #cccccc; font-size: 0.875rem; margin-bottom: 1.5rem;"&gt;&lt;TBODY&gt;&lt;TR style="background-color: #f8f8f8; border-bottom: 1px solid #cccccc;"&gt;&lt;TD style="border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; font-weight: 300; padding: 0.5rem;"&gt;Modify graphics&lt;/TD&gt;&lt;TD style="border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; font-weight: 300; padding: 0.5rem;"&gt;Coming soon&lt;/TD&gt;&lt;TD style="border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; font-weight: 300; padding: 0.5rem;"&gt;To modify a graphic that is already added to the layer: you need to&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html#clone" style="color: #0079c1; text-decoration: none;"&gt;clone&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;it, make modifications, add it to the layer and remove the original graphic. In-place modification of graphic objects will not trigger display refresh.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Feb 2019 02:24:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/polygon-insertpoint-with-settimeout/m-p/635922#M59402</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2019-02-02T02:24:09Z</dc:date>
    </item>
  </channel>
</rss>

