diff --git a/yanzhu-bigscreen/src/views/bim/bimTools.js b/yanzhu-bigscreen/src/views/bim/bimTools.js index 69e1a060..be51e965 100644 --- a/yanzhu-bigscreen/src/views/bim/bimTools.js +++ b/yanzhu-bigscreen/src/views/bim/bimTools.js @@ -140,11 +140,8 @@ function addClipModel(api, bimCfg, modelId, cb, models) { if (models) { modelInfo = models.find((m) => m.modelId == modelId); } - if (bimCfg.clientApi) { + if (bimCfg.clientApi ) { url = `/bimdata/Tools/output/model/${modelId}/root.glt`; - if (modelInfo) { - //direction = modelInfo.bimCfg.direction; - } } console.log("加载模型:" + url); api.Model.add( @@ -202,9 +199,9 @@ function addModel(api, bimCfg, modelId, cb, models) { if (models) { modelInfo = models.find((m) => m.modelId == modelId); } - if (bimCfg.clientApi) { + if (bimCfg.clientApi ) { url = `/bimdata/Tools/output/model/${modelId}/root.glt`; - if (modelInfo) { + if (modelInfo && bimCfg.showGis) { direction = modelInfo.bimCfg.direction; } } @@ -254,7 +251,7 @@ function addModel(api, bimCfg, modelId, cb, models) { function setDefaultViewPoint(api, bimCfg, pt) { if (pt) { - if (bimCfg.clientApi) { + if (bimCfg.clientApi && bimCfg.showGis) { if (bimCfg.clientApi) { if (pt["position"] && pt["heading"] && pt["pitch"]) { api.Camera.SetCamera(pt.position, pt.heading, pt.pitch); @@ -346,12 +343,12 @@ function initModelPosition(that, api) { that.hideParts.push(it); }); } - setTimeout(() => { - api.Model.location(modelId); - setTimeout(() => { - that.resetScene(); - }, 1000); - }, 1000); + // setTimeout(() => { + // api.Model.location(modelId); + // setTimeout(() => { + // that.resetScene(); + // }, 1000); + // }, 1000); } initHideParts(that, api); }); @@ -387,17 +384,18 @@ function resetScene(that, api) { api.Camera.stopImmersiveRoam(); } } catch (e) { } - api.Model.location(api.m_model.keys().toArray()[0]); + if (!that.bimCfg.clientApi) { api.Plugin.deleteMiniMap(); } + api.Model.location(that.models[0].modelId); if (that.viewPoint) { if (that.viewPoint.world) { if (!that.bimCfg.clientApi) { api.Camera.setViewPort(that.viewPoint); } } else { - if (that.bimCfg.clientApi) { + if (that.bimCfg.clientApi && that.bimCfg.showGis) { let pt = that.viewPoint; api.Camera.SetCamera(pt.position, pt.heading, pt.pitch); } diff --git a/yanzhu-bigscreen/src/views/bim/briefingTools.js b/yanzhu-bigscreen/src/views/bim/briefingTools.js index 88fa7c6a..3a427d8b 100644 --- a/yanzhu-bigscreen/src/views/bim/briefingTools.js +++ b/yanzhu-bigscreen/src/views/bim/briefingTools.js @@ -208,7 +208,6 @@ function measurementArea(that) { api.Public.clearHandler(); api.Measurement.clearAllTrace(); api.Feature.getByEvent(true, (n) => { - console.log(n); if (n && n["id"]) { let featureId = n.id; let modelId = featureId.split("^")[0]; @@ -223,7 +222,7 @@ function measurementArea(that) { } //构件体积 -function measuringVolume(that) { } +function measuringVolume(that) {} //构件距离--客户端渲染 function distanceClient(that) { let api = bimBriefingApi; @@ -301,11 +300,11 @@ function getModels(that) { function closeClientClipping(that) { let api = bimBriefingApi; if (that.clipState && that.clip) { - that.models.forEach(it => { - api.Model.setVisible(it.modelId, true); - api.Model.setVisible("clip" + it.modelId, false); - }); if (that.bimCfg.showGis) { + that.models.forEach((it) => { + api.Model.setVisible(it.modelId, true); + api.Model.setVisible("clip" + it.modelId, false); + }); api.Public.setGisState(true); api.viewer.terrainProvider = Cesium.createWorldTerrain({ requestVertexNormals: true, //开启地形光照 @@ -321,15 +320,23 @@ function closeClientClipping(that) { //剖切 -- 客户端渲染 function initClientClipping(that) { let api = bimBriefingApi; - that.models.forEach(it => { - api.Model.setVisible(it.modelId, false); - api.Model.setVisible("clip" + it.modelId, true); - }); + let models = that.models.map((it) => it.modelId); if (that.bimCfg.showGis) { - api.Public.setGisState(false) + that.models.forEach((it) => { + api.Model.setVisible(it.modelId, false); + api.Model.setVisible("clip" + it.modelId, true); + }); + if (that.bimCfg.showGis) { + api.Public.setGisState(false); + } + models = that.models.map((it) => "clip" + it.modelId); + api.Model.location(models[0]); + } else { + let featureIds = (that.hideParts || []).map((it) => it.featureId); + if (featureIds.length > 0) { + api.Feature.setVisible(featureIds.join("#"), false); + } } - let models = that.models.map((it) => "clip" + it.modelId); - api.Model.location(models[0]); closeClientClipping(that); that.$message.info("鼠标左键点击轴线进行操作!"); that.clipState = true; @@ -345,15 +352,13 @@ function initClientClipping(that) { outline: !0, outlineColor: Cesium.Color.WHITE, planeColor: Cesium.Color.WHITE.withAlpha(0.1), - scalar: [1, 1, 1] - + scalar: [1, 1, 1], }, HelperLineWidth: 10, }); } //剖切 -- 服务端渲染 function initClipping(that) { - console.log("---->initClipping") let api = bimBriefingApi; api.Public.clearHandler(); api.Measurement.clearAllTrace(); @@ -362,13 +367,44 @@ function initClipping(that) { //that.clipShow(); return; } + hideFeature(that); api.Model.clipByBox(getModels(that)); } +function hideFeature(that) { + let api = bimBriefingApi; + let featureIds = (that.hideParts || []).map((it) => it.featureId); + if (featureIds.length > 0) { + api.Feature.setVisible(featureIds.join("#"), false); + } +} +function actorVisibleClient(that) { + hideFeature(that); + let api = bimBriefingApi; + api.Public.Event("LEFT_CLICK",res=>{ + api.Feature.GetFeatureByEvent(res.position,n=>{ + if (n && n["id"]) { + let featureId = n.id; + let modelId = featureId.split("^")[0]; + api.Feature.setVisible(featureId, false); + that.hideFeatureIds.push({ + show: false, + id: featureId.split("^")[1], + modelId: modelId, + featureId: featureId, + }); + } + }); + }); +} //构件隐藏 function actorVisible(that) { let api = bimBriefingApi; that.hideFeatureIds = []; + if (that.isClient) { + actorVisibleClient(that); + return; + } api.Feature.getByEvent(true, (n) => { if (n && n["id"]) { let featureId = n.id; @@ -422,5 +458,5 @@ export default { actorVisible, actorShow, clearEvent, - closeClientClipping + closeClientClipping, }; diff --git a/yanzhu-bigscreen/src/views/bimBriefing.vue b/yanzhu-bigscreen/src/views/bimBriefing.vue index 0e6c7332..ce53be4a 100644 --- a/yanzhu-bigscreen/src/views/bimBriefing.vue +++ b/yanzhu-bigscreen/src/views/bimBriefing.vue @@ -12,15 +12,30 @@ 模型结构树
+ | ||
---|---|---|
{{ item2.name }} | -+ |
{{ item2.value }}
米
米2
@@ -108,16 +139,31 @@
-
-
+
+
+
+
+
+
+
+ |