// 扩散围墙
|
<template>
|
<Popup
|
ref="pop"
|
:title="title"
|
:shadow="false"
|
:left="left"
|
width="310px"
|
:showBtn="false"
|
>
|
<el-form ref="form" :model="data" :rules="rules" label-width="70px">
|
<el-form-item label="长度:">
|
<el-input-number v-model="data.length"></el-input-number>
|
</el-form-item>
|
<el-form-item label="形状:">
|
<el-input-number v-model="data.number"></el-input-number>
|
</el-form-item>
|
<el-form-item label="速度:">
|
<el-input-number v-model="data.multiple"></el-input-number>
|
</el-form-item>
|
<el-form-item label="颜色:">
|
<el-color-picker v-model="data.color"></el-color-picker>
|
</el-form-item>
|
<el-form-item label="绘制:">
|
<el-button type="info" size="mini" @click="draw">图上选点</el-button>
|
</el-form-item>
|
</el-form>
|
</Popup>
|
</template>
|
|
<script>
|
import Popup from "@tools/Popup";
|
import Bus from "@tools/Bus";
|
|
let circle;
|
export default {
|
name: "EffectCylinder",
|
components: {
|
Popup,
|
},
|
data() {
|
return {
|
title: "添加扩散围墙",
|
left: "calc(100% - 320px)",
|
data: {
|
length: 200,
|
multiple: 1.5,
|
//形状边数
|
number: 30,
|
color: "#91F1FC",
|
},
|
// 表单验证规则
|
rules: {},
|
};
|
},
|
mounted() {},
|
methods: {
|
// 关闭弹窗
|
close() {
|
circle && circle.end && circle.end();
|
circle = null;
|
// 重置data值
|
Object.assign(this.$data, this.$options.data());
|
},
|
// 打开弹窗
|
open() {
|
this.close();
|
this.$refs.pop.open();
|
},
|
draw() {
|
this.$refs.form.validate((valid) => {
|
// 验证通过
|
if (valid) {
|
this.$message("在场景内绘制范围添加");
|
circle && circle.end && circle.end();
|
let color = Cesium.Color.fromCssColorString(this.data.color).withAlpha(0.6);
|
circle = sgworld.Creator.createSimpleGraphic(
|
"circle",
|
{ color: color.toCssColorString() },
|
(entity, data) => {
|
entity.deleteObject();
|
|
// 获取经纬度
|
let degrees = sgworld.Core.toDegrees(data.positions[1]);
|
this.addEffectCylinder(degrees, data.distance);
|
}
|
);
|
}
|
});
|
},
|
addEffectCylinder(degrees, radius) {
|
degrees.height = this.height;
|
let cylinder = sgworld.Creator.addEffectCylinder({
|
position: degrees,
|
color: this.data.color,
|
radius: radius,
|
length: this.data.length,
|
multiple: this.data.multiple,
|
number: this.data.number,
|
});
|
// 添加到图层树
|
Bus.$emit("addOtherData", "特效", {
|
id: sgworld.Core.getuid(),
|
name: "新建扩散围墙",
|
sourceType: "effectCylinder",
|
position: degrees,
|
radius,
|
...this.data,
|
item: cylinder,
|
});
|
},
|
},
|
};
|
</script>
|
|
<style scoped lang="less">
|
.el-form {
|
margin-top: 20px;
|
margin-right: 10px;
|
width: 300px;
|
|
/deep/ .el-form-item__label {
|
color: #fff;
|
font-size: 18px;
|
}
|
}
|
</style>
|