有没有办法从LayerSwitcher(OpenLayers)中隐藏一个层,但仍然可以看到相应的GeoExt.LegendPanel?
我的地图图层中有一个图例。它为每个动态添加的图层添加颜色图例 我的问题:当我要求将层隐藏在层切换器中时(我不想在那里看到它),它不再向我显示图例,即使层可见。 有没有一种方法,我可以让它远离图层切换,同时让我的传奇故事展示?我想绕过天秤座给我带来的问题。如果有一种方法可以在不使用DisplayInLayerSwitcher:false的情况下从OpenLayers的LayerSwitcher隐藏层,那么它将解决我的问题 这是我的传奇代码:有没有办法从LayerSwitcher(OpenLayers)中隐藏一个层,但仍然可以看到相应的GeoExt.LegendPanel?,openlayers,show-hide,layer,legend,geoext,Openlayers,Show Hide,Layer,Legend,Geoext,我的地图图层中有一个图例。它为每个动态添加的图层添加颜色图例 我的问题:当我要求将层隐藏在层切换器中时(我不想在那里看到它),它不再向我显示图例,即使层可见。 有没有一种方法,我可以让它远离图层切换,同时让我的传奇故事展示?我想绕过天秤座给我带来的问题。如果有一种方法可以在不使用DisplayInLayerSwitcher:false的情况下从OpenLayers的LayerSwitcher隐藏层,那么它将解决我的问题 这是我的传奇代码: //------ Legend Window -----
//------ Legend Window ---------------------------------------------------------------------------
/* --> LegendPanel (This GeoExt Panel automatically displays the legend image of the layer if the layer has been added to the map.
* If this paticular layer has been removed from the map, his legend image will also automatically be removed from the GeoExt Panel.)
*/
function createLegendPanel(){
return new Ext.Window({
id: 'legend_panel_extjs',
header: true,
title: '<center>' + extjs_gui_east_panel_title + '</center>',
shadow: false,
closable:false,
collapsible: true,
animCollapse: false,
cls: 'WindowPanelCls',
resizable: false,
//resizeHandles: 'w',
draggable: false,
width:(legendMaxWidth+17),
height:(legendMaxHeight+15),
plain: true,
listeners: {
show: windowPosition,
collapse: windowPosition
},
items: [
new GeoExt.LegendPanel({
id:'extjs_gui_legend_panel_list',
map: map,
region:'west',
layout: 'table',
filter: function(record){
if( !(record.getLayer().isBaseLayer) && !(record.getLayer() instanceof OpenLayers.Layer.Vector) ){
return true;
}
},
defaults: {
showTitle: false,
baseParams: {
format: 'image/png',
lang: lang
}
,style: '{border-style: ridge;}'
}
})
]
});
}
/----图例窗口---------------------------------------------------------------------------
/*-->LegendPanel(如果图层已添加到地图中,此GeoExt面板将自动显示图层的图例图像。
*如果此特殊层已从地图中删除,其图例图像也将自动从GeoExt面板中删除。)
*/
函数createLegendPanel(){
返回新的外部窗口({
id:'legend_panel_extjs',
标题:对,
标题:''+extjs\u gui\u east\u面板\u标题+'',
影子:错,
可关闭:错误,
可折叠的:是的,
答案:错,
cls:“WindowPanelCls”,
可调整大小:false,
//resizeHandles:'w',
可拖动:错误,
宽度:(legendMaxWidth+17),
高度:(legendMaxHeight+15),
朴素:没错,
听众:{
显示:窗口位置,
折叠:窗口位置
},
项目:[
新GeoExt.LegendPanel({
id:'extjs\u gui\u图例\u面板\u列表',
地图:地图,
地区:'西部',
布局:“表”,
过滤器:功能(记录){
if(!(record.getLayer().isBaseLayer)和&!(record.getLayer()OpenLayers.Layer.Vector实例)){
返回true;
}
},
默认值:{
节目名称:假,
基本参数:{
格式:'image/png',
朗:朗
}
,样式:“{边框样式:脊;}”
}
})
]
});
}
谢谢大家
PS:从GeoExt网站:
LegendPanel将包括其配置的layerStore中所有层的图例,除非该层配置了displayInLayerSwitcher:false,或者层记录具有值为true的hideInLegend字段。通过在LegendPanel上配置过滤器,可以完成额外的过滤