大屏BIM漫游客户端渲染
parent
fca1934db0
commit
aef62e391c
|
@ -146,7 +146,7 @@ const ganttStyle = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
function initEngine(that) {
|
function initEngine(that) {
|
||||||
if (that.isClient()) {
|
if (that.clientShow()) {
|
||||||
apiTools.loadEngine(that, "bim4DContainer", 'bim4DApi',
|
apiTools.loadEngine(that, "bim4DContainer", 'bim4DApi',
|
||||||
() => {
|
() => {
|
||||||
initLoadModel(that);
|
initLoadModel(that);
|
||||||
|
@ -206,7 +206,7 @@ function addModel(that, modelId, cb) {
|
||||||
let url = `${window.config.modelUrl}/Tools/output/model/${modelId}/root.glt`;
|
let url = `${window.config.modelUrl}/Tools/output/model/${modelId}/root.glt`;
|
||||||
let direction = null;
|
let direction = null;
|
||||||
let modelInfo = that.models.find(m => m.modelId == modelId);
|
let modelInfo = that.models.find(m => m.modelId == modelId);
|
||||||
if (that.isClient()) {
|
if (that.clientShow()) {
|
||||||
url = `/bimdata/Tools/output/model/${modelId}/root.glt`;
|
url = `/bimdata/Tools/output/model/${modelId}/root.glt`;
|
||||||
if (modelInfo) {
|
if (modelInfo) {
|
||||||
direction = modelInfo.bimCfg.direction;
|
direction = modelInfo.bimCfg.direction;
|
||||||
|
@ -224,7 +224,7 @@ function addModel(that, modelId, cb) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (that.viewPoint) {
|
if (that.viewPoint) {
|
||||||
if (that.viewPoint.world) {
|
if (that.viewPoint.world) {
|
||||||
if (!that.isClient()) {
|
if (!that.clientShow()) {
|
||||||
api.Camera.setViewPort(that.viewPoint);
|
api.Camera.setViewPort(that.viewPoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,13 +164,19 @@ function addModel(api, bimCfg, modelId, cb, models) {
|
||||||
let rotateX = cfg?.rotateX || 0;
|
let rotateX = cfg?.rotateX || 0;
|
||||||
let rotateY = cfg?.rotateY || 0;
|
let rotateY = cfg?.rotateY || 0;
|
||||||
if (x * 1 + y * 1 + z * 1 != 0) {
|
if (x * 1 + y * 1 + z * 1 != 0) {
|
||||||
api.Model.moveToPosition([x*1, y*1, z*1], 0, modelId)
|
if(bimCfg.showGis){
|
||||||
|
api.Model.moveToPosition([x*1, y*1, z*1], 0, modelId)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (rotateZ * 1 != 0) {
|
if (rotateZ * 1 != 0) {
|
||||||
if (this.me.bimCfg.clientApi) {
|
if (this.me.bimCfg.clientApi) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
api.Model.rotate(rotateX, rotateY, rotateZ, modelId)
|
if(bimCfg.showGis){
|
||||||
|
api.Model.rotate(rotateX, rotateY, rotateZ, modelId)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cfg && cfg.hideParts) {
|
if (cfg && cfg.hideParts) {
|
||||||
|
@ -262,11 +268,16 @@ function initModelPosition(that, api) {
|
||||||
let rotateY = cfg?.rotateY || 0;
|
let rotateY = cfg?.rotateY || 0;
|
||||||
if (x * 1 + y * 1 + z * 1 != 0) {
|
if (x * 1 + y * 1 + z * 1 != 0) {
|
||||||
console.log(x, y, z)
|
console.log(x, y, z)
|
||||||
api.Model.moveToPosition([x, y, z], 0, modelId)
|
if(that.bimCfg.showGis){
|
||||||
|
api.Model.moveToPosition([x, y, z], 0, modelId)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (rotateZ * 1 != 0) {
|
if (rotateZ * 1 != 0) {
|
||||||
if (!this.me.bimCfg.clientApi) {
|
if (!this.me.bimCfg.clientApi) {
|
||||||
api.Model.rotate(rotateX, rotateY, rotateZ, modelId)
|
if(that.bimCfg.showGis){
|
||||||
|
api.Model.rotate(rotateX, rotateY, rotateZ, modelId)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cfg && cfg.hideParts) {
|
if (cfg && cfg.hideParts) {
|
||||||
|
@ -307,7 +318,17 @@ function initHideParts(that, api) {
|
||||||
function resetScene(that, api) {
|
function resetScene(that, api) {
|
||||||
that.selectedViewpoint = null;
|
that.selectedViewpoint = null;
|
||||||
that.selectedRoam = null;
|
that.selectedRoam = null;
|
||||||
api.Camera.stopImmersiveRoam();
|
try{
|
||||||
|
if(that.isClient){
|
||||||
|
api.Camera.IRPlayCancle()
|
||||||
|
api.Camera.stopViewPortRoam()
|
||||||
|
}else{
|
||||||
|
api.Camera.stopViewPortRoam()
|
||||||
|
api.Camera.stopImmersiveRoam();
|
||||||
|
}
|
||||||
|
}catch(e){
|
||||||
|
|
||||||
|
}
|
||||||
api.Model.location(api.m_model.keys().toArray()[0]);
|
api.Model.location(api.m_model.keys().toArray()[0]);
|
||||||
if (!that.bimCfg.clientApi) {
|
if (!that.bimCfg.clientApi) {
|
||||||
api.Plugin.deleteMiniMap();
|
api.Plugin.deleteMiniMap();
|
||||||
|
@ -317,6 +338,11 @@ function resetScene(that, api) {
|
||||||
if (!that.bimCfg.clientApi) {
|
if (!that.bimCfg.clientApi) {
|
||||||
api.Camera.setViewPort(that.viewPoint);
|
api.Camera.setViewPort(that.viewPoint);
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
if(that.bimCfg.clientApi){
|
||||||
|
let pt=that.viewPoint;
|
||||||
|
api.Camera.SetCamera(pt.position, pt.heading, pt.pitch)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,7 +202,7 @@ function clearEvent(that) {
|
||||||
let api = bimBriefingApi;
|
let api = bimBriefingApi;
|
||||||
if (api) {
|
if (api) {
|
||||||
actorShow(that);
|
actorShow(that);
|
||||||
if (!that.isClient()) {
|
if (!that.clientShow()) {
|
||||||
api.Feature.getByEvent(false);
|
api.Feature.getByEvent(false);
|
||||||
api.Model.clearBoundsBox();
|
api.Model.clearBoundsBox();
|
||||||
|
|
||||||
|
|
|
@ -152,8 +152,8 @@ export default {
|
||||||
window.D4App = this;
|
window.D4App = this;
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
isClient() {
|
clientShow() {
|
||||||
return this.bimCfg.clientApi;
|
return this.bimCfg?.clientApi || false;
|
||||||
},
|
},
|
||||||
doSaveSetting() {
|
doSaveSetting() {
|
||||||
if (isNaN(parseInt(this.playTime))) {
|
if (isNaN(parseInt(this.playTime))) {
|
||||||
|
|
|
@ -270,8 +270,8 @@ export default {
|
||||||
this.initEngine();
|
this.initEngine();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
isClient() {
|
clientShow() {
|
||||||
return this.bimCfg.clientApi;
|
return this.bimCfg?.clientApi || false;
|
||||||
},
|
},
|
||||||
clearAllHide() {
|
clearAllHide() {
|
||||||
this.$confirm("确定要显示所有构件吗?", "提示", {
|
this.$confirm("确定要显示所有构件吗?", "提示", {
|
||||||
|
@ -516,7 +516,7 @@ export default {
|
||||||
this.attributeInformation = "";
|
this.attributeInformation = "";
|
||||||
bimTools.initBimCfg(this);
|
bimTools.initBimCfg(this);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (this.isClient()) {
|
if (this.clientShow()) {
|
||||||
apiTools.loadEngine(this, "bimBriefingContainer", 'bimBriefingApi', this.initLoadModel)
|
apiTools.loadEngine(this, "bimBriefingContainer", 'bimBriefingApi', this.initLoadModel)
|
||||||
} else {
|
} else {
|
||||||
sapiTools.loadEngine(this, "bimBriefingContainer", 'bimBriefingApi', this.initLoadModel)
|
sapiTools.loadEngine(this, "bimBriefingContainer", 'bimBriefingApi', this.initLoadModel)
|
||||||
|
@ -631,7 +631,7 @@ export default {
|
||||||
let url = `${window.config.modelUrl}/Tools/output/model/${modelId}/root.glt`;
|
let url = `${window.config.modelUrl}/Tools/output/model/${modelId}/root.glt`;
|
||||||
let direction = null;
|
let direction = null;
|
||||||
let modelInfo = this.models.find(m => m.modelId == modelId);
|
let modelInfo = this.models.find(m => m.modelId == modelId);
|
||||||
if (this.isClient()) {
|
if (this.clientShow()) {
|
||||||
url = `/bimdata/Tools/output/model/${modelId}/root.glt`;
|
url = `/bimdata/Tools/output/model/${modelId}/root.glt`;
|
||||||
if (modelInfo) {
|
if (modelInfo) {
|
||||||
direction = modelInfo.bimCfg.direction;
|
direction = modelInfo.bimCfg.direction;
|
||||||
|
@ -648,7 +648,7 @@ export default {
|
||||||
console.log("加载模型成功");
|
console.log("加载模型成功");
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (this.viewPoint) {
|
if (this.viewPoint) {
|
||||||
if (!this.isClient()) {
|
if (!this.clientShow()) {
|
||||||
api.Camera.setViewPort(this.viewPoint);
|
api.Camera.setViewPort(this.viewPoint);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -853,60 +853,16 @@ export default {
|
||||||
this.loadDevicePosition();
|
this.loadDevicePosition();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
bimTools.setDefaultViewPoint(window.bimMgrApi, this.bimCfg, this.viewPoint)
|
bimTools.setDefaultViewPoint(window.bimMgrApi, this.bimCfg, this.viewPoint)
|
||||||
|
this.hideParts=hideParts;
|
||||||
bimTools.hideParts(window.bimMgrApi, hideParts);
|
bimTools.hideParts(window.bimMgrApi, hideParts);
|
||||||
this.modelLoadSuccess = true;
|
this.modelLoadSuccess = true;
|
||||||
this.resetScene();
|
this.resetScene();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
// this.models.forEach((item) => {
|
|
||||||
// this.addModel(item.lightweightName);
|
|
||||||
// });
|
|
||||||
//bimTools.initLoadModel(this, bimMgrApi)
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
// addModel(modelId, cb) {
|
|
||||||
// let url = `${window.config.modelUrl}/Tools/output/model/${modelId}/root.glt`;
|
|
||||||
// let direction = null;
|
|
||||||
// let modelInfo = this.models.find(m => m.modelId == modelId);
|
|
||||||
// if (this.isClient) {
|
|
||||||
// url = `/bimdata/Tools/output/model/${modelId}/root.glt`;
|
|
||||||
// if (modelInfo) {
|
|
||||||
// direction = modelInfo.bimCfg.direction;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// let api = bimMgrApi;
|
|
||||||
// console.log(modelId, url);
|
|
||||||
// api.Model.add(
|
|
||||||
// url,
|
|
||||||
// modelId,
|
|
||||||
// () => { },
|
|
||||||
// () => {
|
|
||||||
// cb && cb();
|
|
||||||
// console.log("加载模型成功");
|
|
||||||
// this.loadDevicePosition();
|
|
||||||
|
|
||||||
// setTimeout(() => {
|
|
||||||
|
|
||||||
// if (this.isClient) {
|
|
||||||
// } else {
|
|
||||||
// if (this.viewPoint) {
|
|
||||||
// api.Camera.setViewPort(this.viewPoint);
|
|
||||||
// } else {
|
|
||||||
// api.Camera.getViewPort((p) => {
|
|
||||||
// this.viewPoint = p;
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// this.modelLoadSuccess = true;
|
|
||||||
// api.Model.location(modelId)
|
|
||||||
// }, 1000);
|
|
||||||
// }, direction
|
|
||||||
// );
|
|
||||||
// },
|
|
||||||
changeMode(mode) {
|
changeMode(mode) {
|
||||||
if (!this.modelLoadSuccess) {
|
if (!this.modelLoadSuccess) {
|
||||||
this.$message.error("模型加载中,请稍后");
|
this.$message.error("模型加载中,请稍后");
|
||||||
|
@ -922,6 +878,7 @@ export default {
|
||||||
api.Model.original(it.lightweightName);
|
api.Model.original(it.lightweightName);
|
||||||
api.Model.setAlpha(it.lightweightName, 1);
|
api.Model.setAlpha(it.lightweightName, 1);
|
||||||
});
|
});
|
||||||
|
bimTools.hideParts(api, this.hideParts);
|
||||||
this.resetScene();
|
this.resetScene();
|
||||||
} else {
|
} else {
|
||||||
this.$api.planSchedule.findPlanProgress(this.selProject.id).then((d) => {
|
this.$api.planSchedule.findPlanProgress(this.selProject.id).then((d) => {
|
||||||
|
@ -957,7 +914,6 @@ export default {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//console.log("====>",beforeData,afterData,processData,standData);
|
|
||||||
if (allData.length > 0) {
|
if (allData.length > 0) {
|
||||||
allData = allData.map((item) => item.featureId);
|
allData = allData.map((item) => item.featureId);
|
||||||
this.models.forEach((model) => {
|
this.models.forEach((model) => {
|
||||||
|
|
|
@ -121,6 +121,7 @@ export default {
|
||||||
selectedRoam: null,
|
selectedRoam: null,
|
||||||
modelLoaded: false,
|
modelLoaded: false,
|
||||||
isPlay: false,
|
isPlay: false,
|
||||||
|
isClient: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
@ -144,8 +145,8 @@ export default {
|
||||||
this.initEngine();
|
this.initEngine();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
isClient() {
|
clientShow() {
|
||||||
return this.bimCfg.clientApi;
|
return this.bimCfg?.clientApi || false;
|
||||||
},
|
},
|
||||||
loadNode(node, resolve) {
|
loadNode(node, resolve) {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
@ -191,7 +192,6 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getTreeChildren(node, resolve) {
|
getTreeChildren(node, resolve) {
|
||||||
let that = this;
|
|
||||||
let data = node.data;
|
let data = node.data;
|
||||||
this.$api.bim.getModelTree(data.modelId, data.glid).then((d) => {
|
this.$api.bim.getModelTree(data.modelId, data.glid).then((d) => {
|
||||||
let tmps = (d.data || []).map((it) => {
|
let tmps = (d.data || []).map((it) => {
|
||||||
|
@ -217,18 +217,50 @@ export default {
|
||||||
return o;
|
return o;
|
||||||
},
|
},
|
||||||
playIRPause(data) {
|
playIRPause(data) {
|
||||||
|
let api = bimRoadmApi;
|
||||||
data.play = 2;
|
data.play = 2;
|
||||||
this.isPlay = false;
|
this.isPlay = false;
|
||||||
|
if (data.roamingType == 2) {//自定义视图
|
||||||
bimRoadmApi.Camera.pauseImmersiveRoam(false);
|
api.Camera.pauseViewPortRoam(false)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.isClient) {
|
||||||
|
bimRoadmApi.Camera.PlayIRPause();
|
||||||
|
} else {
|
||||||
|
bimRoadmApi.Camera.pauseImmersiveRoam(false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
playClient(data) {
|
||||||
|
let api = bimRoadmApi;
|
||||||
|
api.Camera.startViewPortRoam(JSON.parse(data.points), 0, data.time * 1000, (res) => {
|
||||||
|
this.isRoamingHistory = false
|
||||||
|
data.play = 0
|
||||||
|
this.$message.info('漫游结束!')
|
||||||
|
this.resetScene()
|
||||||
|
})
|
||||||
},
|
},
|
||||||
playContinue(data) {
|
playContinue(data) {
|
||||||
|
let api = bimRoadmApi;
|
||||||
data.play = 1;
|
data.play = 1;
|
||||||
this.isPlay = true;
|
this.isPlay = true;
|
||||||
bimRoadmApi.Camera.pauseImmersiveRoam(true);
|
if (data.roamingType == 2) {//自定义视图
|
||||||
|
if (this.isClient) {
|
||||||
|
this.playClient(data)
|
||||||
|
} else {
|
||||||
|
api.Camera.pauseViewPortRoam(true)
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.isClient) {
|
||||||
|
bimRoadmApi.Camera.PlayIRContinue();
|
||||||
|
} else {
|
||||||
|
bimRoadmApi.Camera.pauseImmersiveRoam(true);
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
playCancle(data) {
|
playCancle(data) {
|
||||||
this.isPlay = false;
|
this.isPlay = false;
|
||||||
|
let api = bimRoadmApi;
|
||||||
if (data) {
|
if (data) {
|
||||||
data.play = 0;
|
data.play = 0;
|
||||||
this.selectedRoam = null;
|
this.selectedRoam = null;
|
||||||
|
@ -237,23 +269,68 @@ export default {
|
||||||
this.roamingList.find((x) => x.play === 1).play = 0;
|
this.roamingList.find((x) => x.play === 1).play = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bimRoadmApi.Camera.cancelPlayImmersiveRoam();
|
if (data && data.roamingType == 2) {//自定义视图
|
||||||
|
if (this.isClient) {
|
||||||
|
api.Camera.IRPlayCancle()
|
||||||
|
} else {
|
||||||
|
api.Camera.stopViewPortRoam()
|
||||||
|
}
|
||||||
|
this.resetScene();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.isClient) {
|
||||||
|
bimRoadmApi.Camera.IRPlayCancle()
|
||||||
|
} else {
|
||||||
|
bimRoadmApi.Camera.cancelPlayImmersiveRoam();
|
||||||
|
}
|
||||||
|
|
||||||
this.resetScene();
|
this.resetScene();
|
||||||
},
|
},
|
||||||
|
doPlayCustomView(data) {
|
||||||
|
//自定义视图
|
||||||
|
let api = bimRoadmApi;
|
||||||
|
if (this.isClient) {
|
||||||
|
this.playClient(data)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
api.Camera.startViewPortRoam(JSON.parse(data.points), data.time, (res) => {
|
||||||
|
this.isRoamingHistory = false
|
||||||
|
data.play = 0
|
||||||
|
this.$message.info('漫游结束!')
|
||||||
|
this.resetScene()
|
||||||
|
})
|
||||||
|
},
|
||||||
startRoaming(data) {
|
startRoaming(data) {
|
||||||
if (!this.modelLoaded) {
|
if (!this.modelLoaded) {
|
||||||
this.$message.error("暂无模型,请先关联模型");
|
this.$message.error("暂无模型,请先关联模型");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let api = bimRoadmApi;
|
let api = bimRoadmApi;
|
||||||
this.playCancle();
|
this.playCancle(data);
|
||||||
|
|
||||||
if (this.roamingList.findIndex((x) => x.play === 1) > -1) {
|
if (this.roamingList.findIndex((x) => x.play === 1) > -1) {
|
||||||
this.roamingList.find((x) => x.play === 1).play = 0;
|
this.roamingList.find((x) => x.play === 1).play = 0;
|
||||||
}
|
}
|
||||||
data.play = 1;
|
data.play = 1;
|
||||||
|
if (data.roamingType == 2) {
|
||||||
|
this.doPlayCustomView(data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
let record = typeof data.points === "string" ? JSON.parse(data.points) : data.points;
|
let record = typeof data.points === "string" ? JSON.parse(data.points) : data.points;
|
||||||
|
|
||||||
|
if (this.isClient) {
|
||||||
|
this.selectedRoam = data;
|
||||||
|
this.isPlay = true;
|
||||||
|
api.Camera.PlayIRCamera({
|
||||||
|
records: data.points,
|
||||||
|
complete: () => {
|
||||||
|
this.selectedRoam = null;
|
||||||
|
data.play = 0;
|
||||||
|
this.isPlay = false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return;
|
||||||
|
}
|
||||||
api.Camera.setImmersiveRoamConfig({
|
api.Camera.setImmersiveRoamConfig({
|
||||||
roamingMode: data.roamingMode,
|
roamingMode: data.roamingMode,
|
||||||
moveRate: data.moveRate,
|
moveRate: data.moveRate,
|
||||||
|
@ -294,6 +371,7 @@ export default {
|
||||||
it.visible = true;
|
it.visible = true;
|
||||||
api.Model.setVisible(it.modelId, true);
|
api.Model.setVisible(it.modelId, true);
|
||||||
api.Model.original(it.modelId);
|
api.Model.original(it.modelId);
|
||||||
|
bimTools.hideParts(window.bimRoadmApi, this.hideParts);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
that.models.forEach((it) => {
|
that.models.forEach((it) => {
|
||||||
|
@ -305,6 +383,7 @@ export default {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
api.Model.setVisible(node.modelId, true);
|
api.Model.setVisible(node.modelId, true);
|
||||||
api.Model.original(node.modelId);
|
api.Model.original(node.modelId);
|
||||||
|
bimTools.hideParts(window.bimRoadmApi, this.hideParts);
|
||||||
this.models.find((mm) => mm.modelId == node.modelId).visible = true;
|
this.models.find((mm) => mm.modelId == node.modelId).visible = true;
|
||||||
} else {
|
} else {
|
||||||
api.Model.setVisible(node.modelId, false);
|
api.Model.setVisible(node.modelId, false);
|
||||||
|
@ -340,6 +419,7 @@ export default {
|
||||||
this.setFeatueVisible(tmps, true);
|
this.setFeatueVisible(tmps, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
bimTools.hideParts(window.bimRoadmApi, this.hideParts);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setFeatueVisible(featureIds, show) {
|
setFeatueVisible(featureIds, show) {
|
||||||
|
@ -376,18 +456,18 @@ export default {
|
||||||
if (!this.selProject) {
|
if (!this.selProject) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
bimTools.initBimCfg(this);
|
||||||
this.elId++;
|
this.elId++;
|
||||||
this.activeMenu = 0;
|
this.activeMenu = 0;
|
||||||
bimTools.initBimCfg(this);
|
bimTools.initBimCfg(this);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (this.isClient()) {
|
bimTools.initEngine("bimRoadmApi", "bimRoamingContainer", this.bimCfg, this.initLoadModel);
|
||||||
apiTools.loadEngine(this, "bimRoamingContainer", 'bimRoadmApi', this.initLoadModel)
|
|
||||||
} else {
|
|
||||||
sapiTools.loadEngine(this, "bimRoamingContainer", 'bimRoadmApi', this.initLoadModel)
|
|
||||||
}
|
|
||||||
}, 10);
|
}, 10);
|
||||||
},
|
},
|
||||||
initLoadModel() {
|
initLoadModel() {
|
||||||
|
if (this.selProject == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.$api.bim.getDefaultViewPoint(this.selProject.id, 1).then((d) => {
|
this.$api.bim.getDefaultViewPoint(this.selProject.id, 1).then((d) => {
|
||||||
let pt = "";
|
let pt = "";
|
||||||
if (d.data && d.data.length > 0) {
|
if (d.data && d.data.length > 0) {
|
||||||
|
@ -417,18 +497,24 @@ export default {
|
||||||
if (this.models.length == 0) {
|
if (this.models.length == 0) {
|
||||||
this.$modal.error("暂无模型,请先关联模型");
|
this.$modal.error("暂无模型,请先关联模型");
|
||||||
} else {
|
} else {
|
||||||
|
bimTools.addModelList(window.bimRoadmApi, this.bimCfg, this.models, (hideParts) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
bimTools.setDefaultViewPoint(window.bimRoadmApi, this.bimCfg, this.viewPoint)
|
||||||
|
this.hideParts = hideParts;
|
||||||
|
bimTools.hideParts(window.bimRoadmApi, hideParts);
|
||||||
|
this.modelLoaded = true;
|
||||||
|
this.resetScene();
|
||||||
|
}, 1000);
|
||||||
|
});
|
||||||
this.models.forEach((item) => {
|
this.models.forEach((item) => {
|
||||||
item.modelId = item.lightweightName;
|
item.modelId = item.lightweightName;
|
||||||
item.gis = JSON.parse(item.gisJson);
|
item.gis = JSON.parse(item.gisJson);
|
||||||
this.addModel(item.lightweightName);
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.$refs.tree.setChecked(item.lightweightName, true, true);
|
this.$refs.tree.setChecked(item.lightweightName, true, true);
|
||||||
}, 3000);
|
}, 3000);
|
||||||
});
|
});
|
||||||
this.treeKey++;
|
this.treeKey++;
|
||||||
|
|
||||||
bimTools.initLoadModel(this, bimRoadmApi)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.init();
|
this.init();
|
||||||
|
@ -453,7 +539,6 @@ export default {
|
||||||
loadRoaming() {
|
loadRoaming() {
|
||||||
this.$api.bim
|
this.$api.bim
|
||||||
.roamingGet({
|
.roamingGet({
|
||||||
roamingType: 1,
|
|
||||||
projectId: this.selProject.id,
|
projectId: this.selProject.id,
|
||||||
pageSize: 100,
|
pageSize: 100,
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
|
@ -463,7 +548,7 @@ export default {
|
||||||
list.forEach((item) => {
|
list.forEach((item) => {
|
||||||
item.play = 0;
|
item.play = 0;
|
||||||
});
|
});
|
||||||
this.roamingList = list;
|
this.roamingList = list.filter(x => (x.roamingMode == (this.isClient ? "Client" : 0) && x.roamingType == 2) || x.roamingType == 1);
|
||||||
this.roamingLoading = false;
|
this.roamingLoading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -474,8 +559,14 @@ export default {
|
||||||
}
|
}
|
||||||
this.playCancle();
|
this.playCancle();
|
||||||
this.selectedViewpoint = item;
|
this.selectedViewpoint = item;
|
||||||
|
let pt = JSON.parse(item.viewPosition)
|
||||||
if (item.viewPosition != null) {
|
if (item.viewPosition != null) {
|
||||||
bimRoadmApi.Camera.setViewPort(JSON.parse(item.viewPosition));
|
if (this.isClient) {
|
||||||
|
bimRoadmApi.Camera.SetCamera(pt.position, pt.heading, pt.pitch)
|
||||||
|
} else {
|
||||||
|
bimRoadmApi.Camera.setViewPort(pt);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
loadModelTree() {
|
loadModelTree() {
|
||||||
|
@ -532,51 +623,13 @@ export default {
|
||||||
};
|
};
|
||||||
node.children = makeTree(objs.filter((item) => item.level == 0));
|
node.children = makeTree(objs.filter((item) => item.level == 0));
|
||||||
node.children.forEach((item) => {
|
node.children.forEach((item) => {
|
||||||
//this.treeExpendedKeys.push(item.key)
|
this.treeExpendedKeys.push(item.key)
|
||||||
});
|
});
|
||||||
this.treeKey++;
|
this.treeKey++;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
addModel(modelId, cb) {
|
|
||||||
let url = `${window.config.modelUrl}/Tools/output/model/${modelId}/root.glt`;
|
|
||||||
console.log(modelId, url);
|
|
||||||
let direction = null;
|
|
||||||
let modelInfo = this.models.find(m => m.modelId == modelId);
|
|
||||||
if (this.isClient()) {
|
|
||||||
url = `/bimdata/Tools/output/model/${modelId}/root.glt`;
|
|
||||||
if (modelInfo) {
|
|
||||||
direction = modelInfo.bimCfg.direction;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let api = bimRoadmApi;
|
|
||||||
api.Model.add(
|
|
||||||
url,
|
|
||||||
modelId,
|
|
||||||
() => { },
|
|
||||||
() => {
|
|
||||||
cb && cb();
|
|
||||||
console.log("加载模型成功");
|
|
||||||
setTimeout(() => {
|
|
||||||
if (this.viewPoint) {
|
|
||||||
if (this.viewPoint.world) {
|
|
||||||
if (!this.isClient()) {
|
|
||||||
api.Camera.setViewPort(this.viewPoint);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
api.Camera.getViewPort((p) => {
|
|
||||||
this.viewPoint = p;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.modelLoaded = true;
|
|
||||||
}, 1000);
|
|
||||||
}, direction
|
|
||||||
);
|
|
||||||
},
|
|
||||||
resetScene() {
|
resetScene() {
|
||||||
bimTools.resetScene(this,bimRoadmApi)
|
bimTools.resetScene(this, bimRoadmApi)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,7 +7,7 @@ function resolve(dir) {
|
||||||
|
|
||||||
module.exports = defineConfig({
|
module.exports = defineConfig({
|
||||||
transpileDependencies: true,
|
transpileDependencies: true,
|
||||||
publicPath: process.env.NODE_ENV==='production'? "./":"./xdbs",
|
publicPath: process.env.NODE_ENV==='production'? "./":"/xdbs",
|
||||||
productionSourceMap: false,
|
productionSourceMap: false,
|
||||||
devServer: {
|
devServer: {
|
||||||
host: "0.0.0.0",
|
host: "0.0.0.0",
|
||||||
|
|
|
@ -275,7 +275,7 @@ export default {
|
||||||
ElMessage.success('漫游结束')
|
ElMessage.success('漫游结束')
|
||||||
that.isRoaming = true
|
that.isRoaming = true
|
||||||
api.Camera.stopViewPortRoam()
|
api.Camera.stopViewPortRoam()
|
||||||
this.resetScane()
|
this.resetScene()
|
||||||
},
|
},
|
||||||
//保存漫游
|
//保存漫游
|
||||||
SaveRoam() {
|
SaveRoam() {
|
||||||
|
@ -307,7 +307,7 @@ export default {
|
||||||
time: 10,
|
time: 10,
|
||||||
name: '',
|
name: '',
|
||||||
}
|
}
|
||||||
this.resetScane()
|
this.resetScene()
|
||||||
this.$refs.ruleForm.resetFields()
|
this.$refs.ruleForm.resetFields()
|
||||||
} else {
|
} else {
|
||||||
ElMessage.error('保存失败!')
|
ElMessage.error('保存失败!')
|
||||||
|
@ -330,11 +330,15 @@ export default {
|
||||||
this.isRoamingHistory = false
|
this.isRoamingHistory = false
|
||||||
data.play = 0
|
data.play = 0
|
||||||
ElMessage.info('漫游结束!')
|
ElMessage.info('漫游结束!')
|
||||||
this.resetScane()
|
this.resetScene()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
resetScane() {
|
resetScene() {
|
||||||
api.Camera.stopViewPortRoam()
|
try{
|
||||||
|
api.Camera.stopViewPortRoam()
|
||||||
|
}catch(e){
|
||||||
|
|
||||||
|
}
|
||||||
api.Model.location(api.m_model.keys().toArray()[0])
|
api.Model.location(api.m_model.keys().toArray()[0])
|
||||||
},
|
},
|
||||||
//暂停播放
|
//暂停播放
|
||||||
|
@ -356,7 +360,7 @@ export default {
|
||||||
this.isRoamingHistory = false
|
this.isRoamingHistory = false
|
||||||
data.play = 0
|
data.play = 0
|
||||||
ElMessage.info('漫游结束!')
|
ElMessage.info('漫游结束!')
|
||||||
this.resetScane()
|
this.resetScene()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
//取消播放
|
//取消播放
|
||||||
|
@ -368,7 +372,7 @@ export default {
|
||||||
api.Camera.IRPlayCancle()
|
api.Camera.IRPlayCancle()
|
||||||
}
|
}
|
||||||
api.Camera.stopViewPortRoam()
|
api.Camera.stopViewPortRoam()
|
||||||
this.resetScane()
|
this.resetScene()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//删除漫游
|
//删除漫游
|
||||||
|
|
|
@ -190,7 +190,8 @@ export default {
|
||||||
bimTools.setDefaultViewPoint(window.api, this.me.bimCfg, this.me.viewPoint)
|
bimTools.setDefaultViewPoint(window.api, this.me.bimCfg, this.me.viewPoint)
|
||||||
bimTools.hideParts(window.api, hideParts);
|
bimTools.hideParts(window.api, hideParts);
|
||||||
cb && cb();
|
cb && cb();
|
||||||
this.$emit("change");
|
this.me.resetScene();
|
||||||
|
this.$emit("change");
|
||||||
}, 1000);
|
}, 1000);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -336,7 +336,7 @@ export default {
|
||||||
title: [],
|
title: [],
|
||||||
remark: "",
|
remark: "",
|
||||||
};
|
};
|
||||||
that.resetScane();
|
that.resetScene();
|
||||||
that.$refs.form.resetFields();
|
that.$refs.form.resetFields();
|
||||||
that.visible = false;
|
that.visible = false;
|
||||||
that.getList();
|
that.getList();
|
||||||
|
@ -348,7 +348,7 @@ export default {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
resetScane() {
|
resetScene() {
|
||||||
api.Camera.stopViewPortRoam();
|
api.Camera.stopViewPortRoam();
|
||||||
api.Model.location(api.m_model.keys().toArray()[0]);
|
api.Model.location(api.m_model.keys().toArray()[0]);
|
||||||
},
|
},
|
||||||
|
|
|
@ -163,13 +163,18 @@ function addModel(api, bimCfg, modelId, cb, models) {
|
||||||
let rotateX = cfg?.rotateX || 0;
|
let rotateX = cfg?.rotateX || 0;
|
||||||
let rotateY = cfg?.rotateY || 0;
|
let rotateY = cfg?.rotateY || 0;
|
||||||
if (x * 1 + y * 1 + z * 1 != 0) {
|
if (x * 1 + y * 1 + z * 1 != 0) {
|
||||||
api.Model.moveToPosition([x*1, y*1, z*1], 0, modelId)
|
if(bimCfg.showGis){
|
||||||
|
api.Model.moveToPosition([x*1, y*1, z*1], 0, modelId)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (rotateZ * 1 != 0) {
|
if (rotateZ * 1 != 0) {
|
||||||
if (this.me.bimCfg.clientApi) {
|
if (this.me.bimCfg.clientApi) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
api.Model.rotate(rotateX, rotateY, rotateZ, modelId)
|
if(bimCfg.showGis){
|
||||||
|
api.Model.rotate(rotateX, rotateY, rotateZ, modelId)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cfg && cfg.hideParts) {
|
if (cfg && cfg.hideParts) {
|
||||||
|
|
|
@ -419,6 +419,7 @@ export default {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
BimTools.setDefaultViewPoint(window.sandSettingApi, this.bimCfg, this.viewPoint)
|
BimTools.setDefaultViewPoint(window.sandSettingApi, this.bimCfg, this.viewPoint)
|
||||||
BimTools.hideParts(window.sandSettingApi, hideParts);
|
BimTools.hideParts(window.sandSettingApi, hideParts);
|
||||||
|
this.resetScene();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue