|
@@ -60,6 +60,7 @@ import { getFileNameById, countModel } from '@/api/model/file'
|
|
|
import { EditLineItem, SItemStatus, SImageShowType, IconTextItem} from "@saga-web/cad-engine"
|
|
|
import { SColor } from "@saga-web/draw"
|
|
|
import { SImageItem } from '@saga-web/graph/lib'
|
|
|
+import { SMathUtil } from "@saga-web/cad-engine/lib/utils/SMathUtil"
|
|
|
export default {
|
|
|
components: {
|
|
|
drawFloor,
|
|
@@ -85,7 +86,7 @@ export default {
|
|
|
'请移动图片与其他楼层对齐'
|
|
|
], // 描述文字
|
|
|
floorList: [], // 当前建筑下所有楼层
|
|
|
- floorRadio: '', //
|
|
|
+ floorRadio: '', // 当前选中的楼层对象
|
|
|
imgService: `/image-service/common/image_get?systemId=dataPlatform&key=`,
|
|
|
curImgItem: null, // 对齐的楼层图片
|
|
|
scaleItem: null, // 比例尺item
|
|
@@ -339,6 +340,7 @@ export default {
|
|
|
},
|
|
|
// 第二部楼层修改
|
|
|
changeFloor(v) {
|
|
|
+ // v->当前改为的楼层对象
|
|
|
this.removeLast();
|
|
|
if (v.StructureInfo && v.StructureInfo.FloorMap) {
|
|
|
const url = this.imgService + v.StructureInfo.FloorMap
|
|
@@ -347,11 +349,16 @@ export default {
|
|
|
this.curImgItem.showType = SImageShowType.AutoFit;
|
|
|
if (v.Properties) {
|
|
|
try {
|
|
|
- // 计算比例尺- todo
|
|
|
+ // 计算两个比例尺差距
|
|
|
+ const scaleItem = this.$refs.drawFloor.scaleItem
|
|
|
+ const r = this.calScaleGap(v.Properties, scaleItem);
|
|
|
+ if (r != 1) {
|
|
|
+ this.$message.warning('比例尺相差较大,可以返回上一步修改比例尺')
|
|
|
+ }
|
|
|
this.curImgItem.showType == SImageShowType.Full;
|
|
|
this.curImgItem.moveTo(v.Properties.x, v.Properties.y);
|
|
|
- this.curImgItem.width = v.Properties.width;
|
|
|
- this.curImgItem.height = v.Properties.height;
|
|
|
+ // this.curImgItem.width = v.Properties.width;
|
|
|
+ // this.curImgItem.height = v.Properties.height;
|
|
|
} catch (err) {
|
|
|
console.log(err);
|
|
|
}
|
|
@@ -372,6 +379,26 @@ export default {
|
|
|
scaleItem.line = [];
|
|
|
scaleItem.pointChange();
|
|
|
scaleItem.text = '';
|
|
|
+ },
|
|
|
+ // 计算两个比例尺差距
|
|
|
+ calScaleGap(pro, item) {
|
|
|
+ // pro -> 楼层的properties
|
|
|
+ // item -> 当前的比例尺item
|
|
|
+ let result = 1
|
|
|
+ if (pro.Line.length && pro.Text) {
|
|
|
+ try {
|
|
|
+ const proDis = 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);
|
|
|
+ const proScale = proDis / proText;
|
|
|
+ const itemDis = SMathUtil.pointDistance(item.line[0].x, item.line[0].y, item.line[1].x, item.line[1].y)
|
|
|
+ const itemText = item.text.substring(0, item.text.length - 3);
|
|
|
+ const itemScale = itemDis / itemText;
|
|
|
+ result = (proScale / itemScale).toFixed()
|
|
|
+ } catch (err) {
|
|
|
+ console.log(err);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
}
|
|
|
},
|
|
|
watch: {
|