|
@@ -1,3 +1,5 @@
|
|
|
|
+import $ from 'jquery';
|
|
|
|
+import model from '@/bimAttribute'
|
|
import {
|
|
import {
|
|
Message
|
|
Message
|
|
} from 'element-ui'
|
|
} from 'element-ui'
|
|
@@ -10,8 +12,7 @@ class bimView {
|
|
fileId: '',
|
|
fileId: '',
|
|
objectId: ''
|
|
objectId: ''
|
|
},
|
|
},
|
|
- extObjMng, roomEditorToolbar, bimIntegrateId, roamAngle, wallEffect, lightMng, directionalLight,
|
|
|
|
- bloomEffectConfig, bloomEffect;
|
|
|
|
|
|
+ extObjMng, roomEditorToolbar, bimIntegrateId, roamAngle, wallEffect;
|
|
dom = arg.dom
|
|
dom = arg.dom
|
|
viewToken = arg.viewToken;
|
|
viewToken = arg.viewToken;
|
|
renderSuccess = arg.renderSuccess;
|
|
renderSuccess = arg.renderSuccess;
|
|
@@ -43,6 +44,9 @@ class bimView {
|
|
this.getCamera = () => {
|
|
this.getCamera = () => {
|
|
return viewer3D.getCamera();
|
|
return viewer3D.getCamera();
|
|
}
|
|
}
|
|
|
|
+ this.toggleContextMenuDisplay = (isEnabled) => {
|
|
|
|
+ viewer3D.toggleContextMenuDisplay(isEnabled)
|
|
|
|
+ }
|
|
this.View3DRender = () => {
|
|
this.View3DRender = () => {
|
|
let webAppConfig = new Glodon.Bimface.Application.WebApplication3DConfig();
|
|
let webAppConfig = new Glodon.Bimface.Application.WebApplication3DConfig();
|
|
webAppConfig.domElement = dom;
|
|
webAppConfig.domElement = dom;
|
|
@@ -53,17 +57,16 @@ class bimView {
|
|
color: bgcolor,
|
|
color: bgcolor,
|
|
stop: "100%"
|
|
stop: "100%"
|
|
}]
|
|
}]
|
|
|
|
+ webAppConfig.enableCSMShadow = false;
|
|
// 设置全局单位
|
|
// 设置全局单位
|
|
webAppConfig.globalUnit = Glodon.Bimface.Common.Units.LengthUnits.Millimeter;
|
|
webAppConfig.globalUnit = Glodon.Bimface.Common.Units.LengthUnits.Millimeter;
|
|
// 创建WebApplication
|
|
// 创建WebApplication
|
|
app = new Glodon.Bimface.Application.WebApplication3D(webAppConfig);
|
|
app = new Glodon.Bimface.Application.WebApplication3D(webAppConfig);
|
|
// 添加待显示的模型
|
|
// 添加待显示的模型
|
|
app.addView(viewToken);
|
|
app.addView(viewToken);
|
|
-
|
|
|
|
// 从WebApplication获取viewer3D对象
|
|
// 从WebApplication获取viewer3D对象
|
|
viewer3D = app.getViewer();
|
|
viewer3D = app.getViewer();
|
|
viewer3D.addEventListener(Glodon.Bimface.Viewer.Viewer3DEvent.MouseClicked, data => {
|
|
viewer3D.addEventListener(Glodon.Bimface.Viewer.Viewer3DEvent.MouseClicked, data => {
|
|
- console.log(data);
|
|
|
|
if (data.eventType == 'Click') { //左击
|
|
if (data.eventType == 'Click') { //左击
|
|
if (click) click(data);
|
|
if (click) click(data);
|
|
} else {
|
|
} else {
|
|
@@ -83,6 +86,7 @@ class bimView {
|
|
})
|
|
})
|
|
viewer3D.addEventListener(Glodon.Bimface.Viewer.Viewer3DEvent.ViewAdded, () => {
|
|
viewer3D.addEventListener(Glodon.Bimface.Viewer.Viewer3DEvent.ViewAdded, () => {
|
|
model3D = viewer3D.getModel();
|
|
model3D = viewer3D.getModel();
|
|
|
|
+ viewer3D.enableSSAOEffect(false);
|
|
this.setCamera({
|
|
this.setCamera({
|
|
isPan: true,
|
|
isPan: true,
|
|
isRotate: true,
|
|
isRotate: true,
|
|
@@ -94,11 +98,12 @@ class bimView {
|
|
.MeshBasicClipMaterial({
|
|
.MeshBasicClipMaterial({
|
|
color: '#3669b8',
|
|
color: '#3669b8',
|
|
opacity: 0.7,
|
|
opacity: 0.7,
|
|
|
|
+ transparent: !0,
|
|
})
|
|
})
|
|
return elementColor;
|
|
return elementColor;
|
|
}
|
|
}
|
|
- // if ($('.gld-bf-properties')[0]) $('.gld-bf-properties')[0].onclick = this.bimAttribute;
|
|
|
|
- // if ($('.gld-bf-firstperson')[0]) $('.gld-bf-firstperson')[0].onclick = this.walkStatus;
|
|
|
|
|
|
+ if ($('.gld-bf-properties')[0]) $('.gld-bf-properties')[0].onclick = this.bimAttribute;
|
|
|
|
+ if ($('.gld-bf-firstperson')[0]) $('.gld-bf-firstperson')[0].onclick = this.walkStatus;
|
|
if (renderSuccess) renderSuccess();
|
|
if (renderSuccess) renderSuccess();
|
|
})
|
|
})
|
|
viewer3D.addEventListener(Glodon.Bimface.Viewer.Viewer3DEvent.SelectionChanged, data => {
|
|
viewer3D.addEventListener(Glodon.Bimface.Viewer.Viewer3DEvent.SelectionChanged, data => {
|
|
@@ -118,6 +123,13 @@ class bimView {
|
|
this.walkStatus = () => {
|
|
this.walkStatus = () => {
|
|
if (roamAngle) this.setStatus(roamAngle)
|
|
if (roamAngle) this.setStatus(roamAngle)
|
|
}
|
|
}
|
|
|
|
+ this.enableWireframe = (isTrue) => {
|
|
|
|
+ viewer3D.enableWireframe(isTrue);
|
|
|
|
+ }
|
|
|
|
+ this.hideComponentsByObjectData = (option) => {
|
|
|
|
+ model3D.hideComponentsByObjectData(option);
|
|
|
|
+ viewer3D.render();
|
|
|
|
+ }
|
|
this.bimAttribute = () => {
|
|
this.bimAttribute = () => {
|
|
if (type === 'model') return;
|
|
if (type === 'model') return;
|
|
$('.bf-close').click();
|
|
$('.bf-close').click();
|
|
@@ -373,7 +385,7 @@ class bimView {
|
|
this.clearAllRooms = () => {
|
|
this.clearAllRooms = () => {
|
|
if (roomManager) roomManager.clearAllRooms();
|
|
if (roomManager) roomManager.clearAllRooms();
|
|
}
|
|
}
|
|
- this.add3DMaker = (markerType, position, imageSrc, clickFn) => {
|
|
|
|
|
|
+ this.add3DMaker = (markerType, position, imageSrc, clickFn, id) => {
|
|
if (!marker3D) {
|
|
if (!marker3D) {
|
|
let markerConfig = new Glodon.Bimface.Plugins.Marker3D.Marker3DContainerConfig();
|
|
let markerConfig = new Glodon.Bimface.Plugins.Marker3D.Marker3DContainerConfig();
|
|
markerConfig.viewer = viewer3D;
|
|
markerConfig.viewer = viewer3D;
|
|
@@ -386,6 +398,7 @@ class bimView {
|
|
} else if (markerType == 'canvas') {};
|
|
} else if (markerType == 'canvas') {};
|
|
marker3dConfig.worldPosition = position;
|
|
marker3dConfig.worldPosition = position;
|
|
marker3dConfig.size = 60;
|
|
marker3dConfig.size = 60;
|
|
|
|
+ if (id) marker3dConfig.id = id;
|
|
let marker3d = new Glodon.Bimface.Plugins.Marker3D.Marker3D(marker3dConfig);
|
|
let marker3d = new Glodon.Bimface.Plugins.Marker3D.Marker3D(marker3dConfig);
|
|
if (clickFn) marker3d.onClick(clickFn)
|
|
if (clickFn) marker3d.onClick(clickFn)
|
|
marker3D.addItem(marker3d);
|
|
marker3D.addItem(marker3d);
|
|
@@ -486,10 +499,6 @@ class bimView {
|
|
this.setGlowEffectById(data);
|
|
this.setGlowEffectById(data);
|
|
})
|
|
})
|
|
}
|
|
}
|
|
- this.removeGlowEffectById = (ids) => {
|
|
|
|
- model3D.removeGlowEffectById(ids);
|
|
|
|
- viewer3D.render();
|
|
|
|
- }
|
|
|
|
this.clearGlowEffect = () => {
|
|
this.clearGlowEffect = () => {
|
|
model3D.clearGlowEffect();
|
|
model3D.clearGlowEffect();
|
|
viewer3D.render();
|
|
viewer3D.render();
|
|
@@ -603,48 +612,9 @@ class bimView {
|
|
// 构造电子围墙扫描效果对象
|
|
// 构造电子围墙扫描效果对象
|
|
wallEffect = new Glodon.Bimface.Plugins.Animation.WallEffect(wallEffectConfig);
|
|
wallEffect = new Glodon.Bimface.Plugins.Animation.WallEffect(wallEffectConfig);
|
|
}
|
|
}
|
|
- this.setLight = () => {
|
|
|
|
- if (!lightMng) lightMng = viewer3D.getLightManager();
|
|
|
|
- // 获取默认用于控制投影的方向光
|
|
|
|
- if (!directionalLight) directionalLight = lightMng.getAllDirectionalLights()[0];
|
|
|
|
- // 开启阴影
|
|
|
|
- directionalLight.enableShadow(true);
|
|
|
|
- // 设置曝光补偿量
|
|
|
|
- viewer3D.setExposureShift(-0.1);
|
|
|
|
- }
|
|
|
|
- this.setExposureShift = (num) => {
|
|
|
|
- viewer3D.setExposureShift(num);
|
|
|
|
- }
|
|
|
|
- this.setLightShow = (ids) => {
|
|
|
|
- if (!bloomEffectConfig) {
|
|
|
|
- // 构造辉光效果的配置项
|
|
|
|
- bloomEffectConfig = new Glodon.Bimface.Plugins.Effect.BloomEffectConfig();
|
|
|
|
- // 设置构件ID数组、强度、扩散程度、viewer参数
|
|
|
|
- bloomEffectConfig.ids = [{
|
|
|
|
- "modelId": model3D.modelId,
|
|
|
|
- "objectIds": ids
|
|
|
|
- }];
|
|
|
|
- bloomEffectConfig.intensity = 0.8;
|
|
|
|
- bloomEffectConfig.spread = 4;
|
|
|
|
- bloomEffectConfig.viewer = viewer3D;
|
|
|
|
- // 构造辉光效果
|
|
|
|
- bloomEffect = new Glodon.Bimface.Plugins.Effect.BloomEffect(bloomEffectConfig);
|
|
|
|
- } else {
|
|
|
|
- bloomEffect.setIds([{
|
|
|
|
- "modelId": model3D.modelId,
|
|
|
|
- "objectIds": ids
|
|
|
|
- }])
|
|
|
|
- bloomEffect.update();
|
|
|
|
- }
|
|
|
|
- viewer3D.render();
|
|
|
|
- }
|
|
|
|
- this.clearLight = () => {
|
|
|
|
- bloomEffect.clear();
|
|
|
|
- viewer3D.render();
|
|
|
|
- }
|
|
|
|
this.destroy = () => {
|
|
this.destroy = () => {
|
|
console.log('销毁场景');
|
|
console.log('销毁场景');
|
|
- viewer3D.destroy();
|
|
|
|
|
|
+ app.destroy();
|
|
}
|
|
}
|
|
this.init();
|
|
this.init();
|
|
}
|
|
}
|