Browse Source

Merge branch 'master' of http://192.168.0.115:3000/bill/traffic-laser

xzw 2 years ago
parent
commit
9d7d438c70

+ 2 - 2
src/graphic/Controls/AddRoad.js

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

+ 1 - 1
src/graphic/Controls/MoveTag.js

@@ -1,5 +1,5 @@
 import { dataService } from "../Service/DataService";
-import { mathUtil } from "../MathUtil.js";
+// import { mathUtil } from "../MathUtil.js";
 
 export default class MoveTag {
   constructor() {}

+ 4 - 4
src/graphic/Controls/UIControl.js

@@ -10,13 +10,13 @@ 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 "../MathUtil.js";
+// import { wallService } from "../Service/WallService.js";
 import { tagService } from "../Service/TagService.js";
 import Constant from "../Constant";
-import { roomsUtil } from "../Room/RoomsUtil.js";
+// import { roomsUtil } from "../Room/RoomsUtil.js";
 import { addRoad } from "../Controls/AddRoad";
-import { floorplanData } from "../VectorData.js";
+// import { floorplanData } from "../VectorData.js";
 import { furnitureService } from "../Service/FurnitureService.js";
 
 export default class UIControl {

+ 2 - 2
src/graphic/Coordinate.js

@@ -1,6 +1,6 @@
 import { dataService } from "./Service/DataService.js";
-import { floorplanData } from "./VectorData.js";
-import { mathUtil } from "./Util/MathUtil.js/index.js";
+// import { floorplanData } from "./VectorData.js";
+// import { mathUtil } from "./Util/MathUtil.js/index.js";
 import Constant from "./Constant";
 import { symbolService } from "./Service/SymbolService.js";
 

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

@@ -1,5 +1,5 @@
 import Geometry from "./Geometry";
-import { mathUtil } from "../Util/MathUtil.js/index.js";
+// 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";

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

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

+ 20 - 20
src/graphic/Geometry/Line.js

@@ -1,27 +1,27 @@
-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 = start;
+    this.end = end;
 
-        this.name = null
-        this.display = false
-        this.geoType = VectorType.Line
-        this.setId(vectorId)
-    }
+    this.name = null;
+    this.display = false;
+    this.geoType = VectorType.Line;
+    this.setId(vectorId);
+  }
 
-    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;
+  }
 }

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

@@ -1,108 +1,124 @@
-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 = 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;
+  }
 }

+ 1 - 1
src/graphic/History/Change.js

@@ -1,6 +1,6 @@
 import { dataService } from "../Service/DataService";
 import { elementService } from "../Service/ElementService";
-import { wallService } from "../Service/WallService";
+// import { wallService } from "../Service/WallService";
 import { historyUtil } from "./HistoryUtil";
 import { symbolService } from "../Service/SymbolService";
 import HistoryEvents from "../enum/HistoryEvents";

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

@@ -1,6 +1,6 @@
 import { dataService } from "../Service/DataService";
 import { elementService } from "../Service/ElementService";
-import { wallService } from "../Service/WallService";
+// import { wallService } from "../Service/WallService";
 import { historyUtil } from "./HistoryUtil";
 import { change } from "./Change";
 import { symbolService } from "../Service/SymbolService";

+ 2 - 2
src/graphic/History/HistoryUtil.js

