3163d413 by 杨威

设置专题树透明度

1 parent 1ebfcc8e
......@@ -2,15 +2,18 @@
"label":"专题树",
"id":"1",
"type":"layerGroup",
"alpha":100,
"children":[
{
"label":"西安市阎良区",
"id":"1-1",
"type":"layerGroup",
"alpha":100,
"children":[{
"label":"行政区划",
"id":"1-1-1",
"type":"layerGroup",
"alpha":100,
"children":[
{
"label":"行政区界限",
......@@ -32,6 +35,7 @@
"label":"地籍分区",
"id":"1-1-2",
"type":"layerGroup",
"alpha":100,
"children":[
{
"label":"地籍区",
......@@ -53,6 +57,7 @@
"label":"不动产单元",
"id":"1-1-3",
"type":"layerGroup",
"alpha":100,
"children":[
{
"label":"线状定着物",
......@@ -130,6 +135,7 @@
"label":"自然地理",
"id":"1-1-4",
"type":"layerGroup",
"alpha":100,
"children":[
{
"label":"辅助面",
......
......@@ -157,6 +157,17 @@ export default {
}
}
layer.sublayers = items;
},
//设置图层透明度
setLayerOpacity(viewId,layers,value){
var view = maps[viewId],
layer = view.map.findLayerById("testLayer");
for(var i = 0;i < layers.length;i++){
var sublayer = layer.findSublayerById(layers[i].layerId);
if(sublayer){
sublayer.opacity = value/100;
}
}
}
}
}
\ No newline at end of file
......
......@@ -31,7 +31,7 @@
<span class="custom-tree-node" slot-scope="{ node, data }">
<span>{{ node.label }}</span>
<span class="setOpacity" v-if="data.type == 'layerGroup'">
<el-slider v-model="data.alpha" ref="data.id" :format-tooltip="formatTooltip" @change="alphaChange(data)"></el-slider>
<el-slider v-model="data.alpha" ref="data.id" :format-tooltip="formatTooltip" @change="alphaChange(data)"></el-slider>
</span>
</span>
</el-tree>
......@@ -114,7 +114,12 @@
return val+"%";
},
alphaChange(nodeData){
if(nodeData.alpha == 0){
return;
}
var ids = [];
this.getChildrens(nodeData,ids);
this.setLayerOpacity(this.viewId,ids,nodeData.alpha);
}
}
}
......