selectGraphic如何设置多图层?

0 投票
215 浏览
IClient for js 8c,控件selectGraphic如何设置多目标图层?

如下方式只能设置一个图层:

var selectGraphic = new SuperMap.Control.SelectGraphic(MygraphicLayer, {
        callbacks : null//callbacks
    });

api文档里包括源码里有layer和layers两个属性,想问一下怎么加多图层?下面方法显然不行

var selectGraphic = new SuperMap.Control.SelectGraphic([MygraphicLayer], {
        callbacks : null//callbacks
    });

从Git上找到的源码,初始化方法,里面只有layer初始化赋值。so,不知道layers怎么搞:

initialize: function(layer, options) {
        SuperMap.Control.prototype.initialize.apply(this, [options]);
        
        if(this.scope === null) {
            this.scope = this;
        }
        //this.initLayer(layers);
         if(layer){
             this.layer = layer;
         }
        var callbacks = {
            click: this.select,
            clickout: this.unselect,
            over: this.overGraphic,
            out: this.outGraphic
        };
             
        this.callbacks = SuperMap.Util.extend(callbacks, this.callbacks);
        this.handlers = {
            graphic: new SuperMap.Handler.Graphic(
                this,
                this.layer,
                this.callbacks,
                {
                    stopDown:false
                }
            )
        };
    }
最新提问 7月 25, 2017 分类:  215次浏览 | 用户: hnsw (5 分)
标签修改 7月 25, 2017 用户:hnsw

1个回答

0 投票
您好,帮助文档有点问题,我这边测试了,没法写图层数组

看了源码的initialize初始化方法,里面就只有一个图层,目前没法写图层数组
最新回答 7月 25, 2017 用户: 郑雅琳 名扬四海 (1,571 分)
ok了解
...