@@ -1,10 +1,10 @@
-import { mathUtil } from "../MathUtil";
+// 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";
+// import { wallService } from "../Service/WallService";
 
 export default class HistoryUtil {
   constructor() {}

+ 7 - 6
src/graphic/Layer.js

@@ -9,7 +9,7 @@ import { historyService } from "./Service/HistoryService";
 
 import UIControl from "./Controls/UIControl";
 
-import { moveRectangle } from "./Controls/MoveRectangle";
+// import { moveRectangle } from "./Controls/MoveRectangle";
 import { moveTag } from "./Controls/MoveTag";
 import { addRoad } from "./Controls/AddRoad";
 import { moveRoad } from "./Controls/MoveRoad";
@@ -17,23 +17,24 @@ import { coordinate } from "./Coordinate";
 import Render from "./Renderer/Render";
 import { draw } from "./Renderer/Draw";
 import { listenLayer } from "./ListenLayer";
-import { floorplanData } from "./VectorData";
+// 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 { mathUtil } from "./MathUtil";
+// import { wallService } from "./Service/WallService";
 import { componentService } from "./Service/ComponentService";
 import History from "./History/History";
+import mitt from "mitt";
 
-import { roomsUtil } from "./Room/RoomsUtil";
+// import { roomsUtil } from "./Room/RoomsUtil";
 import { furnitureService } from "./Service/FurnitureService";
 import { keyService } from "./Service/KeyService";
 
-export default class Layer extends KanKan.MITT.Emiter {
+export default class Layer extends mitt {
   constructor(canvas) {
     super();
     this.canvas = canvas;

+ 2 - 2
src/graphic/ListenLayer.js

@@ -1,7 +1,7 @@
-import { mathUtil } from "./MathUtil.js";
+// import { mathUtil } from "./MathUtil.js";
 import { dataService } from "./Service/DataService.js";
 import { stateService } from "./Service/StateService.js";
-import { wallService } from "./Service/WallService.js";
+// import { wallService } from "./Service/WallService.js";
 import Constant from "./Constant.js";
 import VectorType from "./enum/VectorType.js";
 import SelectState from "./enum/SelectState.js";

+ 3 - 3
src/graphic/Load.js

@@ -1,13 +1,13 @@
-import { floorplanData } from "./VectorData";
+// import { floorplanData } from "./VectorData";
 import { dataService } from "./Service/DataService.js";
-import { wallService } from "./Service/WallService.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 "./MathUtil";
 import { measureService } from "./Service/MeasureService";
 import { cameraService } from "./Service/CameraService";
 import { furnitureService } from "./Service/FurnitureService";

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

@@ -6,10 +6,10 @@ 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 "../MathUtil.js";
 import ElementEvents from "../enum/ElementEvents.js";
 import Constant from "../Constant.js";
-import { roomService } from "../Service/RoomService.js";
+// import { roomService } from "../Service/RoomService.js";
 import { compassService } from "../Service/CompassService";
 import { uoMService } from "../Service/UoMService";
 import { furnitureService } from "../Service/FurnitureService.js";

+ 3 - 3
src/graphic/Renderer/Render.js

@@ -4,9 +4,9 @@ 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 { 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 {

+ 3 - 3
src/graphic/Service/ComponentService.js

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

+ 2 - 2
src/graphic/Service/ElementService.js

@@ -4,8 +4,8 @@ import ElementEvents from "../enum/ElementEvents.js";
 import { listenLayer } from "../ListenLayer";
 import Constant from "../Constant";
 import { dataService } from "./DataService.js";
-import { mathUtil } from "../MathUtil.js";
-import { wallService } from "./WallService.js";
+// import { mathUtil } from "../MathUtil.js";
+// import { wallService } from "./WallService.js";
 import { coordinate } from "../Coordinate.js";
 
 export class ElementService {

+ 1 - 1
src/graphic/Service/FurnitureService.js

@@ -1,7 +1,7 @@
 import VectorType from "../enum/VectorType.js";
 import Furniture from "../Geometry/Furniture.js";
 import { dataService } from "./DataService.js";
-import { Furnitures } from "../enum/UIEvents";
+// import { Furnitures } from "../enum/UIEvents";
 
 export class FurnitureService {
   constructor() {

+ 2 - 2
src/graphic/Service/KeyService.js

@@ -12,8 +12,8 @@ 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";
+// import { wallService } from "./WallService";
+// import { moveRectangle } from "../Controls/MoveRectangle";
 
 export default class KeyService {
   constructor() {

+ 1 - 1
src/graphic/Service/MeasureService.js

@@ -1,5 +1,5 @@
 import { dataService } from "./DataService";
-import { mathUtil } from "../MathUtil.js";
+// import { mathUtil } from "../MathUtil.js";
 import { coordinate } from "../Coordinate";
 import Constant from "../Constant";
 

+ 10 - 10
src/graphic/Service/SymbolService.js

@@ -1,18 +1,18 @@
-import { mathUtil } from "../Util/MathUtil.js/index.js";
-import SingleDoor from "../Geometry/SingleDoor.js";
-import DoubleDoor from "../Geometry/DoubleDoor.js";
-import SlideDoor from "../Geometry/SlideDoor.js";
-import SingleWindow from "../Geometry/SingleWindow.js";
-import FrenchWindow from "../Geometry/FrenchWindow.js";
-import BayWindow from "../Geometry/BayWindow.js";
-import Pass from "../Geometry/Pass.js";
+// import { mathUtil } from "../Util/MathUtil.js/index.js";
+// import SingleDoor from "../Geometry/SingleDoor.js";
+// import DoubleDoor from "../Geometry/DoubleDoor.js";
+// import SlideDoor from "../Geometry/SlideDoor.js";
+// import SingleWindow from "../Geometry/SingleWindow.js";
+// import FrenchWindow from "../Geometry/FrenchWindow.js";
+// import BayWindow from "../Geometry/BayWindow.js";
+// import Pass from "../Geometry/Pass.js";
 import { coordinate } from "../Coordinate";
 import { dataService } from "./DataService.js";
-import { wallService } from "./WallService.js";
+// import { wallService } from "./WallService.js";
 import VectorType from "../enum/VectorType.js";
 
 import Constant from "../Constant";
-import { moveSymbol } from "../Controls/MoveSymbol.js";
+// import { moveSymbol } from "../Controls/MoveSymbol.js";
 import { stateService } from "./StateService.js";
 
 export class SymbolService {

+ 2 - 2
src/graphic/Service/TagService.js

@@ -1,8 +1,8 @@
 import Tag from "../Geometry/Tag.js";
 import { dataService } from "./DataService.js";
-import { floorplanData } from "../VectorData.js";
+// import { floorplanData } from "../VectorData.js";
 import { measureService } from "./MeasureService.js";
-import { mathUtil } from "../MathUtil.js";
+// import { mathUtil } from "../MathUtil.js";
 import { uoMService } from "./UoMService.js";
 
 export default class TagService {

+ 4 - 3
src/graphic/index.js

@@ -1,5 +1,6 @@
+import Layer from "./Layer";
+
 export const structureDraw = (canvas) => {
-  const ctx = canvas.getContext("2d");
-  ctx.fillStyle = "#000";
-  ctx.fillRect(0, 0, 100, 100);
+  console.log("???");
+  new Layer(canvas);
 };

+ 0 - 3
src/hook/custom/preset.ts

@@ -70,15 +70,12 @@ export enum CustomCom {
   FullView = "full",
   SpiltView = "split",
   MagnifierMode = "magnifier",
-  Coord = "coord",
   CustomMouseMenu = "cMoseMenu",
   ResidenMouseMenu = "rMouseMenu",
-  coordOutType = "coordOutType",
   CarryView = "carryView",
   SysView = "sysView",
   boxWidth = "boxWidth",
   autoMarginLeft = "autoMarginLeft",
-  showInfo = "showInfo",
   fullCtrl = "fullCtrl",
 }
 

+ 0 - 5
src/hook/custom/setup.ts

@@ -91,11 +91,6 @@ export const setupSDK = (sdk: SDK) => {
   watchEffect(() =>
     sdk.carry.setShowMeasures(!disabledMap[DisabledCom.Measure])
   );
-  watchEffect(() =>
-    sdk.carry.setCoordType(
-      disabledMap[DisabledCom.Coord] ? null : customMap[CustomCom.Coord]
-    )
-  );
 
   fullScreenSetting(sdk);
   spliceSetting(sdk);

+ 1 - 0
src/views/drawGraphic/index.vue

@@ -17,6 +17,7 @@ const setCanvasSize = () => {
 // window.addEventListener("resize", setCanvasSize);
 
 onMounted(() => {
+  console.log("???");
   setCanvasSize();
   setCanvas(drawCanvasRef.value);
 });