解决隧道仿真数据在隧道中没有渲染问题
This commit is contained in:
@@ -34,7 +34,7 @@ function addEquipment(targetPoint, formInfo, fanData) {
|
||||
}
|
||||
|
||||
//判断墙是否已经存在,如果存在的话,就不管,添加则无效嘛(就是说只能添加一面墙,如果存在一面墙,则不管了)
|
||||
let hasWall = false
|
||||
let hasWall = false;
|
||||
let wallHang = 0;
|
||||
|
||||
// function handleValveEqu(targetPoint, equipmentInfo) {
|
||||
@@ -49,7 +49,8 @@ function handleOtherEqu(targetPoint, equipmentInfo) {
|
||||
equMesh.position.copy(worldP);
|
||||
|
||||
//设备添加标签
|
||||
const tag = EquipmentTag(equipmentInfo.equipmentName);
|
||||
const param = `${equipmentInfo.data || "--"} ${equipmentInfo.unit || "-"}`; //渲染设备参数(data)和单位(unit)
|
||||
const tag = EquipmentTag(equipmentInfo.equipmentName,param);
|
||||
equMesh.getObjectByName("tag").material = tag;
|
||||
if (/tr$/.test(targetPoint.name)) {
|
||||
equMesh.rotation.z = -Math.PI / 2;
|
||||
@@ -195,11 +196,10 @@ function handleFanEqu(
|
||||
if (item.isMesh) {
|
||||
item.material = item.material.clone();
|
||||
}
|
||||
})
|
||||
});
|
||||
// equMesh.geometry = this.equMap.get("equ_fan").geometry.clone();
|
||||
// console.log(equMesh);
|
||||
|
||||
|
||||
const worldP = targetPoint.getWorldPosition(new this.THREE.Vector3());
|
||||
equMesh.position.copy(worldP);
|
||||
equMesh.translateY(-0.6);
|
||||
@@ -213,15 +213,13 @@ function handleFanEqu(
|
||||
...equipmentInfo,
|
||||
};
|
||||
//我们把风机的附着点挂在原型上,这样应该可以进行处理
|
||||
if (targetPoint.info.equipmentName.slice(0, 1) == '1') {
|
||||
this.scene.Fan1targetPoint = targetPoint
|
||||
if (targetPoint.info.equipmentName.slice(0, 1) == "1") {
|
||||
this.scene.Fan1targetPoint = targetPoint;
|
||||
} else {
|
||||
this.scene.Fan2targetPoint = targetPoint
|
||||
this.scene.Fan2targetPoint = targetPoint;
|
||||
}
|
||||
//这里感觉情况改变风机的颜色
|
||||
changeFanColor(fanData, targetPoint, this.scene)
|
||||
|
||||
|
||||
changeFanColor(fanData, targetPoint, this.scene);
|
||||
|
||||
// 定义风机旋转
|
||||
const fanLeaf = equMesh.getObjectByName("fan_leafs");
|
||||
@@ -240,7 +238,6 @@ function removeEquipment(targetPoint) {
|
||||
//删除设备这里需要再进行处理,就是根据附着点(附着点一定保存了当前添加设备的信息了)判断是不是分压阀,然后继续一样的隐藏
|
||||
if (!targetPoint.hasDevice) return;
|
||||
|
||||
|
||||
//删除我们这里使用行数来判断,即是不是删除到了我们的那一行呢?
|
||||
//如果删除到了我们那行的话,我们必须将行的数组从中去掉已存在的数据,然后将附着点列表中也去除这个点,然后将墙设置为false来让下次使用
|
||||
|
||||
@@ -286,8 +283,6 @@ function removeEquipment(targetPoint) {
|
||||
// }
|
||||
// deleteItem(Allhang, Number(lineIndex))
|
||||
|
||||
|
||||
|
||||
console.log("测试是不是删除了");
|
||||
const mesh = this.scene.getObjectById(targetPoint.info.id);
|
||||
this.scene.remove(mesh);
|
||||
@@ -298,13 +293,12 @@ function removeEquipment(targetPoint) {
|
||||
}
|
||||
export { addEquipment, removeEquipment };
|
||||
|
||||
|
||||
function deleteItem(array, item) {
|
||||
let index = array.indexOf(item);
|
||||
if (index !== -1) {
|
||||
array.splice(index, 1);
|
||||
}
|
||||
return array
|
||||
return array;
|
||||
}
|
||||
|
||||
// 这里是改变风机颜色的代码
|
||||
@@ -315,7 +309,7 @@ function changeFanColor(fanData, targetPoint, scene) {
|
||||
//if保证存在风机(即有长度再进行遍历)
|
||||
for (let i = 0; i < fanData.length; i++) {
|
||||
//先做匹配操作
|
||||
let fanType = fanData[i].equipmentType
|
||||
let fanType = fanData[i].equipmentType;
|
||||
//有符合条件的风机进来了
|
||||
if (targetPoint.info.typeKey == fanType) {
|
||||
//下面进行变色需要的逻辑判断了
|
||||
@@ -327,9 +321,9 @@ function changeFanColor(fanData, targetPoint, scene) {
|
||||
// console.log(obj);
|
||||
// 判断子对象是否是物体,如果是,更改其颜色
|
||||
if (obj.isMesh) {
|
||||
obj.material.color.set(0xFF0000)
|
||||
obj.material.color.set(0xff0000);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -342,9 +336,9 @@ function changeFanColor(fanData, targetPoint, scene) {
|
||||
// console.log(obj);
|
||||
// 判断子对象是否是物体,如果是,更改其颜色
|
||||
if (obj.isMesh) {
|
||||
obj.material.color.set(0x008000)
|
||||
obj.material.color.set(0x008000);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -356,4 +350,4 @@ function changeFanColor(fanData, targetPoint, scene) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user