<?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 to check if graphic is a circle? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-check-if-graphic-is-a-circle/m-p/283558#M26184</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is the best solution. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 18 Sep 2014 18:06:49 GMT</pubDate>
    <dc:creator>JonathanUihlein</dc:creator>
    <dc:date>2014-09-18T18:06:49Z</dc:date>
    <item>
      <title>How to check if graphic is a circle?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-check-if-graphic-is-a-circle/m-p/283555#M26181</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am looking for a way to check whether a shape clicked on by a user is a circle [esri/geometry/Circle]. I've tried using &lt;EM&gt;evt.graphic.geometry.type&lt;/EM&gt; but it is coming back as 'polygon'. What's the best way to check it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 17:30:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-check-if-graphic-is-a-circle/m-p/283555#M26181</guid>
      <dc:creator>VygintasCesnauskas</dc:creator>
      <dc:date>2014-09-18T17:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if graphic is a circle?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-check-if-graphic-is-a-circle/m-p/283556#M26182</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think there is a way to see it besides polygon. How are your shapes created? Maybe in your creation you could add an attribute that defines what kind of shape it is and you could later pull that?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 17:37:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-check-if-graphic-is-a-circle/m-p/283556#M26182</guid>
      <dc:creator>TimWitt2</dc:creator>
      <dc:date>2014-09-18T17:37:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if graphic is a circle?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-check-if-graphic-is-a-circle/m-p/283557#M26183</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Circles have properties in the API such as center, radius, etc. Maybe you can test the graphic for the presence of a valid value? If it has one, then it's a circle. Kind of like feature sniffing to test for a particular browser.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise, a crude but probably not foolproof alternative would be test for type=polygon and geometry.width = geometry.height (pseudo code, obviously).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 18:00:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-check-if-graphic-is-a-circle/m-p/283557#M26183</guid>
      <dc:creator>SteveCole</dc:creator>
      <dc:date>2014-09-18T18:00:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if graphic is a circle?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-check-if-graphic-is-a-circle/m-p/283558#M26184</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is the best solution. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 18:06:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-check-if-graphic-is-a-circle/m-p/283558#M26184</guid>
      <dc:creator>JonathanUihlein</dc:creator>
      <dc:date>2014-09-18T18:06:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if graphic is a circle?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-check-if-graphic-is-a-circle/m-p/283559#M26185</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To follow up, I tested points, lines, and polygons. "graphic.geometry.radius" returns undefined for those types but it will return a value for circles.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 18:55:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-check-if-graphic-is-a-circle/m-p/283559#M26185</guid>
      <dc:creator>SteveCole</dc:creator>
      <dc:date>2014-09-18T18:55:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if graphic is a circle?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-check-if-graphic-is-a-circle/m-p/283560#M26186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Steve, I'm getting undefined &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;"graphic.geometry.radius" on all shapes, including circles. Circle was drawn using drawToolbar.activate(Draw["CIRCLE"]);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="geometry.radius.jpg" class="jive-image image-1" src="https://community.esri.com/legacyfs/online/13494_geometry.radius.jpg" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 20:20:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-check-if-graphic-is-a-circle/m-p/283560#M26186</guid>
      <dc:creator>VygintasCesnauskas</dc:creator>
      <dc:date>2014-09-18T20:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if graphic is a circle?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-check-if-graphic-is-a-circle/m-p/283561#M26187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unfortunately, it appears the object returned by the Draw widget is not a true Circle object, but a Polygon object. Therefore, the circle specific properties are not available. Bummer!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We can still work with this though.&lt;/P&gt;&lt;P&gt;Since you know the currently selected draw tool is the circle tool, you can save this as an attribute on the graphic itself when the graphic is created. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;graphic.attributes.shape = "circle";&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/jsapi/circle-amd.html" title="https://developers.arcgis.com/javascript/jsapi/circle-amd.html"&gt;circle-amd | API Reference | ArcGIS API for JavaScript&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 20:56:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-check-if-graphic-is-a-circle/m-p/283561#M26187</guid>
      <dc:creator>JonathanUihlein</dc:creator>
      <dc:date>2014-09-18T20:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if graphic is a circle?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-check-if-graphic-is-a-circle/m-p/283562#M26188</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about something like creating a new temporary circle graphic like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pln"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;var&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; point &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;new&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="typ"&gt;Point&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;([-&lt;/SPAN&gt;&lt;SPAN class="lit"&gt;117.15&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt;&lt;SPAN class="lit"&gt;32.71&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;]);&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;var&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; circleGeometry &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;new&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="typ"&gt;Circle&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;point&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,{&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="str"&gt;"radius"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; 1&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;});&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun"&gt;And then, at the appropriate time, try to update that circle variable with your graphic that may/may not be a circle:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun"&gt;var isCircle = false;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun"&gt;try {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; circleGeometry = evt.graphic;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; isCircle = true;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun"&gt;} catch(err) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; isCircle = false;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun"&gt;My theory is that, if it is a circle, you will be able to update the previously declared graphic variable. If it isn't, it will throw an error.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 21:31:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-check-if-graphic-is-a-circle/m-p/283562#M26188</guid>
      <dc:creator>SteveCole</dc:creator>
      <dc:date>2014-09-18T21:31:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if graphic is a circle?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-check-if-graphic-is-a-circle/m-p/283563#M26189</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Johathan, I went with your idea and it worked. I set the "shape" attribute for the graphic before adding it to the map:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14113914557164272 jive_text_macro" jivemacro_uid="_14113914557164272"&gt;
&lt;P&gt;var graphic = new Graphic(evt.geometry, symbol);&lt;/P&gt;
&lt;P&gt;graphic.setAttributes({ "shape": evt.target._geometryType });&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I use it to identify the shape once user clicks on it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14113915401978776" jivemacro_uid="_14113915401978776"&gt;
&lt;P&gt;if (evt.graphic.attributes.shape == "circle") {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; editToolbar.activate(Edit.SCALE, evt.graphic);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; }&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Sep 2014 13:15:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-check-if-graphic-is-a-circle/m-p/283563#M26189</guid>
      <dc:creator>VygintasCesnauskas</dc:creator>
      <dc:date>2014-09-22T13:15:55Z</dc:date>
    </item>
  </channel>
</rss>

