浏览代码

继续搭建绘图程序

xushiting 2 年之前
父节点
当前提交
16d0f6603d

+ 1 - 8
src/graphic/Coordinate.js

@@ -2,14 +2,7 @@ import { dataService } from "./Service/DataService.js";
 import { floorplanData } from "./VectorData.js";
 import { mathUtil } from "./Util/MathUtil.js/index.js";
 import Constant from "./Constant";
-import { symbolService } from "./Service/SymbolService.js";
-
-// const pad = {
-//     top: 40,
-//     bottom: 40,
-//     left: 40,
-//     right: 40,
-// }
+
 const defaultZoom = 100;
 export default class Coordinate {
   constructor() {

+ 31 - 0
src/graphic/Geometry/Circle.js

@@ -0,0 +1,31 @@
+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";
+
+//不靠墙
+export default class Circle extends Geometry {
+  constructor(center, radius, vectorId) {
+    super();
+    this.radius = 5;
+    this.center = null;
+    this.geoType = VectorType.Circle;
+    this.setId(vectorId);
+
+    this.setRadius(radius);
+    this.setCenter(center);
+  }
+
+  setRadius(radius) {
+    this.radius = radius;
+  }
+
+  setCenter(center) {
+    if (center) {
+      this.center = {};
+      this.center.x = center.x;
+      this.center.y = center.y;
+    }
+  }
+}

+ 13 - 5
src/graphic/Geometry/Edge.js

@@ -6,16 +6,24 @@ export default class Edge extends Geometry {
   constructor(start, end, parentId) {
     super();
     this.parent = parentId;
-    this.start = start;
-    this.end = end;
+    this.start = null;
+    this.end = null;
     this.vectorId = null;
     this.geoType = VectorType.Edge;
+
+    this.setPositions(start, end);
   }
 
-  init = function () {};
+  setPositions(point1, point2) {
+    this.start.x = point1.x;
+    this.start.y = point1.y;
+
+    this.end.x = point2.x;
+    this.end.y = point2.y;
+  }
 
-  getLine = function () {
+  getLine() {
     let line = mathUtil.createLine(this.start, this.end);
     return line;
-  };
+  }
 }

+ 0 - 302
src/graphic/Geometry/Furniture.js

@@ -1,302 +0,0 @@
-import Geometry from "./Geometry";
-import { mathUtil } from "../Util/MathUtil.js/index.js";
-import SelectState from "../enum/SelectState.js";
-import VectorType from "../enum/VectorType.js";
-import Constant from "../Constant.js";
-import { coordinate } from "../Coordinate";
-
-export default class Furniture extends Geometry {
-  constructor(center, vectorId, type) {
-    super();
-    this.center = center;
-    this.geoType = type;
-    //this.boundingVertexs = []
-    this.angle = 0; //逆时针为负,顺时针为正。单位是:°
-    this.zoom = 1; //缩放比例
-    this.setId(vectorId);
-  }
-
-  isContain(position) {
-    // const dis = mathUtil.getDistance(position, this.center)
-    // let len = this.getScale() * this.zoom
-    // if (dis < len / 2) {
-    //     return SelectState.Select
-    // } else {
-    //     return null
-    // }
-    const points2d = this.getBoundingVertexs(this.center);
-    return mathUtil.isPointInPoly(position, points2d);
-  }
-
-  getScale() {
-    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 1;
-      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;
-    }
-  }
-
-  getLengthWidth() {
-    switch (this.geoType) {
-      case VectorType.TV: //电视
-        return {
-          length: 32,
-          width: 10,
-        };
-      case VectorType.CombinationSofa: //组合沙发
-        return {
-          length: 32,
-          width: 28,
-        };
-      case VectorType.SingleSofa: //单人沙发
-        return {
-          length: 26,
-          width: 20,
-        };
-      case VectorType.TeaTable: //茶几
-        return {
-          length: 30,
-          width: 16,
-        };
-      case VectorType.Carpet: //地毯
-        return {
-          length: 32,
-          width: 20,
-        };
-      case VectorType.Plant: //植物
-        return {
-          length: 28,
-          width: 28,
-        };
-      case VectorType.DiningTable: //餐桌
-        return {
-          length: 28,
-          width: 26,
-        };
-      case VectorType.DoubleBed: //双人床
-        return {
-          length: 24,
-          width: 26,
-        };
-      case VectorType.SingleBed: //单人床
-        return {
-          length: 18,
-          width: 26,
-        };
-      case VectorType.Wardrobe: //衣柜
-        return {
-          length: 30,
-          width: 18,
-        };
-      case VectorType.Dresser: //梳妆台
-        return {
-          length: 28,
-          width: 26,
-        };
-      case VectorType.BedsideCupboard: //床头柜
-        return {
-          length: 28,
-          width: 28,
-        };
-      case VectorType.Pillow: //抱枕
-        return {
-          length: 26,
-          width: 26,
-        };
-      case VectorType.GasStove: //燃气灶
-        return {
-          length: 32,
-          width: 20,
-        };
-      case VectorType.Cupboard: //橱柜
-        return {
-          length: 12,
-          width: 32,
-        };
-      case VectorType.Bathtub: //浴缸
-        return {
-          length: 32,
-          width: 18,
-        };
-      case VectorType.Closestool: //马桶
-        return {
-          length: 22,
-          width: 28,
-        };
-      case VectorType.Washstand: //洗漱台
-        return {
-          length: 28,
-          width: 20,
-        };
-      case VectorType.Desk: //书桌
-        return {
-          length: 26,
-          width: 20,
-        };
-      case VectorType.BalconyChair: //阳台椅
-        return {
-          length: 32,
-          width: 10,
-        };
-      case VectorType.Elevator: //电梯
-        return {
-          length: 28,
-          width: 28,
-        };
-    }
-  }
-
-  /*
-    getBoundingVertexs(center) {
-        //this.boundingVertexs = []
-        const boundingVertexs = []
-        //const width = (((this.getScale() * Constant.furnitureWidth) / coordinate.res) * this.zoom)
-        const width = this.getScale() * this.zoom
-
-        const minX = center.x - width / 2
-        const minY = center.y - width / 2
-        const maxX = center.x + width / 2
-        const maxY = center.y + width / 2
-
-        const point1 = this.rotatePoint(
-            {
-                x: minX,
-                y: maxY,
-            },
-            center,
-            this.angle
-        )
-
-        const point2 = this.rotatePoint(
-            {
-                x: maxX,
-                y: maxY,
-            },
-            center,
-            this.angle
-        )
-
-        const point3 = this.rotatePoint(
-            {
-                x: maxX,
-                y: minY,
-            },
-            center,
-            this.angle
-        )
-
-        const point4 = this.rotatePoint(
-            {
-                x: minX,
-                y: minY,
-            },
-            center,
-            this.angle
-        )
-
-        boundingVertexs.push(point1)
-        boundingVertexs.push(point2)
-        boundingVertexs.push(point3)
-        boundingVertexs.push(point4)
-
-        return boundingVertexs
-    }
-    */
-  getBoundingVertexs(center) {
-    //this.boundingVertexs = []
-    const boundingVertexs = [];
-    const rec = this.getLengthWidth();
-    //const width = (((this.getScale() * Constant.furnitureWidth) / coordinate.res) * this.zoom)
-    const length =
-      (this.getScale() * rec.length * this.zoom) / Constant.furnitureWidth;
-    const width =
-      (this.getScale() * rec.width * this.zoom) / Constant.furnitureWidth;
-
-    const minX = center.x - length / 2;
-    const minY = center.y - width / 2;
-    const maxX = center.x + length / 2;
-    const maxY = center.y + width / 2;
-
-    const point1 = this.rotatePoint(
-      {
-        x: minX,
-        y: maxY,
-      },
-      center,
-      this.angle
-    );
-
-    const point2 = this.rotatePoint(
-      {
-        x: maxX,
-        y: maxY,
-      },
-      center,
-      this.angle
-    );
-
-    const point3 = this.rotatePoint(
-      {
-        x: maxX,
-        y: minY,
-      },
-      center,
-      this.angle
-    );
-
-    const point4 = this.rotatePoint(
-      {
-        x: minX,
-        y: minY,
-      },
-      center,
-      this.angle
-    );
-
-    boundingVertexs.push(point1);
-    boundingVertexs.push(point2);
-    boundingVertexs.push(point3);
-    boundingVertexs.push(point4);
-
-    return boundingVertexs;
-  }
-}

+ 1 - 1
src/graphic/Geometry/Geometry.js

@@ -4,7 +4,7 @@ import SymbolEvents from "../enum/SymbolEvents.js";
 
 export default class Geometry {
   constructor() {
-    this.len = null;
+    this.display = true;
   }
 
   setId(vectorId) {

+ 17 - 0
src/graphic/Geometry/Img.js

@@ -0,0 +1,17 @@
+import VectorType from "../enum/VectorType.js";
+import Geometry from "./Geometry";
+
+export default class Img extends Geometry {
+  constructor(src, vectorId) {
+    super();
+    this.src = null;
+    this.geoType = VectorType.Img;
+    this.setId(vectorId);
+
+    this.setSrc(src);
+  }
+
+  setSrc(src) {
+    this.src = src;
+  }
+}

+ 19 - 21
src/graphic/Geometry/Line.js

@@ -1,27 +1,25 @@
-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 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";
 
-//不靠墙
 export default class Line extends Geometry {
-    constructor(start, end, vectorId) {
-        super()
-        this.start = start
-        this.end = end
+  constructor(start, end, vectorId) {
+    super();
+    this.start = null;
+    this.end = null;
+    this.geoType = VectorType.Line;
+    this.setId(vectorId);
 
-        this.name = null
-        this.display = false
-        this.geoType = VectorType.Line
-        this.setId(vectorId)
-    }
+    this.setPositions(start, end);
+  }
 
-    setPositions(point1, point2) {
-        this.start.x = point1.x
-        this.start.y = point1.y
+  setPositions(point1, point2) {
+    this.start.x = point1.x;
+    this.start.y = point1.y;
 
-        this.end.x = point2.x
-        this.end.y = point2.y
-    }
+    this.end.x = point2.x;
+    this.end.y = point2.y;
+  }
 }

+ 22 - 0
src/graphic/Geometry/MeasureLine.js

@@ -0,0 +1,22 @@
+import VectorType from "../enum/VectorType.js";
+import Geometry from "./Geometry";
+
+export default class MeasureLine extends Geometry {
+  constructor(start, end, vectorId) {
+    super();
+    this.start = null;
+    this.end = null;
+    this.geoType = VectorType.MeasureLine;
+    this.setId(vectorId);
+
+    this.setPositions(start, end);
+  }
+
+  setPositions(point1, point2) {
+    this.start.x = point1.x;
+    this.start.y = point1.y;
+
+    this.end.x = point2.x;
+    this.end.y = point2.y;
+  }
+}

+ 5 - 6
src/graphic/Geometry/Point.js

@@ -2,17 +2,16 @@ import VectorType from "../enum/VectorType.js";
 import Geometry from "./Geometry";
 
 export default class Point extends Geometry {
-  constructor(x, y, vectorId) {
+  constructor(position, vectorId) {
     super();
-    this.x = x;
-    this.y = y;
-
-    this.display = false;
-
+    this.x = null;
+    this.y = null;
     this.name = null;
     this.parent = {};
     this.geoType = VectorType.Point;
     this.setId(vectorId);
+
+    this.setPosition(position);
   }
 
   setPosition(position) {

+ 119 - 104
src/graphic/Geometry/Tag.js

@@ -1,108 +1,123 @@
-import VectorType from '../enum/VectorType.js'
-import Geometry from './Geometry'
-import { mathUtil } from '../MathUtil.js'
-import { coordinate } from '../Coordinate'
-import Constant from '../Constant.js'
+import VectorType from "../enum/VectorType.js";
+import Geometry from "./Geometry";
+import { mathUtil } from "../MathUtil.js";
+import { coordinate } from "../Coordinate";
+import Constant from "../Constant.js";
 
 //不靠墙
 export default class Tag extends Geometry {
-    constructor(center, vectorId) {
-        super()
-        this.center = center
-        this.points2d = []
-        //this.title = KanKan.Config.i18n('cad.input')
-        this.title = ''
-        this.des = '' //面积
-        this.unit = 'm' //或者ft
-        this.name = '标注'
-        this.adding = true
-
-        this.sideWidth = 30 //像素
-        this.sideThickness = 30 //像素
-
-        this.geoType = VectorType.Tag
-        this.setId(vectorId)
-    }
-
-    isContain(position) {
-        let points = []
-        points.push(this.points2d[0])
-        points.push(this.points2d[1])
-        points.push(this.points2d[2])
-        points.push(this.points2d[3])
-        return mathUtil.isPointInPoly(position, points)
-    }
-
-    setPoints2d() {
-        this.points2d = []
-        const minX = this.center.x - ((this.sideWidth / coordinate.res) * Constant.defaultZoom) / coordinate.zoom / 2
-        const minY = this.center.y - ((this.sideThickness / coordinate.res) * Constant.defaultZoom) / coordinate.zoom / 2
-        const maxX = this.center.x + ((this.sideWidth / coordinate.res) * Constant.defaultZoom) / coordinate.zoom / 2
-        const maxY = this.center.y + ((this.sideThickness / coordinate.res) * Constant.defaultZoom) / coordinate.zoom / 2
-
-        const point1 = {
-            x: minX,
-            y: maxY,
-        }
-
-        const point2 = {
-            x: maxX,
-            y: maxY,
-        }
-
-        const point3 = {
-            x: maxX,
-            y: minY,
-        }
-
-        const point4 = {
-            x: minX,
-            y: minY,
-        }
-
-        this.points2d.push(point1)
-        this.points2d.push(point2)
-        this.points2d.push(point3)
-        this.points2d.push(point4)
-
-        //-
-        let dx = (point1.x - this.center.x) / 2
-        //+
-        let dy = (point1.y - this.center.y) / 2
-
-        this.points2d.push({
-            x: point1.x - dx,
-            y: point1.y - dy,
-        })
-
-        this.points2d.push({
-            x: point2.x + dx,
-            y: point1.y - dy,
-        })
-
-        this.points2d.push({
-            x: this.center.x,
-            y: point1.y - dy,
-        })
-
-        this.points2d.push({
-            x: this.center.x,
-            y: point3.y + dy,
-        })
-    }
-
-    setTitle(title) {
-        this.title = title
-    }
-
-    setDes(des) {
-        this.des = des
-    }
-    setUnit(unit) {
-        this.unit = unit
-    }
-
-    setAdding(flag) {
-        this.adding = flag
-    }
+  constructor(center, vectorId) {
+    super();
+    this.center = center;
+    this.points2d = [];
+    this.title = "";
+    this.des = ""; //面积
+    this.unit = "m"; //或者ft
+    this.name = "标注";
+    this.adding = true;
+
+    this.sideWidth = 30; //像素
+    this.sideThickness = 30; //像素
+
+    this.geoType = VectorType.Tag;
+    this.setId(vectorId);
+  }
+
+  isContain(position) {
+    let points = [];
+    points.push(this.points2d[0]);
+    points.push(this.points2d[1]);
+    points.push(this.points2d[2]);
+    points.push(this.points2d[3]);
+    return mathUtil.isPointInPoly(position, points);
+  }
+
+  setPoints2d() {
+    this.points2d = [];
+    const minX =
+      this.center.x -
+      ((this.sideWidth / coordinate.res) * Constant.defaultZoom) /
+        coordinate.zoom /
+        2;
+    const minY =
+      this.center.y -
+      ((this.sideThickness / coordinate.res) * Constant.defaultZoom) /
+        coordinate.zoom /
+        2;
+    const maxX =
+      this.center.x +
+      ((this.sideWidth / coordinate.res) * Constant.defaultZoom) /
+        coordinate.zoom /
+        2;
+    const maxY =
+      this.center.y +
+      ((this.sideThickness / coordinate.res) * Constant.defaultZoom) /
+        coordinate.zoom /
+        2;
+
+    const point1 = {
+      x: minX,
+      y: maxY,
+    };
+
+    const point2 = {
+      x: maxX,
+      y: maxY,
+    };
+
+    const point3 = {
+      x: maxX,
+      y: minY,
+    };
+
+    const point4 = {
+      x: minX,
+      y: minY,
+    };
+
+    this.points2d.push(point1);
+    this.points2d.push(point2);
+    this.points2d.push(point3);
+    this.points2d.push(point4);
+
+    //-
+    let dx = (point1.x - this.center.x) / 2;
+    //+
+    let dy = (point1.y - this.center.y) / 2;
+
+    this.points2d.push({
+      x: point1.x - dx,
+      y: point1.y - dy,
+    });
+
+    this.points2d.push({
+      x: point2.x + dx,
+      y: point1.y - dy,
+    });
+
+    this.points2d.push({
+      x: this.center.x,
+      y: point1.y - dy,
+    });
+
+    this.points2d.push({
+      x: this.center.x,
+      y: point3.y + dy,
+    });
+  }
+
+  setTitle(title) {
+    this.title = title;
+  }
+
+  setDes(des) {
+    this.des = des;
+  }
+  setUnit(unit) {
+    this.unit = unit;
+  }
+
+  setAdding(flag) {
+    this.adding = flag;
+  }
 }

+ 39 - 221
src/graphic/History/Change.js

@@ -1,62 +1,35 @@
 import { dataService } from "../Service/DataService";
-import { elementService } from "../Service/ElementService";
-import { wallService } from "../Service/WallService";
+import { roadService } from "../Service/RoadService";
 import { historyUtil } from "./HistoryUtil";
-import { symbolService } from "../Service/SymbolService";
 import HistoryEvents from "../enum/HistoryEvents";
 import { coordinate } from "../Coordinate";
 
 export default class Change {
   constructor() {
     this.lastData = {}; // 每次都是当前数据和lastData进行比较,一般在mouseDown的时候存储进来
-    this.elements = {}; // 当前的变化
+    this.currentData = {}; // 当前的变化
   }
 
   // 保存当前记录
   saveCurrentInfo() {
-    //this.lastData.subFloorNum = dataService.getSubFloor();
-    this.lastData.currentFloor = dataService.getCurrentFloor();
     this.lastData.points = JSON.parse(JSON.stringify(dataService.getPoints()));
-    this.lastData.walls = JSON.parse(JSON.stringify(dataService.getWalls()));
-    this.lastData.symbols = JSON.parse(
-      JSON.stringify(dataService.getSymbols())
-    );
-    this.lastData.components = JSON.parse(
-      JSON.stringify(dataService.getComponents())
-    );
-    this.lastData.furnitures = JSON.parse(
-      JSON.stringify(dataService.getFurnitures())
-    );
+    this.lastData.roads = JSON.parse(JSON.stringify(dataService.getRoads()));
     this.lastData.tags = JSON.parse(JSON.stringify(dataService.getTags()));
-    this.lastData.angle = dataService.getAngle();
     this.lastData.res = coordinate.res;
   }
 
   operate() {
     //
-    this.elements = {};
-    let flag = this.compareAngle();
-    if (!flag) {
-      this.comparePoints();
-      this.compareSymbols();
-      this.compareWalls();
-      this.compareComponents();
-      this.compareTags();
-      this.compareFurnitures();
-    }
-    //旋转了
-    else {
-      this.lastData = {};
-      return true;
-    }
+    this.currentData = {};
+
+    this.comparePoints();
+    this.compareRoads();
+    this.compareTags();
 
     if (
-      this.elements.points.length == 0 &&
-      this.elements.walls.length == 0 &&
-      this.elements.symbols.length == 0 &&
-      this.elements.components.length == 0 &&
-      this.elements.tags.length == 0 &&
-      this.elements.furnitures.length == 0
+      this.currentData.points.length == 0 &&
+      this.currentData.roads.length == 0 &&
+      this.currentData.tags.length == 0
     ) {
       this.saveCurrentInfo();
       return false;
@@ -67,9 +40,8 @@ export default class Change {
   }
 
   comparePoints() {
-    //const currentFloor = dataService.getCurrentFloorNum();
     const points = dataService.getPoints();
-    this.elements.points = [];
+    this.currentData.points = [];
 
     for (const key in points) {
       const point = points[key];
@@ -79,7 +51,7 @@ export default class Change {
           handle: HistoryEvents.AddPoint,
           point: historyUtil.getDataForPoint(point),
         };
-        this.elements.points.push(item);
+        this.currentData.points.push(item);
       } else {
         const lastPoint = this.lastData.points[key];
         if (
@@ -95,7 +67,7 @@ export default class Change {
             prePoint: historyUtil.getDataForPoint(lastPoint),
             curPoint: historyUtil.getDataForPoint(point),
           };
-          this.elements.points.push(item);
+          this.currentData.points.push(item);
         }
       }
       delete this.lastData.points[key];
@@ -106,139 +78,51 @@ export default class Change {
         handle: HistoryEvents.DeletePoint,
         point: historyUtil.getDataForPoint(this.lastData.points[key]),
       };
-      this.elements.points.push(item);
+      this.currentData.points.push(item);
     }
   }
 
-  compareWalls() {
-    //const currentFloor = dataService.getCurrentFloorNum();
-    this.elements.walls = [];
-    const walls = dataService.getWalls();
-    for (const key in walls) {
-      const wall = walls[key];
-      const lastWall = this.lastData.walls[key];
+  compareRoads() {
+    this.currentData.roads = [];
+    const roads = dataService.getRoads();
+    for (const key in roads) {
+      const road = roads[key];
+      const lastRoad = this.lastData.roads[key];
 
       // 不存在意味着增加
-      if (!lastWall) {
+      if (!lastRoad) {
         const item = {
           handle: HistoryEvents.AddRoad,
-          wall: historyUtil.getDataForWall(wall),
-        };
-        this.elements.walls.push(item);
-      } else {
-        if (!historyUtil.isDifferentForWalls(wall, lastWall)) {
-          delete this.lastData.walls[key];
-          continue;
-        } else {
-          const item = {
-            handle: HistoryEvents.ModifyWall,
-            preWall: historyUtil.getDataForWall(lastWall),
-            curWall: historyUtil.getDataForWall(wall),
-          };
-          this.elements.walls.push(item);
-        }
-      }
-      delete this.lastData.walls[key];
-    }
-
-    for (const key in this.lastData.walls) {
-      const item = {
-        handle: HistoryEvents.DeleteWall,
-        wall: historyUtil.getDataForWall(this.lastData.walls[key]),
-      };
-      this.elements.walls.push(item);
-    }
-  }
-
-  compareSymbols() {
-    //const currentFloor = dataService.getCurrentFloorNum();
-
-    this.elements.symbols = [];
-    const symbols = dataService.getSymbols();
-
-    const wallIds = [];
-
-    for (const key in symbols) {
-      const symbol = symbols[key];
-      const lastSymbol = this.lastData.symbols[key];
-
-      // 不存在意味着增加
-      if (!lastSymbol) {
-        const item = {
-          handle: HistoryEvents.AddSymbol,
-          symbol: historyUtil.getDataForSymbol(symbol),
-        };
-        this.elements.symbols.push(item);
-      } else {
-        if (!historyUtil.isDifferentForSymbols(symbol, lastSymbol)) {
-          delete this.lastData.symbols[key];
-          continue;
-        } else {
-          const item = {
-            handle: HistoryEvents.ModifySymbol,
-            preSymbol: historyUtil.getDataForSymbol(lastSymbol),
-            curSymbol: historyUtil.getDataForSymbol(symbol),
-          };
-          this.elements.symbols.push(item);
-        }
-      }
-      delete this.lastData.symbols[key];
-    }
-
-    for (const key in this.lastData.symbols) {
-      const item = {
-        handle: HistoryEvents.DeleteSymbol,
-        symbol: historyUtil.getDataForSymbol(this.lastData.symbols[key]),
-      };
-      this.elements.symbols.push(item);
-    }
-  }
-
-  compareComponents() {
-    //const currentFloor = dataService.getCurrentFloorNum();
-    this.elements.components = [];
-    const components = dataService.getComponents();
-
-    for (const key in components) {
-      const component = components[key];
-      const lastComponent = this.lastData.components[key];
-
-      // 不存在意味着增加
-      if (!lastComponent) {
-        const item = {
-          handle: HistoryEvents.AddComponent,
-          component: historyUtil.getDataForComponent(component),
+          road: historyUtil.getDataForRoad(road),
         };
-        this.elements.components.push(item);
+        this.currentData.roads.push(item);
       } else {
-        if (!historyUtil.isDifferentForComponents(component, lastComponent)) {
-          delete this.lastData.components[key];
+        if (!historyUtil.isDifferentForRoads(road, lastRoad)) {
+          delete this.lastData.roads[key];
           continue;
         } else {
           const item = {
-            handle: HistoryEvents.ModifyComponent,
-            preComponent: historyUtil.getDataForComponent(lastComponent),
-            curComponent: historyUtil.getDataForComponent(component),
+            handle: HistoryEvents.ModifyRoad,
+            preRoad: historyUtil.getDataForRoad(lastRoad),
+            curRoad: historyUtil.getDataForRoad(road),
           };
-          this.elements.components.push(item);
+          this.currentData.roads.push(item);
         }
       }
-      delete this.lastData.components[key];
+      delete this.lastData.roads[key];
     }
 
-    for (const key in this.lastData.components) {
+    for (const key in this.lastData.roads) {
       const item = {
-        handle: HistoryEvents.DeleteComponent,
-        component: historyUtil.getDataForComponent(
-          this.lastData.components[key]
-        ),
+        handle: HistoryEvents.DeleteRoad,
+        road: historyUtil.getDataForRoad(this.lastData.roads[key]),
       };
-      this.elements.components.push(item);
+      this.currentData.roads.push(item);
     }
   }
 
   compareTags() {
-    this.elements.tags = [];
+    this.currentData.tags = [];
     const tags = dataService.getTags();
 
     for (const key in tags) {
@@ -251,7 +135,7 @@ export default class Change {
           handle: HistoryEvents.AddTag,
           tag: historyUtil.getDataForTag(tag),
         };
-        this.elements.tags.push(item);
+        this.currentData.tags.push(item);
       } else {
         if (!historyUtil.isDifferentForTags(tag, lastTag)) {
           delete this.lastData.tags[key];
@@ -262,7 +146,7 @@ export default class Change {
             preTag: historyUtil.getDataForTag(lastTag),
             curTag: historyUtil.getDataForTag(tag),
           };
-          this.elements.tags.push(item);
+          this.currentData.tags.push(item);
         }
       }
       delete this.lastData.tags[key];
@@ -273,73 +157,7 @@ export default class Change {
         handle: HistoryEvents.DeleteTag,
         tag: historyUtil.getDataForTag(this.lastData.tags[key]),
       };
-      this.elements.tags.push(item);
-    }
-  }
-
-  compareFurnitures() {
-    //const currentFloor = dataService.getCurrentFloorNum();
-    this.elements.furnitures = [];
-    const furnitures = dataService.getFurnitures();
-
-    for (const key in furnitures) {
-      const furniture = furnitures[key];
-      const lastFurniture = this.lastData.furnitures[key];
-
-      // 不存在意味着增加
-      if (!lastFurniture) {
-        const item = {
-          handle: HistoryEvents.AddFurniture,
-          furniture: historyUtil.getDataForFurniture(furniture),
-        };
-        this.elements.furnitures.push(item);
-      } else {
-        if (!historyUtil.isDifferentForFurnitures(furniture, lastFurniture)) {
-          delete this.lastData.furnitures[key];
-          continue;
-        } else {
-          const item = {
-            handle: HistoryEvents.ModifyFurniture,
-            preFurniture: historyUtil.getDataForFurniture(lastFurniture),
-            curFurniture: historyUtil.getDataForFurniture(furniture),
-          };
-          this.elements.furnitures.push(item);
-        }
-      }
-      delete this.lastData.furnitures[key];
-    }
-
-    for (const key in this.lastData.furnitures) {
-      const item = {
-        handle: HistoryEvents.DeleteFurniture,
-        furniture: historyUtil.getDataForFurniture(
-          this.lastData.furnitures[key]
-        ),
-      };
-      this.elements.furnitures.push(item);
-    }
-  }
-
-  compareAngle() {
-    const angle = dataService.getAngle();
-    const lastAngle = this.lastData.angle;
-    const lastRes = this.lastData.res;
-    if (historyUtil.isDifferentForAngle(angle, lastAngle)) {
-      const item = {
-        handle: HistoryEvents.ModifyAngle,
-        preState: {
-          angle: historyUtil.getDataForAngle(lastAngle),
-          res: historyUtil.getDataForRes(lastRes),
-        },
-        curState: {
-          angle: historyUtil.getDataForAngle(angle),
-          res: historyUtil.getDataForRes(coordinate.res),
-        },
-      };
-      this.elements.rotate = item;
-      return true;
-    } else {
-      return false;
+      this.currentData.tags.push(item);
     }
   }
 }

+ 78 - 302
src/graphic/History/History.js

@@ -1,17 +1,13 @@
 import { dataService } from "../Service/DataService";
-import { elementService } from "../Service/ElementService";
-import { wallService } from "../Service/WallService";
 import { historyUtil } from "./HistoryUtil";
 import { change } from "./Change";
-import { symbolService } from "../Service/SymbolService";
 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";
 import { measureService } from "../Service/MeasureService";
-import { furnitureService } from "../Service/FurnitureService";
+import { roadService } from "../Service/RoadService";
+import { pointService } from "../Service/PointService";
 
 export default class History {
   constructor(layer) {
@@ -21,13 +17,13 @@ export default class History {
   init() {
     change.saveCurrentInfo();
     const points = dataService.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;
-    }
+    // 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;
+    // }
   }
 
   save() {
@@ -36,28 +32,27 @@ export default class History {
       return;
     }
     measureService.update();
-    historyService.addHistoryRecord(change.elements);
+    historyService.addHistoryRecord(change.currentData);
     change.saveCurrentInfo();
     this.setState();
     const historyState = historyService.getHistoryState();
-    if (historyState.pre) {
-      this.layer.$xui.toolbar.recall = true;
-    }
-    this.layer.$xui.toolbar.recover = false;
+    // if (historyState.pre) {
+    //   this.layer.$xui.toolbar.recall = true;
+    // }
+    // this.layer.$xui.toolbar.recover = false;
 
     const points = dataService.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;
-    }
+    // 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;
+    // }
 
     //给UI发送事件
     this.layer.emit("change");
-
-    return change.elements;
+    return change.currentData;
   }
 
   setState() {
@@ -118,39 +113,25 @@ export default class History {
     if (item) {
       stateService.clearFocusItem();
       stateService.clearEventName();
-      //this.layer.$xui.hideProps()
-      this.layer.uiControl.currentUI = null;
+      //this.layer.uiControl.currentUI = null;
       item.type = "pre";
-      let flag = false;
-      if (item.rotate == null) {
-        flag = false;
-      } else {
-        flag = this.goPreForAngle(item.rotate);
-      }
-
-      if (!flag) {
-        this.goPreForPoints(item.points);
-        this.goPreForWalls(item.walls);
-        // 必须在墙的后面,因为删除带symbol的墙的时候,撤销时,必须是先有墙才有symbol
-        this.goPreForSymbols(item.symbols);
-        this.goPreForComponents(item.components);
-        this.goPreForTags(item.tags);
-        this.goPreForFurnitures(item.furnitures);
-      }
+      this.goPreForPoints(item.points);
+      this.goPreForRoads(item.roads);
+      this.goPreForTags(item.tags);
 
       measureService.update();
       historyService.undoHistoryRecord();
       change.saveCurrentInfo();
       this.setState();
 
-      const points = dataService.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 points = dataService.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;
+      // }
     } else {
       console.error("goPreState超出范围!");
     }
@@ -162,11 +143,7 @@ export default class History {
       if (item.handle == HistoryEvents.AddPoint) {
         historyUtil.deletePoint(item.point.id);
       } else if (item.handle == HistoryEvents.DeletePoint) {
-        let point = wallService.createPoint(
-          item.point.x,
-          item.point.y,
-          item.point.id
-        );
+        let point = pointService.create(item.point, item.point.id);
         point.parent = JSON.parse(JSON.stringify(item.point.parent));
       } else if (item.handle == HistoryEvents.ModifyPoint) {
         const prePoint = item.prePoint;
@@ -176,91 +153,23 @@ export default class History {
     }
   }
 
-  goPreForWalls(itemForWalls) {
-    for (let i = 0; i < itemForWalls.length; ++i) {
-      const item = itemForWalls[i];
+  goPreForRoads(itemForRoads) {
+    for (let i = 0; i < itemForRoads.length; ++i) {
+      const item = itemForRoads[i];
       if (item.handle == HistoryEvents.AddRoad) {
-        dataService.deleteWallNoSymbol(item.wall.id);
-      } else if (item.handle == HistoryEvents.DeleteWall) {
-        const preWall = item.wall;
-        let newWall = wallService.createWall(
-          preWall.start,
-          preWall.end,
-          preWall.id
-        );
-        historyUtil.assignWallFromWall(newWall, preWall);
-      } else if (item.handle == HistoryEvents.ModifyWall) {
-        const preWall = item.preWall;
-        let currentWall = dataService.getWall(item.curWall.id);
-        historyUtil.assignWallFromWall(currentWall, preWall);
-      }
-    }
-  }
-
-  goPreForSymbols(itemForSymbols) {
-    for (let i = 0; i < itemForSymbols.length; ++i) {
-      const item = itemForSymbols[i];
-      if (item.handle == HistoryEvents.AddSymbol) {
-        symbolService.deleteSymbol(item.symbol.id);
-      } else if (item.handle == HistoryEvents.DeleteSymbol) {
-        let newSymbol = symbolService.createSymbol(
-          item.symbol.start,
-          item.symbol.end,
-          item.symbol.type,
-          item.symbol.parent,
-          item.symbol.id
-        );
-        historyUtil.assignSymbolFromSymbol(newSymbol, item.symbol);
-      } else if (item.handle == HistoryEvents.ModifySymbol) {
-        const preSymbol = item.preSymbol;
-        let currentSymbol = dataService.getSymbol(item.curSymbol.id);
-        historyUtil.assignSymbolFromSymbol(currentSymbol, preSymbol);
-      }
-    }
-  }
-
-  goPreForComponents(itemForComponents) {
-    for (let i = 0; i < itemForComponents.length; ++i) {
-      const item = itemForComponents[i];
-      if (item.handle == HistoryEvents.AddComponent) {
-        dataService.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 = dataService.getComponent(item.curComponent.id);
-        historyUtil.assignComponentFromComponent(
-          currentComponent,
-          preComponent
-        );
-      }
-    }
-  }
-
-  goPreForFurnitures(itemForFurnitures) {
-    for (let i = 0; i < itemForFurnitures.length; ++i) {
-      const item = itemForFurnitures[i];
-      if (item.handle == HistoryEvents.AddFurniture) {
-        dataService.deleteFurniture(item.furniture.id);
-      } else if (item.handle == HistoryEvents.DeleteFurniture) {
-        let vFurniture = furnitureService.createFurniture(
-          item.furniture.center,
-          item.furniture.type,
-          item.furniture.id
-        );
-        historyUtil.assignFurnitureFromFurniture(vFurniture, item.furniture);
-      } else if (item.handle == HistoryEvents.ModifyFurniture) {
-        const preFurniture = item.preFurniture;
-        let currentFurniture = dataService.getFurniture(item.curFurniture.id);
-        historyUtil.assignFurnitureFromFurniture(
-          currentFurniture,
-          preFurniture
+        dataService.deleteRoad(item.road.id);
+      } else if (item.handle == HistoryEvents.DeleteRoad) {
+        const preRoad = item.road;
+        let newRoad = roadService.create(
+          preRoad.start,
+          preRoad.end,
+          preRoad.id
         );
+        historyUtil.assignRoadFromRoad(newRoad, preRoad);
+      } else if (item.handle == HistoryEvents.ModifyRoad) {
+        const preRoad = item.preRoad;
+        let currentRoad = dataService.getRoad(item.curRoad.id);
+        historyUtil.assignRoadFromRoad(currentRoad, preRoad);
       }
     }
   }
@@ -281,39 +190,11 @@ export default class History {
     }
   }
 
-  goPreForAngle(itemForAngle) {
-    if (itemForAngle.handle == HistoryEvents.ModifyAngle) {
-      coordinate.reSet();
-      coordinate._setRes(itemForAngle.preState.res);
-      //旋转cad
-      dataService.setAngle(itemForAngle.preState.angle);
-      coordinate.updateForRotate(
-        itemForAngle.preState.angle - itemForAngle.curState.angle
-      );
-      //旋转三维模型
-      let info = coordinate.getScreenInfoForCAD();
-      info.floorPlanAngle = itemForAngle.preState.angle;
-      this.layer.app.core
-        .get("CameraControls")
-        .emit("syncCadAnd3DForRotate", info);
-      this.layer.app.store.getValue("metadata").floorPlanAngle =
-        itemForAngle.preState.angle;
-      this.layer.initPanos(dataService.getCurrentFloor());
-      return true;
-    } else {
-      return false;
-    }
-  }
-
   goNextForPoints(itemForPoints) {
     for (let i = 0; i < itemForPoints.length; ++i) {
       const item = itemForPoints[i];
       if (item.handle == HistoryEvents.AddPoint) {
-        let newPoint = wallService.createPoint(
-          item.point.x,
-          item.point.y,
-          item.point.id
-        );
+        let newPoint = pointService.create(item.point, item.point.id);
         historyUtil.assignPointFromPoint(newPoint, item.point);
       } else if (item.handle == HistoryEvents.DeletePoint) {
         historyUtil.deletePoint(item.point.id);
@@ -325,68 +206,23 @@ export default class History {
     }
   }
 
-  goNextForWalls(itemForWalls) {
-    for (let i = 0; i < itemForWalls.length; ++i) {
-      const item = itemForWalls[i];
+  goNextForRoads(itemForRoads) {
+    for (let i = 0; i < itemForRoads.length; ++i) {
+      const item = itemForRoads[i];
       if (item.handle == HistoryEvents.AddRoad) {
-        const preWall = item.wall;
-        let newWall = wallService.createWall(
-          preWall.start,
-          preWall.end,
-          preWall.id
-        );
-        historyUtil.assignWallFromWall(newWall, preWall);
-      } else if (item.handle == HistoryEvents.DeleteWall) {
-        dataService.deleteWallNoSymbol(item.wall.id);
-      } else if (item.handle == HistoryEvents.ModifyWall) {
-        const currentWall = item.curWall;
-        let preWall = dataService.getWall(item.preWall.id);
-        historyUtil.assignWallFromWall(preWall, currentWall);
-      }
-    }
-  }
-
-  goNextForSymbols(itemForSymbols) {
-    for (let i = 0; i < itemForSymbols.length; ++i) {
-      const item = itemForSymbols[i];
-      if (item.handle == HistoryEvents.AddSymbol) {
-        let newSymbol = symbolService.createSymbol(
-          item.symbol.start,
-          item.symbol.end,
-          item.symbol.type,
-          item.symbol.parent,
-          item.symbol.id
-        );
-        historyUtil.assignSymbolFromSymbol(newSymbol, item.symbol);
-      } else if (item.handle == HistoryEvents.DeleteSymbol) {
-        symbolService.deleteSymbol(item.symbol.id);
-      } else if (item.handle == HistoryEvents.ModifySymbol) {
-        const currentSymbol = item.curSymbol;
-        let preSymbol = dataService.getSymbol(item.curSymbol.id);
-        historyUtil.assignSymbolFromSymbol(preSymbol, currentSymbol);
-      }
-    }
-  }
-
-  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) {
-        dataService.deleteComponent(item.component.id);
-      } else if (item.handle == HistoryEvents.ModifyComponent) {
-        const currentComponent = item.curComponent;
-        let preComponent = dataService.getComponent(item.curComponent.id);
-        historyUtil.assignComponentFromComponent(
-          preComponent,
-          currentComponent
+        const preRoad = item.road;
+        let newRoad = roadService.create(
+          preRoad.start,
+          preRoad.end,
+          preRoad.id
         );
+        historyUtil.assignRoadFromRoad(newRoad, preRoad);
+      } else if (item.handle == HistoryEvents.DeleteRoad) {
+        dataService.deleteRoad(item.road.id);
+      } else if (item.handle == HistoryEvents.ModifyRoad) {
+        const currentRoad = item.curRoad;
+        let preRoad = dataService.getRoad(item.preRoad.id);
+        historyUtil.assignRoadFromRoad(preRoad, currentRoad);
       }
     }
   }
@@ -407,53 +243,6 @@ export default class History {
     }
   }
 
-  goNextForFurnitures(itemForFurnitures) {
-    for (let i = 0; i < itemForFurnitures.length; ++i) {
-      const item = itemForFurnitures[i];
-      if (item.handle == HistoryEvents.AddFurniture) {
-        let vFurniture = furnitureService.createFurniture(
-          item.furniture.center,
-          item.furniture.type,
-          item.furniture.id
-        );
-        historyUtil.assignFurnitureFromFurniture(vFurniture, item.furniture);
-      } else if (item.handle == HistoryEvents.DeleteFurniture) {
-        dataService.deleteFurniture(item.furniture.id);
-      } else if (item.handle == HistoryEvents.ModifyFurniture) {
-        const currentFurniture = item.curFurniture;
-        let preFurniture = dataService.getFurniture(item.curFurniture.id);
-        historyUtil.assignFurnitureFromFurniture(
-          preFurniture,
-          currentFurniture
-        );
-      }
-    }
-  }
-
-  goNextForAngle(itemForAngle) {
-    if (itemForAngle.handle == HistoryEvents.ModifyAngle) {
-      coordinate.reSet();
-      coordinate._setRes(itemForAngle.curState.res);
-      //旋转cad
-      dataService.setAngle(itemForAngle.curState.angle);
-      coordinate.updateForRotate(
-        itemForAngle.curState.angle - itemForAngle.preState.angle
-      );
-      //旋转三维模型
-      let info = coordinate.getScreenInfoForCAD();
-      info.floorPlanAngle = itemForAngle.curState.angle;
-      this.layer.app.core
-        .get("CameraControls")
-        .emit("syncCadAnd3DForRotate", info);
-      this.layer.app.store.getValue("metadata").floorPlanAngle =
-        itemForAngle.curState.angle;
-      this.layer.initPanos(dataService.getCurrentFloor());
-      return true;
-    } else {
-      return false;
-    }
-  }
-
   // 恢复
   goNextState() {
     historyService.redoHistoryRecord();
@@ -461,34 +250,21 @@ export default class History {
     if (item) {
       stateService.clearFocusItem();
       stateService.clearEventName();
-      //this.layer.$xui.hideProps()
-      this.layer.uiControl.currentUI = null;
-      let flag = false;
-      if (item.rotate == null) {
-        flag = false;
-      } else {
-        flag = this.goNextForAngle(item.rotate);
-      }
-      if (!flag) {
-        this.goNextForPoints(item.points);
-        this.goNextForWalls(item.walls);
-        this.goNextForSymbols(item.symbols);
-        this.goNextForComponents(item.components);
-        this.goNextForTags(item.tags);
-        this.goNextForFurnitures(item.furnitures);
-      }
-      measureService.update();
+      //this.layer.uiControl.currentUI = null;
+      this.goNextForPoints(item.points);
+      this.goNextForRoads(item.roads);
+      this.goNextForTags(item.tags);
       change.saveCurrentInfo();
       this.setState();
 
-      const points = dataService.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 points = dataService.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;
+      // }
     } else {
       historyService.undoHistoryRecord();
       console.error("goNextState超出范围!");

+ 44 - 150
src/graphic/History/HistoryUtil.js

@@ -1,141 +1,53 @@
 import { mathUtil } from "../MathUtil";
-import { componentService } from "../Service/ComponentService";
 import { dataService } from "../Service/DataService";
-import { furnitureService } from "../Service/FurnitureService";
-import { symbolService } from "../Service/SymbolService";
 import { tagService } from "../Service/TagService";
-import { wallService } from "../Service/WallService";
 
 export default class HistoryUtil {
   constructor() {}
 
-  isDifferentForWalls(wall1, wall2) {
-    if (
-      wall1.start == wall2.start &&
-      wall1.end == wall2.end &&
-      wall1.out == wall2.out &&
-      wall1.important == wall2.important
-    ) {
-      return false;
-    } else {
-      return true;
-    }
-  }
-  isDifferentForSymbols(symbol1, symbol2) {
-    if (
-      mathUtil.equalPoint(symbol1.startPoint, symbol2.startPoint) &&
-      mathUtil.equalPoint(symbol1.endPoint, symbol2.endPoint) &&
-      symbol1.openSide == symbol2.openSide &&
-      symbol1.parent == symbol2.parent &&
-      symbol1.enter == symbol2.enter
-    ) {
-      return false;
-    } else {
-      return true;
-    }
-  }
-  isDifferentForComponents(component1, component2) {
-    if (
-      JSON.stringify(component1.points2d) ==
-        JSON.stringify(component2.points) &&
-      component1.angle == component2.angle
-    ) {
+  isDifferentForRoads(road1, road2) {
+    if (road1.startId == road2.startId && road1.endId == road2.endId) {
       return false;
     } else {
       return true;
     }
   }
+
   isDifferentForTags(tag1, tag2) {
-    if (
-      mathUtil.equalPoint(tag1.center, tag2.center) &&
-      tag1.title == tag2.title &&
-      tag1.des == tag2.des &&
-      tag1.unit == tag2.unit
-    ) {
-      return false;
-    } else {
-      return true;
-    }
-  }
-  isDifferentForFurnitures(furniture1, furniture2) {
-    if (
-      furniture1.zoom == furniture2.zoom &&
-      JSON.stringify(furniture1.center) == JSON.stringify(furniture2.center) &&
-      furniture1.angle == furniture2.angle
-    ) {
+    if (mathUtil.equalPoint(tag1.center, tag2.center) && tag1.des == tag2.des) {
       return false;
     } else {
       return true;
     }
   }
 
-  isDifferentForAngle(angle1, angle2) {
-    if (angle1 == angle2) {
-      return false;
-    } else {
-      return true;
-    }
+  // road2赋值给road1
+  assignRoadFromRoad(road1, road2) {
+    const roadInfo = {};
+    roadInfo.vectorId = road1.vectorId;
+    roadInfo.start = road2.startId;
+    roadInfo.end = road2.endId;
+    this.setRoadInfo(roadInfo);
   }
 
-  // wall2赋值给wall1
-  assignWallFromWall(wall1, wall2) {
-    const wallInfo = {};
-    wallInfo.vectorId = wall1.vectorId;
-    wallInfo.children = JSON.parse(JSON.stringify(wall2.children));
-    wallInfo.out = wall2.out;
-    wallInfo.important = wall2.important;
-    wallInfo.start = wall2.start;
-    wallInfo.end = wall2.end;
-    wallService.setWallInfo(wallInfo);
-  }
   assignPointFromPoint(point1, point2) {
     const pointInfo = {};
     pointInfo.vectorId = point1.vectorId;
     pointInfo.position = { x: point2.x, y: point2.y };
     pointInfo.parent = JSON.parse(JSON.stringify(point2.parent));
-    wallService.setPointInfo(pointInfo);
-  }
-  assignSymbolFromSymbol(symbol1, symbol2) {
-    const symbolInfo = {};
-    symbolInfo.vectorId = symbol1.vectorId;
-    symbolInfo.openSide = symbol2.openSide;
-    symbolInfo.start = JSON.parse(JSON.stringify(symbol2.start));
-    symbolInfo.end = JSON.parse(JSON.stringify(symbol2.end));
-    symbolInfo.points2d = JSON.parse(JSON.stringify(symbol2.points));
-    if (symbol2.position3d) {
-      symbolInfo.position3d = JSON.parse(JSON.stringify(symbol2.position3d));
-    }
-    symbolInfo.enter = symbol2.enter;
-    symbolInfo.parent = symbol2.parent;
-    symbolService.setSymbolInfo(symbolInfo);
-  }
-  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);
+    this.setPointInfo(pointInfo);
   }
+
   assignTagFromTag(tag1, tag2) {
     const tagInfo = {};
     tagInfo.vectorId = tag1.vectorId;
-    tagInfo.title = tag2.title;
     tagInfo.des = tag2.des;
-    tagInfo.unit = tag2.unit;
     tagInfo.center = JSON.parse(JSON.stringify(tag2.center));
     tagInfo.points2d = JSON.parse(JSON.stringify(tag2.points));
     tagInfo.adding = false;
-    tagService.setTagInfo(tagInfo);
-  }
-  assignFurnitureFromFurniture(furniture1, furniture2) {
-    const furnitureInfo = {};
-    furnitureInfo.vectorId = furniture1.vectorId;
-    furnitureInfo.angle = furniture2.angle;
-    furnitureInfo.center = JSON.parse(JSON.stringify(furniture2.center));
-    furnitureInfo.zoom = furniture2.zoom;
-    furnitureService.setFurnitureInfo(furnitureInfo);
+    this.setTagInfo(tagInfo);
   }
+
   deletePoint(pointId) {
     const point = dataService.getPoint(pointId);
     const parent = point.parent;
@@ -143,6 +55,7 @@ export default class HistoryUtil {
       dataService.deletePoint(pointId, key);
     }
   }
+
   getDataForPoint(point) {
     const data = {};
     data.id = point.vectorId;
@@ -151,49 +64,13 @@ export default class HistoryUtil {
     data.type = point.geoType;
     return data;
   }
-  getDataForWall(wall) {
-    const data = {};
-    data.id = wall.vectorId;
-    data.start = wall.start;
-    data.end = wall.end;
-    data.out = wall.out;
-    data.important = wall.important;
-    data.children = JSON.parse(JSON.stringify(wall.children));
-    data.type = wall.geoType;
-    return data;
-  }
-
-  getDataForSymbol(symbol) {
-    const data = {};
-    data.id = symbol.vectorId;
-    data.start = JSON.parse(JSON.stringify(symbol.startPoint));
-    data.end = JSON.parse(JSON.stringify(symbol.endPoint));
-    data.openSide = symbol.openSide;
-    data.enter = symbol.enter;
-    data.points = JSON.parse(JSON.stringify(symbol.points2d));
-    data.position3d = JSON.parse(JSON.stringify(symbol.position3d));
-    data.parent = symbol.parent;
-    data.type = symbol.geoType;
-    return data;
-  }
 
-  getDataForComponent(component) {
+  getDataForRoad(road) {
     const data = {};
-    data.id = component.vectorId;
-    data.type = component.geoType;
-    data.center = JSON.parse(JSON.stringify(component.center));
-    data.angle = component.angle;
-    data.points = [].concat(component.points2d);
-    return data;
-  }
-
-  getDataForFurniture(furniture) {
-    const data = {};
-    data.id = furniture.vectorId;
-    data.type = furniture.geoType;
-    data.center = JSON.parse(JSON.stringify(furniture.center));
-    data.zoom = furniture.zoom;
-    data.angle = furniture.angle;
+    data.id = road.vectorId;
+    data.start = road.startId;
+    data.end = road.endId;
+    data.type = road.geoType;
     return data;
   }
 
@@ -204,19 +81,36 @@ export default class HistoryUtil {
     data.center = {};
     mathUtil.clonePoint(data.center, tag.center);
     data.points = [].concat(tag.points2d);
-    data.title = tag.title;
     data.des = tag.des;
-    data.unit = tag.unit;
     return data;
   }
 
-  getDataForAngle(angle) {
-    return angle;
-  }
-
   getDataForRes(res) {
     return res;
   }
+
+  setRoadInfo(roadInfo) {
+    let road = dataService.getRoad(roadInfo.vectorId);
+    road.start = roadInfo.start;
+    road.end = roadInfo.end;
+    return road;
+  }
+
+  setPointInfo(pointInfo) {
+    let point = dataService.getPoint(pointInfo.vectorId);
+    mathUtil.clonePoint(point, pointInfo.position);
+    point.parent = JSON.parse(JSON.stringify(pointInfo.parent));
+    return point;
+  }
+
+  setTagInfo(tagInfo) {
+    let tag = dataService.getTag(tagInfo.vectorId);
+    tag.vectorId = tagInfo.vectorId;
+    tag.center = JSON.parse(JSON.stringify(tagInfo.center));
+    tag.points2d = JSON.parse(JSON.stringify(tagInfo.points2d));
+    tag.des = tagInfo.des;
+    tag.adding = tagInfo.adding;
+  }
 }
 
 const historyUtil = new HistoryUtil();

+ 82 - 320
src/graphic/Renderer/Render.js

@@ -21,358 +21,123 @@ export default class Render {
       return;
     }
     switch (vector.geoType) {
-      case VectorType.Wall:
-        draw.drawWall(vector, styleType);
-        //draw.drawMeasures(vector);
+      case VectorType.Road:
+        draw.drawRoad(vector, styleType);
         return;
       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, styleType);
-        return;
-      case VectorType.Beam:
-        draw.drawBeam(vector, styleType);
-        return;
-      case VectorType.Flue:
-        draw.drawFlue(vector, styleType);
-        return;
-      case VectorType.Corridor:
-        draw.drawCorridor(vector, styleType);
-        return;
       case VectorType.Tag:
         draw.drawTag(vector, styleType, flag);
         return;
-    }
-
-    if (furnitureService.isFurniture(vector.geoType)) {
-      draw.drawFurniture(vector, styleType);
-    }
-  }
-
-  //绘制交互的元素
-  drawElement(vector) {
-    if (draw.context == null) {
-      return;
-    }
-    switch (vector.geoType) {
-      case VectorType.Point:
-        draw.drawCircle(vector);
-        break;
-      case VectorType.Line:
-        draw.drawLine(vector);
-        break;
-    }
-  }
-
-  drawPanos(panos) {
-    // const angle = dataService.getAngle()
-    // for (let i = 0; i < panos.length; ++i) {
-    //     let pano = JSON.parse(JSON.stringify(panos[i]))
-    //     //可能要旋转角度
-    //     pano = coordinate.getVectorForRotate(pano, angle)
-    //     draw.drawCircle(pano)
-    //     //draw.drawText(pano, pano.vectorId)
-    // }
-
-    for (let i = 0; i < panos.length; ++i) {
-      draw.drawCircle(panos[i]);
-    }
-  }
-
-  redrawElements() {
-    if (elementService.vCheckLines.X && elementService.vCheckLines.X.display) {
-      this.drawElement(elementService.vCheckLines.X);
-    }
-
-    if (elementService.vCheckLines.Y && elementService.vCheckLines.Y.display) {
-      this.drawElement(elementService.vCheckLines.Y);
-    }
-
-    if (elementService.startAddWall && elementService.startAddWall.display) {
-      this.drawElement(elementService.startAddWall);
-    }
-
-    if (elementService.newWall && elementService.newWall.display) {
-      this.drawElement(elementService.newWall);
-    }
-
-    if (
-      elementService.symbolPoints.Start &&
-      elementService.symbolPoints.Start.display
-    ) {
-      this.drawElement(elementService.symbolPoints.Start);
-    }
-
-    if (
-      elementService.symbolPoints.End &&
-      elementService.symbolPoints.End.display
-    ) {
-      this.drawElement(elementService.symbolPoints.End);
-    }
-
-    if (elementService.checkLines.X && elementService.checkLines.X.display) {
-      this.drawElement(elementService.checkLines.X);
-    }
-
-    if (elementService.checkLines.Y && elementService.checkLines.Y.display) {
-      this.drawElement(elementService.checkLines.Y);
-    }
-
-    if (elementService.signLine1 && elementService.signLine1.display) {
-      this.drawElement(elementService.signLine1);
-    }
-
-    if (elementService.signLine2 && elementService.signLine2.display) {
-      this.drawElement(elementService.signLine2);
+      case VectorType.MeasureLine:
+        draw.drawMeasures(vector, styleType);
     }
   }
 
-  redrawMeasures(styleType) {
-    //
-    draw.drawMeasure(measureService.measureLines.top, "top", styleType);
-    draw.drawMeasure(measureService.measureLines.bottom, "bottom", styleType);
-    draw.drawMeasure(measureService.measureLines.left, "left", styleType);
-    draw.drawMeasure(measureService.measureLines.right, "right", styleType);
-  }
-
-  redrawRooms(floor, styleType) {
-    let rooms = roomService.getRooms(floor);
-    for (let i = 0; i < rooms.length; ++i) {
-      let img = null;
-      for (let j = 0; j < this.layer.app.CadManager.labels.length; ++j) {
-        if (
-          rooms[i].tagName != null &&
-          rooms[i].tagName.trim() == this.layer.app.CadManager.labels[j].text
-        ) {
-          if (this.layer.app.CadManager.labels[j].type == "hall") {
-            img = roomService.getHallImg();
-            draw.drawRoomBackGround(rooms[i], img);
-          } else if (this.layer.app.CadManager.labels[j].type == "room") {
-            img = roomService.getDefaultImg();
-            draw.drawRoomBackGround(rooms[i], img);
-          } else if (this.layer.app.CadManager.labels[j].type == "other") {
-            if (styleType == "style-1") {
-              img = roomService.getOtherWhiteImg();
-            } else {
-              img = roomService.getOtherBlackImg();
-            }
-            draw.drawRoomBackGround(rooms[i], img);
-          }
-          break;
-        }
-      }
-
-      if (img == null) {
-        if (styleType == "style-1") {
-          img = roomService.getOtherWhiteImg();
-        } else {
-          img = roomService.getOtherBlackImg();
-        }
-        draw.drawRoomBackGround(rooms[i], img);
-      }
-    }
-  }
+  // //绘制交互的元素
+  // drawElement(vector) {
+  //   if (draw.context == null) {
+  //     return;
+  //   }
+  //   switch (vector.geoType) {
+  //     case VectorType.Point:
+  //       draw.drawCircle(vector);
+  //       break;
+  //     case VectorType.Line:
+  //       draw.drawLine(vector);
+  //       break;
+  //   }
+  // }
+
+  // redrawElements() {
+  //   if (elementService.vCheckLines.X && elementService.vCheckLines.X.display) {
+  //     this.drawElement(elementService.vCheckLines.X);
+  //   }
+
+  //   if (elementService.vCheckLines.Y && elementService.vCheckLines.Y.display) {
+  //     this.drawElement(elementService.vCheckLines.Y);
+  //   }
+
+  //   if (elementService.startAddWall && elementService.startAddWall.display) {
+  //     this.drawElement(elementService.startAddWall);
+  //   }
+
+  //   if (elementService.newWall && elementService.newWall.display) {
+  //     this.drawElement(elementService.newWall);
+  //   }
+
+  //   if (
+  //     elementService.symbolPoints.Start &&
+  //     elementService.symbolPoints.Start.display
+  //   ) {
+  //     this.drawElement(elementService.symbolPoints.Start);
+  //   }
+
+  //   if (
+  //     elementService.symbolPoints.End &&
+  //     elementService.symbolPoints.End.display
+  //   ) {
+  //     this.drawElement(elementService.symbolPoints.End);
+  //   }
+
+  //   if (elementService.checkLines.X && elementService.checkLines.X.display) {
+  //     this.drawElement(elementService.checkLines.X);
+  //   }
+
+  //   if (elementService.checkLines.Y && elementService.checkLines.Y.display) {
+  //     this.drawElement(elementService.checkLines.Y);
+  //   }
+
+  //   if (elementService.signLine1 && elementService.signLine1.display) {
+  //     this.drawElement(elementService.signLine1);
+  //   }
+
+  //   if (elementService.signLine2 && elementService.signLine2.display) {
+  //     this.drawElement(elementService.signLine2);
+  //   }
+  // }
 
   autoRedraw() {
     draw.clear();
-    if (this.displayPanos) {
-      this.drawPanos(floorplanData.panos);
-    }
-    let data = dataService.getFloorData();
-    if (!data) {
-      return;
-    }
-    let walls = data.walls;
-    for (let key in walls) {
-      this.drawGeometry(walls[key]);
-    }
 
-    let points = data.points;
-    for (let key in points) {
-      this.drawGeometry(points[key]);
-    }
-
-    draw.drawSpecialPoint();
+    let roads = dataService.getRoads();
 
-    let symbols = data.symbols;
-    for (let key in symbols) {
-      this.drawGeometry(symbols[key]);
-      draw.drawSymbolPoint(symbols[key]);
+    for (let key in roads) {
+      this.drawGeometry(roads[key]);
     }
-    draw.drawSelectSymbolPoint();
 
-    let components = data.components;
-    for (let key in components) {
-      this.drawGeometry(components[key]);
-    }
-
-    let furnitures = data.furnitures;
-    for (let key in furnitures) {
-      this.drawGeometry(furnitures[key]);
+    let points = dataService.getPoints();
+    for (let key in points) {
+      this.drawGeometry(points[key]);
     }
 
-    let tags = data.tags;
+    let tags = dataService.getTags();
     for (let key in tags) {
       this.drawGeometry(tags[key]);
     }
 
-    this.redrawElements();
-    this.redrawMeasures();
-
-    // let _rooms = dataService.getRooms()
-    // if(_rooms.length == 0){
-    //     roomsUtil.start()
-    // }
-    // let rooms = dataService.getRooms()
-    // for (let i = 0; i < rooms.length; ++i) {
-    //     draw.drawText(rooms[i].center, rooms[i].roomId, false, 0)
-    // }
-  }
-
-  autoRedrawForImg() {
-    draw.clear();
-
-    // if (this.displayPanos) {
-    //     this.drawPanos(this.layer.panos[dataService.currentFloor])
-    // }
-    let data = dataService.getFloorData();
-    if (!data) {
-      return;
-    }
-    let walls = data.walls;
-    for (let key in walls) {
-      this.drawGeometry(walls[key]);
-    }
-
-    // let points = data.points
-    // for (let key in points) {
-    //     this.drawGeometry(points[key])
-    // }
-
-    let symbols = data.symbols;
-    let noEnter = true;
-    for (let key in symbols) {
-      this.drawGeometry(symbols[key], null, noEnter);
-    }
-
-    let components = data.components;
-    for (let key in components) {
-      this.drawGeometry(components[key]);
-    }
-
-    let furnitures = data.furnitures;
-    for (let key in furnitures) {
-      this.drawGeometry(furnitures[key]);
-    }
-
-    let tags = data.tags;
-    for (let key in tags) {
-      this.drawGeometry(tags[key], null, true);
-    }
-
-    //this.redrawElements()
+    //this.drawGeometry(dataService.getImg());
   }
 
   //下载图片
-  //style表示风格
-  autoRedrawForDownLoadImg(styleType) {
+  autoRedrawForDownLoadImg() {
     draw.clear();
 
-    if (styleType == "style-1") {
-      draw.drawBackGround("#FFFFFF");
-      this.redrawRooms(dataService.getCurrentFloor(), styleType);
-    } else if (styleType == "style-2") {
-      draw.drawBackGround("#000000");
-      this.redrawRooms(dataService.getCurrentFloor(), styleType);
-    } else if (styleType == "style-3") {
-      draw.drawBackGround("#FFFFFF");
-    } else if (styleType == "style-4") {
-      draw.drawBackGround("#000000");
-    }
-
-    let data = dataService.getFloorData();
-    if (!data) {
-      return;
-    }
-    let walls = data.walls;
-    for (let key in walls) {
-      this.drawGeometry(walls[key], styleType);
-    }
-
-    let symbols = data.symbols;
-    let noEnter = false;
-    for (let key in symbols) {
-      this.drawGeometry(symbols[key], styleType, noEnter);
-    }
-
-    let components = data.components;
-    for (let key in components) {
-      this.drawGeometry(components[key], styleType);
-    }
-
-    let furnitures = data.furnitures;
-    for (let key in furnitures) {
-      this.drawGeometry(furnitures[key], styleType);
-    }
-    let tags = data.tags;
-    for (let key in tags) {
-      this.drawGeometry(tags[key], styleType);
-    }
+    let roads = dataService.getRoads();
 
-    this.redrawMeasures(styleType);
-    draw.drawCompass(styleType);
-  }
-
-  redrawCore() {
-    console.log("重绘!");
-    draw.clear();
-
-    let data = dataService.getFloorData();
-    if (!data) {
-      return;
-    }
-    let walls = data.walls;
-    for (let key in walls) {
-      this.drawGeometry(walls[key]);
+    for (let key in roads) {
+      this.drawGeometry(roads[key]);
     }
 
-    let points = data.points;
+    let points = dataService.getPoints();
     for (let key in points) {
       this.drawGeometry(points[key]);
     }
 
-    let symbols = data.symbols;
-    for (let key in symbols) {
-      this.drawGeometry(symbols[key]);
-    }
-
-    let components = data.components;
-    for (let key in components) {
-      this.drawGeometry(components[key]);
-    }
-
-    let furnitures = data.furnitures;
-    for (let key in furnitures) {
-      this.drawGeometry(furnitures[key]);
+    let tags = dataService.getTags();
+    for (let key in tags) {
+      this.drawGeometry(tags[key]);
     }
   }
 
@@ -384,6 +149,3 @@ export default class Render {
     return draw.context;
   }
 }
-
-// const render = new Render()
-// export { render }

+ 0 - 131
src/graphic/Service/AnalyService.js

@@ -1,131 +0,0 @@
-//解析来自算法部的数据:https://4dkk.4dage.com/data/datat-uXiVK7k/floorplan_cad.json?_=0
-import { dataService } from "./FloorplanService";
-import { wallService } from "./WallService";
-import { floorplanData } from "../FloorplanData";
-import VectorType from "../enum/VectorType.js";
-
-export default class AnalyService {
-  constructor(layer) {
-    this.layer = layer;
-    this.app = this.layer.app;
-    this.houseData = null;
-  }
-
-  initVectors(data) {
-    let floors = data.floors;
-    let currentId = -1;
-    let offWallId = 0; //算法部的id都是从0开始,且每层楼的id都是从0开始
-    let offPointId = 0;
-    for (let i = 0; i < floors.length; ++i) {
-      let floorNum = floors[i].subgroup;
-      let floor = floors[i];
-      floorplanData.floors[floorNum] = {};
-      floorplanData.floors[floorNum].points = {};
-      floorplanData.floors[floorNum].walls = {};
-      floorplanData.floors[floorNum].symbols = {};
-      floorplanData.floors[floorNum].components = {};
-      floorplanData.floors[floorNum].tags = {};
-      floorplanData.floors[floorNum].furnitures = {};
-      floorplanData.floors[floorNum].boundingBox = {};
-      floorplanData.floors[floorNum].rooms = [];
-      let minX = null,
-        minY = null,
-        maxX = null,
-        maxY = null;
-
-      for (let j = 0; j < floor["vertex-xy"].length; ++j) {
-        let vectorId = floor["vertex-xy"][j].id + offPointId;
-        if (currentId < vectorId) {
-          currentId = vectorId;
-        }
-        vectorId = VectorType.Point + vectorId;
-        let point = {
-          x: floor["vertex-xy"][j].x,
-          y: floor["vertex-xy"][j].y,
-        };
-        wallService.createPoint(point.x, point.y, vectorId, floorNum);
-        if (minX == null || minX > point.x) {
-          minX = point.x;
-        }
-        if (minY == null || minY > point.y) {
-          minY = point.y;
-        }
-
-        if (maxX == null || maxX < point.x) {
-          maxX = point.x;
-        }
-        if (maxY == null || maxY < point.y) {
-          maxY = point.y;
-        }
-      }
-      offWallId = currentId + 1;
-
-      floorplanData.floors[floorNum].boundingBox.minX = minX;
-      floorplanData.floors[floorNum].boundingBox.minY = minY;
-      floorplanData.floors[floorNum].boundingBox.maxX = maxX;
-      floorplanData.floors[floorNum].boundingBox.maxY = maxY;
-
-      for (let j = 0; j < floor["segment"].length; ++j) {
-        let vectorId = floor["segment"][j].id + offWallId;
-        if (currentId < vectorId) {
-          currentId = vectorId;
-        }
-        vectorId = VectorType.Wall + vectorId;
-        let start = VectorType.Point + (floor["segment"][j].a + offPointId);
-        let end = VectorType.Point + (floor["segment"][j].b + offPointId);
-
-        wallService.createWall(start, end, vectorId, floorNum);
-      }
-
-      offWallId = currentId + 1;
-      offPointId = currentId + 1;
-    }
-    dataService.setCurrentId(currentId + 1);
-    const currentFloorNum =
-      this.app.core.get("Player").model.currentFloor.floorIndex;
-    dataService.setCurrentFloor(currentFloorNum);
-    //随心装的json数据
-    //this.houseData = this.createDecorateData(floorplanData)
-  }
-
-  //随心装数据,houseType.json
-  createDecorateData(floorplanData) {
-    let house = {};
-    house.name = "houseType.json";
-    house.version = "2.1";
-    house.floors = [];
-
-    for (let i = 0; i < floorplanData.floors.length; ++i) {
-      let item = {};
-      item.points = [];
-      item.walls = [];
-
-      //floorplanData.floors.points
-      //floorplanData.floors.walls
-      for (let key in floorplanData.floors[i].points) {
-        let point = {};
-        point.x = floorplanData.floors[i].points[key].x;
-        point.y = floorplanData.floors[i].points[key].y;
-        point.parent = floorplanData.floors[i].points[key].parent;
-        point.vectorId = floorplanData.floors[i].points[key].vectorId;
-
-        item.points.push(point);
-      }
-
-      for (let key in floorplanData.floors[i].walls) {
-        let wall = {};
-        wall.start = floorplanData.floors[i].walls[key].start;
-        wall.end = floorplanData.floors[i].walls[key].end;
-
-        wall.children = [];
-        wall.vectorId = floorplanData.floors[i].walls[key].vectorId;
-        wall.width = 0.2;
-
-        item.walls.push(wall);
-      }
-
-      house.floors.push(item);
-    }
-    return house;
-  }
-}

+ 0 - 25
src/graphic/Service/CompassService.js

@@ -1,25 +0,0 @@
-export default class CompassService {
-    constructor() {
-        this.whiteImg = null
-        this.blackImg = null
-    }
-
-    setWhiteImg(img) {
-        this.whiteImg = img
-    }
-
-    setBlackImg(img) {
-        this.blackImg = img
-    }
-
-    getWhiteImg() {
-        return this.whiteImg
-    }
-
-    getBlackImg() {
-        return this.blackImg
-    }
-}
-
-const compassService = new CompassService()
-export { compassService }

+ 0 - 107
src/graphic/Service/ComponentService.js

@@ -1,107 +0,0 @@
-import VectorType from "../enum/VectorType.js";
-import Beam from "../Geometry/Beam.js";
-import Flue from "../Geometry/Flue.js";
-import Corridor from "../Geometry/Corridor.js";
-import { dataService } from "./DataService.js";
-
-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;
-      case VectorType.Flue:
-        component = new Flue(position, vectorId);
-        break;
-      case VectorType.Corridor:
-        component = new Corridor(position, vectorId);
-        break;
-    }
-
-    component.setPoints2d();
-    dataService.addComponent(component);
-    return component;
-  }
-
-  isComponent(geoType) {
-    switch (geoType) {
-      case VectorType.Beam:
-        return true;
-      case VectorType.Flue:
-        return true;
-      case VectorType.Corridor:
-        return true;
-    }
-    return false;
-  }
-
-  setComponentInfo(componentInfo) {
-    let component = dataService.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));
-  }
-
-  getBoundingVertexs(componentId, center) {
-    let component = dataService.getComponent(componentId);
-    const minX = center.x - component.sideWidth / 2;
-    const minY = center.y - component.sideThickness / 2;
-    const maxX = center.x + component.sideWidth / 2;
-    const maxY = center.y + component.sideThickness / 2;
-
-    const point1 = component.rotatePoint(
-      {
-        x: minX,
-        y: maxY,
-      },
-      center,
-      component.angle
-    );
-
-    const point2 = component.rotatePoint(
-      {
-        x: maxX,
-        y: maxY,
-      },
-      center,
-      component.angle
-    );
-
-    const point3 = component.rotatePoint(
-      {
-        x: maxX,
-        y: minY,
-      },
-      center,
-      component.angle
-    );
-
-    const point4 = component.rotatePoint(
-      {
-        x: minX,
-        y: minY,
-      },
-      center,
-      component.angle
-    );
-
-    const boundingVertexs = [];
-    boundingVertexs.push(point1);
-    boundingVertexs.push(point2);
-    boundingVertexs.push(point3);
-    boundingVertexs.push(point4);
-
-    return boundingVertexs;
-  }
-}
-
-const componentService = new ComponentService();
-export { componentService };

+ 31 - 428
src/graphic/Service/DataService.js

@@ -1,12 +1,7 @@
-import { coordinate } from "../Coordinate.js";
-import Constant from "../Constant";
-
 export class DataService {
   constructor() {
     this.vectorData = {};
     this.currentId = 0; // 当前可用id
-    this.currentFloor = 0; // 当前楼层,第一层是0
-    this.angle = 0; //旋转角度
   }
 
   setCurrentId(id) {
@@ -21,6 +16,13 @@ export class DataService {
     ++this.currentId;
   }
 
+  getVectorData() {
+    return this.vectorData;
+  }
+
+  /**
+   * 对公路的操作
+   */
   getRoads() {
     return this.vectorData.roads;
   }
@@ -37,12 +39,18 @@ export class DataService {
     this.vectorData.roads[road.vectorId] = road;
   }
 
-  getCompass() {
-    return this.vectorData.compass;
+  deleteRoad(roadId) {
+    let road = this.getRoad(roadId);
+    this.deletePoint(road.startId, roadId);
+    this.deletePoint(road.endId, roadId);
+    delete this.vectorData.roads[roadId];
   }
 
-  setCompass(angle) {
-    this.vectorData.compass = angle;
+  /**
+   * 对端点的操作
+   */
+  getPoints() {
+    return this.vectorData.points;
   }
 
   getPoint(pointId) {
@@ -82,13 +90,9 @@ export class DataService {
     this.vectorData.points[point.vectorId] = point;
   }
 
-  deleteRoad(roadId) {
-    let road = this.getRoad(roadId);
-    this.deletePoint(road.startId, roadId);
-    this.deletePoint(road.endId, roadId);
-    delete this.vectorData.roads[roadId];
-  }
-
+  /**
+   * 对公路边缘的操作
+   */
   getEdge(edgeId) {
     return this.vectorData.edges[edgeId];
   }
@@ -97,225 +101,15 @@ export class DataService {
     this.vectorData.edges[edge.vectorId] = edge;
   }
 
-  getAngle() {
-    return this.angle;
-  }
-
-  setAngle(angle) {
-    this.angle = angle;
+  /**
+   * 对标注的操作
+   */
+  addTag(tag) {
+    this.vectorData.tags[tag.vectorId] = tag;
   }
 
-  setBoundingBox(boundingBox, floor) {
-    if (floor == null || typeof floor == "undefined") {
-      floor = this.currentFloor;
-    }
-    this.vectorData.floors[floor].boundingBox = JSON.parse(
-      JSON.stringify(boundingBox)
-    );
-  }
-
-  // getBoundingBox(floor) {
-  //     if (floor == null || typeof floor == 'undefined') {
-  //         floor = this.currentFloor
-  //     }
-  //     if (
-  //         this.vectorData.floors[floor].boundingBox.hasOwnProperty('maxX') &&
-  //         this.vectorData.floors[floor].boundingBox.hasOwnProperty('maxY') &&
-  //         this.vectorData.floors[floor].boundingBox.hasOwnProperty('minX') &&
-  //         this.vectorData.floors[floor].boundingBox.hasOwnProperty('minY')
-  //     ) {
-  //         return this.vectorData.floors[floor].boundingBox
-  //     } else {
-  //         this.updateBoundingBox(floor)
-  //         return this.vectorData.floors[floor].boundingBox
-  //     }
-  // }
-
-  getBoundingBox(floor) {
-    if (floor == null || typeof floor == "undefined") {
-      let minX = null,
-        maxX = null,
-        minY = null,
-        maxY = null;
-      for (let i = 0; i < this.vectorData.floors.length; ++i) {
-        if (
-          !this.vectorData.floors[i].boundingBox.hasOwnProperty("maxX") ||
-          !this.vectorData.floors[i].boundingBox.hasOwnProperty("minX") ||
-          !this.vectorData.floors[i].boundingBox.hasOwnProperty("maxY") ||
-          !this.vectorData.floors[i].boundingBox.hasOwnProperty("minY")
-        ) {
-          this.updateBoundingBox(i);
-        }
-        if (minX == null || minX > this.vectorData.floors[i].boundingBox.minX) {
-          minX = this.vectorData.floors[i].boundingBox.minX;
-        }
-        if (maxX == null || maxX < this.vectorData.floors[i].boundingBox.maxX) {
-          maxX = this.vectorData.floors[i].boundingBox.maxX;
-        }
-        if (minY == null || minY > this.vectorData.floors[i].boundingBox.minY) {
-          minY = this.vectorData.floors[i].boundingBox.minY;
-        }
-        if (maxY == null || maxY < this.vectorData.floors[i].boundingBox.maxY) {
-          maxY = this.vectorData.floors[i].boundingBox.maxY;
-        }
-      }
-
-      return {
-        minX: minX,
-        maxX: maxX,
-        minY: minY,
-        maxY: maxY,
-      };
-    } else {
-      return this.vectorData.floors[floor].boundingBox;
-    }
-  }
-
-  updateBoundingBox(floor) {
-    const points = this.getPoints(floor);
-    let minX = null,
-      maxX = null,
-      minY = null,
-      maxY = null;
-    for (let key in points) {
-      let point = points[key];
-      if (minX == null || minX > point.x) {
-        minX = point.x;
-      }
-      if (maxX == null || maxX < point.x) {
-        maxX = point.x;
-      }
-      if (minY == null || minY > point.y) {
-        minY = point.y;
-      }
-      if (maxY == null || maxY < point.y) {
-        maxY = point.y;
-      }
-    }
-    this.setBoundingBox(
-      {
-        minX: minX,
-        maxX: maxX,
-        minY: minY,
-        maxY: maxY,
-      },
-      floor
-    );
-  }
-
-  getFloorData(floor) {
-    if (floor == null || typeof floor == "undefined") {
-      floor = this.currentFloor;
-    }
-    return this.vectorData.floors[floor];
-  }
-
-  getWalls(floor) {
-    if (floor == null || typeof floor == "undefined") {
-      floor = this.currentFloor;
-    }
-    return this.vectorData.floors[floor].walls;
-  }
-
-  getPoints(floor) {
-    if (floor == null || typeof floor == "undefined") {
-      floor = this.currentFloor;
-    }
-    return this.vectorData.floors[floor].points;
-  }
-
-  getSymbol(symbolId, floor) {
-    if (floor == null || typeof floor == "undefined") {
-      floor = this.currentFloor;
-    }
-    return this.vectorData.floors[floor].symbols[symbolId];
-  }
-
-  addRoad(wall, floor) {
-    if (floor == null || typeof floor == "undefined") {
-      floor = this.currentFloor;
-    }
-    this.vectorData.floors[floor].walls[wall.vectorId] = wall;
-  }
-
-  addPoint(point) {
-    this.vectorData.points[point.vectorId] = point;
-  }
-
-  addSymbol(symbol, floor) {
-    if (floor == null || typeof floor == "undefined") {
-      floor = this.currentFloor;
-    }
-    this.vectorData.floors[floor].symbols[symbol.vectorId] = symbol;
-  }
-
-  addComponent(component, floor) {
-    if (floor == null || typeof floor == "undefined") {
-      floor = this.currentFloor;
-    }
-    this.vectorData.floors[floor].components[component.vectorId] = component;
-  }
-
-  addFurniture(furniture, floor) {
-    if (floor == null || typeof floor == "undefined") {
-      floor = this.currentFloor;
-    }
-    this.vectorData.floors[floor].furnitures[furniture.vectorId] = furniture;
-  }
-
-  deleteSymbol(symbolId, floor) {
-    if (floor == null || typeof floor == "undefined") {
-      floor = this.currentFloor;
-    }
-    let symbol = this.getSymbol(symbolId, floor);
-    symbol = null;
-    delete this.vectorData.floors[floor].symbols[symbolId];
-  }
-
-  getComponent(componentId, floor) {
-    if (floor == null || typeof floor == "undefined") {
-      floor = this.currentFloor;
-    }
-    return this.vectorData.floors[floor].components[componentId];
-  }
-
-  deleteComponent(componentId, floor) {
-    if (floor == null || typeof floor == "undefined") {
-      floor = this.currentFloor;
-    }
-    let component = this.getComponent(componentId, floor);
-    component = null;
-    delete this.vectorData.floors[floor].components[componentId];
-  }
-
-  getFurniture(furnitureId, floor) {
-    if (floor == null || typeof floor == "undefined") {
-      floor = this.currentFloor;
-    }
-    return this.vectorData.floors[floor].furnitures[furnitureId];
-  }
-
-  deleteFurniture(furnitureId, floor) {
-    if (floor == null || typeof floor == "undefined") {
-      floor = this.currentFloor;
-    }
-    let furniture = this.getFurniture(furnitureId, floor);
-    furniture = null;
-    delete this.vectorData.floors[floor].furnitures[furnitureId];
-  }
-
-  addTag(tag, floor) {
-    if (floor == null || typeof floor == "undefined") {
-      floor = this.currentFloor;
-    }
-    this.vectorData.floors[floor].tags[tag.vectorId] = tag;
-  }
-
-  getTag(tagId, floor) {
-    if (floor == null || typeof floor == "undefined") {
-      floor = this.currentFloor;
-    }
-    return this.vectorData.floors[floor].tags[tagId];
+  getTag(tagId) {
+    return this.vectorData.tags[tagId];
   }
 
   deleteTag(tagId) {
@@ -324,203 +118,12 @@ export class DataService {
     delete this.vectorData.tags[tagId];
   }
 
-  getSymbols(floor) {
-    if (floor == null || typeof floor == "undefined") {
-      floor = this.currentFloor;
-    }
-    return this.vectorData.floors[floor].symbols;
-  }
-
-  getComponents(floor) {
-    if (floor == null || typeof floor == "undefined") {
-      floor = this.currentFloor;
-    }
-    return this.vectorData.floors[floor].components;
-  }
-
-  getTags(floor) {
-    if (floor == null || typeof floor == "undefined") {
-      floor = this.currentFloor;
-    }
-    return this.vectorData.floors[floor].tags;
-  }
-
-  getFurnitures(floor) {
-    if (floor == null || typeof floor == "undefined") {
-      floor = this.currentFloor;
-    }
-    return this.vectorData.floors[floor].furnitures;
-  }
-
-  getAllBoundingBox() {
-    let bounds = [];
-    for (let i = 0; i < this.vectorData.floors.length; ++i) {
-      let minX, minY, maxX, maxY;
-      let bound = {};
-      for (let key in this.vectorData.floors[i].points) {
-        let x = this.vectorData.floors[i].points[key].x;
-        let y = this.vectorData.floors[i].points[key].y;
-        if (typeof minX == "undefined" || minX > x) {
-          minX = x;
-        }
-        if (typeof maxX == "undefined" || maxX < x) {
-          maxX = x;
-        }
-        if (typeof minY == "undefined" || minY > y) {
-          minY = y;
-        }
-        if (typeof maxY == "undefined" || maxY < y) {
-          maxY = y;
-        }
-      }
-
-      bound.left = minX;
-      bound.top = maxY;
-      bound.right = maxX;
-      bound.bottom = minY;
-
-      bounds.push(bound);
-    }
-    return bounds;
-  }
-
-  getCadInfo(canvas) {
-    let cadInfo = [];
-    let bounds = this.getAllBoundingBox();
-    for (let i = 0; i < bounds.length; ++i) {
-      let item = {};
-
-      let leftTop = coordinate.getScreenXY({
-        x: bounds[i].left,
-        y: bounds[i].top,
-      });
-
-      let rightBottom = coordinate.getScreenXY({
-        x: bounds[i].right,
-        y: bounds[i].bottom,
-      });
-
-      let left = leftTop.x;
-      let top = leftTop.y;
-
-      let right = canvas.width - rightBottom.x;
-      let bottom = canvas.height - rightBottom.y;
-
-      // item.left = Constant.ratio * left
-      // item.top = Constant.ratio * top
-      // item.right = Constant.ratio * right
-      // item.bottom = Constant.ratio * bottom
-      item.left = left;
-      item.top = top;
-      item.right = right;
-      item.bottom = bottom;
-
-      item.bound = bounds[i];
-      item.bound.top = -1 * item.bound.top;
-      item.bound.bottom = -1 * item.bound.bottom;
-      cadInfo.push(item);
-    }
-    return cadInfo;
-  }
-
-  getRooms(floor) {
-    if (floor == null || typeof floor == "undefined") {
-      floor = this.currentFloor;
-    }
-    return this.vectorData.floors[floor].rooms;
+  getTags() {
+    return this.vectorData.tags;
   }
 
-  clear(saveBoundingBox) {
-    // for (let i = 0; i < this.vectorData.floors.length; ++i) {
-    //     this.vectorData.floors[i].points = {}
-    //     this.vectorData.floors[i].walls = {}
-    //     this.vectorData.floors[i].symbols = {}
-    //     this.vectorData.floors[i].components = {}
-    //     this.vectorData.floors[i].tags = {}
-    //     this.vectorData.floors[i].boundingBox = {}
-    //     this.vectorData.floors[i].rooms = []
-    // }
-    if (this.vectorData.floors[this.currentFloor]) {
-      this.vectorData.floors[this.currentFloor].points = {};
-      this.vectorData.floors[this.currentFloor].walls = {};
-      this.vectorData.floors[this.currentFloor].symbols = {};
-      this.vectorData.floors[this.currentFloor].components = {};
-      this.vectorData.floors[this.currentFloor].tags = {};
-      this.vectorData.floors[this.currentFloor].furnitures = {};
-      if (!saveBoundingBox) {
-        this.vectorData.floors[this.currentFloor].boundingBox = {};
-      }
-      this.vectorData.floors[this.currentFloor].rooms = [];
-    }
-
-    //this.vectorData.angle = 0
-  }
-
-  // getBoundingBox2DPosition(floorIndex) {
-  //     let bound = this.vectorData.floors[floorIndex].boundingBox
-  //     let leftTop = coordinate.getScreenXY({
-  //         x: bound.minX,
-  //         y: bound.maxY,
-  //     })
-
-  //     let rightBottom = coordinate.getScreenXY({
-  //         x: bound.maxX,
-  //         y: bound.minY,
-  //     })
-
-  //     return {
-  //         top: leftTop.y,
-  //         bottom: rightBottom.y,
-  //         left: leftTop.x,
-  //         right: rightBottom.x,
-  //     }
-  // }
-
-  //boundingBox3d是__sdk.core.get('Player').model.floors.index[floorIndex].boundingBox.Box3
-  getBoundingBox2DPosition(boundingBox3d) {
-    let leftTop = coordinate.getScreenXY({
-      x: boundingBox3d.min.x,
-      y: boundingBox3d.max.z,
-    });
-
-    let rightBottom = coordinate.getScreenXY({
-      x: boundingBox3d.max.x,
-      y: boundingBox3d.min.z,
-    });
-
-    return {
-      top: leftTop.y,
-      bottom: rightBottom.y,
-      left: leftTop.x,
-      right: rightBottom.x,
-    };
-  }
-
-  deleteFloorData() {
-    this.vectorData.floors = [];
-  }
-
-  setFloorName(floorName, floor) {
-    this.vectorData.floors[floor].name = floorName;
-  }
-
-  setFloorId(floorId, floor) {
-    this.vectorData.floors[floor].id = floorId;
-  }
-
-  setFloorSubgroup(floorSubgroup, floor) {
-    this.vectorData.floors[floor].subgroup = floorSubgroup;
-  }
-
-  setFloorHeight(subgroup, height) {
-    this.vectorData.floors[subgroup].height = height;
-  }
-
-  getFloorHeight(floor) {
-    if (floor == null || typeof floor == "undefined") {
-      floor = this.currentFloor;
-    }
-    return this.vectorData.floors[floor].height;
+  clear() {
+    this.vectorData = {};
   }
 }
 

+ 0 - 178
src/graphic/Service/FurnitureService.js

@@ -1,178 +0,0 @@
-import VectorType from "../enum/VectorType.js";
-import Furniture from "../Geometry/Furniture.js";
-import { dataService } from "./DataService.js";
-import { Furnitures } from "../enum/UIEvents";
-
-export class FurnitureService {
-  constructor() {
-    this.$app = null;
-    this.furnitures = null;
-  }
-  fetchFurnitures() {
-    if (this.furnitures) {
-      return;
-    }
-    this.furnitures = {};
-    for (let key in Furnitures) {
-      // 测试代码
-      if (key != Furnitures.TV) {
-        continue;
-      }
-
-      this.$app.store
-        .getAppImage(`images/cad/furnitures/${Furnitures[key]}.svg`)
-        .then((img) => {
-          this.furnitures[Furnitures[key]] = img;
-          console.log(this.furnitures);
-        })
-        .catch((err) => {
-          console.error(err);
-        });
-    }
-  }
-
-  // 新建component
-  createFurniture(position, geoType, vectorId) {
-    let furniture = null;
-    switch (geoType) {
-      case VectorType.TV:
-        furniture = new Furniture(position, vectorId, VectorType.TV);
-        break;
-      case VectorType.CombinationSofa:
-        furniture = new Furniture(
-          position,
-          vectorId,
-          VectorType.CombinationSofa
-        );
-        break;
-      case VectorType.SingleSofa:
-        furniture = new Furniture(position, vectorId, VectorType.SingleSofa);
-        break;
-      case VectorType.TeaTable:
-        furniture = new Furniture(position, vectorId, VectorType.TeaTable);
-        break;
-      case VectorType.Carpet:
-        furniture = new Furniture(position, vectorId, VectorType.Carpet);
-        break;
-      case VectorType.Plant:
-        furniture = new Furniture(position, vectorId, VectorType.Plant);
-        break;
-      case VectorType.DiningTable:
-        furniture = new Furniture(position, vectorId, VectorType.DiningTable);
-        break;
-
-      case VectorType.DoubleBed:
-        furniture = new Furniture(position, vectorId, VectorType.DoubleBed);
-        break;
-      case VectorType.SingleBed:
-        furniture = new Furniture(position, vectorId, VectorType.SingleBed);
-        break;
-      case VectorType.Wardrobe:
-        furniture = new Furniture(position, vectorId, VectorType.Wardrobe);
-        break;
-      case VectorType.Dresser:
-        furniture = new Furniture(position, vectorId, VectorType.Dresser);
-        break;
-      case VectorType.BedsideCupboard:
-        furniture = new Furniture(
-          position,
-          vectorId,
-          VectorType.BedsideCupboard
-        );
-        break;
-      case VectorType.Pillow:
-        furniture = new Furniture(position, vectorId, VectorType.Pillow);
-        break;
-
-      case VectorType.GasStove:
-        furniture = new Furniture(position, vectorId, VectorType.GasStove);
-        break;
-      case VectorType.Cupboard:
-        furniture = new Furniture(position, vectorId, VectorType.Cupboard);
-        break;
-      case VectorType.Bathtub:
-        furniture = new Furniture(position, vectorId, VectorType.Bathtub);
-        break;
-      case VectorType.Closestool:
-        furniture = new Furniture(position, vectorId, VectorType.Closestool);
-        break;
-      case VectorType.Washstand:
-        furniture = new Furniture(position, vectorId, VectorType.Washstand);
-        break;
-
-      case VectorType.Desk:
-        furniture = new Furniture(position, vectorId, VectorType.Desk);
-        break;
-      case VectorType.BalconyChair:
-        furniture = new Furniture(position, vectorId, VectorType.BalconyChair);
-        break;
-      case VectorType.Elevator:
-        furniture = new Furniture(position, vectorId, VectorType.Elevator);
-        break;
-    }
-
-    dataService.addFurniture(furniture);
-    return furniture;
-  }
-
-  isFurniture(geoType) {
-    switch (geoType) {
-      case VectorType.TV:
-        return true;
-      case VectorType.CombinationSofa:
-        return true;
-      case VectorType.SingleSofa:
-        return true;
-      case VectorType.TeaTable:
-        return true;
-      case VectorType.Carpet:
-        return true;
-      case VectorType.Plant:
-        return true;
-      case VectorType.DiningTable:
-        return true;
-      case VectorType.DoubleBed:
-        return true;
-      case VectorType.SingleBed:
-        return true;
-      case VectorType.Wardrobe:
-        return true;
-      case VectorType.Dresser:
-        return true;
-      case VectorType.BedsideCupboard:
-        return true;
-      case VectorType.Pillow:
-        return true;
-      case VectorType.GasStove:
-        return true;
-      case VectorType.Cupboard:
-        return true;
-      case VectorType.Bathtub:
-        return true;
-      case VectorType.Closestool:
-        return true;
-      case VectorType.Washstand:
-        return true;
-      case VectorType.Desk:
-        return true;
-      case VectorType.BalconyChair:
-        return true;
-      case VectorType.Elevator:
-        return true;
-    }
-    return false;
-  }
-
-  setFurnitureInfo(furnitureInfo) {
-    let furniture = dataService.getFurniture(furnitureInfo.vectorId);
-    furniture.vectorId = furnitureInfo.vectorId;
-    furniture.angle = furnitureInfo.angle;
-    furniture.center = JSON.parse(JSON.stringify(furnitureInfo.center));
-  }
-  getFurniture(name) {
-    return this.furnitures[name];
-  }
-}
-
-const furnitureService = new FurnitureService();
-export { furnitureService };

+ 0 - 104
src/graphic/Service/KeyService.js

@@ -1,104 +0,0 @@
-import Constant from "../Constant";
-import { dataService } from "./DataService";
-import { stateService } from "./StateService";
-import { elementService } from "./ElementService";
-import { coordinate } from "../Coordinate";
-import VectorType from "../enum/VectorType";
-import SelectState from "../enum/SelectState.js";
-import LayerEvents from "../enum/LayerEvents.js";
-import { componentService } from "./ComponentService";
-import { symbolService } from "./SymbolService";
-import { furnitureService } from "./FurnitureService";
-import { tagService } from "./TagService";
-import { addRoad } from "../Controls/AddRoad";
-import UIEvents from "../enum/UIEvents.js";
-import { wallService } from "./WallService";
-import { moveRectangle } from "../Controls/MoveRectangle";
-
-export default class KeyService {
-  constructor() {
-    this.wallLineStyle = null;
-    this.targetItem = null;
-  }
-
-  clearTargetItem() {
-    this.targetItem = null;
-  }
-
-  copy(focusItem, mousePosition) {
-    if (focusItem && focusItem.type) {
-      this.targetItem = {
-        vectorId: focusItem.vectorId,
-        type: focusItem.type,
-      };
-    }
-
-    this.paste(mousePosition);
-    this.clearTargetItem();
-  }
-
-  //复制
-  paste(mousePosition) {
-    let flag = false;
-    const position = coordinate.getXYFromScreen(mousePosition);
-
-    // if (this.targetItem && componentService.isComponent(this.targetItem.type)) {
-    //     const component = dataService.getComponent(this.targetItem.vectorId)
-    //     const newComponent = componentService.createComponent(position, this.targetItem.type)
-    //     newComponent.angle = component.angle
-    //     newComponent.sideWidth = component.sideWidth
-    //     newComponent.sideThickness = component.sideThickness
-    //     stateService.setSelectItem(newComponent.vectorId, this.targetItem.type, SelectState.All)
-    //     stateService.setDraggingItem(stateService.selectItem)
-    //     stateService.setEventName(LayerEvents.MoveComponent)
-    //     flag = true
-    // } else if (this.targetItem && this.targetItem.type == VectorType.Tag) {
-    //     let tag = dataService.getTag(this.targetItem.vectorId)
-    //     const newTag = tagService.createTag(position)
-    //     newTag.title = tag.title
-    //     newTag.des = tag.des
-    //     newTag.unit = tag.unit
-    //     newTag.adding = tag.adding
-    //     newTag.name = tag.name
-
-    //     stateService.setSelectItem(newTag.vectorId, this.targetItem.type, SelectState.All)
-    //     stateService.setDraggingItem(stateService.selectItem)
-    //     stateService.setEventName(LayerEvents.MoveTag)
-    //     flag = true
-    // } else if (this.targetItem && furnitureService.isFurniture(this.targetItem.type)) {
-    //     const furniture = dataService.getFurniture(this.targetItem.vectorId)
-    //     const newFurniture = furnitureService.createFurniture(position, this.targetItem.type)
-    //     newFurniture.angle = furniture.angle
-    //     newFurniture.zoom = furniture.zoom
-    //     stateService.setSelectItem(newFurniture.vectorId, this.targetItem.type, SelectState.All)
-    //     stateService.setDraggingItem(stateService.selectItem)
-    //     stateService.setEventName(LayerEvents.MoveFurniture)
-    //     moveRectangle.clear()
-    //     flag = true
-    // }
-
-    if (this.targetItem && furnitureService.isFurniture(this.targetItem.type)) {
-      const furniture = dataService.getFurniture(this.targetItem.vectorId);
-      const newFurniture = furnitureService.createFurniture(
-        position,
-        this.targetItem.type
-      );
-      newFurniture.angle = furniture.angle;
-      newFurniture.zoom = furniture.zoom;
-      stateService.setSelectItem(
-        newFurniture.vectorId,
-        this.targetItem.type,
-        SelectState.All
-      );
-      stateService.setDraggingItem(stateService.selectItem);
-      stateService.setEventName(LayerEvents.MoveFurniture);
-      moveRectangle.clear();
-      flag = true;
-    }
-    stateService.clearFocusItem();
-    return flag;
-  }
-}
-
-const keyService = new KeyService();
-export { keyService };

文件差异内容过多而无法显示
+ 0 - 1149
src/graphic/Service/SymbolService.js


+ 0 - 11
src/graphic/Service/TagService.js

@@ -16,17 +16,6 @@ export default class TagService {
     return tag;
   }
 
-  setTagInfo(tagInfo) {
-    let tag = dataService.getTag(tagInfo.vectorId);
-    tag.vectorId = tagInfo.vectorId;
-    tag.center = JSON.parse(JSON.stringify(tagInfo.center));
-    tag.points2d = JSON.parse(JSON.stringify(tagInfo.points2d));
-    tag.title = tagInfo.title;
-    tag.des = tagInfo.des;
-    tag.unit = tagInfo.unit;
-    tag.adding = tagInfo.adding;
-  }
-
   deleteTag(tagId, floorNum) {
     dataService.deleteTag(tagId, floorNum);
   }

+ 0 - 362
src/graphic/Service/UoMService.js

@@ -1,362 +0,0 @@
-const FEET_TO_INCHES_FACTOR = 12
-const EIGHTHS_SYMBOLS = ['', '⅛', '¼', '⅜', '½', '⅝', '¾', '⅞'] //eighths 八分之……
-
-class UnitOfMeasurement {
-    //转化单位工具
-    constructor(t, e, n, i) {
-        ;(this.name = t), (this.symbol = e), (this.base = n), (this.factor = i)
-    }
-    toBase(t) {
-        //换算到base
-        return t * this.factor
-    }
-
-    fromBase(t) {
-        //换算到当前
-        return t / this.factor
-    }
-}
-
-/*  var o = function t(e) {
-    this.gettext = e,
-    t.METRIC = this.gettext("metric", void 0, "measurement system"),
-    t.IMPERIAL = this.gettext("imperial", void 0, "measurement system") 
-    
-    
-};
-e.UoMSystem = o;
-
-let UoMSystem = {
-    
-} */
-
-/* var MeasurementDomain = {
-
-    DISTANCE : "DISTANCE",
-    t.AREA = "AREA",
-    t.VOLUME = "VOLUME",
-    t.DATA = "DATA",
-    t
-}
- 
-
- */
-
-var UnitsOfMeasurement = {
-    MILLIMETER: ['Millimeter', 'mm'],
-    CENTIMETER: ['Centimeter', 'cm'],
-    METER: ['Meter', 'm'],
-    KILOMETER: ['Kilometer', 'km'],
-    INCH: ['Inch', 'in'],
-    FOOT: ['Foot', 'ft'],
-    MILE: ['Mile', 'mi'],
-    SQUAREMETER: ['SquareMeter', 'm²'],
-    SQUAREFOOT: ['SquareFoot', 'ft²'],
-    CUBICMETER: ['CubicMeter', 'm³'],
-    CUBICFOOT: ['CubicFoot', 'ft³'],
-    BYTE: ['Byte', 'B'],
-    KILOBYTE: ['Kilobyte', 'kB'],
-    MEGABYTE: ['Megabyte', 'MB'],
-    GIGABYTE: ['Gigabyte', 'GB'],
-    TERABYTE: ['Terabyte', 'TB'],
-    PETABYTE: ['Petabyte', 'PB'],
-
-    init: function () {
-        var e,
-            n,
-            i,
-            a,
-            s,
-            c,
-            l,
-            u,
-            d,
-            p,
-            h,
-            f = new UnitOfMeasurement(UnitsOfMeasurement.METER[0], UnitsOfMeasurement.METER[1], void 0, 1),
-            g = new UnitOfMeasurement(UnitsOfMeasurement.SQUAREMETER[0], UnitsOfMeasurement.SQUAREMETER[1], void 0, 1),
-            m = new UnitOfMeasurement(UnitsOfMeasurement.CUBICMETER[0], UnitsOfMeasurement.CUBICMETER[1], void 0, 1),
-            v = new UnitOfMeasurement(UnitsOfMeasurement.BYTE[0], UnitsOfMeasurement.BYTE[1], void 0, 1)
-
-        UnitsOfMeasurement.DISTANCE =
-            (((e = {})['metric'] =
-                (((n = {})[UnitsOfMeasurement.MILLIMETER[0]] = new UnitOfMeasurement(UnitsOfMeasurement.MILLIMETER[0], UnitsOfMeasurement.MILLIMETER[1], f, 0.001)),
-                (n[UnitsOfMeasurement.CENTIMETER[0]] = new UnitOfMeasurement(UnitsOfMeasurement.CENTIMETER[0], UnitsOfMeasurement.CENTIMETER[1], f, 0.01)),
-                (n[UnitsOfMeasurement.METER[0]] = f),
-                (n[UnitsOfMeasurement.KILOMETER[0]] = new UnitOfMeasurement(UnitsOfMeasurement.KILOMETER[0], UnitsOfMeasurement.KILOMETER[1], f, 1e3)),
-                n)),
-            (e['imperial'] =
-                (((i = {})[UnitsOfMeasurement.INCH[0]] = new UnitOfMeasurement(UnitsOfMeasurement.INCH[0], UnitsOfMeasurement.INCH[1], f, 0.0254)),
-                (i[UnitsOfMeasurement.FOOT[0]] = new UnitOfMeasurement(UnitsOfMeasurement.FOOT[0], UnitsOfMeasurement.FOOT[1], f, 0.3048)),
-                (i[UnitsOfMeasurement.MILE[0]] = new UnitOfMeasurement(UnitsOfMeasurement.MILE[0], UnitsOfMeasurement.MILE[1], f, 1609.344)),
-                i)),
-            e)
-
-        UnitsOfMeasurement.AREA =
-            (((a = {})['metric'] = (((s = {})[UnitsOfMeasurement.SQUAREMETER[0]] = g), s)),
-            (a['imperial'] = (((c = {})[UnitsOfMeasurement.SQUAREFOOT[0]] = new UnitOfMeasurement(UnitsOfMeasurement.SQUAREFOOT[0], UnitsOfMeasurement.SQUAREFOOT[1], g, 0.092903)), c)),
-            a)
-
-        UnitsOfMeasurement.VOLUME =
-            (((l = {})['metric'] = (((u = {})[UnitsOfMeasurement.CUBICMETER[0]] = m), u)),
-            (l['imperial'] = (((d = {})[UnitsOfMeasurement.CUBICFOOT[0]] = new UnitOfMeasurement(UnitsOfMeasurement.CUBICFOOT[0], UnitsOfMeasurement.CUBICFOOT[1], m, 0.0283168)), d)),
-            l)
-
-        //数据大小
-        var y =
-            (((p = {})[UnitsOfMeasurement.BYTE[0]] = v),
-            (p[UnitsOfMeasurement.KILOBYTE[0]] = new UnitOfMeasurement(UnitsOfMeasurement.KILOBYTE[0], UnitsOfMeasurement.KILOBYTE[1], v, 1e3)),
-            (p[UnitsOfMeasurement.MEGABYTE[0]] = new UnitOfMeasurement(UnitsOfMeasurement.MEGABYTE[0], UnitsOfMeasurement.MEGABYTE[1], v, 1e6)),
-            (p[UnitsOfMeasurement.GIGABYTE[0]] = new UnitOfMeasurement(UnitsOfMeasurement.GIGABYTE[0], UnitsOfMeasurement.GIGABYTE[1], v, 1e9)),
-            (p[UnitsOfMeasurement.TERABYTE[0]] = new UnitOfMeasurement(UnitsOfMeasurement.TERABYTE[0], UnitsOfMeasurement.TERABYTE[1], v, 1e12)),
-            (p[UnitsOfMeasurement.PETABYTE[0]] = new UnitOfMeasurement(UnitsOfMeasurement.PETABYTE[0], UnitsOfMeasurement.PETABYTE[1], v, 1e15)),
-            p)
-        UnitsOfMeasurement.DATA = (((h = {})['metric'] = y), (h['imperial'] = y), h)
-    },
-    getUnitsOfMeasurementByDomain: function (e) {
-        return this[e.toUpperCase()]
-
-        /* switch (e.toUpperCase()) {
-        case a.DISTANCE:
-            return t.DISTANCE;
-        case a.AREA:
-            return t.AREA;
-        case a.VOLUME:
-            return t.VOLUME;
-        case a.DATA:
-            return t.DATA;
-        default:
-            console.error(e + " measurement domain is not supported.")
-        } */
-    },
-    getUnitsOfMeasurementByDomainAndSystem: function (domain, system) {
-        var r = this.getUnitsOfMeasurementByDomain(domain)
-        if (r.hasOwnProperty(system.toLowerCase())) return r[system.toLowerCase()]
-        console.error(n + ' measurement system is not supported.')
-    },
-    getDefaultUnitByDomainAndSystem: function (e, n) {
-        switch (e.toUpperCase()) {
-            case 'DISTANCE':
-                switch (n.toLowerCase()) {
-                    case 'metric':
-                        return this.DISTANCE['metric'][this.METER[0]]
-                    case 'imperial':
-                        return this.DISTANCE['imperial'][this.FOOT[0]]
-                    default:
-                        console.error(n + ' measurement system is not supported.')
-                }
-            case 'AREA':
-                switch (n.toLowerCase()) {
-                    case 'metric':
-                        return this.AREA['metric'][this.SQUAREMETER[0]]
-                    case 'imperial':
-                        return this.AREA['imperial'][this.SQUAREFOOT[0]]
-                    default:
-                        console.error(n + ' measurement system is not supported.')
-                }
-            case 'VOLUME':
-                switch (n.toLowerCase()) {
-                    case 'metric':
-                        return this.VOLUME['metric'][this.CUBICMETER[0]]
-                    case 'imperial':
-                        return this.VOLUME['imperial'][this.CUBICFOOT[0]]
-                    default:
-                        console.error(n + ' measurement system is not supported.')
-                }
-            case 'DATA':
-                switch (n.toLowerCase()) {
-                    case 'metric':
-                        return this.DATA['metric'][this.BYTE[0]]
-                    case 'imperial':
-                        return this.DATA['imperial'][this.BYTE[0]]
-                    default:
-                        console.error(n + ' measurement system is not supported.')
-                }
-            default:
-                console.error(e + ' measurement domain is not supported.')
-        }
-    },
-}
-
-class UnitService {
-    constructor(/* e, n, i */) {
-        //this.LanguageService = e,
-        //this.localStorageService = n,
-        //this.gettext = i,
-        //this.unitChanged = new r.Signal,
-        this.LOCAL_STORAGE_KEY = 'iv_unit_key' //?
-        UnitsOfMeasurement.init()
-        this.unitSystems = ['metric', 'imperial'] //[o.UoMSystem.METRIC, o.UoMSystem.IMPERIAL],
-        this.defaultSystem = 'metric' //'imperial'
-        //var a = this.LanguageService.getBrowserLocaleString().toLowerCase();
-        //this.defaultSystem =  t.isLocaleImperial(a) ? o.UoMSystem.IMPERIAL : o.UoMSystem.METRIC,
-
-        //this.initUnit()
-    }
-
-    /* initUnit() {
-        var t = this.localStorageService.get(this.LOCAL_STORAGE_KEY);
-        if (t)
-            for (var e = 0, n = this.unitSystems; e < n.length; e++) {
-                var i = n[e];
-                if (i === t)
-                    return void this.setUnit(i, !0)
-            }
-        this.setUnit(this.defaultSystem, !1)
-    }
-    setUnit(t, e) {
-        this.currentSystem !== t && (this.currentSystem = t,
-        this.unitChanged.emit()),
-        e && this.localStorageService.set(this.LOCAL_STORAGE_KEY, t)
-    } */
-
-    /*isLocaleImperial(e) {
-        return t.IMPERIAL_LOCALES.indexOf(e.toLowerCase()) >= 0
-    }
-    ,
-     t.IMPERIAL_LOCALES = ["en_us"],
-    t.ɵfac(e) {
-        return new (e || t)(c.ɵɵinject(l.LanguageService),
-        c.ɵɵinject("localStorageService"),c.ɵɵinject("gettext"))
-    }
-     ,
-    t.ɵprov = c.ɵɵdefineInjectable({
-        token: t,
-        factory: t.ɵfac,
-        providedIn: "root"
-    }), */
-}
-
-class UoMService {
-    constructor(/* UnitService */) {
-        this.UnitService = new UnitService() /* UnitService */
-    }
-    scopedConvert(t, n, precision = 2, r, maxFactor) {
-        return e.convert(t, n, precision, r, maxFactor)
-    }
-
-    convert(number, domain, precision = 2, system, maxFactor, ifEighths = !1) {
-        if (!number) return ''
-        var s = this.getMostRelevantMeasurement(domain, system || this.UnitService.currentSystem, number, maxFactor)
-        return this.getFormattedMeasurementString(s[0], s[1], precision, ifEighths)
-    }
-
-    getFormattedMeasurementString(number, unit, precision, ifEighths) {
-        var result
-        if (ifEighths && unit.name === UnitsOfMeasurement.FOOT[0]) {
-            result = this.formatImperialDistance(number * FEET_TO_INCHES_FACTOR)
-        } else if (ifEighths && unit.name === UnitsOfMeasurement.INCH[0]) {
-            result = this.formatImperialDistance(number)
-        } else {
-            result =
-                number.toLocaleString(void 0, {
-                    minimumFractionDigits: precision,
-                    maximumFractionDigits: precision,
-                }) +
-                ' ' +
-                unit.symbol
-        }
-
-        return result
-    }
-
-    formatImperialDistance(e) {
-        var n = Math.round(8 * e),
-            i = Math.floor(n / 8),
-            r = Math.floor(i / FEET_TO_INCHES_FACTOR),
-            o = i - r * FEET_TO_INCHES_FACTOR,
-            a = EIGHTHS_SYMBOLS[n % 8],
-            s = 0 === o && '' !== a ? '' : o
-
-        '' !== s && '' !== a && (a = ' ' + a)
-
-        return 0 !== r ? r + "' " + s + a + '"' : '' + s + a + '"'
-    }
-
-    getMostRelevantMeasurement(t, e, n, maxFactor = 0) {
-        /* var a = r.values(UnitsOfMeasurement.getUnitsOfMeasurementByDomainAndSystem(t, e))
-          , s = r.filter(a, function(t) {
-            return t.factor >= i
-        })
-          , c = r.reduce(s, function(t, e) {
-            return e.fromBase(n) < t.fromBase(n) && e.fromBase(n) >= 1 ? e : t
-        }); */
-        let a = []
-        let u = UnitsOfMeasurement.getUnitsOfMeasurementByDomainAndSystem(t, e)
-        for (let i in u) {
-            a.push(u[i])
-        }
-
-        let s = a.filter(m => m.factor >= maxFactor)
-
-        //有可能会写错,看不懂原函数
-
-        let c = s.reduce(function (i, e) {
-            //reduce计算数组元素相加后的总和
-            return e.fromBase(n) < i.fromBase(n) && e.fromBase(n) >= 1 ? e : i
-        })
-
-        return c ? [c.fromBase(n), c] : void 0
-    }
-
-    getMostRelevantMeasurement2(domain, system, number, minFactor = 0) {
-        //add
-        let a = []
-        let u = UnitsOfMeasurement.getUnitsOfMeasurementByDomainAndSystem(domain, system)
-        for (let i in u) {
-            a.push(u[i])
-        }
-        let s = a.filter(m => m.factor >= minFactor)
-        let c = s.reduce(function (prev, currentValue) {
-            //reduce最终值是最后一次return的值 ( 没看懂这句话作用)
-            return currentValue.toBase(number) < prev.toBase(number) && currentValue.toBase(number) >= 1 ? currentValue : prev
-        })
-        return c ? [c.toBase(number), c] : void 0
-    }
-
-    //this.convertBack(1, 'area', 5, 'imperial')    1英尺-->'0.09290 m²'
-    //this.convertBack(1, 'Distance', 2, 'imperial')  1平方英尺-->'0.03 m'
-    convertBack(number, domain, precision = 2, fromSystem, minFactor) {
-        //从英制转到'metric'
-        if (!number) return ''
-        //number += 'ft²';
-        number = number.trim().replace(',', '')
-        var d = UnitsOfMeasurement.getDefaultUnitByDomainAndSystem(domain, 'metric')
-
-        var s = this.getMostRelevantMeasurement2(domain, fromSystem, number, minFactor)
-        return this.getFormattedMeasurementString(s[0], d, precision)
-    }
-
-    /* ɵfac(e){
-        return new (e || t)(c.ɵɵinject(l.UnitService))
-    }
-    
-    ɵprov = c.ɵɵdefineInjectable({
-        token: t,
-        factory: t.ɵfac,
-        providedIn: "root"
-    }) */
-}
-
-/* 
-使用方法:
-
-
-初始化:
-    var unitConvert = new UoMService();
- 
-    要设置的类型,两种:var unitSystem = 'metric'(米) || 'imperial' (英制) 
- 
-
-使用:
-
-    面积:
-        let text = viewer.unitConvert.convert(area, 'area', void 0,  unitSystem,  )  
-
-    长度:
-        var text = viewer.unitConvert.convert(distance, 'distance', void 0, unitSystem, 0.1 , true)//distance要传0.1这个factor。 最后一个参数传true代表使用八分之一表示。
-
- */
-
-const uoMService = new UoMService()
-export { uoMService }

+ 12 - 12
src/graphic/enum/ElementEvents.js

@@ -1,13 +1,13 @@
 const ElementEvents = {
-    StartAddWall: 'StartAddWall',
-    NewWall: 'NewWall',
-    StartSymbolPoints: 'StartSymbolPoints',
-    EndSymbolPoints: 'EndSymbolPoints',
-    CheckLinesX: 'CheckLinesX',
-    CheckLinesY: 'CheckLinesY',
-    VCheckLinesX: 'vCheckLinesX',
-    VCheckLinesY: 'vCheckLinesY',
-    SignLine1: 'SignLine1',
-    SignLine2: 'SignLine2',
-}
-export default ElementEvents
+  StartAddRoad: "StartAddRoad",
+  NewRoad: "NewRoad",
+  // StartSymbolPoints: 'StartSymbolPoints',
+  // EndSymbolPoints: 'EndSymbolPoints',
+  // CheckLinesX: 'CheckLinesX',
+  // CheckLinesY: 'CheckLinesY',
+  // VCheckLinesX: 'vCheckLinesX',
+  // VCheckLinesY: 'vCheckLinesY',
+  // SignLine1: 'SignLine1',
+  // SignLine2: 'SignLine2',
+};
+export default ElementEvents;

+ 2 - 16
src/graphic/enum/HistoryEvents.js

@@ -4,25 +4,11 @@ const HistoryEvents = {
   ModifyPoint: "modifyPoint",
 
   AddRoad: "addRoad",
-  DeleteWall: "deleteWall",
-  ModifyWall: "modifyWall",
-
-  AddSymbol: "addSymbol",
-  DeleteSymbol: "deleteSymbol",
-  ModifySymbol: "modifySymbol",
-
-  AddComponent: "addComponent",
-  DeleteComponent: "deleteComponent",
-  ModifyComponent: "modifyComponent",
+  DeleteRoad: "deleteRoad",
+  ModifyRoad: "modifyRoad",
 
   AddTag: "addTag",
   DeleteTag: "deleteTag",
   ModifyTag: "modifyTag",
-
-  AddFurniture: "addFurniture",
-  DeleteFurniture: "deleteFurniture",
-  ModifyFurniture: "modifyFurniture",
-
-  ModifyAngle: "modifyAngle",
 };
 export default HistoryEvents;

+ 1 - 1
src/graphic/enum/LayerEvents.js

@@ -3,7 +3,7 @@ const LayerEvents = {
   AddRoad: "addRoad", //开始添加墙
   AddingRoad: "addingRoad", //添加墙进行中
   MoveRoad: "moveRoad", //拖拽墙面
-  MoveWallRoad: "moveWallRoad", //拖拽墙角
+  MoveRoadPoint: "moveRoadPoint", //拖拽墙角
 
   AddTag: "addTag",
   MoveTag: "moveTag",

+ 0 - 5
src/graphic/enum/SymbolEvents.js

@@ -1,5 +0,0 @@
-const SymbolEvents = {
-    Left: 'LEFT',
-    Right: 'RIGHT',
-}
-export default SymbolEvents

+ 11 - 45
src/graphic/enum/VectorType.js

@@ -1,46 +1,12 @@
 const VectorType = {
-    Point: 'Point',
-    WallCorner: 'WallCorner',
-    Wall: 'Wall',
-    SingleDoor: 'SingleDoor',
-    DoubleDoor: 'DoubleDoor',
-    SlideDoor: 'SlideDoor',
-
-    SingleWindow: 'SingleWindow',
-    BayWindow: 'BayWindow',
-    FrenchWindow: 'FrenchWindow',
-    Pass: 'Pass',
-
-    Beam: 'Beam',
-    Flue: 'Flue',
-    Corridor: 'Corridor',
-    Line: 'Line',
-
-    Tag: 'Tag',
-
-    TV: 'TV', //电视
-    CombinationSofa: 'CombinationSofa', //组合沙发
-    SingleSofa: 'SingleSofa', //单人沙发
-    TeaTable: 'TeaTable', //茶几
-    Carpet: 'Carpet', //地毯
-    Plant: 'Plant', //植物
-    DiningTable: 'DiningTable', //餐桌
-
-    DoubleBed: 'DoubleBed', //双人床
-    SingleBed: 'SingleBed', //单人床
-    Wardrobe: 'Wardrobe', //衣柜
-    Dresser: 'Dresser', //梳妆台
-    BedsideCupboard: 'BedsideCupboard', //床头柜
-    Pillow: 'Pillow', //抱枕
-
-    GasStove: 'GasStove', //燃气灶
-    Cupboard: 'Cupboard', //橱柜
-    Bathtub: 'Bathtub', //浴缸
-    Closestool: 'Closestool', //马桶
-    Washstand: 'Washstand', //洗漱台
-
-    Desk: 'Desk', //书桌
-    BalconyChair: 'BalconyChair', //阳台椅
-    Elevator: 'Elevator', //电梯
-}
-export default VectorType
+  Point: "Point",
+  Circle: "Circle",
+  Img: "Img",
+  Line: "Line",
+  MeasureLine: "MeasureLine",
+  RoadCorner: "RoadCorner",
+  Edge: "Edge",
+  Road: "Road",
+  Tag: "Tag",
+};
+export default VectorType;