邓洁 : 隧道模型合并
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
export function addDev(devId) {
|
||||
if (!this.checkDevId) {
|
||||
alert("请选择设备");
|
||||
return;
|
||||
}
|
||||
const devModel = this.devMap.get(devId).clone();
|
||||
handleLoadedDevice.call(this, devModel);
|
||||
}
|
||||
|
||||
function handleLoadedDevice(model) {
|
||||
if (!this.targetPoint) return;
|
||||
//获取定位位置
|
||||
const wp = this.targetPoint.getWorldPosition(new this.THREE.Vector3());
|
||||
model.position.copy(wp);
|
||||
this.targetPoint.visible = false;
|
||||
|
||||
this.scene.add(model);
|
||||
if (model.name === "camera") {
|
||||
model.translateX(-5);
|
||||
model.translateZ(4);
|
||||
model.translateY(-0.5);
|
||||
}
|
||||
// 添加的信息请求或初始化的信息
|
||||
this.targetPoint.info = {
|
||||
name: "摄像头",
|
||||
state: "未开启",
|
||||
devId: model.id,
|
||||
};
|
||||
this.targetPoint.hasDevice = true;
|
||||
}
|
||||
Reference in New Issue
Block a user