Browse Source

继续搭建绘图

xushiting 2 years ago
parent
commit
7f923a9823

+ 1 - 3
src/graphic/Controls/AddRoad.js

@@ -1,12 +1,10 @@
 import { listenLayer } from "../ListenLayer";
 import Constant from "../Constant";
-// import { mathUtil } from "../MathUtil";
+import { mathUtil } from "../Util/MathUtil";
 import { dataService } from "../Service/DataService";
 import { pointService } from "../Service/PointService";
 import { elementService } from "../Service/ElementService";
-// import { wallService } from "../Service/WallService";
 import { stateService } from "../Service/StateService";
-import { symbolService } from "../Service/SymbolService";
 import VectorType from "../enum/VectorType";
 import { roadService } from "../Service/RoadService";
 

+ 0 - 1
src/graphic/Controls/MoveRoad.js

@@ -3,7 +3,6 @@ import { dataService } from "../Service/DataService";
 import Constant from "../Constant";
 import { mathUtil } from "../Util/MathUtil";
 import { elementService } from "../Service/ElementService";
-import { symbolService } from "../Service/SymbolService";
 import { coordinate } from "../Coordinate";
 
 export default class MoveRoad {

+ 1 - 6
src/graphic/Controls/UIControl.js

@@ -2,22 +2,17 @@ import { coordinate } from "../Coordinate.js";
 import LayerEvents from "../enum/LayerEvents.js";
 import UIEvents from "../enum/UIEvents.js";
 import VectorType from "../enum/VectorType.js";
-import SymbolEvents from "../enum/SymbolEvents.js";
 import { stateService } from "../Service/StateService.js";
 import { measureService } from "../Service/MeasureService.js";
 import { dataService } from "../Service/DataService.js";
 import { historyService } from "../Service/HistoryService.js";
-import { symbolService } from "../Service/SymbolService.js";
-import { componentService } from "../Service/ComponentService.js";
 import { elementService } from "../Service/ElementService";
-// import { mathUtil } from "../MathUtil.js";
-// import { wallService } from "../Service/WallService.js";
+import { mathUtil } from "../Util/MathUtil";
 import { tagService } from "../Service/TagService.js";
 import Constant from "../Constant";
 // import { roomsUtil } from "../Room/RoomsUtil.js";
 import { addRoad } from "../Controls/AddRoad";
 // import { floorplanData } from "../VectorData.js";
-import { furnitureService } from "../Service/FurnitureService.js";
 
 export default class UIControl {
   constructor(layer) {

+ 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 - 2
src/graphic/Geometry/Geometry.js

@@ -1,6 +1,5 @@
 import { dataService } from "../Service/DataService";
-// import { mathUtil } from "../Util/MathUtil.js/index.js";
-import SymbolEvents from "../enum/SymbolEvents.js";
+import { mathUtil } from "../Util/MathUtil";
 
 export default class Geometry {
   constructor() {

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

@@ -1,7 +1,6 @@
 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 {

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

@@ -1,6 +1,6 @@
 import VectorType from "../enum/VectorType.js";
 import Geometry from "./Geometry";
-import { mathUtil } from "../MathUtil.js";
+import { mathUtil } from "../Util/MathUtil.js";
 import { coordinate } from "../Coordinate";
 import Constant from "../Constant.js";
 

+ 1 - 12
src/graphic/Layer.js

@@ -1,14 +1,11 @@
 import Load from "./Load";
 import { stateService } from "./Service/StateService";
-import { symbolService } from "./Service/SymbolService";
 import { elementService } from "./Service/ElementService";
 import { dataService } from "./Service/DataService";
 import { measureService } from "./Service/MeasureService";
 import { tagService } from "./Service/TagService";
 import { historyService } from "./Service/HistoryService";
-
 import UIControl from "./Controls/UIControl";
-
 // import { moveRectangle } from "./Controls/MoveRectangle";
 import { moveTag } from "./Controls/MoveTag";
 import { addRoad } from "./Controls/AddRoad";
@@ -17,21 +14,13 @@ import { coordinate } from "./Coordinate";
 import Render from "./Renderer/Render";
 import { draw } from "./Renderer/Draw";
 import { listenLayer } from "./ListenLayer";
-// import { floorplanData } from "./VectorData";
-
 import LayerEvents from "./enum/LayerEvents.js";
 import UIEvents from "./enum/UIEvents.js";
 import SelectState from "./enum/SelectState.js";
 import Constant from "./Constant";
 import VectorType from "./enum/VectorType";
-// import { mathUtil } from "./MathUtil";
-// import { wallService } from "./Service/WallService";
-import { componentService } from "./Service/ComponentService";
+import { mathUtil } from "./Util/MathUtil";
 import History from "./History/History";
-import mitt from "mitt";
-
-// import { roomsUtil } from "./Room/RoomsUtil";
-import { furnitureService } from "./Service/FurnitureService";
 import { keyService } from "./Service/KeyService";
 
 export default class Layer extends mitt {

+ 1 - 6
src/graphic/Load.js

@@ -1,16 +1,11 @@
-// import { floorplanData } from "./VectorData";
 import { dataService } from "./Service/DataService.js";
-// import { wallService } from "./Service/WallService.js";
 import { stateService } from "./Service/StateService.js";
-import { symbolService } from "./Service/SymbolService.js";
-import { componentService } from "./Service/ComponentService.js";
 import { coordinate } from "./Coordinate.js";
 import Constant from "./Constant";
 import { tagService } from "./Service/TagService";
-// import { mathUtil } from "./MathUtil";
+import { mathUtil } from "./Util/MathUtil";
 import { measureService } from "./Service/MeasureService";
 import { cameraService } from "./Service/CameraService";
-import { furnitureService } from "./Service/FurnitureService";
 
 export default class Load {
   constructor(layer) {

+ 2 - 6
src/graphic/Renderer/Draw.js

@@ -1,18 +1,14 @@
 import { dataService } from "../Service/DataService.js";
 import { stateService } from "../Service/StateService.js";
 import { measureService } from "../Service/MeasureService";
-import { symbolService } from "../Service/SymbolService";
 import { coordinate } from "../Coordinate.js";
 import Style from "../Style.js";
 import VectorType from "../enum/VectorType.js";
 import SelectState from "../enum/SelectState.js";
-// import { mathUtil } from "../MathUtil.js";
+import { mathUtil } from "../Util/MathUtil.js";
 import ElementEvents from "../enum/ElementEvents.js";
 import Constant from "../Constant.js";
-// import { roomService } from "../Service/RoomService.js";
-import { compassService } from "../Service/CompassService";
-import { uoMService } from "../Service/UoMService";
-import { furnitureService } from "../Service/FurnitureService.js";
+
 export default class Draw {
   constructor() {
     this.context = null;

+ 0 - 4
src/graphic/Renderer/Render.js

@@ -4,10 +4,6 @@ import { elementService } from "../Service/ElementService.js";
 import { measureService } from "../Service/MeasureService";
 import { coordinate } from "../Coordinate.js";
 import { draw } from "./Draw.js";
-// import { roomService } from "../Service/RoomService.js";
-// import { roomsUtil } from "../Room/RoomsUtil.js";
-// import { floorplanData } from "../VectorData.js";
-import { furnitureService } from "../Service/FurnitureService.js";
 
 export default class Render {
   constructor(layer) {

+ 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 };

+ 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 - 5
src/graphic/Service/KeyService.js

@@ -6,14 +6,9 @@ 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() {

+ 79 - 82
src/graphic/Service/StateService.js

@@ -1,96 +1,93 @@
-import VectorType from '../enum/VectorType.js'
-import SelectState from '../enum/SelectState.js'
-import { symbolService } from './SymbolService.js'
-import { componentService } from './ComponentService.js'
-import { furnitureService } from './FurnitureService.js'
+import VectorType from "../enum/VectorType.js";
+import SelectState from "../enum/SelectState.js";
 
 export default class StateService {
-    constructor() {
-        this.eventName = null
-        this.selectItem = null
-        this.focusItem = null
-        this.draggingItem = null
+  constructor() {
+    this.eventName = null;
+    this.selectItem = null;
+    this.focusItem = null;
+    this.draggingItem = null;
+  }
+
+  getEventName() {
+    return this.eventName;
+  }
+
+  setEventName(eventName) {
+    this.eventName = eventName;
+  }
+
+  clearEventName() {
+    this.eventName = null;
+  }
+
+  // type表示类型,state默认是select,但是有的元素需要知道选中的是哪个顶点
+  setSelectItem(vectorId, type, state) {
+    this.selectItem = {};
+    this.selectItem.vectorId = vectorId;
+    this.selectItem.type = type;
+
+    if (symbolService.isSymbol(type)) {
+      if (state == SelectState.Select) {
+        this.selectItem.selectIndex = SelectState.All;
+      } else {
+        this.selectItem.selectIndex = state;
+      }
+    } else if (componentService.isComponent(type)) {
+      if (state == SelectState.Select) {
+        this.selectItem.selectIndex = SelectState.All;
+      }
+    } else if (type == VectorType.Tag) {
+      if (state == SelectState.Select) {
+        this.selectItem.selectIndex = SelectState.All;
+      } else {
+        this.selectItem.selectIndex = state;
+      }
+    } else if (furnitureService.isFurniture(type)) {
+      if (state == SelectState.Select) {
+        this.selectItem.selectIndex = SelectState.All;
+      }
     }
+  }
 
-    getEventName() {
-        return this.eventName
-    }
+  getSelectItem() {
+    return this.selectItem;
+  }
 
-    setEventName(eventName) {
-        this.eventName = eventName
-    }
+  clearSelectItem() {
+    this.selectItem = null;
+  }
 
-    clearEventName() {
-        this.eventName = null
-    }
+  getDraggingItem() {
+    return this.draggingItem;
+  }
 
-    // type表示类型,state默认是select,但是有的元素需要知道选中的是哪个顶点
-    setSelectItem(vectorId, type, state) {
-        this.selectItem = {}
-        this.selectItem.vectorId = vectorId
-        this.selectItem.type = type
-
-        if (symbolService.isSymbol(type)) {
-            if (state == SelectState.Select) {
-                this.selectItem.selectIndex = SelectState.All
-            } else {
-                this.selectItem.selectIndex = state
-            }
-        } else if (componentService.isComponent(type)) {
-            if (state == SelectState.Select) {
-                this.selectItem.selectIndex = SelectState.All
-            }
-        } else if (type == VectorType.Tag) {
-            if (state == SelectState.Select) {
-                this.selectItem.selectIndex = SelectState.All
-            } else {
-                this.selectItem.selectIndex = state
-            }
-        } else if (furnitureService.isFurniture(type)) {
-            if (state == SelectState.Select) {
-                this.selectItem.selectIndex = SelectState.All
-            }
-        }
-    }
+  setDraggingItem(draggingItem) {
+    this.draggingItem = draggingItem;
+  }
 
-    getSelectItem() {
-        return this.selectItem
-    }
+  clearDraggingItem() {
+    this.draggingItem = null;
+  }
 
-    clearSelectItem() {
-        this.selectItem = null
-    }
+  getFocusItem() {
+    return this.focusItem;
+  }
 
-    getDraggingItem() {
-        return this.draggingItem
-    }
+  setFocusItem(focusItem) {
+    this.focusItem = focusItem;
+  }
 
-    setDraggingItem(draggingItem) {
-        this.draggingItem = draggingItem
-    }
+  clearFocusItem() {
+    this.focusItem = null;
+  }
 
-    clearDraggingItem() {
-        this.draggingItem = null
-    }
-
-    getFocusItem() {
-        return this.focusItem
-    }
-
-    setFocusItem(focusItem) {
-        this.focusItem = focusItem
-    }
-
-    clearFocusItem() {
-        this.focusItem = null
-    }
-
-    clearItems() {
-        this.selectItem = null
-        this.focusItem = null
-        this.draggingItem = null
-    }
+  clearItems() {
+    this.selectItem = null;
+    this.focusItem = null;
+    this.draggingItem = null;
+  }
 }
 
-const stateService = new StateService()
-export { stateService }
+const stateService = new StateService();
+export { stateService };

File diff suppressed because it is too large
+ 0 - 1149
src/graphic/Service/SymbolService.js


+ 1 - 42
src/graphic/Service/TagService.js

@@ -1,9 +1,6 @@
 import Tag from "../Geometry/Tag.js";
 import { dataService } from "./DataService.js";
-// import { floorplanData } from "../VectorData.js";
-import { measureService } from "./MeasureService.js";
-// import { mathUtil } from "../MathUtil.js";
-import { uoMService } from "./UoMService.js";
+import { mathUtil } from "../Util/MathUtil.js";
 
 export default class TagService {
   constructor() {}
@@ -35,44 +32,6 @@ export default class TagService {
     }
   }
 
-  convertUnit(unit) {
-    for (let i = 0; i < floorplanData.floors.length; ++i) {
-      let tags = floorplanData.floors[i].tags;
-      for (let key in tags) {
-        let tag = tags[key];
-        if (tag.unit == unit) {
-          continue;
-        } else if (tag.des) {
-          tag.unit = unit;
-          if (unit == "m") {
-            //平方英尺转平方米
-            tag.des = uoMService.convertBack(
-              tag.des,
-              "area",
-              7,
-              "imperial",
-              0.01,
-              false
-            );
-            tag.des = parseFloat(tag.des);
-          } else {
-            //平方米转平方英尺
-            tag.des = uoMService.convert(
-              tag.des,
-              "area",
-              7,
-              "imperial",
-              0.01,
-              false
-            );
-            tag.des = tag.des.replace("ft²", "");
-            //tag.des = parseFloat(tag.des)
-          }
-        }
-      }
-    }
-  }
-
   getTags(floorNum) {
     return floorplanData.floors[floorNum].tags;
   }