<?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 Get list of graphics under a mouse defined region in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-list-of-graphics-under-a-mouse-defined-region/m-p/748645#M69263</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Need to get the list of graphics that lie under a region/geometry defined by mouse action (such as click-drag draw, or a simple left mouse click) and then use this list of graphics to select it and retrieve its list of attributes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The graphics are already defined on the graphicslayer, and do not want to query the backend again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the best way to do this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Jan 2015 17:42:41 GMT</pubDate>
    <dc:creator>EdwardSohn2</dc:creator>
    <dc:date>2015-01-29T17:42:41Z</dc:date>
    <item>
      <title>Get list of graphics under a mouse defined region</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-list-of-graphics-under-a-mouse-defined-region/m-p/748645#M69263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Need to get the list of graphics that lie under a region/geometry defined by mouse action (such as click-drag draw, or a simple left mouse click) and then use this list of graphics to select it and retrieve its list of attributes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The graphics are already defined on the graphicslayer, and do not want to query the backend again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the best way to do this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jan 2015 17:42:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-list-of-graphics-under-a-mouse-defined-region/m-p/748645#M69263</guid>
      <dc:creator>EdwardSohn2</dc:creator>
      <dc:date>2015-01-29T17:42:41Z</dc:date>
    </item>
    <item>
      <title>Re: Get list of graphics under a mouse defined region</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-list-of-graphics-under-a-mouse-defined-region/m-p/748646#M69264</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Graphics often have their attributes embedded. If there's a template defined on the graphic then a click can trigger a popup infoWindow to display those attributes. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A graphics layer has a number of events (click, mouse-move) that can be used to highlight the relevant graphics in a layer as well. Depending on what you want to do those might help. Sticking to click-popup is the easiest path. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2015 19:22:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-list-of-graphics-under-a-mouse-defined-region/m-p/748646#M69264</guid>
      <dc:creator>JoshHevenor</dc:creator>
      <dc:date>2015-02-02T19:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: Get list of graphics under a mouse defined region</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-list-of-graphics-under-a-mouse-defined-region/m-p/748647#M69265</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As your graphics are already within a GraphicsLayer you have access to the &lt;A href="https://developers.arcgis.com/javascript/jsapi/graphicslayer-amd.html#event-click"&gt;click&lt;/A&gt; event to handle mouse click events. This will allow you to handle the simple left mouse click scenario.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The region selection would require a different approach. Firstly, you would need to capture your region shape using something like the map &lt;A href="https://developers.arcgis.com/javascript/jsapi/map-amd.html#event-mouse-down"&gt;mouse-down&lt;/A&gt; and &lt;A href="https://developers.arcgis.com/javascript/jsapi/map-amd.html#event-mouse-drag-end"&gt;mouse-drag-end&lt;/A&gt; events or alternatively use the &lt;A href="https://developers.arcgis.com/javascript/jsapi/draw-amd.html"&gt;draw toolbar&lt;/A&gt; to create a graphic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you have a selection &lt;A href="https://developers.arcgis.com/javascript/jsapi/extent-amd.html"&gt;extent&lt;/A&gt; you can then loop through all of the graphics in your graphics layer and test which ones intersect your selection graphic using the &lt;A href="https://developers.arcgis.com/javascript/jsapi/extent-amd.html#contains"&gt;extent.contains()&lt;/A&gt; method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This &lt;A href="http://developers.arcgis.com/javascript/samples/graphics_extent_query/"&gt;sample&lt;/A&gt; shows using the draw toolbar to capture the selection extent.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2015 19:52:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-list-of-graphics-under-a-mouse-defined-region/m-p/748647#M69265</guid>
      <dc:creator>OwenEarley</dc:creator>
      <dc:date>2015-02-02T19:52:48Z</dc:date>
    </item>
  </channel>
</rss>

