<?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: Highlighting multiple feature layer geometries in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/highlighting-multiple-feature-layer-geometries/m-p/333845#M30838</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Ed,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;highlight the geometry onmouseover for whichever layers are visible at any one time... the above function works when clicking the map but does anyone know how to achieve the same but only clicking on the feature layer?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Set up &lt;/SPAN&gt;&lt;STRONG&gt;dojo.connect&lt;/STRONG&gt;&lt;SPAN&gt; each time a layer is switched on, &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;at the layer level&lt;/SPAN&gt;&lt;SPAN&gt;. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;P align="left"&gt;If you save this to a variable, you can use &lt;/P&gt;&lt;/SPAN&gt;&lt;STRONG&gt;dojo.disconnect&lt;/STRONG&gt;&lt;SPAN&gt; when the layer is switched off.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
//When the layer is switched on:
var1 = dojo.connect(layer1, "onClick"....)

//When the layer is switched off:
dojo.disconnect(var1)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;P&gt;&lt;/P&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Steve&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 15:48:19 GMT</pubDate>
    <dc:creator>StephenLead</dc:creator>
    <dc:date>2021-12-11T15:48:19Z</dc:date>
    <item>
      <title>Highlighting multiple feature layer geometries</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/highlighting-multiple-feature-layer-geometries/m-p/333844#M30837</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am displaying multiple feature layers in my app and would like to highlight the geometry onmouseover for whichever layers are visible at any one time.&amp;nbsp; Does anyone know how to adapt the following code for use with multiple feature layers:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; dojo.connect(map,"onClick",function(evt){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; var query = new esri.tasks.Query();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; query.geometry = pointToExtent(map,evt.mapPoint,10);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; var deferred = featureLayer.selectFeatures(query,esri.layers.FeatureLayer.SELECTION_NEW);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; map.infoWindow.setFeatures([deferred]);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; map.infoWindow.show(evt.mapPoint);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; });&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've tried using an array but that doesn't work.&amp;nbsp; Related question - the above function works when clicking the map but does anyone know how to achieve the same but only clicking on the feature layer?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance for any help.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Jan 2012 07:33:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/highlighting-multiple-feature-layer-geometries/m-p/333844#M30837</guid>
      <dc:creator>EdSaunders</dc:creator>
      <dc:date>2012-01-07T07:33:21Z</dc:date>
    </item>
    <item>
      <title>Re: Highlighting multiple feature layer geometries</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/highlighting-multiple-feature-layer-geometries/m-p/333845#M30838</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Ed,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;highlight the geometry onmouseover for whichever layers are visible at any one time... the above function works when clicking the map but does anyone know how to achieve the same but only clicking on the feature layer?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Set up &lt;/SPAN&gt;&lt;STRONG&gt;dojo.connect&lt;/STRONG&gt;&lt;SPAN&gt; each time a layer is switched on, &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;at the layer level&lt;/SPAN&gt;&lt;SPAN&gt;. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;P align="left"&gt;If you save this to a variable, you can use &lt;/P&gt;&lt;/SPAN&gt;&lt;STRONG&gt;dojo.disconnect&lt;/STRONG&gt;&lt;SPAN&gt; when the layer is switched off.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
//When the layer is switched on:
var1 = dojo.connect(layer1, "onClick"....)

//When the layer is switched off:
dojo.disconnect(var1)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;P&gt;&lt;/P&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Steve&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:48:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/highlighting-multiple-feature-layer-geometries/m-p/333845#M30838</guid>
      <dc:creator>StephenLead</dc:creator>
      <dc:date>2021-12-11T15:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: Highlighting multiple feature layer geometries</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/highlighting-multiple-feature-layer-geometries/m-p/333846#M30839</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Steve, thanks again for the suggestions, much appreciated.&amp;nbsp; I'm using your suggestion that sets up an onMouseOver when I declare the feature layer.&amp;nbsp; Happily when I hide the feature layer the dojo.connect function is no longer available so I don't have to disconnect it.&amp;nbsp; Either that or I'm propagating memory leaks ; )&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; 
dwfLayer = new esri.layers.FeatureLayer(dwfLayerUrl, {
&amp;nbsp; mode : esri.layers.FeatureLayer.MODE_ONDEMAND,
&amp;nbsp; infoTemplate : template,
&amp;nbsp; outFields : ["*"],
});
dojo.connect(dwfLayer, "onMouseOver", function(evt) {
&amp;nbsp; map.setMapCursor("pointer");
&amp;nbsp; highlightPointLayer.clear();
&amp;nbsp; highlightPointLayer.add(new esri.Graphic(evt.graphic.geometry));
});
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can I use arrays to streamline the code (obviously using more than one feature layer), like the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
var wfLayers = []; 
dwfLayer = new esri.layers.FeatureLayer(dwfLayerUrl, {
&amp;nbsp; mode : esri.layers.FeatureLayer.MODE_ONDEMAND,
&amp;nbsp; infoTemplate : template,
&amp;nbsp; outFields : ["*"],
});
wfLayers.push(dwfLayer);
dojo.connect(wfLayers, "onMouseOver", function(evt) {
&amp;nbsp; map.setMapCursor("pointer");
&amp;nbsp; highlightPointLayer.clear();
&amp;nbsp; highlightPointLayer.add(new esri.Graphic(evt.graphic.geometry));
});
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks heaps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:48:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/highlighting-multiple-feature-layer-geometries/m-p/333846#M30839</guid>
      <dc:creator>EdSaunders</dc:creator>
      <dc:date>2021-12-11T15:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: Highlighting multiple feature layer geometries</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/highlighting-multiple-feature-layer-geometries/m-p/333847#M30840</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;when I hide the feature layer the dojo.connect function is no longer available so I don't have to disconnect it.&amp;nbsp; Either that or I'm propagating memory leaks ; )&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That's a question for someone from Esri I guess. I'd say that if you're running code to hide the layer, it's no big deal to switch off the listener at the same time, so you might as well....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Can I use arrays to streamline the code (obviously using more than one feature layer), like the following:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt; dojo.connect(wfLayers, "onMouseOver", function(evt) {&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As before, I think you'll need to run a &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;for each&lt;/SPAN&gt;&lt;SPAN&gt; loop and set this for each layer individually - there's no mechanism to set the onMouseOver listener directly on an array of layers, to my knowledge.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Steve&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jan 2012 03:09:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/highlighting-multiple-feature-layer-geometries/m-p/333847#M30840</guid>
      <dc:creator>StephenLead</dc:creator>
      <dc:date>2012-01-11T03:09:37Z</dc:date>
    </item>
  </channel>
</rss>

