修改大屏webGL
parent
8b6f89bf8f
commit
f96590ea08
|
@ -158,60 +158,7 @@ function initEngine(that) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function initEngine2(that) {
|
|
||||||
console.log("开始初始化引擎");
|
|
||||||
window.bim4DApi = new SAPI(
|
|
||||||
{
|
|
||||||
serverIP: window.config.serverIP, //服务ip地址
|
|
||||||
port: window.config.port, //HTTP端口
|
|
||||||
useHttps: window.config.useHttps, //使用Https
|
|
||||||
container: "bim4DContainer", //[必须]容器id
|
|
||||||
secretKey: window.config.secretKey,
|
|
||||||
openEarth: window.config.openEarth, //[可选]开启Gis场景
|
|
||||||
bgColor: window.config.bgColor, //[可选]bim场景背景色, 传值即为纯色天空盒
|
|
||||||
tintColor: window.config.tintColor, //[可选]osgb单体化颜色
|
|
||||||
sceneTime: window.config.sceneTime, //[可选]分别为当前时间、日出时间、日落时间
|
|
||||||
cadMode: window.config.cadMode, // 是否是Cad图纸预览模式
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
that.initSuccess = true;
|
|
||||||
console.log("初始化成功");
|
|
||||||
setTimeout(() => {
|
|
||||||
initLoadModel(that);
|
|
||||||
}, 10);
|
|
||||||
let mapOptions = {
|
|
||||||
imgs: {
|
|
||||||
// 六面图片
|
|
||||||
top: "/cdn/bim/sapi/img/top.png",
|
|
||||||
bottom: "/cdn/bim/sapi/img/under.png",
|
|
||||||
east: "/cdn/bim/sapi/img/east.png",
|
|
||||||
south: "/cdn/bim/sapi/img/south.png",
|
|
||||||
west: "/cdn/bim/sapi/img/west.png",
|
|
||||||
north: "/cdn/bim/sapi/img/north.png",
|
|
||||||
},
|
|
||||||
offset: {
|
|
||||||
// 屏幕坐标偏移
|
|
||||||
corner: GLENavigationCube.RightTop,
|
|
||||||
x: 25,
|
|
||||||
y: 20,
|
|
||||||
},
|
|
||||||
cube: {
|
|
||||||
hoverColor: "#7193dc", // 立方导航快鼠标移过显示颜色
|
|
||||||
size: 32, // 导航立方尺寸
|
|
||||||
hotPointSize: 7, // 导航立方棱角热点区域尺寸
|
|
||||||
cubeTextColor: "#4c4c4ccc", // cube 各个面文字颜色
|
|
||||||
cubeStrokeColor: "#374769cc", // cube 各个面边框颜色
|
|
||||||
cubeFillColor: "#374769cc", // cube 各个面填充颜色
|
|
||||||
},
|
|
||||||
zoomRatios: 1, // 缩放倍率
|
|
||||||
show: true, // 是否显示
|
|
||||||
showAxes: true, // 是否显示XYZ轴线
|
|
||||||
};
|
|
||||||
bim4DApi.Plugin.initNavCube(mapOptions);
|
|
||||||
bimTools.initBimGis(that, bim4DApi)
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function initLoadModel(that) {
|
function initLoadModel(that) {
|
||||||
that.$api.bim.getDefaultViewPoint(that.selProject.id, 1).then((d) => {
|
that.$api.bim.getDefaultViewPoint(that.selProject.id, 1).then((d) => {
|
||||||
|
|
|
@ -11,16 +11,6 @@ function initBimCfg(that) {
|
||||||
that.bimCfg.clientApi = config.clientApi || false
|
that.bimCfg.clientApi = config.clientApi || false
|
||||||
}
|
}
|
||||||
|
|
||||||
function initBimGis(that, api) {
|
|
||||||
if (that.bimCfg.showGis) {
|
|
||||||
api.Public.setGisState(true);
|
|
||||||
api.Public.setTerrainState(false, "http://113.201.2.107:9304/layer.json", false)
|
|
||||||
api.Public.setGisState(true);
|
|
||||||
} else if (that.bimCfg.background) {
|
|
||||||
api.Public.setGisState(false, that.bimCfg.background);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function initLoadModel(that, api) {
|
function initLoadModel(that, api) {
|
||||||
let fnInit = () => {
|
let fnInit = () => {
|
||||||
if (api.m_model.size > 0) {
|
if (api.m_model.size > 0) {
|
||||||
|
@ -43,12 +33,16 @@ function initModelPosition(that, api) {
|
||||||
let y = cfg?.y || 0;
|
let y = cfg?.y || 0;
|
||||||
let z = cfg?.z || 0;
|
let z = cfg?.z || 0;
|
||||||
let rotateZ = cfg?.rotateZ || 0;
|
let rotateZ = cfg?.rotateZ || 0;
|
||||||
|
let rotateX = cfg?.rotateX || 0;
|
||||||
|
let rotateY = cfg?.rotateY || 0;
|
||||||
if (x * 1 + y * 1 + z * 1 != 0) {
|
if (x * 1 + y * 1 + z * 1 != 0) {
|
||||||
console.log("移动模型", modelId, x, y, z)
|
console.log(x, y, z)
|
||||||
api.Model.moveToPosition([x, y, z], 0, modelId)
|
api.Model.moveToPosition([x, y, z], 0, modelId)
|
||||||
}
|
}
|
||||||
if (rotateZ * 1 != 0) {
|
if (rotateZ * 1 != 0) {
|
||||||
api.Model.rotate(0, 0, rotateZ, modelId)
|
if (!this.me.bimCfg.clientApi) {
|
||||||
|
api.Model.rotate(rotateX, rotateY, rotateZ, modelId)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (cfg && cfg.hideParts) {
|
if (cfg && cfg.hideParts) {
|
||||||
cfg.hideParts.forEach(it => {
|
cfg.hideParts.forEach(it => {
|
||||||
|
@ -104,7 +98,6 @@ function resetScene(that, api) {
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
initBimCfg,
|
initBimCfg,
|
||||||
initBimGis,
|
|
||||||
initLoadModel,
|
initLoadModel,
|
||||||
initModelPosition,
|
initModelPosition,
|
||||||
initHideParts,
|
initHideParts,
|
||||||
|
|
|
@ -51,7 +51,7 @@ function loadEngine(that, elId, apiName, cb) {
|
||||||
api.Plugin.initNavCube(mapOptions);
|
api.Plugin.initNavCube(mapOptions);
|
||||||
if (that.bimCfg.showGis) {
|
if (that.bimCfg.showGis) {
|
||||||
api.Public.setGisState(true);
|
api.Public.setGisState(true);
|
||||||
api.Public.setTerrainState(false, "/cdn/Cesium/layer.json", false)
|
api.Public.setTerrainState(false, "http://113.201.2.107:9304/layer.json", false)
|
||||||
api.Public.setGisState(true);
|
api.Public.setGisState(true);
|
||||||
} else if (that.bimCfg.background) {
|
} else if (that.bimCfg.background) {
|
||||||
api.Public.setGisState(false, that.bimCfg.background);
|
api.Public.setGisState(false, that.bimCfg.background);
|
||||||
|
|
|
@ -523,59 +523,6 @@ export default {
|
||||||
}
|
}
|
||||||
}, 10);
|
}, 10);
|
||||||
},
|
},
|
||||||
loadEngine() {
|
|
||||||
window.bimBriefingApi = new SAPI(
|
|
||||||
{
|
|
||||||
serverIP: window.config.serverIP, //服务ip地址
|
|
||||||
port: window.config.port, //HTTP端口
|
|
||||||
useHttps: window.config.useHttps, //使用Https
|
|
||||||
container: "bimBriefingContainer", //[必须]容器id
|
|
||||||
secretKey: window.config.secretKey,
|
|
||||||
openEarth: window.config.openEarth, //[可选]开启Gis场景
|
|
||||||
bgColor: window.config.bgColor, //[可选]bim场景背景色, 传值即为纯色天空盒
|
|
||||||
tintColor: window.config.tintColor, //[可选]osgb单体化颜色
|
|
||||||
sceneTime: window.config.sceneTime, //[可选]分别为当前时间、日出时间、日落时间
|
|
||||||
cadMode: window.config.cadMode, // 是否是Cad图纸预览模式
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
this.initSuccess = true;
|
|
||||||
console.log("初始化成功");
|
|
||||||
setTimeout(() => {
|
|
||||||
this.initLoadModel();
|
|
||||||
}, 10);
|
|
||||||
let mapOptions = {
|
|
||||||
imgs: {
|
|
||||||
// 六面图片
|
|
||||||
top: "/cdn/bim/sapi/img/top.png",
|
|
||||||
bottom: "/cdn/bim/sapi/img/under.png",
|
|
||||||
east: "/cdn/bim/sapi/img/east.png",
|
|
||||||
south: "/cdn/bim/sapi/img/south.png",
|
|
||||||
west: "/cdn/bim/sapi/img/west.png",
|
|
||||||
north: "/cdn/bim/sapi/img/north.png",
|
|
||||||
},
|
|
||||||
offset: {
|
|
||||||
// 屏幕坐标偏移
|
|
||||||
corner: GLENavigationCube.RightTop,
|
|
||||||
x: 25,
|
|
||||||
y: 20,
|
|
||||||
},
|
|
||||||
cube: {
|
|
||||||
hoverColor: "#7193dc", // 立方导航快鼠标移过显示颜色
|
|
||||||
size: 32, // 导航立方尺寸
|
|
||||||
hotPointSize: 7, // 导航立方棱角热点区域尺寸
|
|
||||||
cubeTextColor: "#4c4c4ccc", // cube 各个面文字颜色
|
|
||||||
cubeStrokeColor: "#374769cc", // cube 各个面边框颜色
|
|
||||||
cubeFillColor: "#374769cc", // cube 各个面填充颜色
|
|
||||||
},
|
|
||||||
zoomRatios: 1, // 缩放倍率
|
|
||||||
show: true, // 是否显示
|
|
||||||
showAxes: true, // 是否显示XYZ轴线
|
|
||||||
};
|
|
||||||
bimBriefingApi.Plugin.initNavCube(mapOptions);
|
|
||||||
bimTools.initBimGis(this, bimBriefingApi)
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
|
||||||
initLoadModel() {
|
initLoadModel() {
|
||||||
this.$api.bim.getDefaultViewPoint(this.selProject.id, 1).then((d) => {
|
this.$api.bim.getDefaultViewPoint(this.selProject.id, 1).then((d) => {
|
||||||
let pt = "";
|
let pt = "";
|
||||||
|
|
|
@ -329,6 +329,7 @@ const css = `<style>
|
||||||
</style>`;
|
</style>`;
|
||||||
import debounce from "lodash.debounce";
|
import debounce from "lodash.debounce";
|
||||||
import videoDialog from "./bim/videoDialog.vue";
|
import videoDialog from "./bim/videoDialog.vue";
|
||||||
|
import bimTools from './bim/bimTools'
|
||||||
import apiTools from './bim/apiTools.js'
|
import apiTools from './bim/apiTools.js'
|
||||||
import sapiTools from './bim/sapiTools.js'
|
import sapiTools from './bim/sapiTools.js'
|
||||||
export default {
|
export default {
|
||||||
|
@ -389,12 +390,6 @@ export default {
|
||||||
menuShowCount: 0,
|
menuShowCount: 0,
|
||||||
modelLoadSuccess: false, //模型加载成功
|
modelLoadSuccess: false, //模型加载成功
|
||||||
mode: "model", //显示模式 model-整体模型 plan-形象进度
|
mode: "model", //显示模式 model-整体模型 plan-形象进度
|
||||||
bimCfg: {//BIM显示配置
|
|
||||||
background: '',
|
|
||||||
showGis: false,
|
|
||||||
clientApi: false,
|
|
||||||
},
|
|
||||||
hideParts: [],//后台配置的隐藏
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
|
@ -772,10 +767,10 @@ export default {
|
||||||
this.addLabels = [];
|
this.addLabels = [];
|
||||||
},
|
},
|
||||||
initEngine() {
|
initEngine() {
|
||||||
let config = this.$tryToJson(this.selProject?.bimConfig, {})
|
if (!this.selProject) {
|
||||||
this.bimCfg.background = config.background || ''
|
return;
|
||||||
this.bimCfg.showGis = config.showGis || false
|
}
|
||||||
this.bimCfg.clientApi = config.clientApi || false
|
bimTools.initBimCfg(this);
|
||||||
this.elId++;
|
this.elId++;
|
||||||
this.activeMenu = 0;
|
this.activeMenu = 0;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
@ -822,17 +817,7 @@ export default {
|
||||||
this.models.forEach((item) => {
|
this.models.forEach((item) => {
|
||||||
this.addModel(item.lightweightName);
|
this.addModel(item.lightweightName);
|
||||||
});
|
});
|
||||||
let api = bimMgrApi;
|
bimTools.initLoadModel(this, bimMgrApi)
|
||||||
let fnInit = () => {
|
|
||||||
if (api.m_model.size > 0) {
|
|
||||||
setTimeout(() => {
|
|
||||||
this.initModelPosition()
|
|
||||||
}, 1000)
|
|
||||||
} else {
|
|
||||||
setTimeout(fnInit, 1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fnInit();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -876,56 +861,6 @@ export default {
|
||||||
}, direction
|
}, direction
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
initModelPosition() {
|
|
||||||
let api = bimMgrApi;
|
|
||||||
this.models.forEach(modelInfo => {
|
|
||||||
if (modelInfo) {
|
|
||||||
let modelId = modelInfo.lightweightName
|
|
||||||
let cfg = this.$tryToJson(modelInfo.bimConfig, {});
|
|
||||||
let x = cfg?.x || 0;
|
|
||||||
let y = cfg?.y || 0;
|
|
||||||
let z = cfg?.z || 0;
|
|
||||||
let rotateZ = cfg?.rotateZ || 0;
|
|
||||||
if (x * 1 + y * 1 + z * 1 != 0) {
|
|
||||||
console.log("移动模型", modelId, x, y, z)
|
|
||||||
api.Model.moveToPosition([x, y, z], 0, modelId)
|
|
||||||
}
|
|
||||||
if (rotateZ * 1 != 0) {
|
|
||||||
api.Model.rotate(0, 0, rotateZ, modelId)
|
|
||||||
}
|
|
||||||
if (cfg && cfg.hideParts) {
|
|
||||||
cfg.hideParts.forEach(it => {
|
|
||||||
this.hideParts.push(it);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
setTimeout(() => {
|
|
||||||
api.Model.location(modelId);
|
|
||||||
setTimeout(() => {
|
|
||||||
this.resetScene();
|
|
||||||
}, 1000);
|
|
||||||
}, 1000);
|
|
||||||
}
|
|
||||||
this.initHideParts()
|
|
||||||
});
|
|
||||||
},
|
|
||||||
initHideParts() {
|
|
||||||
let api = bimMgrApi;
|
|
||||||
let hideCnt = 0;
|
|
||||||
let hideFn = () => {
|
|
||||||
hideCnt++;
|
|
||||||
if (hideCnt > 30) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setTimeout(() => {
|
|
||||||
let featureIds = (this.hideParts || []).map(it => it.featureId);
|
|
||||||
if (featureIds.length > 0) {
|
|
||||||
api.Feature.setVisible(featureIds.join("#"), false);
|
|
||||||
}
|
|
||||||
hideFn();
|
|
||||||
}, 100)
|
|
||||||
};
|
|
||||||
hideFn();
|
|
||||||
},
|
|
||||||
changeMode(mode) {
|
changeMode(mode) {
|
||||||
if (!this.modelLoadSuccess) {
|
if (!this.modelLoadSuccess) {
|
||||||
this.$message.error("模型加载中,请稍后");
|
this.$message.error("模型加载中,请稍后");
|
||||||
|
@ -999,15 +934,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
resetScene() {
|
resetScene() {
|
||||||
bimMgrApi.Camera.stopImmersiveRoam();
|
bimTools.resetScene(this,bimMgrApi)
|
||||||
bimMgrApi.Model.location(bimMgrApi.m_model.keys().toArray()[0]);
|
|
||||||
if (!this.isClient()) {
|
|
||||||
bimMgrApi.Plugin.deleteMiniMap();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.viewPoint) {
|
|
||||||
bimMgrApi.Camera.setViewPort(this.viewPoint);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
loadDeviceData() {
|
loadDeviceData() {
|
||||||
if (this.loadDevDatatimeOut) {
|
if (this.loadDevDatatimeOut) {
|
||||||
|
|
Loading…
Reference in New Issue