Javascript OpenLayers多层选择

Javascript OpenLayers多层选择,javascript,jquery,openlayers,Javascript,Jquery,Openlayers,我有一个带有多个图层(A、B、C、D、E、F)的OpenLayers地图。 我需要能够选择不同层上的项目,并与他们互动。 目前我只能选择F层,其他层阻止我选择B层 我创建图层 var Fields = new OpenLayers.Layer.Vector(); var Text = new OpenLayers.Layer.Vector(); 将图层添加到我的地图 map.addLayers([Text, ZipCode, Legal, Fields, FieldLabels]); 调用我

我有一个带有多个图层(A、B、C、D、E、F)的OpenLayers地图。 我需要能够选择不同层上的项目,并与他们互动。 目前我只能选择F层,其他层阻止我选择B层

我创建图层

var Fields = new OpenLayers.Layer.Vector();
var Text = new OpenLayers.Layer.Vector();
将图层添加到我的地图

map.addLayers([Text, ZipCode, Legal, Fields, FieldLabels]);
调用我创建的高亮显示功能,因为功能正在添加到地图中

    function HighLighText(ID) {
    //var mySelectStyle = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style["default"]);
    //OpenLayers.Util.extend(mySelectStyle, { fillColor: "#f6b721", fillOpacity: 1 });

    mySelectStyle[ID] = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style["default"]);
    OpenLayers.Util.extend(mySelectStyle, { fontColor: "#F6FF00", fillOpacity: .6 });
    mySelectStyle[ID].fontColor = "#F6FF00";
    mySelectStyle[ID].fillOpacity = .6;
    mySelectStyle[ID].label = String(ID);


    var txtReport = function (e) { OpenLayers.Console.log(e.type, e.feature.id); };
    highlightTextCtrl[ID] = new OpenLayers.Control.SelectFeature(Fields[ID], {
        hover: true,
        highlightOnly: true,
        renderIntent: "temporary",
        selectStyle: mySelectStyle[ID]


    });



    map.addControl(highlightTextCtrl[ID]);    
    highlightTextCtrl[ID].activate();

};

只要我隐藏上面的层,上面的功能就可以很好地工作……我如何才能在不隐藏层的情况下工作?

我不完全理解这个问题。你是在说这样的事吗?查看来源:我的工作示例会很有帮助。@JohnBarca是的,只是当我将一组图层添加到我的选择功能时,它根本不起作用……我想提供我的工作示例,但我不知道这是否可行。我非常感谢您能提供的任何帮助。@JohnBarça例如,在上面的代码中,如果我添加像这样的层…map.addLayers([Fields,fieldlabeltext,ZipCode,Legal]);现在Zipcode和legal阻止我悬停或选择字段。