Select to view content in your preferred language

Flash a Graphic

2873
1
05-07-2013 03:43 PM
MeleKoneya
Frequent Contributor
I have a datagrid (dojox.grid.DataGrid) configured such that I can click on a row and show a symbol on the map for the "clicked" feature in the Grid.

What I would like is to flash a symbol where the feature is.

My thinking is to draw a graphic, pause, and then remove it to simulate a flash.

Anyone have some code using the methodology above,  or with a different method?

Thanks,

Mele
0 Kudos
1 Reply
VivekPrasad
Deactivated User
I have a datagrid (dojox.grid.DataGrid) configured such that I can click on a row and show a symbol on the map for the "clicked" feature in the Grid.

What I would like is to flash a symbol where the feature is.

My thinking is to draw a graphic, pause, and then remove it to simulate a flash.

Anyone have some code using the methodology above,  or with a different method?

Thanks,

Mele


Hi,

Please try the calling below functions. You might need to modify this according to your requirements.

//to blink feature twice on click of goto button         
             _glowFeature: function (graphic, count, highlightSymbol) {
                 this._hideRipple();
                 var i = 20, flag;
                 var intervalID = setInterval(lang.hitch(this, function () {
                     if (i == 20) {
                         flag = false;
                         var segmentGraphic = this.layer._map.graphics.add(new esri.Graphic(graphic.geometry, highlightSymbol));
                         segmentGraphic._isGraphicSelected = true;
                         segmentGraphic.setSymbol(highlightSymbol);
                     }
                     else if (i == 14) {
                         flag = true;
                     }
                     if (flag) {
                         this._hideRipple();
                         count++;
                         if (count === 1) {
                             this._glowFeature(graphic, count, highlightSymbol);
                         }
                     }
                     else i--;
                 }), 100);
                 this.intervalIDs[this.intervalIDs.length] = intervalID;
             },
             //Clears all the intervals
             _clearAllIntervals: function () {
                 for (var i = 0; i < this.intervalIDs.length; i++) {
                     clearTimeout(this.intervalIDs);
                 }
                 this.intervalIDs.length = 0;
             },
             //Hide the highlight symbol
             _hideRipple: function () {
                 this._clearAllIntervals();
                 this._clearGraphics();
             },
             //Function to clear the graphics from the graphics layer
             _clearGraphics: function (eventArgs) {
                 if (this.layer._map.graphics != null) {
                     var self = this;
                     array.forEach(this.layer._map.graphics.graphics, function (graphic) {
                         if (graphic && graphic._isGraphicSelected === true) {
                             self.layer._map.graphics.remove(graphic);
                         }
                     });
                 }
             }
0 Kudos