diff --git a/yanzhu-bigscreen/public/index.html b/yanzhu-bigscreen/public/index.html
index 3230291e..081a3048 100644
--- a/yanzhu-bigscreen/public/index.html
+++ b/yanzhu-bigscreen/public/index.html
@@ -27,7 +27,7 @@
-
+
diff --git a/yanzhu-bigscreen/src/views/bim/briefingTools.js b/yanzhu-bigscreen/src/views/bim/briefingTools.js
index 4ab8b910..907e3d99 100644
--- a/yanzhu-bigscreen/src/views/bim/briefingTools.js
+++ b/yanzhu-bigscreen/src/views/bim/briefingTools.js
@@ -46,9 +46,37 @@ function dataFiltering(that, id) {
});
}
/**
- * 获取构件属性信息
+ * 获取构件属性信息-客户端渲染
+ */
+function getClientProperty(that) {
+ let api = bimBriefingApi;
+ api.Public.event("LEFT_CLICK", e => {
+ api.Feature.getByEvent(e.position, n => {
+ if (n && n["id"]) {
+ let featureId = n.id;
+ if (featureId.split("^")[1]) {
+ clearSelectFeature(that);
+ api.Feature.setColor(featureId, 255, 0, 255, 1);
+ that.selFeatureId = featureId;
+ dataFiltering(that, featureId);
+ that.propertyLoad = "start";
+ that.attributeInformation = "查询中,请稍候~";
+ }
+ } else {
+ that.attributeInformation = "未选中构件";
+ }
+ }, false, false)
+ });
+}
+/**
+ * 获取构件属性信息-服务端渲染
*/
function getProperty(that) {
+ that.$message.info("请在模型中点击选中构件");
+ if (that.isClient) {
+ getClientProperty(that);
+ return;
+ }
let api = bimBriefingApi;
api.Feature.getByEvent(true, (n) => {
if (n && n["id"]) {
@@ -74,18 +102,67 @@ function getModelUnit(that, modelId) {
}
/**
- * 获取构件尺寸信息
+ * 获取构件尺寸信息-客户端渲染
*/
-function subFeatureSize(that) {
+function subFeatureSizeClient(that) {
let api = bimBriefingApi;
let result = [
{ name: "构建尺寸", data: [] },
{ name: "构建表面积", data: [] },
{ name: "构建体积", data: [] },
];
+ api.Public.event("LEFT_CLICK", e => {
+ api.Feature.getByEvent(e.position, n => {
+ if (n && n["id"]) {
+ let featureId = n.id;
+ if (featureId.split("^")[1]) {
+ let modelId = featureId.split("^")[0];
+
+ clearSelectFeature(that);
+ api.Feature.setColor(featureId, 255, 0, 255, 1);
+ that.selFeatureId = featureId;
+ api.Feature.getGeometrySizeById(featureId, modelId, res => {
+ if (res) {
+ let unit = getModelUnit(that, modelId);
+ let size = res || {};
+ let x = (size.x || 0) * unit * 1.0;
+ let y = (size.y || 0) * unit * 1.0;
+ let z = (size.z || 0) * unit * 1.0;
+ result[0].data = [
+ { name: "长", value: x.toFixed(2) + "" },
+ { name: "宽", value: y.toFixed(2) + "" },
+ { name: "高", value: z.toFixed(2) + "" },
+ ];
+ result[1].data = [{ name: "面积", value: (x * y).toFixed(4) + "" }];
+ result[2].data = [{ name: "体积", value: (x * y * z).toFixed(6) }];
+ }
+ });
+ }
+ }
+ });
+ });
+ that.info = result;
+}
+
+/**
+ * 获取构件尺寸信息-服务端渲染
+ */
+function subFeatureSize(that) {
+ let api = bimBriefingApi;
that.info = [];
api.Public.clearHandler();
api.Measurement.clearAllTrace();
+ if (that.isClient) {
+ subFeatureSizeClient(that);
+ return;
+ }
+
+ let result = [
+ { name: "构建尺寸", data: [] },
+ { name: "构建表面积", data: [] },
+ { name: "构建体积", data: [] },
+ ];
+
api.Feature.getByEvent(true, (n) => {
if (n && n["id"]) {
let featureId = n.id;
@@ -115,7 +192,8 @@ function subFeatureSize(that) {
function measurementArea(that) {
let api = bimBriefingApi;
that.info = [];
- api.Public.clearHandler(), api.Measurement.clearAllTrace();
+ api.Public.clearHandler();
+ api.Measurement.clearAllTrace();
api.Feature.getByEvent(true, (n) => {
console.log(n);
if (n && n["id"]) {
@@ -133,13 +211,55 @@ function measurementArea(that) {
//构件体积
function measuringVolume(that) { }
-//构件距离
+//构件距离--客户端渲染
+function distanceClient(that) {
+ let api = bimBriefingApi;
+ let result = [{ name: "测量结果", data: [] }];
+ let unit = 1;
+ api.Public.event("LEFT_CLICK", e => {
+ api.Feature.getByEvent(e.position, n => {
+ if (n && n["id"]) {
+ let featureId = n.id;
+ if (featureId.split("^")[1]) {
+ let modelId = featureId.split("^")[0];
+ unit = getModelUnit(that, modelId);
+ }
+ }
+ });
+ });
+ api.Measurement.distance(data => {
+ if (data) {
+ result[0].data = [
+ {
+ name: "距离",
+ value: (data.dis * unit).toFixed(2),
+ },
+ { name: "X", value: (data.X * unit).toFixed(2) },
+ { name: "Y", value: (data.Y * unit).toFixed(2) },
+ { name: "Z", value: (data.Z * unit).toFixed(2) },
+ ];
+ that.info = result;
+ }
+ }, true);
+}
+//构件距离--服务端渲染
function distance(that) {
let api = bimBriefingApi;
let result = [{ name: "测量结果", data: [] }];
that.$message.info("请在模型中点击两点,右键结束测量");
api.Public.clearHandler();
api.Measurement.clearAllTrace();
+ api.Public.event("LEFT_CLICK", (res) => {
+ api.Measurement.clearAllTrace();
+ });
+ //右键结束测量
+ api.Public.event("RIGHT_CLICK", (res) => {
+ api.Measurement.distance(false);
+ });
+ if (that.isClient) {
+ distanceClient(that);
+ return;
+ }
let unit = 1;
api.Feature.getByEvent(true, (n) => {
if (n && n["id"]) {
@@ -162,19 +282,23 @@ function distance(that) {
that.info = result;
});
- api.Public.event("LEFT_CLICK", (res) => {
- api.Measurement.clearAllTrace();
- });
- //右键结束测量
- api.Public.event("RIGHT_CLICK", (res) => {
- api.Measurement.distance(false);
- });
+
}
function getModels(that) {
return that.models.map((d) => d.modelId);
}
-//剖切
+//剖切 -- 客户端渲染
+function initClientClipping(that) {
+ let api = bimBriefingApi;
+}
+//剖切 -- 服务端渲染
function initClipping(that) {
+ api.Public.clearHandler();
+ api.Measurement.clearAllTrace();
+ if(that.isClient){
+ initClientClipping(that);
+ return;
+ }
let api = bimBriefingApi;
api.Model.clipByBox(getModels(that));
}
diff --git a/yanzhu-bigscreen/src/views/bimBriefing.vue b/yanzhu-bigscreen/src/views/bimBriefing.vue
index 576de43f..98a1fda6 100644
--- a/yanzhu-bigscreen/src/views/bimBriefing.vue
+++ b/yanzhu-bigscreen/src/views/bimBriefing.vue
@@ -50,8 +50,8 @@
- {{ item2.propertyName }} |
- {{ item2.value }} |
+ {{ item2.propertyName }} |
+ {{ item2.value }} |
@@ -66,8 +66,8 @@
- {{ item2.name }} |
-
+ | {{ item2.name }} |
+
{{ item2.value }}
米
米2
@@ -216,7 +216,6 @@
|