Просмотр исходного кода

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

# Conflicts:
#	server/test/SS-t-P1d6CwREny2/attach/sceneStore
xzw 2 лет назад
Родитель
Сommit
21c602c976

+ 15 - 3
src/components/fill-slide/index.vue

@@ -1,8 +1,9 @@
 <template>
   <div class="fill-slide">
+    <div></div>
     <div class="header">
       <slot name="header" />
-      <ui-icon class="close" type="close" @click="$emit('quit')" ctrl />
+      <ui-icon class="close" type="close" @click="clickHandler" ctrl />
     </div>
     <div class="slide-layout">
       <ui-slide
@@ -32,10 +33,14 @@ import UiIcon from "@/components/base/components/icon/index.vue";
 type Item = {url: string}
 
 defineProps<{ data: Item[], active: Item, getURL?: (data: any) => string }>()
-defineEmits<{
+const emit = defineEmits<{
   (e: 'update:active', d: Item): void,
   (e: 'quit'): void
 }>()
+
+const clickHandler = () => {
+  emit('quit')
+}
 </script>
 
 <style scoped lang="scss">
@@ -54,8 +59,11 @@ defineEmits<{
 }
 
 .slide-layout {
+  max-width: 90vw;
   width: 840px;
   height: 540px;
+  position: relative;
+  z-index: 1;
 }
 
 .image {
@@ -67,7 +75,10 @@ defineEmits<{
 
 .header {
   width: 100%;
-  position: relative;
+  position: absolute;
+  z-index: 4;
+  background: red;
+  //height: 120px;
 }
 
 .close {
@@ -76,6 +87,7 @@ defineEmits<{
   top: 32px;
   font-size: 20px;
   color: #fff;
+  z-index: 1;
 }
 .foot {
   width: 100%;

+ 43 - 41
src/graphic/CanvasStyle/default.js

@@ -1,42 +1,44 @@
+import { coordinate } from '../Coordinate.js'
+
 const Road = {
   strokeStyle: "#939393",
-  lineWidth: 1,
+  lineWidth: 1 * coordinate.ratio,
 };
 
 const RoadEdge = {
   ...Road,
-  lineWidth: 1,
+  lineWidth: 1 * coordinate.ratio,
   strokeStyle: "#000",
 };
 
 const Lane = {
   ...RoadEdge,
-  lineWidth: 1,
+  lineWidth: 1 * coordinate.ratio,
   strokeStyle: "#000",
-  dash: [8, 8],
+  dash: [8 * coordinate.ratio, 8 * coordinate.ratio],
 };
 
 const ArrowLine = {
-  lineWidth: 2,
+  lineWidth: 2 * coordinate.ratio,
   strokeStyle: "red",
 };
 
 const Magnifier = {
   strokeStyle: "#2F8FFF",
-  lineWidth: 1,
+  lineWidth: 1 * coordinate.ratio,
   fillStyle: "rgba(0,0,0,0)",
-  radius: 10,
+  radius: 10 * coordinate.ratio,
   target: {
-    radius: 100,
-    realRadius: 50,
+    radius: 100 * coordinate.ratio,
+    realRadius: 50 * coordinate.ratio,
     strokeStyle: "#2F8FFF",
-    lineWidth: 3,
+    lineWidth: 3 * coordinate.ratio,
   },
 };
 
 const CurveRoad = {
   ...Road,
-  lineWidth: 1,
+  lineWidth: 1 * coordinate.ratio,
 };
 
 const CurveRoadEdge = {
@@ -52,27 +54,27 @@ const CurveLan = {
 const Text = {
   strokeStyle: "rgb(0,0,0,1)",
   fillStyle: "rgb(0,0,0,1)",
-  fontSize: 14,
+  fontSize: 14 * coordinate.ratio,
   strokeStyle_adding: "rgba(243, 255, 0, 0.8)",
   fillStyle_adding: "rgba(243, 255, 0, 0.8)",
-  lineWidth: 1,
+  lineWidth: 1 * coordinate.ratio,
 };
 
 const CanvasFont = {
-  font: "14px Microsoft YaHei",
+  font: `${14 * coordinate.ratio}px Microsoft YaHei`,
   fillStyle: "#000000",
   strokeStyle: "#000000",
   textAlign: "center",
   textBaseline: "middle",
-  miterLimit: 10,
+  miterLimit: 10 * coordinate.ratio,
   direction: "ltr",
 };
 
 const Point = {
   strokeStyle: "#3290FF",
   fillStyle: "#fff",
-  radius: 4,
-  lineWidth: 4,
+  radius: 4 * coordinate.ratio,
+  lineWidth: 4 * coordinate.ratio,
 };
 
 const RoadPoint = {
@@ -86,85 +88,85 @@ const CurveRoadPoint = {
 const CrossPoint = {
   ...Point,
   strokeStyle: "#3290FF",
-  radius: 8,
+  radius: 8 * coordinate.ratio,
 };
 
 const Circle = {
   strokeStyle: "red",
   fillStyle: "rgba(0,0,0,0)",
-  lineWidth: 2,
-  radius: 30,
+  lineWidth: 2 * coordinate.ratio,
+  radius: 30 * coordinate.ratio,
 };
 
 const Measure = {
   txt: "rgba(255,255,255,1)", //画墙/选墙的时候 测量值的颜色
   strokeStyle: "rgba(255,255,255,1)",
-  lineWidth: 1,
+  lineWidth: 1 * coordinate.ratio,
 };
 
 const NormalLine = {
   strokeStyle: "#000",
-  lineWidth: 2,
+  lineWidth: 2 * coordinate.ratio,
 };
 const GuideLine = {
   strokeStyle: "#CED806",
-  lineWidth: 2,
-  dash: [3, 2, 2],
+  lineWidth: 2 * coordinate.ratio,
+  dash: [3 * coordinate.ratio, 2 * coordinate.ratio, 2 * coordinate.ratio],
 };
 const MeasureLine = {
   strokeStyle: "#2F8FFF",
-  lineWidth: 4,
+  lineWidth: 4 * coordinate.ratio,
   text: {
     fillColor: "#fff",
-    padding: 6,
+    padding: 6 * coordinate.ratio,
     backColor: "#2F8FFF"
   },
 
 };
 const BaseLine = {
   strokeStyle: "#000",
-  lineWidth: 1,
+  lineWidth: 1 * coordinate.ratio,
 };
 
 const BasePoint = {
   strokeStyle: "rgba(0,0,0,0)",
   fillStyle: "#000",
-  radius: 6,
-  lineWidth: 1,
+  radius: 6 * coordinate.ratio,
+  lineWidth: 1 * coordinate.ratio,
   out: {
     strokeStyle: "#000",
     fillStyle: "rgba(255,255,255,0)",
-    radius: 8,
-    lineWidth: 1,
+    radius: 8 * coordinate.ratio,
+    lineWidth: 1 * coordinate.ratio,
   }
 }
 
 const Element = {
   AddingPoint: {
-    radius: 4,
+    radius: 4 * coordinate.ratio,
     fillStyle: "yellow",
     strokeStyle: "green",
   },
   NewRoad: {
-    lineWidth: 4,
+    lineWidth: 4 * coordinate.ratio,
     strokeStyle: "rgba(100,100,100,0.3)",
     errorStrokeStyle: "rgb(250,63,72,0.3)",
   },
   CheckLinesX: {
-    lineWidth: 2,
+    lineWidth: 2 * coordinate.ratio,
     strokeStyle: "#CED806",
   },
   CheckLinesY: {
-    lineWidth: 2,
+    lineWidth: 2 * coordinate.ratio,
     strokeStyle: "#CED806",
   },
   VCheckLinesX: {
-    lineWidth: 2,
+    lineWidth: 2 * coordinate.ratio,
     strokeStyle: "#CED806",
     //strokeStyle: 'rgba(100,149,237,0.5)',
   },
   VCheckLinesY: {
-    lineWidth: 2,
+    lineWidth: 2 * coordinate.ratio,
     strokeStyle: "#CED806",
     //strokeStyle: 'rgba(100,149,237,0.5)',
   },
@@ -174,13 +176,13 @@ const Element = {
 const TestPoint = {
   strokeStyle: "rgba(0,0,0,0)",
   fillStyle: "#fff",
-  radius: 6,
-  lineWidth: 1,
+  radius: 6 * coordinate.ratio,
+  lineWidth: 1 * coordinate.ratio,
   out: {
     strokeStyle: "#3290FF",
     fillStyle: "rgba(255,255,255,0)",
-    radius: 8,
-    lineWidth: 3,
+    radius: 8 * coordinate.ratio,
+    lineWidth: 3 * coordinate.ratio,
   }
 }
 

+ 16 - 15
src/graphic/CanvasStyle/focus.js

@@ -1,14 +1,15 @@
 import def from "./default.js";
+import {coordinate} from "@/graphic/Coordinate.js";
 
 const Road = {
   ...def.Road,
-  lineWidth: 2,
+  lineWidth: 2 * coordinate.ratio,
   strokeStyle: "#3290FF",
 };
 
 const NormalLine = {
   ...def.NormalLine,
-  lineWidth: 2,
+  lineWidth: 2 * coordinate.ratio,
   strokeStyle: "#3290FF",
 };
 
@@ -19,7 +20,7 @@ const Magnifier = {
 const CurveRoad = {
   ...def.CurveRoad,
   ...Road,
-  lineWidth: 2,
+  lineWidth: 2 * coordinate.ratio,
 };
 
 const Text = {
@@ -49,30 +50,30 @@ const CrossPoint = {
 
 const RoadEdge = {
   ...def.RoadEdge,
-  lineWidth: 2,
+  lineWidth: 2 * coordinate.ratio,
   strokeStyle: "#3290FF",
 };
 
 const CurveRoadEdge = {
   ...def.CurveRoadEdge,
-  lineWidth: 2,
+  lineWidth: 2 * coordinate.ratio,
   strokeStyle: "#3290FF",
 };
 const ArrowLine = {
-  lineWidth: 2,
+  lineWidth: 2 * coordinate.ratio,
   strokeStyle: "red",
 };
 
 const BasePoint = {
   strokeStyle: "rgba(0,0,0,0)",
   fillStyle: "#3290FF",
-  radius: 6,
-  lineWidth: 1,
+  radius: 6 * coordinate.ratio,
+  lineWidth: 1 * coordinate.ratio,
   out: {
     strokeStyle: "#3290FF",
     fillStyle: "rgba(255,255,255,0)",
-    radius: 8,
-    lineWidth: 1,
+    radius: 8 * coordinate.ratio,
+    lineWidth: 1 * coordinate.ratio,
   }
 }
 
@@ -80,18 +81,18 @@ const BasePoint = {
 const TestPoint = {
   strokeStyle: "rgba(0,0,0,0)",
   fillStyle: "#fff",
-  radius: 6,
-  lineWidth: 1,
+  radius: 6 * coordinate.ratio,
+  lineWidth: 1 * coordinate.ratio,
   out: {
     strokeStyle: "#3290FF",
     fillStyle: "rgba(255,255,255,0)",
-    radius: 8,
-    lineWidth: 3,
+    radius: 8 * coordinate.ratio,
+    lineWidth: 3 * coordinate.ratio,
   }
 }
 const BaseLine = {
   strokeStyle: "#3290FF",
-  lineWidth: 1,
+  lineWidth: 1 * coordinate.ratio,
 };
 export default {
   Road,

+ 16 - 15
src/graphic/CanvasStyle/select.js

@@ -1,28 +1,29 @@
 import def from "./default.js";
+import {coordinate} from "@/graphic/Coordinate.js";
 
 const Road = {
   ...def.Road,
-  lineWidth: 2,
+  lineWidth: 2 * coordinate.ratio,
   strokeStyle: "#3290FF",
 };
 
 const BaseLine = {
   strokeStyle: "#3290FF",
-  lineWidth: 1,
+  lineWidth: 1 * coordinate.ratio,
 };
 const NormalLine = {
   ...def.NormalLine,
-  lineWidth: 2,
+  lineWidth: 2 * coordinate.ratio,
   strokeStyle: "#3290FF",
 };
 const ArrowLine = {
-  lineWidth: 2,
+  lineWidth: 2 * coordinate.ratio,
   strokeStyle: "red",
 };
 const CurveRoad = {
   ...def.CurveRoad,
   ...Road,
-  lineWidth: 2,
+  lineWidth: 2 * coordinate.ratio,
 };
 
 const Text = {
@@ -33,13 +34,13 @@ const Text = {
 
 const RoadEdge = {
   ...def.RoadEdge,
-  lineWidth: 2,
+  lineWidth: 2 * coordinate.ratio,
   strokeStyle: "#3290FF",
 };
 
 const CurveRoadEdge = {
   ...def.CurveRoadEdge,
-  lineWidth: 2,
+  lineWidth: 2 * coordinate.ratio,
   strokeStyle: "#3290FF",
 };
 
@@ -65,26 +66,26 @@ const CrossPoint = {
 const BasePoint = {
   strokeStyle: "rgba(0,0,0,0)",
   fillStyle: "#3290FF",
-  radius: 6,
-  lineWidth: 1,
+  radius: 6 * coordinate.ratio,
+  lineWidth: 1 * coordinate.ratio,
   out: {
     strokeStyle: "#3290FF",
     fillStyle: "rgba(255,255,255,0)",
-    radius: 8,
-    lineWidth: 1,
+    radius: 8 * coordinate.ratio,
+    lineWidth: 1 * coordinate.ratio,
   }
 }
 
 const TestPoint = {
   strokeStyle: "rgba(0,0,0,0)",
   fillStyle: "#fff",
-  radius: 6,
-  lineWidth: 1,
+  radius: 6 * coordinate.ratio,
+  lineWidth: 1 * coordinate.ratio,
   out: {
     strokeStyle: "#3290FF",
     fillStyle: "rgba(255,255,255,0)",
-    radius: 8,
-    lineWidth: 3,
+    radius: 8 * coordinate.ratio,
+    lineWidth: 3 * coordinate.ratio,
   }
 }
 

+ 30 - 67
src/graphic/Controls/AddPoint.js

@@ -17,18 +17,40 @@ export default class AddPoint {
   }
 
   buildPoint(position) {
-    const newPoint = pointService.create(position);
-    if (newPoint.getCategory() == VectorCategory.Point.BasePoint) {
+    let newPoint;
+    if (Settings.pointCategory == VectorCategory.Point.BasePoint) {
+      newPoint = pointService.create(position);
       Settings.selectBasePointId = newPoint.vectorId;
     } else {
-      if (Settings.locationMode == Constant.angleLocationMode) {
+      if (
+        Settings.selectBasePointId != null &&
+        Settings.locationMode == Constant.angleLocationMode
+      ) {
+        newPoint = pointService.create(position);
         this.setLocationByAngle(newPoint.vectorId);
-      } else if (Settings.locationMode == Constant.allLocationMode) {
+        newPoint.setLocationMode(Constant.angleLocationMode);
+      } else if (
+        Settings.selectBasePointId != null &&
+        Settings.locationMode == Constant.allLocationMode
+      ) {
+        newPoint = pointService.create(position);
         this.setLocationByAll(newPoint.vectorId);
+        newPoint.setLocationMode(Constant.allLocationMode);
       } else if (Settings.locationMode == Constant.normalLocationMode) {
+        newPoint = pointService.create(position);
         this.setLocationByNormal(newPoint.vectorId);
+        newPoint.setLocationMode(Constant.normalLocationMode);
+      } else if (
+        Settings.selectBasePointId == null &&
+        (Settings.locationMode == Constant.angleLocationMode ||
+          Settings.locationMode == Constant.allLocationMode)
+      ) {
+        return null;
       }
-      if (newPoint.getCategory() == VectorCategory.Point.TestPoint) {
+      if (
+        newPoint &&
+        newPoint.getCategory() == VectorCategory.Point.TestPoint
+      ) {
         this.testPointIds.push(newPoint.vectorId);
       }
     }
@@ -50,10 +72,8 @@ export default class AddPoint {
   setLocationByAngle(testPointId) {
     let basePoint = this.isFocusBasePoint();
     if (!basePoint) {
-      console.error("没有基准点");
       return;
     }
-    console.error("选中基准点:" + basePoint.vectorId);
     let testPoint = dataService.getPoint(testPointId);
     if (testPoint.getCategory() != VectorCategory.Point.TestPoint) {
       return;
@@ -67,6 +87,7 @@ export default class AddPoint {
     let join = mathUtil.getJoinLinePoint(basePoint, vLine);
     join = pointService.create(join);
     join.setCategory(VectorCategory.Point.TestBasePoint);
+    join.setLocationMode(Constant.angleLocationMode);
     join.setLinkedBasePointId(basePoint.vectorId);
     join.setLinkedTestPointId(testPointId);
     lineService.createByPointId(
@@ -82,38 +103,6 @@ export default class AddPoint {
     );
   }
 
-  //待测基准点,待测点与基准线相交的点
-  getTestBasePoint(basePointId, testPointId) {
-    let points = dataService.getPoints();
-    for (let key in points) {
-      const point = dataService.getPoint(key);
-      if (point.getCategory() == VectorCategory.Point.TestBasePoint) {
-        if (
-          point.getLinkedBasePointId() == basePointId &&
-          point.getLinkedTestPointId() == testPointId
-        ) {
-          return point;
-        }
-      }
-    }
-    return null;
-  }
-
-  //更新待测点(直角定位法)
-  updateTestPointByAngle(testPointId, newPosition) {
-    let testPoint = dataService.getPoint(testPointId);
-    mathUtil.clonePoint(testPoint, newPosition);
-    let basePoint = dataService.getPoint(testPoint.getLinkedBasePointId());
-    let lineGeometry = dataService.getLine(Settings.baseLineId);
-    let startPoint = dataService.getPoint(lineGeometry.startId);
-    let endPoint = dataService.getPoint(lineGeometry.endId);
-    let line = mathUtil.createLine1(startPoint, endPoint);
-    let vLine = mathUtil.getVerticalLine(line, testPoint);
-    let join = mathUtil.getJoinLinePoint(basePoint, vLine);
-    let testBasePoint = this.getTestBasePoint(basePoint.vectorId, testPointId);
-    mathUtil.clonePoint(testBasePoint, join);
-  }
-
   //综合定位法
   setLocationByAll(testPointId) {
     let basePoint = this.isFocusBasePoint();
@@ -130,6 +119,7 @@ export default class AddPoint {
     let join = mathUtil.getJoinLinePoint(testPoint, line);
     join = pointService.create(join); //经过待测点且与基准线垂直的线段,与基准线的交点
     join.setCategory(VectorCategory.Point.TestBasePoint);
+    join.setLocationMode(Constant.allLocationMode);
     join.setLinkedBasePointId(basePoint.vectorId);
     join.setLinkedTestPointId(testPointId);
     //待测点与基准线的垂直线
@@ -159,20 +149,6 @@ export default class AddPoint {
     }
   }
 
-  //更新待测点(综合定位法)
-  updateTestPointByAll(testPointId, newPosition) {
-    let testPoint = dataService.getPoint(testPointId);
-    mathUtil.clonePoint(testPoint, newPosition);
-    let basePoint = dataService.getPoint(testPoint.getLinkedBasePointId());
-    let lineGeometry = dataService.getLine(Settings.baseLineId);
-    let startPoint = dataService.getPoint(lineGeometry.startId);
-    let endPoint = dataService.getPoint(lineGeometry.endId);
-    let line = mathUtil.createLine1(startPoint, endPoint);
-    let join = getJoinLinePoint(testPoint, line);
-    let testBasePoint = this.getTestBasePoint(basePoint.vectorId, testPointId);
-    mathUtil.clonePoint(testBasePoint, join);
-  }
-
   setLocationByNormal(testPointId) {
     let testPoint = dataService.getPoint(testPointId);
     if (testPoint.getCategory() != VectorCategory.Point.TestPoint) {
@@ -186,6 +162,7 @@ export default class AddPoint {
     let join = mathUtil.getIntersectionPoint(vLine, line);
     join = pointService.create(join);
     join.setCategory(VectorCategory.Point.TestBasePoint);
+    join.setLocationMode(Constant.normalLocationMode);
     join.setLinkedTestPointId(testPointId);
     lineService.createByPointId(
       testPointId,
@@ -193,20 +170,6 @@ export default class AddPoint {
       VectorCategory.Line.PositionLine
     );
   }
-
-  //更新待测点(自由定位法)
-  updateTestPointByNormal(testPointId, newPosition) {
-    let testPoint = dataService.getPoint(testPointId);
-    mathUtil.clonePoint(testPoint, newPosition);
-    let basePoint = dataService.getPoint(testPoint.getLinkedBasePointId());
-    let lineGeometry = dataService.getLine(Settings.baseLineId);
-    let startPoint = dataService.getPoint(lineGeometry.startId);
-    let endPoint = dataService.getPoint(lineGeometry.endId);
-    let line = mathUtil.createLine1(startPoint, endPoint);
-    let join = getJoinLinePoint(testPoint, line);
-    let testBasePoint = this.getTestBasePoint(basePoint.vectorId, testPointId);
-    mathUtil.clonePoint(testBasePoint, join);
-  }
 }
 
 const addPoint = new AddPoint();

+ 88 - 55
src/graphic/Controls/MovePoint.js

@@ -1,8 +1,11 @@
 import { dataService } from "../Service/DataService";
 import { pointService } from "../Service/PointService";
 import Settings from "../Settings";
+import Constant from "../Constant";
 import VectorCategory from "../enum/VectorCategory";
 import { listenLayer } from "../ListenLayer";
+import { uiService } from "../Service/UIService";
+import { mathUtil } from "../Util/MathUtil";
 
 export default class MovePoint {
   constructor() {}
@@ -11,6 +14,11 @@ export default class MovePoint {
     let point = dataService.getPoint(pointId);
     point.x = position.x;
     point.y = position.y;
+    if (point.getCategory() == VectorCategory.Point.TestPoint) {
+      this.updatePositionByTestPoint(pointId);
+    } else if (point.getCategory() == VectorCategory.Point.BasePoint) {
+      this.updateBasePoint(pointId);
+    }
   }
 
   finish(pointId) {
@@ -29,80 +37,105 @@ export default class MovePoint {
         category != VectorCategory.Point.TestPoint
       ) {
         pointService.mergePoint(pointId, listenLayer.modifyPoint.linkedPointId);
+        Settings.selectBasePointId = null;
       } else if (category == VectorCategory.Point.BasePoint) {
         Settings.selectBasePointId = pointId;
+      } else {
+        Settings.selectBasePointId = null;
+      }
+    }
+  }
+
+  //待测基准点,待测点与基准线相交的点
+  getTestBasePoint(basePointId, testPointId, locationMode) {
+    let points = dataService.getPoints();
+    for (let key in points) {
+      const point = dataService.getPoint(key);
+      if (point.getCategory() == VectorCategory.Point.TestBasePoint) {
+        if (
+          point.getLinkedBasePointId() == basePointId &&
+          point.getLinkedTestPointId() == testPointId &&
+          point.getLocationMode() == locationMode
+        ) {
+          return point;
+        }
       }
     }
+    return null;
   }
 
-  //直角定位法
-  //movePointForLocationByAngle(testPointId, basePointId) {
-  movePointByAngleLocation(pointId) {
-    if (testPointId == null || basePointId == null) {
-      return null;
+  updatePositionByTestPoint(pointId) {
+    let point = dataService.getPoint(pointId);
+    let locationMode = point.getLocationMode();
+    if (locationMode == Constant.angleLocationMode) {
+      this.updateTestPointByAngle(pointId);
+    } else if (locationMode == Constant.allLocationMode) {
+      this.updateTestPointByAll(pointId);
+    } else if (locationMode == Constant.normalLocationMode) {
+      this.updateTestPointByNormal(pointId);
     }
+  }
+
+  //更新待测点(直角定位法)
+  updateTestPointByAngle(testPointId) {
     let testPoint = dataService.getPoint(testPointId);
-    let basePoint = dataService.getPoint(basePointId);
+    let basePoint = dataService.getPoint(testPoint.getLinkedBasePointId());
     let lineGeometry = dataService.getLine(Settings.baseLineId);
     let startPoint = dataService.getPoint(lineGeometry.startId);
     let endPoint = dataService.getPoint(lineGeometry.endId);
     let line = mathUtil.createLine1(startPoint, endPoint);
-    let vLine1 = mathUtil.getVerticalLine(line, testPoint);
-    let join = mathUtil.getJoinLinePoint(basePoint, vLine1);
-    join = pointService.create(join);
-
-    lineService.createByPointId(
+    let vLine = mathUtil.getVerticalLine(line, testPoint);
+    let join = mathUtil.getJoinLinePoint(basePoint, vLine);
+    let testBasePoint = this.getTestBasePoint(
+      basePoint.vectorId,
       testPointId,
-      join.vectorId,
-      VectorCategory.Line.PositionLine
+      Constant.angleLocationMode
     );
+    mathUtil.clonePoint(testBasePoint, join);
+  }
 
-    lineService.createByPointId(
-      basePointId,
-      join.vectorId,
-      VectorCategory.Line.PositionLine
+  //更新待测点(综合定位法)
+  updateTestPointByAll(testPointId) {
+    let testPoint = dataService.getPoint(testPointId);
+    let basePoint = dataService.getPoint(testPoint.getLinkedBasePointId());
+    let lineGeometry = dataService.getLine(Settings.baseLineId);
+    let startPoint = dataService.getPoint(lineGeometry.startId);
+    let endPoint = dataService.getPoint(lineGeometry.endId);
+    let line = mathUtil.createLine1(startPoint, endPoint);
+    let join = mathUtil.getJoinLinePoint(testPoint, line);
+    let testBasePoint = this.getTestBasePoint(
+      basePoint.vectorId,
+      testPointId,
+      Constant.allLocationMode
     );
+    mathUtil.clonePoint(testBasePoint, join);
   }
 
-  //综合定位法
-  movePointForLocationByFull(testPointId1, testPointId2, basePointId) {
-    if (testPointId1 == null || basePointId == null) {
-      return null;
-    } else {
-      let testPoint1 = dataService.getPoint(testPointId1);
-      let lineGeometry = dataService.getLine(Settings.baseLineId);
-      let startPoint = dataService.getPoint(lineGeometry.startId);
-      let endPoint = dataService.getPoint(lineGeometry.endId);
-      let line = mathUtil.createLine1(startPoint, endPoint);
-      if (testPointId2 == null) {
-        let join = mathUtil.getJoinLinePoint(testPoint1, line);
-        join = pointService.create(join);
-        lineService.createByPointId(
-          testPointId1,
-          join.vectorId,
-          VectorCategory.Line.PositionLine
-        );
-
-        lineService.createByPointId(
-          basePointId,
-          testPointId1,
-          VectorCategory.Line.PositionLine
-        );
-      } else {
-        let testPoint2 = dataService.getPoint(testPointId2);
-        let join = mathUtil.getJoinLinePoint(testPoint2, line);
-        join = pointService.create(join);
-        lineService.createByPointId(
-          testPointId2,
-          join.vectorId,
-          VectorCategory.Line.PositionLine
-        );
+  //更新待测点(自由定位法)
+  updateTestPointByNormal(testPointId) {
+    let testPoint = dataService.getPoint(testPointId);
+    let lineGeometry = dataService.getLine(Settings.baseLineId);
+    let startPoint = dataService.getPoint(lineGeometry.startId);
+    let endPoint = dataService.getPoint(lineGeometry.endId);
+    let line = mathUtil.createLine1(startPoint, endPoint);
+    let join = mathUtil.getJoinLinePoint(testPoint, line);
+    let testBasePoint = this.getTestBasePoint(
+      null,
+      testPointId,
+      Constant.normalLocationMode
+    );
+    mathUtil.clonePoint(testBasePoint, join);
+  }
 
-        lineService.createByPointId(
-          testPointId2,
-          testPointId1,
-          VectorCategory.Line.PositionLine
-        );
+  updateBasePoint(basePointId) {
+    let points = dataService.getPoints();
+    for (let key in points) {
+      let point = dataService.getPoint(key);
+      if (
+        point.getCategory() == VectorCategory.Point.TestPoint &&
+        point.getLinkedBasePointId() == basePointId
+      ) {
+        this.updatePositionByTestPoint(key);
       }
     }
   }

+ 9 - 5
src/graphic/Controls/UIControl.js

@@ -20,6 +20,7 @@ import { addLine } from "./AddLine.js";
 import VectorCategory from "../enum/VectorCategory.js";
 // import { floorplanData } from "../VectorData.js";
 import Message from "@/components/base/components/message/message.vue";
+import { pointService } from "../Service/PointService.js";
 
 export default class UIControl {
   constructor(layer, newsletter, graphicStateUI) {
@@ -123,6 +124,9 @@ export default class UIControl {
   //删除按钮
   deleteVector(vectorId, geoType) {
     switch (geoType) {
+      case VectorType.Point:
+        pointService.deletePoint(vectorId);
+        break;
       case VectorType.Line:
         dataService.deleteLine(vectorId);
         break;
@@ -282,15 +286,15 @@ export default class UIControl {
 
   // 进入持续添加出确认与取消框
   showConfirm() {
-    this.graphicStateUI.continuedMode = true
+    this.graphicStateUI.continuedMode = true;
   }
   confirmEntry() {
-    console.log("确认")
-    this.graphicStateUI.continuedMode = false
+    console.log("确认");
+    this.graphicStateUI.continuedMode = false;
   }
   confirmCancel() {
-    console.log("取消")
-    this.graphicStateUI.continuedMode = false
+    console.log("取消");
+    this.graphicStateUI.continuedMode = false;
   }
 
   hidePrompt() {

+ 14 - 5
src/graphic/Coordinate.js

@@ -7,8 +7,7 @@ export default class Coordinate {
     this.defaultZoom = defaultZoom;
     this.zoom = defaultZoom; // 当前缩放比例,不会改变世界坐标系的坐标,只是改变渲染时转换的屏幕坐标
     this.res = defaultRes; //比例尺。实际尺寸与屏幕像素的比例,用于测量。与之前的绘制不同,目前存储的数据与像素的比例是1:1,只是最后测量值再除以这个比例
-    this.ratio = 1; //不同硬件设备,像素率不同
-
+    this.ratio = window.devicePixelRatio || 1; //不同硬件设备,像素率不同
     this.width == null;
     this.height == null;
   }
@@ -77,14 +76,24 @@ export default class Coordinate {
 
   updateForCanvas(canvas) {
     if (canvas) {
-      this.width = canvas.clientWidth;
-      this.height = canvas.clientHeight;
+      canvas.width *= this.ratio;
+      canvas.height *= this.ratio;
+      this.width = canvas.width;
+      this.height = canvas.height;
     }
     this.setCenter(canvas);
   }
 
-  updateZoom(zoom) {
+  updateZoom(screenPosition, zoom) {
+    let position = this.getXYFromScreen(screenPosition);
     this.zoom = zoom;
+    this.center.x =
+      position.x -
+      ((screenPosition.x - this.width / 2) * defaultZoom) / this.zoom;
+
+    this.center.y =
+      position.y -
+      ((this.height / 2 - screenPosition.y) * defaultZoom) / this.zoom;
   }
 
   moveTo(zoom, screenPosition) {

+ 9 - 0
src/graphic/Geometry/Point.js

@@ -11,6 +11,7 @@ export default class Point extends Geometry {
     this.parent = {};
     this.linkedBasePointId = null; //关联基准点
     this.linkedTestPointId = null; //关联待测点
+    this.locationMode = null; //如果该点是待测点,采用的定位法是哪种
     this.category = Settings.pointCategory;
     this.geoType = VectorType.Point;
     this.setId(vectorId);
@@ -51,4 +52,12 @@ export default class Point extends Geometry {
       this.category = value;
     }
   }
+
+  setLocationMode(value) {
+    this.locationMode = value;
+  }
+
+  getLocationMode() {
+    return this.locationMode;
+  }
 }

+ 4 - 0
src/graphic/History/HistoryUtil.js

@@ -20,6 +20,7 @@ export default class HistoryUtil {
       point1.y == point2.y &&
       JSON.stringify(point1.parent) == JSON.stringify(point2.parent) &&
       point1.category == point2.category &&
+      point1.locationMode == point2.locationMode &&
       point1.linkedBasePointId == point2.linkedBasePointId &&
       point1.linkedTestPointId == point2.linkedTestPointId
     ) {
@@ -166,6 +167,7 @@ export default class HistoryUtil {
     pointInfo.vectorId = point1.vectorId;
     pointInfo.position = { x: point2.x, y: point2.y };
     pointInfo.parent = JSON.parse(JSON.stringify(point2.parent));
+    pointInfo.locationMode = point2.locationMode;
     pointInfo.linkedBasePointId = point2.linkedBasePointId;
     pointInfo.linkedTestPointId = point2.linkedTestPointId;
     pointInfo.category = point2.category;
@@ -292,6 +294,7 @@ export default class HistoryUtil {
     mathUtil.clonePoint(data, point);
     data.parent = JSON.parse(JSON.stringify(point.parent));
     data.category = point.category;
+    data.locationMode = point.locationMode;
     data.linkedBasePointId = point.linkedBasePointId;
     data.linkedTestPointId = point.linkedTestPointId;
     data.type = point.geoType;
@@ -419,6 +422,7 @@ export default class HistoryUtil {
     mathUtil.clonePoint(point, pointInfo.position);
     point.parent = JSON.parse(JSON.stringify(pointInfo.parent));
     point.category = pointInfo.category;
+    point.locationMode = pointInfo.locationMode;
     point.linkedBasePointId = pointInfo.linkedBasePointId;
     point.linkedTestPointId = pointInfo.linkedTestPointId;
     return point;

+ 43 - 34
src/graphic/Layer.js

@@ -140,11 +140,14 @@ export default class Layer {
       case LayerEvents.AddPoint:
         stateService.setEventName(LayerEvents.MovePoint);
         const newPoint = addPoint.buildPoint(position);
-        stateService.setSelectItem(
-          newPoint.vectorId,
-          VectorType.Point,
-          SelectState.Select
-        );
+        if (newPoint) {
+          stateService.setSelectItem(
+            newPoint.vectorId,
+            VectorType.Point,
+            SelectState.Select
+          );
+        }
+
         break;
       case LayerEvents.AddCircle:
         stateService.setEventName(LayerEvents.AddingCircle);
@@ -201,34 +204,34 @@ export default class Layer {
         //记录开始的两个触摸点的坐标
         if (!this.StorePage1 || !this.StorePage2) {
           this.onMouseUp(e);
-          this.StorePage1 = { x: ev.touches[0].pageX, y: ev.touches[0].pageY };
-          this.StorePage2 = { x: ev.touches[1].pageX, y: ev.touches[1].pageY };
+          this.StorePage1 = { x: e.touches[0].pageX, y: e.touches[0].pageY };
+          this.StorePage2 = { x: e.touches[1].pageX, y: e.touches[1].pageY };
           return;
         }
         const point1 = {
-          x: ev.touches[0].pageX,
-          y: ev.touches[0].pageY,
+          x: e.touches[0].pageX,
+          y: e.touches[0].pageY,
         };
         const point2 = {
-          x: ev.touches[1].pageX,
-          y: ev.touches[1].pageY,
+          x: e.touches[1].pageX,
+          y: e.touches[1].pageY,
         };
 
         // let zoom =
         //   (mathUtil.getDistance(point1, point2) /
         //     mathUtil.getDistance(this.StorePage1, this.StorePage2)) *
-        //   coordinate.defaultZoom;
-        let zoom =
-          coordinate.defaultZoom +
-          mathUtil.getDistance(this.StorePage1, this.StorePage2) -
-          mathUtil.getDistance(point1, point2);
+        //   coordinate.zoom;
+        let dis1 = mathUtil.getDistance(point1, point2) / 100;
+        let dis2 = mathUtil.getDistance(this.StorePage1, this.StorePage2) / 100;
+        let zoom = coordinate.zoom + dis1 - dis2;
+        console.log("缩放距离:" + dis1 + "," + dis2);
         this.zoomVector(zoom);
         return;
       }
     }
 
-    let dx = X - this.lastX;
-    let dy = Y - this.lastY;
+    let dx = (X - this.lastX) * coordinate.ratio;
+    let dy = (Y - this.lastY) * coordinate.ratio;
 
     let position = coordinate.getXYFromScreen({
       x: X,
@@ -238,16 +241,18 @@ export default class Layer {
       x: position.x,
       y: position.y,
     };
+    const eventName = stateService.getEventName();
     if (
       Math.abs(X - this.startX) > minDragDis ||
       Math.abs(Y - this.startY) > minDragDis
     ) {
       // 是否拖拽了
       this.dragging = true;
+      if (eventName != null) {
+        stateService.clearFocusItem();
+        this.uiControl.focusVector = null;
+      }
     }
-
-    const eventName = stateService.getEventName();
-
     // 是否需要重绘
     let needAutoRedraw = false;
     let point = null;
@@ -267,15 +272,10 @@ export default class Layer {
         break;
       case LayerEvents.PanBackGround:
         stateService.clearItems();
-        coordinate.center.x =
-          coordinate.center.x - (dx * coordinate.defaultZoom) / coordinate.zoom;
-        coordinate.center.y =
-          coordinate.center.y + (dy * coordinate.defaultZoom) / coordinate.zoom;
+        coordinate.center.x = coordinate.center.x - dx;
+        coordinate.center.y = coordinate.center.y + dy;
 
-        dataService.setGridForPan(
-          (dx * coordinate.defaultZoom) / coordinate.zoom,
-          (dy * coordinate.defaultZoom) / coordinate.zoom
-        );
+        dataService.setGridForPan(dx, dy);
         needAutoRedraw = true;
         break;
       case LayerEvents.AddRoad:
@@ -819,7 +819,9 @@ export default class Layer {
         break;
       case LayerEvents.MovePoint:
         needAutoRedraw = true;
-        movePoint.finish(draggingItem.vectorId);
+        if (draggingItem && draggingItem.vectorId) {
+          movePoint.finish(draggingItem.vectorId);
+        }
         this.history.save();
         break;
       case LayerEvents.MoveCircle:
@@ -844,16 +846,23 @@ export default class Layer {
         ? (e.wheelDelta / 120) * 20
         : (-(e.detail || 0) / 3) * 20;
       const zoom = coordinate.zoom + delta;
-      this.zoomVector(zoom);
+      let X = e.offsetX || e.layerX;
+      let Y = e.offsetY || e.layerY;
+      this.zoomVector(
+        {
+          x: X,
+          y: Y,
+        },
+        zoom
+      );
     }
   }
 
-  zoomVector(zoom) {
+  zoomVector(position, zoom) {
     if (zoom < minZoom || zoom > maxZoom) {
       return;
     }
-
-    coordinate.updateZoom(zoom);
+    coordinate.updateZoom(position, zoom);
     dataService.setGridForZoom(
       coordinate.width,
       coordinate.height,

+ 10 - 0
src/graphic/ListenLayer.js

@@ -10,6 +10,7 @@ import { elementService } from "./Service/ElementService";
 import { coordinate } from "./Coordinate";
 import { draw } from "./Renderer/Draw.js";
 import { edgeService } from "./Service/EdgeService";
+import VectorCategory from "./enum/VectorCategory";
 
 export default class ListenLayer {
   constructor() {
@@ -100,6 +101,9 @@ export default class ListenLayer {
         continue;
       }
       const point = dataService.getPoint(pointId);
+      if (point.getCategory() == VectorCategory.Point.TestBasePoint) {
+        continue;
+      }
       const distance = mathUtil.getDistance(position, point);
       if (distance < Constant.minAdsorbPix) {
         if (pointInfo.pointId == null) {
@@ -163,6 +167,12 @@ export default class ListenLayer {
         continue;
       }
       const line = dataService.getLine(lineId);
+      if (
+        line.getCategory() == VectorCategory.Line.PositionLine ||
+        line.getCategory() == VectorCategory.Line.BaseLine
+      ) {
+        continue;
+      }
       let startPoint = dataService.getPoint(line.startId);
       let endPoint = dataService.getPoint(line.endId);
       const comLine = mathUtil.createLine1(startPoint, endPoint);

+ 29 - 10
src/graphic/Renderer/Draw.js

@@ -255,7 +255,7 @@ export default class Draw {
       this.context.lineTo(w, y);
     }
     this.context.strokeStyle = "rgba(0,0,0,0.1)";
-    this.context.lineWidth = 0.5;
+    this.context.lineWidth = 0.5 * coordinate.ratio;
     this.context.stroke();
 
     this.context.beginPath();
@@ -269,7 +269,7 @@ export default class Draw {
       this.context.lineTo(w, y);
     }
     this.context.strokeStyle = "rgba(0,0,0,0.2)";
-    this.context.lineWidth = 1;
+    this.context.lineWidth = 1 * coordinate.ratio;
     this.context.stroke();
     this.context.restore();
   }
@@ -610,19 +610,34 @@ export default class Draw {
   }
 
   drawPoint(vector) {
+    if (vector.category === VectorCategory.Point.TestBasePoint) {
+      return;
+    }
     const pt = coordinate.getScreenXY({ x: vector.x, y: vector.y });
     const ctx = this.context;
-    const [style] = help.setVectorStyle(
+    const [style, attr] = help.setVectorStyle(
       ctx,
       vector,
       [vector.category, vector.geoType, "Point"]
 
     );
+    if (vector.category === VectorCategory.Point.NormalPoint) {
+      const lineid = Object.keys(vector.parent)[0]
+      let line, style
+      if (!(lineid && (line = dataService.getLine(lineid)))) {
+        return;
+      }
+      const [_, attr] = help.getVectorStyle(line)
+      if (!attr) {
+        return;
+      }
+    }
+
     if (vector.color) {
       ctx.strokeStyle = vector.color;
     }
     const draw = (style) => {
-      const radius = help.getReal(vector.radius || style.radius);
+      const radius = vector.radius || style.radius;
       ctx.save();
       ctx.beginPath();
       ctx.arc(pt.x, pt.y, radius, 0, Math.PI * 2, true);
@@ -631,6 +646,7 @@ export default class Draw {
       ctx.fill();
       ctx.restore();
     }
+
     draw(style)
     if (style.out) {
       draw(style.out)
@@ -668,7 +684,7 @@ export default class Draw {
     help.setVectorStyle(this.context, vector);
     this.context.fillStyle = vector.color;
     const oldFont = this.context.font;
-    this.context.font = `${vector.fontSize}px Microsoft YaHei`;
+    this.context.font = `${vector.fontSize * coordinate.ratio}px Microsoft YaHei`;
     this.drawTextByInfo(vector.center, vector.value, 0, false);
 
     const ctx = this.context;
@@ -700,7 +716,7 @@ export default class Draw {
     const point = mathUtil.translate(
       end, start, end, mathUtil.getDistance(start, end) / 3
     )
-    const p4 = help.getPerpendicularPoint(start, end, point, 30)
+    const p4 = help.getPerpendicularPoint(start, end, point, 30 * coordinate.ratio)
     const ctx = this.context
     ctx.beginPath();
     const [style] = help.setVectorStyle(
@@ -712,14 +728,15 @@ export default class Draw {
     ctx.lineTo(p4.x, p4.y);
     ctx.stroke();
 
-    const p5 = help.getPerpendicularPoint(start, end, point, 35)
+    const p5 = help.getPerpendicularPoint(start, end, point, 35 * coordinate.ratio)
+    this.context.font = `${10 * coordinate.ratio}px Microsoft YaHei`;
     help.drawLineText(
       this.context,
-      help.getPerpendicularPoint(point, p5, p5, 10),
-      help.getPerpendicularPoint(point, p5, p5, -10),
+      help.getPerpendicularPoint(point, p5, p5, 10 * coordinate.ratio),
+      help.getPerpendicularPoint(point, p5, p5, -10 * coordinate.ratio),
       "基准线",
       {
-        padding: 6,
+        padding: 6 * coordinate.ratio,
         backColor: "rgba(0,0,0,0)",
         fillColor: style.strokeStyle
       }
@@ -750,6 +767,7 @@ export default class Draw {
 
     const drawPoints = () => {
       // if (attr) {
+      console.log("???")
         this.drawPoint(dataService.getPoint(vector.startId))
         this.drawPoint(dataService.getPoint(vector.endId))
       // }
@@ -767,6 +785,7 @@ export default class Draw {
       case VectorCategory.Line.PositionLine:
         this.drawLineText(vector, style.text)
         break;
+
     }
 
   }

+ 24 - 16
src/graphic/Service/DataService.js

@@ -2,16 +2,17 @@ import Line from "../Geometry/Line.js";
 import CurveLine from "../Geometry/CurveLine.js";
 import VectorType from "../enum/VectorType.js";
 import { coordinate } from "../Coordinate.js";
+import VectorCategory from "../enum/VectorCategory.js";
 
 export class DataService {
   constructor() {
     this.grid = {
       startX: 0,
       startY: 0,
-      step1: 50,
-      step2: 250,
-      defalutstep1: 50,
-      defalutstep2: 250,
+      step1: 50 * coordinate.ratio,
+      step2: 250 * coordinate.ratio,
+      defalutstep1: 50 * coordinate.ratio,
+      defalutstep2: 250 * coordinate.ratio,
       display: true,
     };
     this.vectorData = {
@@ -67,8 +68,8 @@ export class DataService {
   }
 
   setGridForPan(dx, dy) {
-    this.grid.startX += dx;
-    this.grid.startY += dy;
+    this.grid.startX += dx * coordinate.ratio;
+    this.grid.startY += dy * coordinate.ratio;
     this.grid.step1 =
       (this.grid.defalutstep1 * coordinate.zoom) / coordinate.defaultZoom;
     this.grid.step2 =
@@ -81,12 +82,11 @@ export class DataService {
     }
   }
 
-  setGridForZoom(w, h, ratio) {
-    console.log("setGridForZoom:" + ratio);
-    this.grid.startX = w / 2 - (ratio * w) / 2;
-    this.grid.startY = w / 2 - (ratio * h) / 2;
-    this.grid.step1 = this.grid.defalutstep1 * ratio;
-    this.grid.step2 = this.grid.defalutstep2 * ratio;
+  setGridForZoom(w, h, zoom) {
+    this.grid.startX = w / 2 - (zoom * w) / 2;
+    this.grid.startY = h / 2 - (zoom * h) / 2;
+    this.grid.step1 = this.grid.defalutstep1 * zoom;
+    this.grid.step2 = this.grid.defalutstep2 * zoom;
     while (this.grid.startX > 0) {
       this.grid.startX -= this.grid.step2;
     }
@@ -135,7 +135,10 @@ export class DataService {
     if (start) {
       let startParent = start.getParent();
       delete startParent[lineId];
-      if (Object.keys(startParent).length == 0) {
+      if (
+        Object.keys(startParent).length == 0 &&
+        start.getCategory() != VectorCategory.Point.BasePoint
+      ) {
         this.deletePoint(line.startId);
       }
     }
@@ -144,7 +147,10 @@ export class DataService {
     if (end) {
       let endParent = end.getParent();
       delete endParent[lineId];
-      if (Object.keys(endParent).length == 0) {
+      if (
+        Object.keys(endParent).length == 0 &&
+        end.getCategory() != VectorCategory.Point.BasePoint
+      ) {
         this.deletePoint(line.endId);
       }
     }
@@ -167,8 +173,10 @@ export class DataService {
 
   deletePoint(pointId) {
     let point = this.getPoint(pointId);
-    delete this.vectorData.points[pointId];
-    point = null;
+    if (point) {
+      delete this.vectorData.points[pointId];
+      point = null;
+    }
   }
 
   //圆圈

+ 64 - 0
src/graphic/Service/PointService.js

@@ -4,6 +4,7 @@ import { dataService } from "./DataService.js";
 import VectorCategory from "../enum/VectorCategory.js";
 import { mathUtil } from "../Util/MathUtil.js";
 import { lineService } from "./LineService.js";
+import Settings from "../Settings.js";
 export default class PointService {
   constructor() {}
 
@@ -41,6 +42,69 @@ export default class PointService {
       dataService.deletePoint(pointId1);
     }
   }
+
+  deletePoint(pointId) {
+    let point = dataService.getPoint(pointId);
+    const category = point.getCategory();
+    if (category == VectorCategory.Point.NormalPoint) {
+      dataService.deletePoint(pointId); //暂时简单粗暴
+    } else if (category == VectorCategory.Point.BasePoint) {
+      this.deleteBasePoint(pointId);
+    } else if (category == VectorCategory.Point.TestPoint) {
+      this.deleteTestPoint(pointId);
+    }
+  }
+
+  deleteBasePoint(basePointId) {
+    let points = dataService.getPoints();
+    let needDeletePointIds = [];
+    for (let key in points) {
+      let point = dataService.getPoint(key);
+      if (point.vectorId == basePointId) {
+        needDeletePointIds.push(basePointId);
+      } else if (point.linkedBasePointId == basePointId) {
+        needDeletePointIds.push(key);
+      }
+    }
+    let lines = dataService.getLines();
+    for (let key in lines) {
+      let line = dataService.getLine(key);
+      if (
+        needDeletePointIds.indexOf(line.startId) > -1 ||
+        needDeletePointIds.indexOf(line.endId) > -1
+      ) {
+        dataService.deleteLine(key);
+      }
+    }
+    dataService.deletePoint(basePointId);
+    if (Settings.selectBasePointId == basePointId) {
+      Settings.selectBasePointId = null;
+    }
+  }
+
+  deleteTestPoint(testPointId) {
+    let points = dataService.getPoints();
+    let needDeletePointIds = [];
+    for (let key in points) {
+      let point = dataService.getPoint(key);
+      if (point.vectorId == testPointId) {
+        needDeletePointIds.push(testPointId);
+      } else if (point.linkedTestPointId == testPointId) {
+        needDeletePointIds.push(key);
+      }
+    }
+    let lines = dataService.getLines();
+    for (let key in lines) {
+      let line = dataService.getLine(key);
+      if (
+        needDeletePointIds.indexOf(line.startId) > -1 ||
+        needDeletePointIds.indexOf(line.endId) > -1
+      ) {
+        dataService.deleteLine(key);
+      }
+    }
+    dataService.deletePoint(testPointId);
+  }
 }
 
 const pointService = new PointService();

+ 4 - 0
src/graphic/Service/UIService.js

@@ -150,6 +150,10 @@ export default class UIService {
     Settings.locationMode = value;
   }
 
+  getLocationMode() {
+    return Settings.locationMode;
+  }
+
   //如果position在屏幕左上角,返回的就朝向右下角,如果是右下角,则返回的是左上角。其他情况以此类推
   getNewPositionForPop(position) {
     const offset = 50;

+ 9 - 3
src/hook/useGraphic.ts

@@ -20,11 +20,17 @@ const newsletter = ref<{
 }>({ selectUI: null, focusVector: null });
 
 const changeIndex = ref(0)
-export const changeStore = () => changeIndex.value++
+export const changeStore = () => {
+  console.error("111")
+  changeIndex.value++
+}
 export const useChange = (fn: () => void) => {
+  let old
   return watchEffect(() => {
-    changeIndex.value;
-    fn()
+    if (old !== changeIndex.value) {
+      old = changeIndex.value;
+      fn()
+    }
   })
 }
 

+ 1 - 5
src/views/graphic/container.vue

@@ -16,15 +16,11 @@ import {roadPhotos} from "@/store/roadPhotos";
 import { useData } from './data'
 
 const drawCanvasRef = ref<HTMLCanvasElement>();
-const setCanvasSize = () => {
-  drawCanvasRef.value.width = drawCanvasRef.value.offsetWidth;
-  drawCanvasRef.value.height = drawCanvasRef.value.offsetHeight;
-};
+
 
 
 onMounted(() => {
   console.log(useData())
-  setCanvasSize();
   setCanvas(drawCanvasRef.value, useData());
 });
 </script>

+ 0 - 2
src/views/graphic/geos/arrow.vue

@@ -49,7 +49,6 @@ const menus = [
     text: "复制",
     onClick: () => {
       drawRef.value.uiControl.handleGeo(GeoActions.CopyAction)
-      uiType.change(UIType.Copy)
     }
   },
   {
@@ -57,7 +56,6 @@ const menus = [
     text: "删除",
     onClick: () => {
       drawRef.value.uiControl.handleGeo(GeoActions.DeleteAction)
-      uiType.change(UIType.Delete)
     }
   }
 ]

+ 0 - 1
src/views/graphic/geos/del.vue

@@ -18,7 +18,6 @@ const menus = [
     text: "删除",
     onClick: () => {
       drawRef.value.uiControl.handleGeo(GeoActions.DeleteAction)
-      uiType.change(UIType.Delete)
     }
   }
 ]

+ 1 - 1
src/views/graphic/geos/text.vue

@@ -53,6 +53,7 @@ const color = ref("#000000")
 const size = ref(18)
 
 const syncVector = ([text, size, color]) => {
+  console.log(text, size, color)
   vector.value.setValue(text)
   vector.value.setColor(color)
   vector.value.setFontSize(size)
@@ -67,7 +68,6 @@ watchEffect(() => {
 })
 
 useChange(() => {
-  console.log(vector.value)
   color.value = vector.value.color
   size.value = vector.value.fontSize
   text.value = vector.value.value

+ 16 - 0
src/views/roads/tabulation.vue

@@ -178,6 +178,22 @@ const { cssMatrix: photoCSSMatrix, matrix: photoMatrix } = useHand(
 
 
 const downMode = ref(false)
+const layoutRef = ref<HTMLDivElement>()
+const getLayoutImage = async () => {
+  downMode.value = true
+  await nextTick()
+  const canvas = await html2canvas(layoutRef.value)
+  downMode.value = false
+  const blob = await new Promise<Blob>(resolve => canvas.toBlob(resolve, "image/jpeg", 0.95))
+  return await uploadImage(blob)
+}
+const saveHandler = async () => {
+  roadPhoto.value.table = {
+    ...history.value.value,
+    url: await getLayoutImage()
+  }
+  router.replace({name: writeRouteName.roads})
+}
 
 </script>
 

+ 5 - 5
src/views/sys/menu/index.vue

@@ -4,11 +4,11 @@
     class="menu global-menu"
     :class="{ show: !isEdit, disabled: showToolbar, readonly: disabledGoto }"
   >
-    <template #first v-if="!os.isPc">
-      <div class="menu-close" @click="customMap.sysView = 'full'">
-        <ui-icon type="close"></ui-icon>
-      </div>
-    </template>
+<!--    <template #first v-if="!os.isPc">-->
+<!--      <div class="menu-close" @click="customMap.sysView = 'full'">-->
+<!--        <ui-icon type="close"></ui-icon>-->
+<!--      </div>-->
+<!--    </template>-->
 
     <template v-slot="{ raw }">
       <Item :menu="raw" :active="active" @select="gotoMenuItem">