xushiting пре 2 година
родитељ
комит
9101016e00

+ 5 - 4
src/views/draw-file/board/editCAD/Controls/MoveArrow.js

@@ -1,6 +1,7 @@
 import { floorplanService } from '../Service/FloorplanService'
 import { mathUtil } from '../MathUtil.js'
 import { coordinate } from '../Coordinate'
+import Constant from '../Constant'
 
 export default class MoveArrow {
     constructor() {}
@@ -8,13 +9,13 @@ export default class MoveArrow {
     moveFullArrow(dx,dy, arrowId) {
         let arrow = floorplanService.getArrow(arrowId)
         arrow.startPoint = {
-            x:arrow.startPoint.x + dx/coordinate.res,
-            y:arrow.startPoint.y - dy/coordinate.res,
+            x:arrow.startPoint.x + dx/coordinate.res * Constant.defaultZoom/coordinate.zoom,
+            y:arrow.startPoint.y - dy/coordinate.res * Constant.defaultZoom/coordinate.zoom,
         }
 
         arrow.endPoint = {
-            x:arrow.endPoint.x + dx/coordinate.res,
-            y:arrow.endPoint.y - dy/coordinate.res,
+            x:arrow.endPoint.x + dx/coordinate.res * Constant.defaultZoom/coordinate.zoom,
+            y:arrow.endPoint.y - dy/coordinate.res * Constant.defaultZoom/coordinate.zoom,
         }
     }
 

+ 10 - 9
src/views/draw-file/board/editCAD/Controls/MoveCircle.js

@@ -1,6 +1,7 @@
 import { floorplanService } from '../Service/FloorplanService'
 import { mathUtil } from '../MathUtil.js'
 import { coordinate } from '../Coordinate'
+import Constant from '../Constant'
 
 export default class MoveCircle {
     constructor() {}
@@ -9,28 +10,28 @@ export default class MoveCircle {
         let circle = floorplanService.getCircle(circleId)
 
         circle.points[0] = {
-            x:circle.points[0].x + dx/coordinate.res,
-            y:circle.points[0].y - dy/coordinate.res,
+            x:circle.points[0].x + dx/coordinate.res * Constant.defaultZoom/coordinate.zoom,
+            y:circle.points[0].y - dy/coordinate.res * Constant.defaultZoom/coordinate.zoom,
         }
 
         circle.points[1] = {
-            x:circle.points[1].x + dx/coordinate.res,
-            y:circle.points[1].y - dy/coordinate.res,
+            x:circle.points[1].x + dx/coordinate.res * Constant.defaultZoom/coordinate.zoom,
+            y:circle.points[1].y - dy/coordinate.res * Constant.defaultZoom/coordinate.zoom,
         }
 
         circle.points[2] = {
-            x:circle.points[2].x + dx/coordinate.res,
+            x:circle.points[2].x + dx/coordinate.res * Constant.defaultZoom/coordinate.zoom,
             y:circle.points[2].y - dy/coordinate.res,
         }
 
         circle.points[3] = {
-            x:circle.points[3].x + dx/coordinate.res,
-            y:circle.points[3].y - dy/coordinate.res,
+            x:circle.points[3].x + dx/coordinate.res * Constant.defaultZoom/coordinate.zoom,
+            y:circle.points[3].y - dy/coordinate.res * Constant.defaultZoom/coordinate.zoom,
         }
 
         circle.center = {
-            x:circle.center.x + dx/coordinate.res,
-            y:circle.center.y - dy/coordinate.res,
+            x:circle.center.x + dx/coordinate.res * Constant.defaultZoom/coordinate.zoom,
+            y:circle.center.y - dy/coordinate.res * Constant.defaultZoom/coordinate.zoom,
         }
     }
 

+ 11 - 10
src/views/draw-file/board/editCAD/Controls/MoveIcon.js

@@ -1,6 +1,7 @@
 import { floorplanService } from '../Service/FloorplanService'
 import { mathUtil } from '../MathUtil.js'
 import { coordinate } from '../Coordinate'
+import Constant from '../Constant'
 
 export default class MoveIcon {
     constructor() {}
@@ -9,28 +10,28 @@ export default class MoveIcon {
         let icon = floorplanService.getIcon(iconId)
 
         icon.points[0] = {
-            x:icon.points[0].x + dx/coordinate.res,
-            y:icon.points[0].y - dy/coordinate.res,
+            x:icon.points[0].x + dx/coordinate.res * Constant.defaultZoom/coordinate.zoom,
+            y:icon.points[0].y - dy/coordinate.res * Constant.defaultZoom/coordinate.zoom,
         }
 
         icon.points[1] = {
-            x:icon.points[1].x + dx/coordinate.res,
-            y:icon.points[1].y - dy/coordinate.res,
+            x:icon.points[1].x + dx/coordinate.res * Constant.defaultZoom/coordinate.zoom,
+            y:icon.points[1].y - dy/coordinate.res * Constant.defaultZoom/coordinate.zoom,
         }
 
         icon.points[2] = {
-            x:icon.points[2].x + dx/coordinate.res,
-            y:icon.points[2].y - dy/coordinate.res,
+            x:icon.points[2].x + dx/coordinate.res * Constant.defaultZoom/coordinate.zoom,
+            y:icon.points[2].y - dy/coordinate.res * Constant.defaultZoom/coordinate.zoom,
         }
 
         icon.points[3] = {
-            x:icon.points[3].x + dx/coordinate.res,
-            y:icon.points[3].y - dy/coordinate.res,
+            x:icon.points[3].x + dx/coordinate.res * Constant.defaultZoom/coordinate.zoom,
+            y:icon.points[3].y - dy/coordinate.res * Constant.defaultZoom/coordinate.zoom,
         }
 
         icon.center = {
-            x:icon.center.x + dx/coordinate.res,
-            y:icon.center.y - dy/coordinate.res,
+            x:icon.center.x + dx/coordinate.res * Constant.defaultZoom/coordinate.zoom,
+            y:icon.center.y - dy/coordinate.res * Constant.defaultZoom/coordinate.zoom,
         }
     }
 

+ 9 - 8
src/views/draw-file/board/editCAD/Controls/MoveRectangle.js

@@ -1,6 +1,7 @@
 import { floorplanService } from '../Service/FloorplanService'
 import { mathUtil } from '../MathUtil.js'
 import { coordinate } from '../Coordinate'
+import Constant from '../Constant'
 
 export default class MoveRectangle {
     constructor() {}
@@ -9,23 +10,23 @@ export default class MoveRectangle {
         let rectangle = floorplanService.getRectangle(rectangleId)
 
         rectangle.points[0] = {
-            x:rectangle.points[0].x + dx/coordinate.res,
-            y:rectangle.points[0].y - dy/coordinate.res,
+            x:rectangle.points[0].x + dx/coordinate.res * Constant.defaultZoom/coordinate.zoom,
+            y:rectangle.points[0].y - dy/coordinate.res * Constant.defaultZoom/coordinate.zoom,
         }
 
         rectangle.points[1] = {
-            x:rectangle.points[1].x + dx/coordinate.res,
-            y:rectangle.points[1].y - dy/coordinate.res,
+            x:rectangle.points[1].x + dx/coordinate.res * Constant.defaultZoom/coordinate.zoom,
+            y:rectangle.points[1].y - dy/coordinate.res * Constant.defaultZoom/coordinate.zoom,
         }
 
         rectangle.points[2] = {
-            x:rectangle.points[2].x + dx/coordinate.res,
-            y:rectangle.points[2].y - dy/coordinate.res,
+            x:rectangle.points[2].x + dx/coordinate.res * Constant.defaultZoom/coordinate.zoom,
+            y:rectangle.points[2].y - dy/coordinate.res * Constant.defaultZoom/coordinate.zoom,
         }
 
         rectangle.points[3] = {
-            x:rectangle.points[3].x + dx/coordinate.res,
-            y:rectangle.points[3].y - dy/coordinate.res,
+            x:rectangle.points[3].x + dx/coordinate.res * Constant.defaultZoom/coordinate.zoom,
+            y:rectangle.points[3].y - dy/coordinate.res * Constant.defaultZoom/coordinate.zoom,
         }
     }
 

+ 2 - 2
src/views/draw-file/board/editCAD/Controls/MoveWall.js

@@ -378,8 +378,8 @@ export default class MoveWall {
     }
 
     getNewPointsForMoveWall(wallId, dx, dy) {
-        dx = dx / coordinate.res
-        dy = -dy / coordinate.res
+        dx = dx / coordinate.res * Constant.defaultZoom/coordinate.zoom
+        dy = -dy / coordinate.res * Constant.defaultZoom/coordinate.zoom
 
         const wall = floorplanService.getWall(wallId)
         const startPoint = floorplanService.getPoint(wall.start)

+ 12 - 6
src/views/draw-file/board/editCAD/Controls/UIControl.js

@@ -64,8 +64,10 @@ export default class UIControl {
         else if (
             this.selectUI == UIEvents.Cigaret ||
             this.selectUI == UIEvents.FirePoint ||
-            this.selectUI == UIEvents.FootPrint ||
-            this.selectUI == UIEvents.ShoePrint ||
+            this.selectUI == UIEvents.LeftFootPrint ||
+            this.selectUI == UIEvents.RightFootPrint ||
+            this.selectUI == UIEvents.LeftShoePrint ||
+            this.selectUI == UIEvents.RightShoePrint ||
             this.selectUI == UIEvents.FingerPrint ||
             this.selectUI == UIEvents.DeadBody ||
             this.selectUI == UIEvents.BloodStain 
@@ -203,10 +205,14 @@ export default class UIControl {
             return VectorType.Cigaret
         } else if (this.selectUI == UIEvents.FirePoint) {
             return VectorType.FirePoint
-        } else if (this.selectUI == UIEvents.FootPrint) {
-            return VectorType.FootPrint
-        } else if (this.selectUI == UIEvents.ShoePrint) {
-            return VectorType.ShoePrint
+        } else if (this.selectUI == UIEvents.LeftFootPrint) {
+            return VectorType.LeftFootPrint
+        } else if (this.selectUI == UIEvents.RightFootPrint) {
+            return VectorType.RightFootPrint
+        } else if (this.selectUI == UIEvents.LeftShoePrint) {
+            return VectorType.LeftShoePrint
+        } else if (this.selectUI == UIEvents.RightShoePrint) {
+            return VectorType.RightShoePrint
         } else if (this.selectUI == UIEvents.FingerPrint) {
             return VectorType.FingerPrint
         } else if (this.selectUI == UIEvents.DeadBody) {

+ 29 - 49
src/views/draw-file/board/editCAD/Geometry/Sign.js

@@ -8,62 +8,42 @@ export default class Sign extends Geometry {
         super()
         this.center = center
         this.geoType = type
-        this.points = []
         this.angle = 0 //逆时针为负,顺时针为正。单位是:°
         this.scale = 1 //缩放比例
-        this.radius = 1;
         this.setId(vectorId)
     }
 
-    setPoints(){
-        const point0 = {
-            x:-this.radius,
-            y:this.radius
-        }
-        const point1 = {
-            x:this.radius,
-            y:this.radius
-        }
-        const point2 = {
-            x:this.radius,
-            y:-this.radius
-        }
-        const point3 = {
-            x:-this.radius,
-            y:-this.radius
-        }
-        
-        this.points[0] = {
-            x:point0.x*Math.cos(this.angle)-point0.y*Math.sin(this.angle)+this.center.x,
-            y:point0.y*Math.cos(this.angle)+point0.x*Math.sin(this.angle)+this.center.y
-        }
-        this.points[1] = {
-            x:point1.x*Math.cos(this.angle)-point1.y*Math.sin(this.angle)+this.center.x,
-            y:point1.y*Math.cos(this.angle)+point1.x*Math.sin(this.angle)+this.center.y
-        }
-        this.points[2] = {
-            x:point2.x*Math.cos(this.angle)-point2.y*Math.sin(this.angle)+this.center.x,
-            y:point2.y*Math.cos(this.angle)+point2.x*Math.sin(this.angle)+this.center.y
-        }
-        this.points[3] = {
-            x:point3.x*Math.cos(this.angle)-point3.y*Math.sin(this.angle)+this.center.x,
-            y:point3.y*Math.cos(this.angle)+point3.x*Math.sin(this.angle)+this.center.y
-        }
-    }
-
-    isContain(position){
-        for(let i=0;i<this.points.length;++i){
-            const dis = mathUtil.getDistance(position, this.points[i])
-            if(dis < Constant.minAdsorb){
-                return SelectState.Scale
-            }
-        }
-
+    isContain(position) {
         const dis = mathUtil.getDistance(position, this.center)
-        if(Math.abs(this.radius - dis)<Constant.minAdsorb){
-            return SelectState.All
+        let len = this.getLen() * this.scale
+        if (dis < len / 2) {
+            return SelectState.Select
+        } else {
+            return null
         }
+    }
 
-        return null;
+    getLen() {
+        // switch (this.geoType) {
+        //     case VectorType.Cigaret: //烟头
+        //         return 1.3
+        //     case VectorType.FirePoint: //起火点
+        //         return 3.4
+        //     case VectorType.LeftFootPrint: //脚印
+        //         return 1
+        //     case VectorType.RightFootPrint: //脚印
+        //         return 1
+        //     case VectorType.RightShoePrint: //鞋印
+        //         return 0.8
+        //     case VectorType.ShoePrint: //鞋印
+        //         return 0.8
+        //     case VectorType.FingerPrint: //指纹
+        //         return 2
+        //     case VectorType.DeadBody: //尸体
+        //         return 0.3
+        //     case VectorType.BloodStain: //血迹
+        //         return 2.4
+        // }
+        return 0.2;
     }
 }

+ 10 - 23
src/views/draw-file/board/editCAD/History/History.js

@@ -28,32 +28,19 @@ export default class History {
     }
 
     save() {
-        const flag = change.operate()
-        if (!flag) {
-            return
-        }
-        historyService.addHistoryRecord(change.elements)
-        change.saveCurrentInfo()
-        this.setState()
-        const historyState = historyService.getHistoryState()
-        // if (historyState.pre) {
-        //     this.layer.$xui.toolbar.recall = true
-        // }
-        // this.layer.$xui.toolbar.recover = false
-
-        // const points = floorplanService.getPoints()
-        // if (Object.keys(points).length > 0) {
-        //     this.layer.$xui.toolbar.clear = true
-        //     this.layer.$xui.toolbar.download = true
-        // } else {
-        //     this.layer.$xui.toolbar.clear = false
-        //     this.layer.$xui.toolbar.download = false
+        // const flag = change.operate()
+        // if (!flag) {
+        //     return
         // }
+        // historyService.addHistoryRecord(change.elements)
+        // change.saveCurrentInfo()
+        // this.setState()
+        // const historyState = historyService.getHistoryState()
 
-        //给UI发送事件
-        // this.layer.emit('change')
+        // //给UI发送事件
+        // // this.layer.emit('change')
 
-        return change.elements
+        // return change.elements
     }
 
     setState() {

+ 0 - 5
src/views/draw-file/board/editCAD/Layer.js

@@ -687,9 +687,6 @@ export default class Layer {
                 return
             }
             coordinate.updateZoom(zoom)
-
-            let info = coordinate.getScreenInfoForCAD()
-            info.floorPlanAngle = floorplanService.getAngle()
             this.renderer.autoRedraw()
         }
     }
@@ -718,8 +715,6 @@ export default class Layer {
         }
     }
 
-    
-
     setEventName(eventType) {
         let eventName = stateService.getEventName()
 

+ 3 - 0
src/views/draw-file/board/editCAD/ListenLayer.js

@@ -616,6 +616,9 @@ export default class ListenLayer {
             }
         } else if (this.arrowInfo.arrowId != null && this.arrowInfo.state != null) {
             stateService.setSelectItem(this.arrowInfo.arrowId, VectorType.Arrow, this.arrowInfo.state)
+        } else if (this.signInfo.signsId != null && this.signInfo.state != null) {
+            const sign = floorplanService.getSign(this.signInfo.signsId)
+            stateService.setSelectItem(this.signInfo.signsId, sign.geoType, this.signInfo.state)
         } 
         else {
             stateService.clearSelectItem()

Разлика између датотеке није приказан због своје велике величине
+ 889 - 85
src/views/draw-file/board/editCAD/Renderer/Draw.js


+ 16 - 6
src/views/draw-file/board/editCAD/Service/SignService.js

@@ -18,11 +18,17 @@ export default class SignService {
             case VectorType.FirePoint:
                 sign = new Sign(position, vectorId, VectorType.FirePoint)
                 break
-            case VectorType.FootPrint:
-                sign = new Sign(position, vectorId, VectorType.FootPrint)
+            case VectorType.LeftFootPrint:
+                sign = new Sign(position, vectorId, VectorType.LeftFootPrint)
                 break
-            case VectorType.ShoePrint:
-                sign = new Sign(position, vectorId, VectorType.ShoePrint)
+            case VectorType.RightFootPrint:
+                sign = new Sign(position, vectorId, VectorType.RightFootPrint)
+                break
+            case VectorType.LeftShoePrint:
+                sign = new Sign(position, vectorId, VectorType.LeftShoePrint)
+                break
+            case VectorType.RightShoePrint:
+                sign = new Sign(position, vectorId, VectorType.RightShoePrint)
                 break
             case VectorType.FingerPrint:
                 sign = new Sign(position, vectorId, VectorType.FingerPrint)
@@ -45,9 +51,13 @@ export default class SignService {
                 return true
             case VectorType.FirePoint:
                 return true
-            case VectorType.FootPrint:
+            case VectorType.LeftFootPrint:
+                return true
+            case VectorType.RightFootPrint:
+                return true
+            case VectorType.LeftShoePrint:
                 return true
-            case VectorType.ShoePrint:
+            case VectorType.RightShoePrint:
                 return true
             case VectorType.FingerPrint:
                 return true

+ 14 - 2
src/views/draw-file/board/editCAD/enum/UIEvents.js

@@ -6,13 +6,25 @@ const UIEvents = {
     Circle:'Circle',
     Arrow:'Arrow',
     Icon:'Icon',
+
+    Cigaret: 'Cigaret', 
+    FirePoint: 'FirePoint', 
+    LeftFootPrint: 'LeftFootPrint', 
+    RightFootPrint: 'RightFootPrint', 
+    LeftShoePrint: 'LeftShoePrint', 
+    RightShoePrint: 'RightShoePrint', 
+    FingerPrint: 'FingerPrint', 
+    DeadBody: 'DeadBody', 
+    BloodStain: 'BloodStain', 
 }
 
 export const Signs = {
     Cigaret: UIEvents.Cigaret,                  //烟头
     FirePoint: UIEvents.FirePoint,              //起火点
-    FootPrint: UIEvents.FootPrint,              //脚印
-    ShoePrint: UIEvents.ShoePrint,              //鞋印
+    LeftFootPrint: UIEvents.LeftFootPrint,              //左脚印
+    RightFootPrint: UIEvents.RightFootPrint,              //右脚印
+    LeftShoePrint: UIEvents.LeftShoePrint,              //左鞋印
+    RightShoePrint: UIEvents.RightShoePrint,              //右鞋印
     FingerPrint: UIEvents.FingerPrint,          //指纹
     DeadBody: UIEvents.DeadBody,                //尸体
     BloodStain: UIEvents.BloodStain,            //血迹

+ 4 - 2
src/views/draw-file/board/editCAD/enum/VectorType.js

@@ -10,8 +10,10 @@ const VectorType = {
     Icon:'Icon',
     Cigaret: 'Cigaret',                  //烟头
     FirePoint: 'FirePoint',              //起火点
-    FootPrint: 'FootPrint',              //脚印
-    ShoePrint: 'ShoePrint',              //鞋印
+    LeftFootPrint: 'LeftFootPrint',              //脚印
+    RightFootPrint: 'RightFootPrint',              //脚印
+    LeftShoePrint: 'LeftShoePrint',              //鞋印
+    RightShoePrint: 'RightShoePrint',              //鞋印
     FingerPrint: 'FingerPrint',          //指纹
     DeadBody: 'DeadBody',                //尸体
     BloodStain: 'BloodStain',            //血迹