Merge pull request 'trp:修复重新渲染设备时设备数量不一致问题' (#402) from trp_dev into dengjie
Reviewed-on: http://git.feashow.cn/clay/tunnel-cloud-web/pulls/402
This commit is contained in:
@@ -392,6 +392,8 @@ function hoverDevEquipmentCallback(targetPointInfo) {
|
||||
devRealtimeDetail.value.equipmentType =typeKey;
|
||||
devRealtimeDetail.value.unit = u;
|
||||
devRealtimeDetail.value.value = 1000; //1000替换为value
|
||||
|
||||
demo.clearTunnelEquipments()
|
||||
}
|
||||
/**
|
||||
* @description: 渲染隧道入口提示板信息
|
||||
|
||||
@@ -10,12 +10,11 @@ import {
|
||||
import { saveState, resetState } from "./viewBack";
|
||||
import addFunction from "./addEvent";
|
||||
import { editTunnelInit } from "./editTunnelInit";
|
||||
import { addEquipment, removeEquipment } from "./editEquipment";
|
||||
import { addEquipment, removeEquipment,clearTunnelEquipments } from "./editEquipment";
|
||||
import previewtunnelModeInit from "./previewTunnelInit";
|
||||
import { StreetSignTag } from "./utils/StreetSignTag/StreetSignTag.js";
|
||||
import { realTimeRenderData } from "./realTimeRerender";
|
||||
// import { fa } from "element-plus/es/locale/index.js";
|
||||
// import { ref } from "vue";
|
||||
|
||||
export default class Demo {
|
||||
// 摄像机看向位置s
|
||||
origin = null;
|
||||
@@ -37,7 +36,7 @@ export default class Demo {
|
||||
this.previewtunnelModeInit = previewtunnelModeInit;
|
||||
this.editTunnelInit = editTunnelInit;
|
||||
this.realTimeRenderData = realTimeRenderData;
|
||||
|
||||
this.clearTunnelEquipments = clearTunnelEquipments;
|
||||
// 外部可添加函数
|
||||
this.addFunction = addFunction;
|
||||
this.THREE = three;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
import { eq } from "lodash";
|
||||
import EquipmentTag from "../utils/EquipmentTag";
|
||||
/**
|
||||
@@ -48,13 +47,17 @@ function handleOtherEqu(targetPoint, equipmentInfo) {
|
||||
const equMesh = this.equMap.get("equ_sensors").clone();
|
||||
const worldP = targetPoint.getWorldPosition(new this.THREE.Vector3());
|
||||
equMesh.position.copy(worldP);
|
||||
|
||||
|
||||
//设备添加标签
|
||||
const param = `${equipmentInfo.data || "--"} ${equipmentInfo.unit || "-"}`; //渲染设备参数(data)和单位(unit)
|
||||
const tag = EquipmentTag(equipmentInfo.equipmentName,param);
|
||||
const tag = EquipmentTag(equipmentInfo.equipmentName, param);
|
||||
equMesh.getObjectByName("tag").material = tag;
|
||||
this.deviceModels.push({'tagSpriteId':equMesh.getObjectByName("tag").id, 'equipmentId':equipmentInfo.equipmentId})
|
||||
this.realTimeRenderData(231321)
|
||||
this.deviceModels.push({
|
||||
tagSpriteId: equMesh.getObjectByName("tag").id,
|
||||
equipmentId: equipmentInfo.equipmentId,
|
||||
objId: equMesh.id,
|
||||
});
|
||||
this.realTimeRenderData(231321);
|
||||
if (/tr$/.test(targetPoint.name)) {
|
||||
equMesh.rotation.z = -Math.PI / 2;
|
||||
equMesh.rotation.y -= Math.PI / 4;
|
||||
@@ -234,6 +237,11 @@ function handleFanEqu(
|
||||
fanLeaf.rotation.z = obj.rotation;
|
||||
});
|
||||
this.fanSpinArray.push(fanSpin);
|
||||
this.deviceModels.push({
|
||||
tagSpriteId: "",
|
||||
equipmentId: equipmentInfo.equipmentId,
|
||||
objId: equMesh.id,
|
||||
});
|
||||
}
|
||||
|
||||
// 删除传感器
|
||||
@@ -354,3 +362,10 @@ function changeFanColor(fanData, targetPoint, scene) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function clearTunnelEquipments() {
|
||||
this.deviceModels.forEach((deviceModel) => {
|
||||
this.scene.remove(this.scene.getObjectById(deviceModel.objId));
|
||||
});
|
||||
this.deviceModels = [];
|
||||
}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
export function editTunnelInit(equipmentList) {
|
||||
// 清空设备
|
||||
this.clearTunnelEquipments()
|
||||
//初始化将墙壁隐藏起来
|
||||
equipmentList.forEach((item) => {
|
||||
this.addEquipment(this.scene.getObjectByName(item.position), item, 1);
|
||||
// 根据定位获取附着点信息
|
||||
const target = this.scene.getObjectByName(item.position);
|
||||
this.addEquipment(target, item, 1);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
export function handleLHover(targetPoint) {
|
||||
this.clearTunnelEquipments()
|
||||
if (this.tag3CSS2DObj.element.style.opacity != '1') {
|
||||
// 保存进入状态
|
||||
this._saveState();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
export function realTimeRenderData(realTimeData) {
|
||||
console.log(this.deviceModels);
|
||||
this.deviceModels.forEach((deviceModel) => {
|
||||
this.scene.getObjectById(deviceModel.tagSpriteId);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user