独自の filter 機能を loader に設定できます。
geoext02_layer-tree.html を修正します。
---
<script type="text/javascript">
var map, layer1, layer2, layer3, layer4, layer5, layer6, layer7;
// Filtering 用にレイヤ追加
---
layer4 = new OpenLayers.Layer.WMS( "Railroad JR Line WMS",
"http://192.168.1.6/cgi-bin/mapserv?",
{
map: '/home/nob61/mapfile/tokyo_pf_pgis.map',
layers: 'jrline',
transparent: true,
format: 'image/png'
},{
projection: new OpenLayers.Projection("EPSG:4326")
}
);
layer5 = new OpenLayers.Layer.WMS( "Railroad Public Line WMS",
"http://192.168.1.6/cgi-bin/mapserv?",
{
map: '/home/nob61/mapfile/tokyo_pf_pgis.map',
layers: 'publicline',
transparent: true,
format: 'image/png'
},{
projection: new OpenLayers.Projection("EPSG:4326")
}
);
layer6 = new OpenLayers.Layer.WMS( "Railroad Private Line WMS",
"http://192.168.1.6/cgi-bin/mapserv?",
{
map: '/home/nob61/mapfile/tokyo_pf_pgis.map',
layers: 'privateline',
transparent: true,
format: 'image/png'
},{
projection: new OpenLayers.Projection("EPSG:4326")
}
);
layer7 = new OpenLayers.Layer.WMS( "Railroad Third Sector Line WMS",
"http://192.168.1.6/cgi-bin/mapserv?",
{
map: '/home/nob61/mapfile/tokyo_pf_pgis.map',
layers: 'thirdsec',
transparent: true,
format: 'image/png'
},{
projection: new OpenLayers.Projection("EPSG:4326")
}
);
map.addLayers([layer1, layer2, layer3, layer4, layer5, layer6, layer7]);
---
var layerList = new GeoExt.tree.LayerContainer({
text: 'Raiload Layers',
layerStore: mapPanel.layers,
leaf: false,
expanded: true,
// 追加
loader: {
filter: function(record) {
return record.get("layer").name.indexOf("Railroad") !== -1
// OpenLayers.Layer.WMS の名前
}
}
// ここまで
});
---
0 件のコメント:
コメントを投稿