xushiting 2 năm trước cách đây
mục cha
commit
eb71aaa19b

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

@@ -5,7 +5,6 @@ import VectorType from '../enum/VectorType.js'
 import { stateService } from '../Service/StateService.js'
 import { floorplanService } from '../Service/FloorplanService.js'
 import { historyService } from '../Service/HistoryService.js'
-import { componentService } from '../Service/ComponentService.js'
 import { elementService } from '../Service/ElementService'
 import { mathUtil } from '../MathUtil.js'
 import { wallService } from '../Service/WallService.js'
@@ -71,8 +70,6 @@ export default class UIControl {
             this.selectUI == UIEvents.Pass
         ) {
             stateService.setEventName(LayerEvents.AddSymbol)
-        } else if (this.selectUI == UIEvents.Beam || this.selectUI == UIEvents.Flue || this.selectUI == UIEvents.Corridor) {
-            stateService.setEventName(LayerEvents.AddComponent)
         } else if (this.selectUI == UIEvents.Tag) {
             stateService.setEventName(LayerEvents.AddTag)
         } else if (
@@ -115,8 +112,6 @@ export default class UIControl {
             case 'remove':
                 if (type == VectorType.Wall || type == 'OutWall') {
                     floorplanService.deleteWall(item.vectorId)
-                } else if (componentService.isComponent(type)) {
-                    floorplanService.deleteComponent(item.vectorId)
                 } else if (type == VectorType.Tag) {
                     floorplanService.deleteTag(item.vectorId)
                     let _item = stateService.getDraggingItem()
@@ -133,26 +128,12 @@ export default class UIControl {
                 this.layer.renderer.autoRedraw()
                 break
             case 'angle':
-                if (componentService.isComponent(type)) {
-                    let component = floorplanService.getComponent(item.vectorId)
-                    component.angle = value
-                    component.setPoints2d()
-                    this.layer.renderer.autoRedraw()
-                } else if (signService.isSign(type)) {
+                if (signService.isSign(type)) {
                     let sign = floorplanService.getSign(item.vectorId)
                     sign.angle = value
                     this.layer.renderer.autoRedraw()
                 }
                 break
-            case 'width':
-                if (componentService.isComponent(type)) {
-                    let component = floorplanService.getComponent(item.vectorId)
-                    component.sideWidth = value
-                    component.setPoints2d()
-                }
-                this.layer.renderer.autoRedraw()
-                break
-
             case 'scale':
                 if (signService.isSign(type)) {
                     let sign = floorplanService.getSign(item.vectorId)
@@ -160,14 +141,6 @@ export default class UIControl {
                     this.layer.renderer.autoRedraw()
                 }
                 break
-            case 'thickness':
-                if (componentService.isComponent(type)) {
-                    let component = floorplanService.getComponent(item.vectorId)
-                    component.sideThickness = value
-                    component.setPoints2d()
-                    this.layer.renderer.autoRedraw()
-                }
-                break
             case 'split':
                 if (type == VectorType.Wall || type == 'OutWall') {
                     let wall = floorplanService.getWall(item.vectorId)
@@ -213,28 +186,6 @@ export default class UIControl {
                     this.layer.renderer.autoRedraw()
                 }
                 break
-            case 'default':
-                if (type == 'compass') {
-                    floorplanService.setCompass(0)
-                    return
-                } else if (componentService.isComponent(type)) {
-                    let component = floorplanService.getComponent(item.vectorId)
-                    component.sideWidth = componentService.sideWidth
-                    component.sideThickness = componentService.sideThickness
-                    component.angle = 0
-                    component.setPoints2d()
-                    this.layer.$xui.currentAttributes = {
-                        name: item.type,
-                        width: mathUtil.getFixed(component.sideWidth, 2), //Math.floor((component.sideWidth) * 100) / 100,
-                        thickness: mathUtil.getFixed(component.sideThickness, 2), //Math.floor((component.sideThickness) * 100) / 100,
-                        angle: 0,
-                    }
-                }
-                this.layer.renderer.autoRedraw()
-                break
-            case 'compass':
-                floorplanService.setCompass(parseFloat(value))
-                break
         }
     }
 
@@ -250,17 +201,7 @@ export default class UIControl {
         if (item == null) {
             item = stateService.getDraggingItem()
         }
-        if (componentService.isComponent(item.type)) {
-            let component = floorplanService.getComponent(item.vectorId)
-            let sideWidth = component.sideWidth
-            let sideThickness = component.sideThickness
-            this.layer.$xui.currentAttributes = {
-                name: item.type,
-                width: mathUtil.getFixed(sideWidth, 2), //Math.floor((component.sideWidth) * 100) / 100,
-                thickness: mathUtil.getFixed(sideThickness, 2), //Math.floor((component.sideThickness) * 100) / 100,
-                angle: component.angle,
-            }
-        } else if (item.type == VectorType.Tag) {
+        if (item.type == VectorType.Tag) {
             let tag = floorplanService.getTag(item.vectorId)
             this.layer.$xui.currentAttributes = {
                 name: item.type,
@@ -289,16 +230,6 @@ export default class UIControl {
         this.selectUI = null
     }
 
-    getComponentTypeForUI() {
-        if (this.selectUI == UIEvents.Beam) {
-            return VectorType.Beam
-        } else if (this.selectUI == UIEvents.Flue) {
-            return VectorType.Flue
-        } else if (this.selectUI == UIEvents.Corridor) {
-            return VectorType.Corridor
-        }
-    }
-
     getSignTypeForUI() {
         if (this.selectUI == UIEvents.Cigaret) {
             return VectorType.Cigaret

+ 18 - 0
src/views/draw-file/board/editCAD/FloorplanData.js

@@ -0,0 +1,18 @@
+export default class FloorplanData {
+    constructor() {
+        this.version = 'v4.0'
+        this.floors = []
+    }
+
+    initFloor(floorNum) {
+        this.floors[floorNum] = {}
+        this.floors[floorNum].points = {}
+        this.floors[floorNum].walls = {}
+        this.floors[floorNum].tags = {}
+        this.floors[floorNum].signs = {}
+    }
+}
+
+let floorplanData = new FloorplanData()
+window.floorplanData = floorplanData
+export { floorplanData }

+ 21 - 0
src/views/draw-file/board/editCAD/Geometry/Arrow.js

@@ -0,0 +1,21 @@
+import VectorType from '../enum/VectorType.js'
+import Geometry from './Geometry.js'
+
+export default class Arrow extends Geometry {
+    constructor(pointId1, pointId2, vectorId, floor) {
+        super()
+        this.start = pointId1
+        this.end = pointId2
+        this.floor = floor?floor:0
+        this.geoType = VectorType.Arrow
+        this.setId(vectorId)
+    }
+
+    getPointId(dir) {
+        if (dir == 'start') {
+            return this.start
+        } else {
+            return this.end
+        }
+    }
+}

+ 0 - 76
src/views/draw-file/board/editCAD/Geometry/Beam.js

@@ -1,76 +0,0 @@
-import VectorType from '../enum/VectorType.js'
-import SelectState from '../enum/SelectState.js'
-import Geometry from './Geometry'
-import { mathUtil } from '../MathUtil.js'
-import Constant from '../Constant.js'
-import { coordinate } from '../Coordinate'
-
-//靠墙
-export default class Beam extends Geometry {
-    constructor(center, vectorId) {
-        super()
-        this.center = center
-        this.angle = 0 //逆时针为负,顺时针为正。单位是:°
-        this.points2d = []
-
-        this.sideWidth = 0.65
-        this.sideThickness = 0.65
-
-        this.name = '柱子'
-        this.geoType = VectorType.Beam
-        this.setId(vectorId)
-    }
-
-    isContain(position) {
-        return mathUtil.isPointInPoly(position, this.points2d)
-    }
-
-    setPoints2d() {
-        this.points2d = []
-        const minX = this.center.x - this.sideWidth / 2
-        const minY = this.center.y - this.sideThickness / 2
-        const maxX = this.center.x + this.sideWidth / 2
-        const maxY = this.center.y + this.sideThickness / 2
-
-        const point1 = this.rotatePoint(
-            {
-                x: minX,
-                y: maxY,
-            },
-            this.center,
-            this.angle
-        )
-
-        const point2 = this.rotatePoint(
-            {
-                x: maxX,
-                y: maxY,
-            },
-            this.center,
-            this.angle
-        )
-
-        const point3 = this.rotatePoint(
-            {
-                x: maxX,
-                y: minY,
-            },
-            this.center,
-            this.angle
-        )
-
-        const point4 = this.rotatePoint(
-            {
-                x: minX,
-                y: minY,
-            },
-            this.center,
-            this.angle
-        )
-
-        this.points2d.push(point1)
-        this.points2d.push(point2)
-        this.points2d.push(point3)
-        this.points2d.push(point4)
-    }
-}

+ 13 - 0
src/views/draw-file/board/editCAD/Geometry/Circle.js

@@ -0,0 +1,13 @@
+import VectorType from '../enum/VectorType.js'
+import Geometry from './Geometry.js'
+
+export default class Circle extends Geometry {
+    constructor(position,radius, vectorId, floor) {
+        super()
+        this.position = position
+        this.radius = radius
+        this.floor = floor?floor:0
+        this.geoType = VectorType.Circle
+        this.setId(vectorId)
+    }
+}

+ 13 - 0
src/views/draw-file/board/editCAD/Geometry/Icon.js

@@ -0,0 +1,13 @@
+import VectorType from '../enum/VectorType.js'
+import Geometry from './Geometry.js'
+
+export default class Icon extends Geometry {
+    constructor(position,value, vectorId, floor) {
+        super()
+        this.position = position
+        this.value = value
+        this.floor = floor?floor:0
+        this.geoType = VectorType.Icon
+        this.setId(vectorId)
+    }
+}

+ 13 - 0
src/views/draw-file/board/editCAD/Geometry/Rectangle.js

@@ -0,0 +1,13 @@
+import VectorType from '../enum/VectorType.js'
+import Geometry from './Geometry.js'
+
+export default class Rectangle extends Geometry {
+    constructor(position, vectorId, floor) {
+        super()
+        this.start = position
+        this.points = []
+        this.floor = floor?floor:0
+        this.geoType = VectorType.Rectangle
+        this.setId(vectorId)
+    }
+}

+ 72 - 0
src/views/draw-file/board/editCAD/Geometry/Sign.js

@@ -0,0 +1,72 @@
+import Geometry from './Geometry'
+import { mathUtil } from '../MathUtil.js'
+import SelectState from '../enum/SelectState.js'
+import VectorType from '../enum/VectorType.js'
+
+export default class Sign extends Geometry {
+    constructor(center, vectorId, type) {
+        super()
+        this.center = center
+        this.geoType = type
+        this.angle = 0 //逆时针为负,顺时针为正。单位是:°
+        this.scale = 1 //缩放比例
+        this.setId(vectorId)
+    }
+
+    isContain(position) {
+        const dis = mathUtil.getDistance(position, this.center)
+        let len = this.getLen() * this.scale
+        if (dis < len / 2) {
+            return SelectState.Select
+        } else {
+            return null
+        }
+    }
+
+    getLen() {
+        switch (this.geoType) {
+            case VectorType.TV: //电视
+                return 1.3
+            case VectorType.CombinationSofa: //组合沙发
+                return 3.4
+            case VectorType.SingleSofa: //单人沙发
+                return 1
+            case VectorType.TeaTable: //茶几
+                return 0.8
+            case VectorType.Carpet: //地毯
+                return 2
+            case VectorType.Plant: //植物
+                return 0.3
+            case VectorType.DiningTable: //餐桌
+                return 2.4
+            case VectorType.DoubleBed: //双人床
+                return 2
+            case VectorType.SingleBed: //单人床
+                return 2
+            case VectorType.Wardrobe: //衣柜
+                return 1.2
+            case VectorType.Dresser: //梳妆台
+                return 0.8
+            case VectorType.BedsideCupboard: //床头柜
+                return 0.4
+            case VectorType.Pillow: //抱枕
+                return 0.6
+            case VectorType.GasStove: //燃气灶
+                return 1
+            case VectorType.Cupboard: //橱柜
+                return 1.2
+            case VectorType.Bathtub: //浴缸
+                return 1.6
+            case VectorType.Closestool: //马桶
+                return 0.63
+            case VectorType.Washstand: //洗漱台
+                return 0.8
+            case VectorType.Desk: //书桌
+                return 1.2
+            case VectorType.BalconyChair: //阳台椅
+                return 2
+            case VectorType.Elevator: //电梯
+                return 1.5
+        }
+    }
+}

+ 0 - 0
src/views/draw-file/board/editCAD/Geometry/Table.js


+ 1 - 33
src/views/draw-file/board/editCAD/Geometry/Wall.js

@@ -6,27 +6,11 @@ export default class Wall extends Geometry {
         super()
         this.start = pointId1
         this.end = pointId2
-        this.floor = floor
-
-        this.children = [] //门/窗
-        this.out = false //是否外墙
-        this.important = false //是否承重墙
-        //this.border = true //true表示房间墙,粗一点,false表示非房间墙,细一点
-        //this.exterior = null //是否外墙
+        this.floor = floor?floor:0
         this.geoType = VectorType.Wall
         this.setId(vectorId)
     }
 
-    getOtherPointId(pointId) {
-        if (this.start == pointId) {
-            return this.end
-        } else if (this.end == pointId) {
-            return this.start
-        } else {
-            return null
-        }
-    }
-
     getPointId(dir) {
         if (dir == 'start') {
             return this.start
@@ -34,20 +18,4 @@ export default class Wall extends Geometry {
             return this.end
         }
     }
-
-    clearChildren() {
-        this.children = []
-    }
-
-    setImportant(flag) {
-        this.important = flag
-    }
-
-    setOut(flag) {
-        this.out = flag
-    }
-
-    setChildren(children) {
-        this.children = children
-    }
 }

+ 0 - 35
src/views/draw-file/board/editCAD/History/History.js

@@ -5,7 +5,6 @@ import { historyUtil } from './HistoryUtil'
 import { change } from './Change'
 import { stateService } from '../Service/StateService'
 import HistoryEvents from '../enum/HistoryEvents'
-import { componentService } from '../Service/ComponentService'
 import { historyService } from '../Service/HistoryService'
 import { tagService } from '../Service/TagService'
 import { coordinate } from '../Coordinate'
@@ -127,7 +126,6 @@ export default class History {
             if (!flag) {
                 this.goPreForPoints(item.points)
                 this.goPreForWalls(item.walls)
-                this.goPreForComponents(item.components)
                 this.goPreForTags(item.tags)
                 this.goPreForSigns(item.signs)
             }
@@ -182,22 +180,6 @@ export default class History {
         }
     }
 
-    goPreForComponents(itemForComponents) {
-        for (let i = 0; i < itemForComponents.length; ++i) {
-            const item = itemForComponents[i]
-            if (item.handle == HistoryEvents.AddComponent) {
-                floorplanService.deleteComponent(item.component.id)
-            } else if (item.handle == HistoryEvents.DeleteComponent) {
-                let vComponent = componentService.createComponent(item.component.center, item.component.type, item.component.id)
-                historyUtil.assignComponentFromComponent(vComponent, item.component)
-            } else if (item.handle == HistoryEvents.ModifyComponent) {
-                const preComponent = item.preComponent
-                let currentComponent = floorplanService.getComponent(item.curComponent.id)
-                historyUtil.assignComponentFromComponent(currentComponent, preComponent)
-            }
-        }
-    }
-
     goPreForSigns(itemForSigns) {
         for (let i = 0; i < itemForSigns.length; ++i) {
             const item = itemForSigns[i]
@@ -282,22 +264,6 @@ export default class History {
         }
     }
 
-    goNextForComponents(itemForComponents) {
-        for (let i = 0; i < itemForComponents.length; ++i) {
-            const item = itemForComponents[i]
-            if (item.handle == HistoryEvents.AddComponent) {
-                let vComponent = componentService.createComponent(item.component.center, item.component.type, item.component.id)
-                historyUtil.assignComponentFromComponent(vComponent, item.component)
-            } else if (item.handle == HistoryEvents.DeleteComponent) {
-                floorplanService.deleteComponent(item.component.id)
-            } else if (item.handle == HistoryEvents.ModifyComponent) {
-                const currentComponent = item.curComponent
-                let preComponent = floorplanService.getComponent(item.curComponent.id)
-                historyUtil.assignComponentFromComponent(preComponent, currentComponent)
-            }
-        }
-    }
-
     goNextForTags(itemForTags) {
         for (let i = 0; i < itemForTags.length; ++i) {
             const item = itemForTags[i]
@@ -366,7 +332,6 @@ export default class History {
             if (!flag) {
                 this.goNextForPoints(item.points)
                 this.goNextForWalls(item.walls)
-                this.goNextForComponents(item.components)
                 this.goNextForTags(item.tags)
                 this.goNextForSigns(item.signs)
             }

+ 0 - 9
src/views/draw-file/board/editCAD/History/HistoryUtil.js

@@ -1,5 +1,4 @@
 import { mathUtil } from '../MathUtil'
-import { componentService } from '../Service/ComponentService'
 import { floorplanService } from '../Service/FloorplanService'
 import { signService } from '../Service/SignService'
 import { tagService } from '../Service/TagService'
@@ -77,14 +76,6 @@ export default class HistoryUtil {
         wallService.setPointInfo(pointInfo)
     }
 
-    assignComponentFromComponent(component1, component2) {
-        const componentInfo = {}
-        componentInfo.vectorId = component1.vectorId
-        componentInfo.angle = component2.angle
-        componentInfo.center = JSON.parse(JSON.stringify(component2.center))
-        componentInfo.points2d = JSON.parse(JSON.stringify(component2.points))
-        componentService.setComponentInfo(componentInfo)
-    }
     assignTagFromTag(tag1, tag2) {
         const tagInfo = {}
         tagInfo.vectorId = tag1.vectorId

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

@@ -22,9 +22,7 @@ import Constant from './Constant'
 import VectorType from './enum/VectorType'
 import { mathUtil } from './MathUtil'
 import { wallService } from './Service/WallService'
-import { componentService } from './Service/ComponentService'
 import History from './History/History'
-import { compassService } from './Service/CompassService'
 import { signService } from './Service/SignService'
 
 export default class Layer {
@@ -257,17 +255,6 @@ export default class Layer {
                 }
                 needAutoRedraw = true
                 break
-            case LayerEvents.AddComponent:
-                needAutoRedraw = true
-                if (draggingItem == null) {
-                    const componentType = this.uiControl.getComponentTypeForUI()
-                    const component = componentService.createComponent(position, componentType)
-                    if (component.vectorId) {
-                        stateService.setSelectItem(component.vectorId, componentType, SelectState.All)
-                        stateService.setDraggingItem(stateService.selectItem)
-                    }
-                }
-                break
             case LayerEvents.AddTag:
                 needAutoRedraw = true
                 if (draggingItem == null) {

+ 0 - 9
src/views/draw-file/board/editCAD/Load.js

@@ -1,6 +1,5 @@
 import { floorplanService } from './Service/FloorplanService.js'
 import { wallService } from './Service/WallService.js'
-import { componentService } from './Service/ComponentService.js'
 import { tagService } from './Service/TagService'
 import { signService } from './Service/SignService'
 
@@ -31,14 +30,6 @@ export default class Load {
                 wall.setChildren(floor.walls[key].children)
             }
 
-            for (let key in floor.components) {
-                let component = componentService.createComponent(floor.components[key].center, floor.components[key].geoType, floor.components[key].vectorId)
-                component.angle = floor.components[key].angle
-                component.sideThickness = floor.components[key].sideThickness
-                component.sideWidth = floor.components[key].sideWidth
-                component.points2d = JSON.parse(JSON.stringify(floor.components[key].points2d))
-            }
-
             for (let key in floor.tags) {
                 let tag = tagService.createTag(floor.tags[key].center, floor.tags[key].vectorId, i)
                 tag.setPoints2d()

+ 0 - 226
src/views/draw-file/board/editCAD/Renderer/Draw.js

@@ -774,232 +774,6 @@ export default class Draw {
         this.context.restore()
     }
 
-    drawBeam(geometry, styleType) {
-        let points2d = geometry.points2d
-        let points = []
-        for (let i = 0; i < points2d.length; ++i) {
-            points[i] = coordinate.getScreenXY({ x: points2d[i].x, y: points2d[i].y })
-        }
-
-        this.context.save()
-
-        this.context.lineWidth = Style.Component.lineWidth * coordinate.ratio
-        this.context.strokeStyle = Style.Component.strokeStyle
-
-        let isFill = false
-
-        if (styleType) {
-            if (styleType == 'style-1') {
-                this.context.lineWidth = Style.DownLoad.style1.Component.lineWidth * coordinate.ratio
-                this.context.strokeStyle = Style.DownLoad.style1.Component.strokeStyle
-            } else if (styleType == 'style-2') {
-                this.context.lineWidth = Style.DownLoad.style2.Component.lineWidth * coordinate.ratio
-                this.context.strokeStyle = Style.DownLoad.style2.Component.strokeStyle
-            } else if (styleType == 'style-3') {
-                this.context.lineWidth = Style.DownLoad.style3.Component.lineWidth * coordinate.ratio
-                this.context.strokeStyle = Style.DownLoad.style3.Component.strokeStyle
-            } else if (styleType == 'style-4') {
-                this.context.lineWidth = Style.DownLoad.style4.Component.lineWidth * coordinate.ratio
-                this.context.strokeStyle = Style.DownLoad.style4.Component.strokeStyle
-            }
-        } else {
-            const selectItem = stateService.getSelectItem()
-            const draggingItem = stateService.getDraggingItem()
-            const focusItem = stateService.getFocusItem()
-
-            if (selectItem && selectItem.type == VectorType.Beam) {
-                if (geometry.vectorId == selectItem.vectorId) {
-                    this.context.strokeStyle = Style.Select.Component.strokeStyle
-                    this.context.fillStyle = Style.Select.Component.fillStyle
-                    isFill = true
-                }
-            } else if (draggingItem && draggingItem.type == VectorType.Beam) {
-                if (geometry.vectorId == draggingItem.vectorId) {
-                    this.context.strokeStyle = Style.Select.Component.strokeStyle
-                    this.context.fillStyle = Style.Select.Component.fillStyle
-                    isFill = true
-                }
-            }
-
-            if (focusItem && focusItem.type == VectorType.Beam) {
-                if (geometry.vectorId == focusItem.vectorId) {
-                    this.context.strokeStyle = Style.Focus.Component.strokeStyle
-                    this.context.fillStyle = Style.Focus.Component.fillStyle
-                    isFill = true
-                }
-            }
-        }
-
-        this.context.beginPath()
-        this.context.moveTo(points[0].x, points[0].y)
-        this.context.lineTo(points[1].x, points[1].y)
-        this.context.lineTo(points[2].x, points[2].y)
-        this.context.lineTo(points[3].x, points[3].y)
-        this.context.closePath()
-        this.context.stroke()
-        if (isFill) {
-            this.context.fill()
-        }
-
-        //this.context.beginPath()
-        this.context.moveTo(points[0].x, points[0].y)
-        this.context.lineTo(points[2].x, points[2].y)
-        //this.context.stroke()
-
-        //this.context.beginPath()
-        this.context.moveTo(points[1].x, points[1].y)
-        this.context.lineTo(points[3].x, points[3].y)
-        this.context.stroke()
-        this.context.restore()
-    }
-
-    drawFlue(geometry, styleType) {
-        let points2d = geometry.points2d
-        let points = []
-        for (let i = 0; i < points2d.length; ++i) {
-            points[i] = coordinate.getScreenXY({ x: points2d[i].x, y: points2d[i].y })
-        }
-
-        this.context.save()
-
-        this.context.lineWidth = Style.Component.lineWidth * coordinate.ratio
-        this.context.strokeStyle = Style.Component.strokeStyle
-
-        let isFill = false
-
-        if (styleType) {
-            if (styleType == 'style-1') {
-                this.context.lineWidth = Style.DownLoad.style1.Component.lineWidth * coordinate.ratio
-                this.context.strokeStyle = Style.DownLoad.style1.Component.strokeStyle
-            } else if (styleType == 'style-2') {
-                this.context.lineWidth = Style.DownLoad.style2.Component.lineWidth * coordinate.ratio
-                this.context.strokeStyle = Style.DownLoad.style2.Component.strokeStyle
-            } else if (styleType == 'style-3') {
-                this.context.lineWidth = Style.DownLoad.style3.Component.lineWidth * coordinate.ratio
-                this.context.strokeStyle = Style.DownLoad.style3.Component.strokeStyle
-            } else if (styleType == 'style-4') {
-                this.context.lineWidth = Style.DownLoad.style4.Component.lineWidth * coordinate.ratio
-                this.context.strokeStyle = Style.DownLoad.style4.Component.strokeStyle
-            }
-        } else {
-            const selectItem = stateService.getSelectItem()
-            const draggingItem = stateService.getDraggingItem()
-            const focusItem = stateService.getFocusItem()
-
-            if (selectItem && selectItem.type == VectorType.Flue) {
-                if (geometry.vectorId == selectItem.vectorId) {
-                    this.context.strokeStyle = Style.Select.Component.strokeStyle
-                    this.context.fillStyle = Style.Select.Component.fillStyle
-                    isFill = true
-                }
-            } else if (draggingItem && draggingItem.type == VectorType.Flue) {
-                if (geometry.vectorId == draggingItem.vectorId) {
-                    this.context.strokeStyle = Style.Select.Component.strokeStyle
-                    this.context.fillStyle = Style.Select.Component.fillStyle
-                    isFill = true
-                }
-            }
-
-            if (focusItem && focusItem.type == VectorType.Flue) {
-                if (geometry.vectorId == focusItem.vectorId) {
-                    this.context.strokeStyle = Style.Focus.Component.strokeStyle
-                    this.context.fillStyle = Style.Focus.Component.fillStyle
-                    isFill = true
-                }
-            }
-        }
-
-        this.context.beginPath()
-        this.context.moveTo(points[0].x, points[0].y)
-        this.context.lineTo(points[1].x, points[1].y)
-        this.context.lineTo(points[2].x, points[2].y)
-        this.context.lineTo(points[3].x, points[3].y)
-        this.context.closePath()
-        this.context.stroke()
-        if (isFill) {
-            this.context.fill()
-        }
-
-        this.context.beginPath()
-        this.context.moveTo(points[4].x, points[4].y)
-        this.context.lineTo(points[5].x, points[5].y)
-        this.context.lineTo(points[6].x, points[6].y)
-        this.context.lineTo(points[7].x, points[7].y)
-        this.context.closePath()
-        this.context.stroke()
-
-        this.context.moveTo(points[4].x, points[4].y)
-        this.context.lineTo(points[8].x, points[8].y)
-        this.context.lineTo(points[6].x, points[6].y)
-        this.context.stroke()
-
-        this.context.restore()
-    }
-
-    drawCorridor(geometry, styleType) {
-        let points2d = geometry.points2d
-        let points = []
-        for (let i = 0; i < points2d.length; ++i) {
-            points[i] = coordinate.getScreenXY({ x: points2d[i].x, y: points2d[i].y })
-        }
-
-        this.context.save()
-
-        this.context.lineWidth = Style.Component.lineWidth * coordinate.ratio
-        this.context.strokeStyle = Style.Component.strokeStyle
-
-        if (styleType) {
-            if (styleType == 'style-1') {
-                this.context.lineWidth = Style.DownLoad.style1.Component.lineWidth * coordinate.ratio
-                this.context.strokeStyle = Style.DownLoad.style1.Component.strokeStyle
-            } else if (styleType == 'style-2') {
-                this.context.lineWidth = Style.DownLoad.style2.Component.lineWidth * coordinate.ratio
-                this.context.strokeStyle = Style.DownLoad.style2.Component.strokeStyle
-            } else if (styleType == 'style-3') {
-                this.context.lineWidth = Style.DownLoad.style3.Component.lineWidth * coordinate.ratio
-                this.context.strokeStyle = Style.DownLoad.style3.Component.strokeStyle
-            } else if (styleType == 'style-4') {
-                this.context.lineWidth = Style.DownLoad.style4.Component.lineWidth * coordinate.ratio
-                this.context.strokeStyle = Style.DownLoad.style4.Component.strokeStyle
-            }
-        } else {
-            const selectItem = stateService.getSelectItem()
-            const draggingItem = stateService.getDraggingItem()
-            const focusItem = stateService.getFocusItem()
-
-            if (selectItem && selectItem.type == VectorType.Corridor) {
-                if (geometry.vectorId == selectItem.vectorId) {
-                    this.context.strokeStyle = Style.Select.Component.strokeStyle
-                }
-            } else if (draggingItem && draggingItem.type == VectorType.Corridor) {
-                if (geometry.vectorId == draggingItem.vectorId) {
-                    this.context.strokeStyle = Style.Select.Component.strokeStyle
-                }
-            }
-
-            if (focusItem && focusItem.type == VectorType.Corridor) {
-                if (geometry.vectorId == focusItem.vectorId) {
-                    this.context.strokeStyle = Style.Focus.Component.strokeStyle
-                }
-            }
-        }
-
-        this.context.beginPath()
-        this.context.moveTo(points[0].x, points[0].y)
-        this.context.lineTo(points[1].x, points[1].y)
-        this.context.lineTo(points[2].x, points[2].y)
-        this.context.lineTo(points[3].x, points[3].y)
-        this.context.closePath()
-        this.context.stroke()
-
-        for (let i = 4; i < points.length - 1; i += 2) {
-            this.context.moveTo(points[i].x, points[i].y)
-            this.context.lineTo(points[i + 1].x, points[i + 1].y)
-        }
-        this.context.stroke()
-        this.context.restore()
-    }
-
     drawTag(geometry, styleType, hide) {
         this.context.save()
 

+ 0 - 30
src/views/draw-file/board/editCAD/Renderer/Render.js

@@ -25,36 +25,6 @@ export default class Render {
             case VectorType.Point:
                 draw.drawPoint(vector)
                 return
-            case VectorType.SingleDoor:
-                draw.drawSingleDoor(vector, styleType, flag)
-                return
-            case VectorType.DoubleDoor:
-                draw.drawDoubleDoor(vector, styleType, flag)
-                return
-            case VectorType.SlideDoor:
-                draw.drawSlideDoor(vector, styleType, flag)
-                return
-            case VectorType.SingleWindow:
-                draw.drawSingleWindow(vector, styleType)
-                return
-            case VectorType.FrenchWindow:
-                draw.drawFrenchWindow(vector, styleType)
-                return
-            case VectorType.BayWindow:
-                draw.drawBayWindow(vector, styleType)
-                return
-            case VectorType.Pass:
-                draw.drawPass(vector)
-                return
-            case VectorType.Beam:
-                draw.drawBeam(vector)
-                return
-            case VectorType.Flue:
-                draw.drawFlue(vector)
-                return
-            case VectorType.Corridor:
-                draw.drawCorridor(vector)
-                return
             case VectorType.Tag:
                 draw.drawTag(vector, styleType, flag)
                 return

+ 0 - 43
src/views/draw-file/board/editCAD/Service/ComponentService.js

@@ -1,43 +0,0 @@
-import VectorType from '../enum/VectorType.js'
-import Beam from '../Geometry/Beam.js'
-import { floorplanService } from './FloorplanService'
-
-export class ComponentService {
-    constructor() {
-        this.sideWidth = 0.65
-        this.sideThickness = 0.65
-    }
-
-    // 新建component
-    createComponent(position, geoType, vectorId) {
-        let component = null
-        switch (geoType) {
-            case VectorType.Beam:
-                component = new Beam(position, vectorId)
-                break
-        }
-
-        component.setPoints2d()
-        floorplanService.addComponent(component)
-        return component
-    }
-
-    isComponent(geoType) {
-        switch (geoType) {
-            case VectorType.Beam:
-                return true
-        }
-        return false
-    }
-
-    setComponentInfo(componentInfo) {
-        let component = floorplanService.getComponent(componentInfo.vectorId)
-        component.vectorId = componentInfo.vectorId
-        component.angle = componentInfo.angle
-        component.center = JSON.parse(JSON.stringify(componentInfo.center))
-        component.points2d = JSON.parse(JSON.stringify(componentInfo.points2d))
-    }
-}
-
-const componentService = new ComponentService()
-export { componentService }

+ 75 - 0
src/views/draw-file/board/editCAD/Service/SignService.js

@@ -0,0 +1,75 @@
+import VectorType from '../enum/VectorType.js'
+import Sign from '../Geometry/Sign.js'
+import { floorplanService } from './FloorplanService'
+import { Signs } from '../enum/UIEvents'
+
+
+export default class SignService {
+    constructor() {
+        this.signs = null
+    }
+  
+    createSign(position, geoType, vectorId) {
+        let sign = null
+        switch (geoType) {
+            case VectorType.Cigaret:
+                sign = new Sign(position, vectorId, VectorType.Cigaret)
+                break
+            case VectorType.FirePoint:
+                sign = new Sign(position, vectorId, VectorType.FirePoint)
+                break
+            case VectorType.FootPrint:
+                sign = new Sign(position, vectorId, VectorType.FootPrint)
+                break
+            case VectorType.ShoePrint:
+                sign = new Sign(position, vectorId, VectorType.ShoePrint)
+                break
+            case VectorType.FingerPrint:
+                sign = new Sign(position, vectorId, VectorType.FingerPrint)
+                break
+            case VectorType.DeadBody:
+                sign = new Sign(position, vectorId, VectorType.DeadBody)
+                break
+            case VectorType.BloodStain:
+                sign = new Sign(position, vectorId, VectorType.BloodStain)
+                break
+        }
+
+        floorplanService.addSign(sign)
+        return sign
+    }
+
+    isSign(geoType) {
+        switch (geoType) {
+            case VectorType.Cigaret:
+                return true
+            case VectorType.FirePoint:
+                return true
+            case VectorType.FootPrint:
+                return true
+            case VectorType.ShoePrint:
+                return true
+            case VectorType.FingerPrint:
+                return true
+            case VectorType.DeadBody:
+                return true
+            case VectorType.BloodStain:
+                return true
+        }
+        return false
+    }
+
+    setSignInfo(signInfo) {
+        let sign = floorplanService.getSign(signInfo.vectorId)
+        sign.vectorId = signInfo.vectorId
+        sign.angle = signInfo.angle
+        sign.center = JSON.parse(JSON.stringify(signInfo.center))
+    }
+    
+    getSign(name) {
+        return this.signs[name]
+    }
+}
+
+const signService = new SignService()
+export { signService }

+ 1 - 6
src/views/draw-file/board/editCAD/Service/StateService.js

@@ -1,6 +1,5 @@
 import VectorType from '../enum/VectorType.js'
 import SelectState from '../enum/SelectState.js'
-import { componentService } from './ComponentService.js'
 import { signService } from './SignService.js'
 
 export default class StateService {
@@ -29,11 +28,7 @@ export default class StateService {
         this.selectItem.vectorId = vectorId
         this.selectItem.type = type
 
-        if (componentService.isComponent(type)) {
-            if (state == SelectState.Select) {
-                this.selectItem.selectIndex = SelectState.All
-            }
-        } else if (type == VectorType.Tag) {
+        if (type == VectorType.Tag) {
             if (state == SelectState.Select) {
                 this.selectItem.selectIndex = SelectState.All
             } else {

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

@@ -3,6 +3,11 @@ const VectorType = {
     WallCorner: 'WallCorner',
     Wall: 'Wall',
     Tag: 'Tag',
+    Table:'Table',          
+    Rectangle:'Rectangle',
+    Circle:'Circle',
+    Arrow:'Arrow',
+    Icon:'Icon',
     Cigaret: 'Cigaret',                  //烟头
     FirePoint: 'FirePoint',              //起火点
     FootPrint: 'FootPrint',              //脚印