Select to view content in your preferred language

Returned results from query flash on the map

1128
2
06-19-2014 11:17 AM
AndrewL
Frequent Contributor
Hi. Is there a way to have returned results from a query "flash" for a brief second similar to the flash that is created in ArcMap editing mode when clicking on the Attributes? They are hard to see at the US CONUS extent.

I want it so that visible layer 6 in my map service flashes the returned polygons.

I was looking for a workaround and thought of having a different symbology for small scales but that is not possible yet according to this arcgis idea: http://ideas.arcgis.com/ideaView?id=087300000008IPaAAM

Thank you.

        
   searchService.setLayerDefinitions(defintionExpression, true);
            searchService.setVisibleLayers(visible, true);

            var vL = searchService.visibleLayers;
            //If 1 and 2 are the only layers selected, make them non-transparent so they stand out (since they are points, not polygons) 
            if (vL == 1) {
                searchService.setOpacity(1.0);
            } else if (vL == 2) {
                searchService.setOpacity(1.0);
            } else {
                searchService.setOpacity(0.6);
            }
0 Kudos
2 Replies
KenBuja
MVP Esteemed Contributor
On one of my sites, I flash a feature when the user clicks on a row in a dGrid. To see this in action, click in the study area polygon and in the popup window, click on the row to see the feature flash.

The basic code is found in this function

    function gridSelect(e) {
        var graphicFlash;
        var gridId = e.currentTarget.id;
        var selectedGrid = dijit.byId(gridId);
        var row = selectedGrid.row(e);

        graphicHighlight = findGraphicByAttribute(row.data);

        if (graphicHighlight !== null) {
            switch (graphicHighlight.geometry.type) {
                case "point": case "multipoint":
                    graphicFlash = new esri.Graphic(graphicHighlight.geometry, symbolFlashPoint)
                    break;
                case "polyline":
                    graphicFlash = new esri.Graphic(graphicHighlight.geometry, symbolFlashPolyline);
                    break;
                case "polygon": case "extent":
                    graphicFlash = new esri.Graphic(graphicHighlight.geometry, symbolFlashPolygon);
                    break;
            }
            map.graphics.add(graphicFlash);
        }

        var shape = graphicFlash.getDojoShape();
        var animStroke = fx.animateStroke({
            shape: shape,
            duration: 500,
            color: { end: new dojo.Color([0, 0, 0, 0]) }
        });
        var animFill = fx.animateFill({
            shape: shape,
            duration: 500,
            color: { end: new dojo.Color([0, 0, 0, 0]) }
        });
        var anim = dojo.fx.combine([animStroke, animFill]).play();
        var animConnect = dojo.connect(anim, "onEnd", function () {
            map.graphics.remove(graphicFlash);
        });
    }
0 Kudos
AndrewL
Frequent Contributor
Thanks for the code! I will test this out.
0 Kudos