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.equipmentType =typeKey;
|
||||||
devRealtimeDetail.value.unit = u;
|
devRealtimeDetail.value.unit = u;
|
||||||
devRealtimeDetail.value.value = 1000; //1000替换为value
|
devRealtimeDetail.value.value = 1000; //1000替换为value
|
||||||
|
|
||||||
|
demo.clearTunnelEquipments()
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @description: 渲染隧道入口提示板信息
|
* @description: 渲染隧道入口提示板信息
|
||||||
|
|||||||
@@ -10,12 +10,11 @@ import {
|
|||||||
import { saveState, resetState } from "./viewBack";
|
import { saveState, resetState } from "./viewBack";
|
||||||
import addFunction from "./addEvent";
|
import addFunction from "./addEvent";
|
||||||
import { editTunnelInit } from "./editTunnelInit";
|
import { editTunnelInit } from "./editTunnelInit";
|
||||||
import { addEquipment, removeEquipment } from "./editEquipment";
|
import { addEquipment, removeEquipment,clearTunnelEquipments } from "./editEquipment";
|
||||||
import previewtunnelModeInit from "./previewTunnelInit";
|
import previewtunnelModeInit from "./previewTunnelInit";
|
||||||
import { StreetSignTag } from "./utils/StreetSignTag/StreetSignTag.js";
|
import { StreetSignTag } from "./utils/StreetSignTag/StreetSignTag.js";
|
||||||
import { realTimeRenderData } from "./realTimeRerender";
|
import { realTimeRenderData } from "./realTimeRerender";
|
||||||
// import { fa } from "element-plus/es/locale/index.js";
|
|
||||||
// import { ref } from "vue";
|
|
||||||
export default class Demo {
|
export default class Demo {
|
||||||
// 摄像机看向位置s
|
// 摄像机看向位置s
|
||||||
origin = null;
|
origin = null;
|
||||||
@@ -37,7 +36,7 @@ export default class Demo {
|
|||||||
this.previewtunnelModeInit = previewtunnelModeInit;
|
this.previewtunnelModeInit = previewtunnelModeInit;
|
||||||
this.editTunnelInit = editTunnelInit;
|
this.editTunnelInit = editTunnelInit;
|
||||||
this.realTimeRenderData = realTimeRenderData;
|
this.realTimeRenderData = realTimeRenderData;
|
||||||
|
this.clearTunnelEquipments = clearTunnelEquipments;
|
||||||
// 外部可添加函数
|
// 外部可添加函数
|
||||||
this.addFunction = addFunction;
|
this.addFunction = addFunction;
|
||||||
this.THREE = three;
|
this.THREE = three;
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import { eq } from "lodash";
|
import { eq } from "lodash";
|
||||||
import EquipmentTag from "../utils/EquipmentTag";
|
import EquipmentTag from "../utils/EquipmentTag";
|
||||||
/**
|
/**
|
||||||
@@ -48,13 +47,17 @@ function handleOtherEqu(targetPoint, equipmentInfo) {
|
|||||||
const equMesh = this.equMap.get("equ_sensors").clone();
|
const equMesh = this.equMap.get("equ_sensors").clone();
|
||||||
const worldP = targetPoint.getWorldPosition(new this.THREE.Vector3());
|
const worldP = targetPoint.getWorldPosition(new this.THREE.Vector3());
|
||||||
equMesh.position.copy(worldP);
|
equMesh.position.copy(worldP);
|
||||||
|
|
||||||
//设备添加标签
|
//设备添加标签
|
||||||
const param = `${equipmentInfo.data || "--"} ${equipmentInfo.unit || "-"}`; //渲染设备参数(data)和单位(unit)
|
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;
|
equMesh.getObjectByName("tag").material = tag;
|
||||||
this.deviceModels.push({'tagSpriteId':equMesh.getObjectByName("tag").id, 'equipmentId':equipmentInfo.equipmentId})
|
this.deviceModels.push({
|
||||||
this.realTimeRenderData(231321)
|
tagSpriteId: equMesh.getObjectByName("tag").id,
|
||||||
|
equipmentId: equipmentInfo.equipmentId,
|
||||||
|
objId: equMesh.id,
|
||||||
|
});
|
||||||
|
this.realTimeRenderData(231321);
|
||||||
if (/tr$/.test(targetPoint.name)) {
|
if (/tr$/.test(targetPoint.name)) {
|
||||||
equMesh.rotation.z = -Math.PI / 2;
|
equMesh.rotation.z = -Math.PI / 2;
|
||||||
equMesh.rotation.y -= Math.PI / 4;
|
equMesh.rotation.y -= Math.PI / 4;
|
||||||
@@ -234,6 +237,11 @@ function handleFanEqu(
|
|||||||
fanLeaf.rotation.z = obj.rotation;
|
fanLeaf.rotation.z = obj.rotation;
|
||||||
});
|
});
|
||||||
this.fanSpinArray.push(fanSpin);
|
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) {
|
export function editTunnelInit(equipmentList) {
|
||||||
|
// 清空设备
|
||||||
|
this.clearTunnelEquipments()
|
||||||
//初始化将墙壁隐藏起来
|
//初始化将墙壁隐藏起来
|
||||||
equipmentList.forEach((item) => {
|
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) {
|
export function handleLHover(targetPoint) {
|
||||||
|
this.clearTunnelEquipments()
|
||||||
if (this.tag3CSS2DObj.element.style.opacity != '1') {
|
if (this.tag3CSS2DObj.element.style.opacity != '1') {
|
||||||
// 保存进入状态
|
// 保存进入状态
|
||||||
this._saveState();
|
this._saveState();
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
export function realTimeRenderData(realTimeData) {
|
export function realTimeRenderData(realTimeData) {
|
||||||
console.log(this.deviceModels);
|
|
||||||
this.deviceModels.forEach((deviceModel) => {
|
this.deviceModels.forEach((deviceModel) => {
|
||||||
this.scene.getObjectById(deviceModel.tagSpriteId);
|
this.scene.getObjectById(deviceModel.tagSpriteId);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user