iclient for ol做了子图层控制,每次创建临时图层的时候都添加了一次Layer,看classic的示例 layer.events.on({"layerInitialized": addLayer});有个监督方法,只做一次添加,那么再openlayers的时候怎么做到只添加一次呢
createTempLayerCompleted(createTempLayerEventArgs){
tempLayerID = createTempLayerEventArgs.result.newResourceID;
tempLayer = new ol.layer.Tile({
source: ol.source.TileSuperMapRest({
url: url,
wrapX: true,
//transparent: false,
cacheEnabled: false,
redirect: true,
layersID: tempLayerID
}),
projection: 'EPSG:4326'
})
map.addLayer(tempLayer);