Show multiple features as Selected

576
1
06-25-2013 05:00 AM
GyanendraAgnihotri
New Contributor
Hi,

i need to show multiple feature(geometry) selected(blinking) for a map,
i got features using query which i have to show selected(blinking) now i have no idea how would i show these features
blinking on the map.
any help would be greatly appreciated.
Thanks
0 Kudos
1 Reply
JacksonGilman1
New Contributor III
You could try something like this to get you started:

require(['dojo/_base/declare', 'dojo/_base/lang', 'dojo/_base/array'], function (declare, lang, array) {
            var Blinker = declare(null, {                
                constructor: function (graphics, interval) {
                    this.graphics = graphics || [];
                    this.interval = interval || 1000;
                },
                _interval: null,
                blink: function () {
                    array.forEach(this.graphics, function (graphic) {
                        return graphic.visible ? graphic.hide() : graphic.show();
                    });
                },
                start: function () {
                    this._interval = setInterval(lang.hitch(this, 'blink'), this.interval);
                    return this;
                },
                stop: function () {
                    return this._interval && clearInterval(this._interval);
                }
            });
            /**
             * 
             * @param {FeatureLayer} layer feature layer whos selection should be blinking
             * @param {Number} [interval] millisecond delay for blink  
             * @example
             *      // start blinking
             *      var blinker = Blinker.blinkSelectedFeatures(myFeatureLayer, 2000);
             *      
             *      // stop blinking
             *      blinker.stop();
             * @returns {*}
             */
            Blinker.blinkSelectedFeatures = function (/* FeatureLayer */ layer,/* number */ interval) {
                return new Blinker(layer.getSelectedFeatures(), interval).start(); // Blinker                
            };           
        });
0 Kudos