Browse Source

修改比例尺字段

haojianlong 4 years ago
parent
commit
35267dec37

+ 18 - 4
src/components/ledger/lib/bimDialog.vue

@@ -112,9 +112,22 @@ export default {
           that.getGraphtSuc(res)
         })
       } else if (type == 3) {
+        let x = 0;
+        let y = 0;
+        let scale = 1;
+        if (this.floorData && this.floorData.infos && this.floorData.infos.floorMapRatio && this.floorData.infos.floorMapShift) {
+          try {
+            const point = JSON.parse(this.floorData.infos.floorMapShift);
+            x = point.x;
+            y = point.y;
+            scale = this.floorData.infos.floorMapRatio;
+          } catch (err) {
+            console.log(err);
+          }
+        }
         that.drawMainScene.loadImg(`/image-service/common/image_get?systemId=dataPlatform&key=${Id}`, (res) => {
-          that.getGraphtSuc(res)
-        })
+            that.getGraphtSuc(res)
+        }, x, y, scale)
       }
     },
     // 获取底图成功
@@ -223,9 +236,10 @@ export default {
     canvasClick(item, event) {
       if (item instanceof SGraphItem) {
         this.clearMark()
+        const p = item.mapToScene(event[0].x, event[0].y)
         let obj = {
-          X: event[0].x,
-          Y: event[0].y,
+          X: p.x,
+          Y: p.y,
         }
         this.drawMainScene.addMarker(obj)
         this.view.fitSceneToView()

+ 0 - 2
src/components/ledger/lib/floorCascader.vue

@@ -110,7 +110,6 @@
                                         FloorSequenceID: floor.floorSequenceId,
                                         infos: floor.infos || {},
                                         outline: floor.outline || null,
-                                        properties: floor.properties || null
                                     })
                                 } else {
                                     build.children = []
@@ -126,7 +125,6 @@
                                         FloorSequenceID: floor.floorSequenceId,
                                         infos: floor.infos || {},
                                         outline: floor.outline || null,
-                                        properties: floor.properties || null
                                     })
                                 }
                             }

+ 8 - 9
src/views/ledger/facility/batchPoint.vue

@@ -377,10 +377,11 @@ export default {
     // 打点
     spaceClick(item, e) {
         if (this.isMarking) {
+            const p = item.mapToScene(e[0].x, e[0].y)
             this.scene.addIconText({
                 id: this.equipData.id,
-                X: e[0].x, 
-                Y: e[0].y, 
+                X: p.x, 
+                Y: p.y, 
                 Z: 0,
                 text: [`${this.equipData.localName || '--'}\n${this.equipData.localId || '--'}\n0`]
             });
@@ -485,13 +486,11 @@ export default {
         let x = 0;
         let y = 0;
         let scale = 1;
-        if (this.floorData && this.floorData.Properties) {
-            x = this.floorData.properties.x;
-            y = this.floorData.properties.y;
-            const pro = this.floorData.properties;
-            const dis = SMathUtil.pointDistance(pro.line[0].x, pro.line[0].y, pro.line[1].x, pro.line[1].y)
-            const proText = pro.Text.substring(0, pro.text.length - 3);
-            scale = proText / dis;
+        if (this.floorData && this.floorData.infos && this.floorData.infos.floorMapRatio && this.floorData.infos.floorMapShift) {
+            const point = JSON.parse(this.floorData.infos.floorMapShift);
+            x = point.x;
+            y = point.y;
+            scale = this.floorData.infos.floorMapRatio;
         }
         this.scene.loadImg(`/image-service/common/image_get?systemId=dataPlatform&key=${this.floorMap}`, res => {
           this.getGraphtSuc(res)

+ 4 - 3
src/views/ready/buildfloor/drawGraphy/drawFloor.vue

@@ -125,9 +125,10 @@ export default {
       if (this.type == 3) {
         this.addScaleItem(this.floorData.properties)
         this.$emit('getGraphSuc');
-        if (this.floorData.properties) {
-          const x = this.floorData.properties.x;
-          const y = this.floorData.properties.y;
+        if (this.floorData.infos && this.floorData.infos.FloorMapShift) {
+          const struct = JSON.parse(this.floorData.infos.FloorMapShift)
+          const x = struct.x;
+          const y = struct.y;
           if (x != 0 || y != 0) {
             this.drawMainScene.imgList[0].moveTo(x, y);
           }

+ 11 - 5
src/views/ready/buildfloor/repetitionGraphy.vue

@@ -299,18 +299,23 @@ export default {
       const line = scaleItem.line.map(t => {
         return { x: t.x + this.baseImgItem.x, y: t.y + this.baseImgItem.y }
       })
+      // 计算放缩比例
+      const proDis = SMathUtil.pointDistance(line[0].x, line[0].y, line[1].x, line[1].y)
+      const proText = scaleItem.text.substring(0, scaleItem.text.length - 3);
+      const proScale = proDis / proText;
       let Param = {
         content: [{
           id: this.FloorID,
-          infos: { floorMap: this.key },
+          infos: { 
+            floorMap: this.key,
+            floorMapRatio: proScale,
+            floorMapShift: JSON.stringify({x: this.baseImgItem.x, y: this.baseImgItem.y})
+          },
           properties: {
-            x: this.baseImgItem.x,
-            y: this.baseImgItem.y,
             line: line,
             text: scaleItem.text
           }
         }],
-        // projection: ['infos', 'properties'],
       }
       manageUpdateFloor(Param, (res) => {
         this.$message.success('更新成功')
@@ -399,6 +404,7 @@ export default {
           this.curImgItem.showType = SImageShowType.AutoFit;
           if (v.properties) {
             try {
+              const point = JSON.parse(v.infos.floorMapShift)
               // 计算两个比例尺差距
               const scaleItem = this.$refs.drawFloor.scaleItem
               this.curImgItem.zOrder = scaleItem.zOrder - 1;
@@ -407,7 +413,7 @@ export default {
                 this.$message.warning('比例尺相差较大,可以返回上一步修改比例尺')
               }
               this.curImgItem.showType == SImageShowType.Full;
-              this.curImgItem.moveTo(v.properties.x, v.properties.y);
+              this.curImgItem.moveTo(point.x, point.y);
             } catch (err) {
               console.log(err);
             }