首页 / 浏览问题 / 云GIS / 问题详情
selectGraphic如何设置多图层?
20EXP 2017年07月25日
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
                }
            )
        };
    }

1个回答

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

看了源码的initialize初始化方法,里面就只有一个图层,目前没法写图层数组
1,603EXP 2017年07月25日
ok了解
...