分压阀功能大致完成
This commit is contained in:
19427
public/tunnelModel/chanel-have-wall.gltf
Normal file
19427
public/tunnelModel/chanel-have-wall.gltf
Normal file
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -76,7 +76,7 @@ async function handleMounted() {
|
|||||||
demo = new ThreeDScene(three, content.value);
|
demo = new ThreeDScene(three, content.value);
|
||||||
//看是不是预览模式,然后继续相关的操作(会在demo中的初始化中进行)
|
//看是不是预览模式,然后继续相关的操作(会在demo中的初始化中进行)
|
||||||
demo.isedit = params.isedit;
|
demo.isedit = params.isedit;
|
||||||
let tunnelasync = await demo.loadModel(GLTFLoader, "./assets/tunnelModel/chanel.gltf");
|
let tunnelasync = await demo.loadModel(GLTFLoader, "./assets/tunnelModel/chanel-No-have-wall.gltf");
|
||||||
demo.addOrbitControls(OrbitControls);
|
demo.addOrbitControls(OrbitControls);
|
||||||
demo.addTween(TWEEN);
|
demo.addTween(TWEEN);
|
||||||
demo.addCSS3Renderer(CSS3DRenderer, CSS3DSprite, doms);
|
demo.addCSS3Renderer(CSS3DRenderer, CSS3DSprite, doms);
|
||||||
@@ -84,7 +84,6 @@ async function handleMounted() {
|
|||||||
lClickCallback(demo); //绑定左键回调
|
lClickCallback(demo); //绑定左键回调
|
||||||
rClickCallback(demo); //绑定右键回调
|
rClickCallback(demo); //绑定右键回调
|
||||||
|
|
||||||
|
|
||||||
//加载HDR背景图片
|
//加载HDR背景图片
|
||||||
demo.loadBackground(hdrLoader, backColorSet);
|
demo.loadBackground(hdrLoader, backColorSet);
|
||||||
watch(
|
watch(
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ export default class Demo {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.gltfloader = new GLTFLoader();
|
this.gltfloader = new GLTFLoader();
|
||||||
this.gltfloader.load(
|
this.gltfloader.load(
|
||||||
"/tunnelModel/chanel.gltf",
|
"/tunnelModel/chanel-have-wall.gltf",
|
||||||
(gltf) => {
|
(gltf) => {
|
||||||
gltf.scene.traverse((child) => {
|
gltf.scene.traverse((child) => {
|
||||||
this._forModels(child);
|
this._forModels(child);
|
||||||
@@ -486,25 +486,4 @@ export default class Demo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ThreeConfig = {
|
|
||||||
code: 0,
|
|
||||||
data: {
|
|
||||||
tunnelThreeConfig: [{
|
|
||||||
equipmentId: 'fan_01',//传感器id
|
|
||||||
equipmentName: '01',//设备名称
|
|
||||||
pointName: 'point_005_tl',//附着点名称(定位)
|
|
||||||
equipmentType: 'fan',//设备类型(类型可根据后端
|
|
||||||
equipmentValue: 23, //设备存的值
|
|
||||||
}, {
|
|
||||||
equipmentId: 'sensors_01',//传感器id
|
|
||||||
equipmentName: '01',//设备名称
|
|
||||||
pointName: 'point_009_bl',//附着点名称(定位)
|
|
||||||
equipmentType: 'sensors',//设备类型(类型可根据后端
|
|
||||||
equipmentValue: 67, //设备存的值
|
|
||||||
}],
|
|
||||||
},
|
|
||||||
msg: "dda"
|
|
||||||
}
|
|
||||||
tunnelConfigEquipment = this.ThreeConfig.data.tunnelThreeConfig
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import Demo from "../demo";
|
||||||
import EquipmentTag from "../utils/EquipmentTag";
|
import EquipmentTag from "../utils/EquipmentTag";
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -16,6 +17,10 @@ function addEquipment(targetPoint, formInfo) {
|
|||||||
case "frequency":
|
case "frequency":
|
||||||
handleFanEqu.call(this, targetPoint, formInfo.chooseEquipment);
|
handleFanEqu.call(this, targetPoint, formInfo.chooseEquipment);
|
||||||
break;
|
break;
|
||||||
|
// 还没有风压阀的模型,所以先用其他设备传感器实现
|
||||||
|
// case "valve":
|
||||||
|
// handleValveEqu.call(this, targetPoint, formInfo.chooseEquipment);
|
||||||
|
// break;
|
||||||
case "windPressure":
|
case "windPressure":
|
||||||
case "sensor":
|
case "sensor":
|
||||||
handleOtherEqu.call(this, targetPoint, formInfo.chooseEquipment);
|
handleOtherEqu.call(this, targetPoint, formInfo.chooseEquipment);
|
||||||
@@ -27,6 +32,14 @@ function addEquipment(targetPoint, formInfo) {
|
|||||||
// 标识设备信息
|
// 标识设备信息
|
||||||
this.clearTagsObj();
|
this.clearTagsObj();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// function handleValveEqu(targetPoint, equipmentInfo) {
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 其他传感器
|
// 其他传感器
|
||||||
function handleOtherEqu(targetPoint, equipmentInfo) {
|
function handleOtherEqu(targetPoint, equipmentInfo) {
|
||||||
const equMesh = this.equMap.get("equ_sensors").clone();
|
const equMesh = this.equMap.get("equ_sensors").clone();
|
||||||
@@ -58,12 +71,53 @@ function handleOtherEqu(targetPoint, equipmentInfo) {
|
|||||||
targetPoint.scale.set(0.03, 0.06, 0.05);
|
targetPoint.scale.set(0.03, 0.06, 0.05);
|
||||||
this.scene.add(equMesh);
|
this.scene.add(equMesh);
|
||||||
targetPoint.visible = false;
|
targetPoint.visible = false;
|
||||||
|
targetPoint.hasWall = true
|
||||||
|
//处理风压阀的代码片段
|
||||||
|
let lineIndex = targetPoint.name.slice(7, 9)
|
||||||
|
for (let line = Number(lineIndex); line <= 20; line++) {
|
||||||
|
if (line < 10) {
|
||||||
|
let wall = 'wall_' + '0' + line
|
||||||
|
this.scene.getObjectByName(wall).visible = true
|
||||||
|
let point = 'point_' + '00' + line + '_tc'
|
||||||
|
console.log(this.scene.getObjectByName(point));
|
||||||
|
this.scene.getObjectByName(point).visible = false
|
||||||
|
this.scene.getObjectByName(point).layers.set(-2)
|
||||||
|
if (this.scene.getObjectByName(point).hasDevice == true) {
|
||||||
|
let EquID = this.scene.getObjectByName(point).info.id
|
||||||
|
this.scene.getObjectById(EquID).visible = false
|
||||||
|
}
|
||||||
|
} else if (line >= 10) {
|
||||||
|
let wall = 'wall_' + line
|
||||||
|
this.scene.getObjectByName(wall).visible = true
|
||||||
|
let point = 'point_' + '0' + line + '_tc'
|
||||||
|
this.scene.getObjectByName(point).visible = false
|
||||||
|
this.scene.getObjectByName(point).layers.set(-2)
|
||||||
|
if (this.scene.getObjectByName(point).hasDevice == true) {
|
||||||
|
let EquID = this.scene.getObjectByName(point).info.id
|
||||||
|
this.scene.getObjectById(EquID).visible = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//处理21行的设备和附着点
|
||||||
|
let point = 'point_' + '0' + 21 + '_tc'
|
||||||
|
this.scene.getObjectByName(point).visible = false
|
||||||
|
this.scene.getObjectByName(point).layers.set(-2)
|
||||||
|
if (this.scene.getObjectByName(point).hasDevice == true) {
|
||||||
|
let EquID = this.scene.getObjectByName(point).info.id
|
||||||
|
this.scene.getObjectById(EquID).visible = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// this.scene.getObjectByName('wall_01').visible = true
|
||||||
|
// console.log(this.scene);
|
||||||
// 保存该设备模型id,后期直接从附附着点进行删除
|
// 保存该设备模型id,后期直接从附附着点进行删除
|
||||||
targetPoint.info = {
|
targetPoint.info = {
|
||||||
id: equMesh.id,
|
id: equMesh.id,
|
||||||
...equipmentInfo,
|
...equipmentInfo,
|
||||||
};
|
};
|
||||||
|
//下面进行模拟分压阀的添加效果
|
||||||
|
// 1.先取出当前点击添加设备锚点的行数
|
||||||
|
// 2.再进行字符串拼接出墙的名字,使用scene.getObjectByName(墙名去获取)
|
||||||
|
// 3.加上循环,固定到20结束就可以了,将点击的函数到20的函数的墙全部设为visable设为可见,还需要将中间的那行设备和附着点全部设为隐藏,且层级变低,无法选中
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 风机
|
// 风机
|
||||||
@@ -105,7 +159,45 @@ function handleFanEqu(
|
|||||||
|
|
||||||
// 删除传感器
|
// 删除传感器
|
||||||
function removeEquipment(targetPoint) {
|
function removeEquipment(targetPoint) {
|
||||||
|
//删除设备这里需要再进行处理,就是根据附着点(附着点一定保存了当前添加设备的信息了)判断是不是分压阀,然后继续一样的隐藏
|
||||||
if (!targetPoint.hasDevice) return;
|
if (!targetPoint.hasDevice) return;
|
||||||
|
if (targetPoint.hasWall == true) {
|
||||||
|
let lineIndex = targetPoint.name.slice(7, 9)
|
||||||
|
for (let line = Number(lineIndex); line <= 20; line++) {
|
||||||
|
if (line < 10) {
|
||||||
|
let wall = 'wall_' + '0' + line
|
||||||
|
this.scene.getObjectByName(wall).visible = false
|
||||||
|
let point = 'point_' + '00' + line + '_tc'
|
||||||
|
console.log(this.scene.getObjectByName(point));
|
||||||
|
this.scene.getObjectByName(point).visible = true
|
||||||
|
this.scene.getObjectByName(point).layers.set(0)
|
||||||
|
if (this.scene.getObjectByName(point).hasDevice == true) {
|
||||||
|
this.scene.getObjectByName(point).visible = false
|
||||||
|
let EquID = this.scene.getObjectByName(point).info.id
|
||||||
|
this.scene.getObjectById(EquID).visible = true
|
||||||
|
}
|
||||||
|
} else if (line >= 10) {
|
||||||
|
let wall = 'wall_' + line
|
||||||
|
this.scene.getObjectByName(wall).visible = false
|
||||||
|
let point = 'point_' + '0' + line + '_tc'
|
||||||
|
this.scene.getObjectByName(point).visible = true
|
||||||
|
this.scene.getObjectByName(point).layers.set(0)
|
||||||
|
if (this.scene.getObjectByName(point).hasDevice == true) {
|
||||||
|
this.scene.getObjectByName(point).visible = false
|
||||||
|
let EquID = this.scene.getObjectByName(point).info.id
|
||||||
|
this.scene.getObjectById(EquID).visible = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//处理21行的设备和附着点
|
||||||
|
let point = 'point_' + '0' + 21 + '_tc'
|
||||||
|
this.scene.getObjectByName(point).visible = true
|
||||||
|
this.scene.getObjectByName(point).layers.set(0)
|
||||||
|
if (this.scene.getObjectByName(point).hasDevice == true) {
|
||||||
|
let EquID = this.scene.getObjectByName(point).info.id
|
||||||
|
this.scene.getObjectById(EquID).visible = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
const mesh = this.scene.getObjectById(targetPoint.info.id);
|
const mesh = this.scene.getObjectById(targetPoint.info.id);
|
||||||
this.scene.remove(mesh);
|
this.scene.remove(mesh);
|
||||||
targetPoint.visible = true;
|
targetPoint.visible = true;
|
||||||
|
|||||||
@@ -1,4 +1,15 @@
|
|||||||
export function editTunnelInit(equipmentList) {
|
export function editTunnelInit(equipmentList) {
|
||||||
|
//初始化将墙壁隐藏起来
|
||||||
|
for (let line = 1; line <= 20; line++) {
|
||||||
|
if (line < 10) {
|
||||||
|
let wall = 'wall_' + '0' + line
|
||||||
|
this.scene.getObjectByName(wall).visible = false
|
||||||
|
} else if (line >= 10) {
|
||||||
|
let wall = 'wall_' + line
|
||||||
|
this.scene.getObjectByName(wall).visible = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
equipmentList.forEach((item) => {
|
equipmentList.forEach((item) => {
|
||||||
const formInfo = {
|
const formInfo = {
|
||||||
equipmentType: item.equipmentType, //设备类型
|
equipmentType: item.equipmentType, //设备类型
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
export default function previewtunnelModeInit(equipmentList) {
|
export default function previewtunnelModeInit(equipmentList) {
|
||||||
// for (const item of this.tunnelConfigEquipment) {
|
//初始化将墙壁隐藏起来
|
||||||
// //使用api取拿到附着点
|
for (let line = 1; line <= 20; line++) {
|
||||||
// let pointmodel = this.scene.getObjectByName(item.pointName)
|
if (line < 10) {
|
||||||
// pointmodel.hasDevice;
|
let wall = 'wall_' + '0' + line
|
||||||
// let formInfo = {
|
this.scene.getObjectByName(wall).visible = false
|
||||||
// equipmentType: item.equipmentType, //设备类型
|
} else if (line >= 10) {
|
||||||
// chooseEquipment: item.equipmentName, //设备选择(设备名称)
|
let wall = 'wall_' + line
|
||||||
// threshold: item.equipmentValue, //阈值
|
this.scene.getObjectByName(wall).visible = false
|
||||||
// }
|
}
|
||||||
// this.addEquipment(pointmodel, formInfo);
|
}
|
||||||
// }
|
|
||||||
equipmentList.forEach((item) => {
|
equipmentList.forEach((item) => {
|
||||||
const formInfo = {
|
const formInfo = {
|
||||||
equipmentType: item.equipmentType, //设备类型
|
equipmentType: item.equipmentType, //设备类型
|
||||||
|
|||||||
Reference in New Issue
Block a user