Преглед на файлове

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

xzw преди 2 години
родител
ревизия
812203f438
променени са 39 файла, в които са добавени 842 реда и са изтрити 713 реда
  1. 1 1
      server/test/a0k4xu045_202305311600080410/attach/sceneStore
  2. 36 25
      src/components/base/assets/scss/components/_loading.scss
  3. 3 2
      src/components/base/components/loading/Loading.vue
  4. BIN
      src/components/base/components/loading/_4.gif
  5. 44 32
      src/components/group-button/index.vue
  6. 6 2
      src/graphic/CanvasStyle/default.js
  7. 3 170
      src/graphic/Controls/AddPoint.js
  8. 46 2
      src/graphic/Controls/LocationModeControl.js
  9. 89 79
      src/graphic/Controls/MoveLine.js
  10. 76 52
      src/graphic/Controls/MovePoint.js
  11. 3 1
      src/graphic/Controls/MoveText.js
  12. 6 0
      src/graphic/Controls/UIControl.js
  13. 11 2
      src/graphic/Geometry/Geometry.js
  14. 12 0
      src/graphic/Geometry/Line.js
  15. 1 9
      src/graphic/Geometry/Point.js
  16. 0 2
      src/graphic/History/History.js
  17. 24 5
      src/graphic/History/HistoryUtil.js
  18. 12 8
      src/graphic/Layer.js
  19. 27 10
      src/graphic/ListenLayer.js
  20. 32 2
      src/graphic/Load.js
  21. 57 32
      src/graphic/Renderer/Draw.js
  22. 8 6
      src/graphic/Service/CurveRoadService.js
  23. 5 3
      src/graphic/Service/DataService.js
  24. 1 2
      src/graphic/Service/LineService.js
  25. 44 26
      src/graphic/Service/PointService.js
  26. 4 0
      src/graphic/Service/RoadService.js
  27. 9 16
      src/graphic/Service/UIService.js
  28. 0 2
      src/graphic/Util/MathUtil.js
  29. 1 2
      src/graphic/enum/VectorCategory.js
  30. 6 2
      src/views/graphic/geos/road.vue
  31. 10 10
      src/views/roads/tabulation.vue
  32. 24 20
      src/views/scene/covers/basePoints.vue
  33. 60 39
      src/views/scene/covers/fixPoints.vue
  34. BIN
      src/views/scene/covers/icon/loading.zip
  35. 21 5
      src/views/scene/menus/actions.ts
  36. 88 80
      src/views/scene/menus/menus.ts
  37. 62 56
      src/views/scene/menus/pane.vue
  38. 6 8
      src/views/scene/mode.vue
  39. 4 0
      后续要继续做的内容.txt

Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
server/test/a0k4xu045_202305311600080410/attach/sceneStore


+ 36 - 25
src/components/base/assets/scss/components/_loading.scss

@@ -1,39 +1,48 @@
 .ui-loading {
-    position: absolute;
-    display: flex;
-    align-items: center;
-    justify-content: center;
-    left: 0;
-    top: 0;
-    width: 100%;
-    height: 100%;
-    overflow: hidden;
+    position        : absolute;
+    display         : flex;
+    align-items     : center;
+    justify-content : center;
+    left            : 0;
+    top             : 0;
+    width           : 100%;
+    height          : 100%;
+    overflow        : hidden;
     background-color: rgba($color: #000000, $alpha: 0.3);
-    --width: 15px;
-    --color: #fff;
+    --width         : 15px;
+    --color         : #fff;
 }
+
 .ui-loading__box {
-    position: relative;
-    width: 100px;
-    height: 100px;
-    display: flex;
-    align-items: center;
+    position       : relative;
+    width          : 50px;
+    height         : 50px;
+    display        : flex;
+    align-items    : center;
     justify-content: center;
+
+    img {
+        width: 100%;
+    }
+
     .default {
         div {
-            width: var(--width);
-            height: var(--width);
-            background: var(--color);
+            width        : var(--width);
+            height       : var(--width);
+            background   : var(--color);
             border-radius: 50%;
-            display: inline-block;
-            margin-left: calc(var(--width) * 0.6);
+            display      : inline-block;
+            margin-left  : calc(var(--width) * 0.6);
         }
+
         div:nth-child(1) {
             animation: ui-loading-default 1s -0.5s linear infinite;
         }
+
         div:nth-child(2) {
             animation: ui-loading-default 1s -0.25s linear infinite;
         }
+
         div:nth-child(3) {
             animation: ui-loading-default 1s 0s linear infinite;
         }
@@ -43,14 +52,16 @@
 @keyframes ui-loading-default {
     0% {
         transform: scale(1);
-        opacity: 1;
+        opacity  : 1;
     }
+
     50% {
         transform: scale(0.5);
-        opacity: 0.5;
+        opacity  : 0.5;
     }
+
     100% {
         transform: scale(1);
-        opacity: 0.8;
+        opacity  : 0.8;
     }
-}
+}

+ 3 - 2
src/components/base/components/loading/Loading.vue

@@ -5,11 +5,12 @@
       :style="{ zIndex, ['--width']: size + 'px', ['--color']: color }"
     >
       <div class="ui-loading__box">
-        <div class="default">
+        <img src="./_4.gif" />
+        <!-- <div class="default">
           <div></div>
           <div></div>
           <div></div>
-        </div>
+        </div> -->
       </div>
     </div>
   </teleport>

BIN
src/components/base/components/loading/_4.gif


+ 44 - 32
src/components/group-button/index.vue

@@ -5,61 +5,74 @@
       :key="menu.key"
       class="menu"
       :style="menuStyle"
-      :class="{ active: activeKey === menu.key, dire, disabled: disabledMap[menu.key], border: menu.border }"
+      :class="{
+        active: activeKey === menu.key,
+        dire,
+        disabled: disabledMap[menu.key],
+        border: menu.border,
+      }"
       @click="menu.onClick && menu.onClick(menu)"
       v-show="!menu.hide"
     >
       <template v-if="$slots.default">
         <slot :data="menu" />
       </template>
-      <ui-icon :type="menu.icon || 'close'" class="icon" v-else/>
+      <ui-icon :type="menu.icon || 'close'" class="icon" v-else />
+
       <p v-if="menu.text">{{ menu.text }}</p>
     </div>
   </ButtonPane>
 </template>
 
 <script setup lang="ts">
-import ButtonPane from '@/components/button-pane/index.vue'
+import ButtonPane from "@/components/button-pane/index.vue";
 import UiIcon from "@/components/base/components/icon/index.vue";
-import {computed} from "vue";
+import { computed } from "vue";
 
-type Menu =  {
-  key: any,
-  text?: string,
-  hide?: boolean
-  border?: boolean
-  icon?: string,
-  disabled?: boolean | (() => boolean)
-  onClick?: (menu: Menu) => void
-}
+type Menu = {
+  key: any;
+  text?: string;
+  hide?: boolean;
+  border?: boolean;
+  icon?: string;
+  disabled?: boolean | (() => boolean);
+  onClick?: (menu: Menu) => void;
+};
 
 const props = withDefaults(
-  defineProps<{ menus: Menu[], activeKey?: any, dire?: 'row' | 'column', size?: number }>(),
-  {dire: 'row', size: 64}
-)
+  defineProps<{
+    menus: Menu[];
+    activeKey?: any;
+    dire?: "row" | "column";
+    size?: number;
+  }>(),
+  { dire: "row", size: 64 }
+);
 
 const disabledMap = computed(() => {
-  const map = {}
+  const map = {};
   for (let menu of props.menus) {
-    map[menu.key] = !menu.disabled ? false :
-      typeof menu.disabled === "boolean" ? menu.disabled : menu.disabled()
+    map[menu.key] = !menu.disabled
+      ? false
+      : typeof menu.disabled === "boolean"
+      ? menu.disabled
+      : menu.disabled();
   }
-  return map
-})
+  return map;
+});
 
 const menuStyle = computed(() => {
   const offset = props.size / 4;
-  return props.dire === 'row'
+  return props.dire === "row"
     ? {
         padding: `0 10px`,
-        marginRight: '8px'
+        marginRight: "8px",
       }
-    :
-      {
+    : {
         padding: `10px 0 `,
-        marginBottom: '8px'
-      }
-})
+        marginBottom: "8px",
+      };
+});
 </script>
 
 <style lang="scss" scoped>
@@ -77,7 +90,7 @@ const menuStyle = computed(() => {
   cursor: pointer;
   height: 100%;
   text-align: center;
-  transition: color .3s ease;
+  transition: color 0.3s ease;
   color: #fff;
   border-radius: 4px;
   align-items: center;
@@ -100,7 +113,7 @@ const menuStyle = computed(() => {
   }
 
   &.active {
-    background: rgba(255, 255, 255, 0.1);;
+    background: rgba(255, 255, 255, 0.1);
   }
 
   .icon {
@@ -108,7 +121,6 @@ const menuStyle = computed(() => {
     align-items: center;
     justify-content: center;
     font-size: 20px;
-
   }
 
   p {
@@ -117,7 +129,7 @@ const menuStyle = computed(() => {
     margin-top: 4px;
     line-height: 17px;
     font-size: 14px;
-    white-space:nowrap;
+    white-space: nowrap;
   }
 }
 </style>

+ 6 - 2
src/graphic/CanvasStyle/default.js

@@ -84,8 +84,7 @@ const Point = {
 const NormalPoint = {
   ...Point,
   fillStyle: "#fff",
-
-}
+};
 
 const RoadPoint = {
   ...Point,
@@ -233,12 +232,17 @@ export default {
   MeasureLine,
   FreeMeasureLine: MeasureLine,
   PositionLine: MeasureLine,
+  LocationLineByFixPoint: MeasureLine,
+  LocationLineByBasePoint: MeasureLine,
   NormalPoint,
   Measure,
   Element,
   TestPoint,
   RoadPoint,
   GuidePositionLine,
+  ExtendedPositionLine: GuidePositionLine,
+  GuideLocationLine: GuidePositionLine,
+
   SingleArrowLine,
   DoubleArrowLine,
   BasePoint,

+ 3 - 170
src/graphic/Controls/AddPoint.js

@@ -12,74 +12,15 @@ import VectorType from "../enum/VectorType";
 import Constant from "../Constant";
 import { listenLayer } from "../ListenLayer";
 import { textService } from "../Service/TextService";
+import { uiService } from "../Service/UIService";
 
 export default class AddPoint {
   constructor() {
     this.testPointIds = []; //所有待测点
   }
 
-  buildPoint(position) {
-    //只有一个基准点的时候,测量的时候自动选择基准点
-    if (
-      (Settings.selectLocationMode == Constant.angleLocationMode ||
-        Settings.selectLocationMode == Constant.allLocationMode) &&
-      Settings.basePointIds.length == 1
-    ) {
-      Settings.selectBasePointId = Settings.basePointIds[0];
-    }
-    let newPoint;
-    if (Settings.selectPointCategory == VectorCategory.Point.BasePoint) {
-      newPoint = pointService.create(position);
-      Settings.selectBasePointId = newPoint.vectorId;
-    } else {
-      if (
-        Settings.selectBasePointId != null &&
-        Settings.selectLocationMode == Constant.angleLocationMode
-      ) {
-        newPoint = pointService.create(position);
-        this.setLocationByAngle(newPoint.vectorId);
-        newPoint.setLocationMode(Constant.angleLocationMode);
-        stateService.setEventName(LayerEvents.AddPoint);
-      } else if (
-        Settings.selectBasePointId != null &&
-        Settings.selectLocationMode == Constant.allLocationMode
-      ) {
-        newPoint = pointService.create(position);
-        this.setLocationByAll(newPoint.vectorId);
-        newPoint.setLocationMode(Constant.allLocationMode);
-        stateService.setEventName(LayerEvents.AddPoint);
-      } else if (
-        Settings.baseLineId != null &&
-        Settings.selectLocationMode == Constant.normalLocationMode
-      ) {
-        newPoint = pointService.create(position);
-        this.setLocationByNormal(newPoint.vectorId);
-        newPoint.setLocationMode(Constant.normalLocationMode);
-
-        stateService.setEventName(LayerEvents.AddPoint);
-      } else if (
-        Settings.selectBasePointId == null &&
-        (Settings.selectLocationMode == Constant.angleLocationMode ||
-          Settings.selectLocationMode == Constant.allLocationMode)
-      ) {
-        return null;
-      }
-      if (
-        newPoint &&
-        (newPoint.getLocationMode() == Constant.allLocationMode ||
-          newPoint.getLocationMode() == Constant.angleLocationMode ||
-          newPoint.getLocationMode() == Constant.normalLocationMode) &&
-        newPoint.getCategory() == VectorCategory.Point.TestPoint
-      ) {
-        this.testPointIds.push(newPoint.vectorId);
-      }
-    }
-    listenLayer.clear();
-    return newPoint;
-  }
-
   //添加固定点/基准点
-  buildPoint2(position) {
+  buildPoint(position) {
     let newPoint = null;
     if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedPointId) {
       return null;
@@ -96,6 +37,7 @@ export default class AddPoint {
       newPoint.linkedTextId = textVector.vectorId;
       textVector.linkedPointId = newPoint.vectorId;
     }
+    uiService.setSelectPointCategory(VectorCategory.Point.NormalPoint);
     listenLayer.clear();
     return newPoint;
   }
@@ -110,115 +52,6 @@ export default class AddPoint {
     return null;
   }
 
-  //直角定位法
-  setLocationByAngle(testPointId) {
-    let basePoint = this.isFocusBasePoint();
-    if (!basePoint) {
-      return;
-    }
-    let testPoint = dataService.getPoint(testPointId);
-    if (testPoint.getCategory() != VectorCategory.Point.TestPoint) {
-      return;
-    }
-    testPoint.setLinkedBasePointId(basePoint.vectorId);
-    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);
-    join = pointService.create(join);
-    join.setCategory(VectorCategory.Point.TestBasePoint);
-    join.setLocationMode(Constant.angleLocationMode);
-    join.setLinkedBasePointId(basePoint.vectorId);
-    join.setLinkedTestPointId(testPointId);
-    let guidePositionLine = lineService.createByPointId(
-      testPointId,
-      join.vectorId,
-      VectorCategory.Line.GuidePositionLine
-    );
-
-    let positionLine = lineService.createByPointId(
-      basePoint.vectorId,
-      join.vectorId,
-      VectorCategory.Line.PositionLine
-    );
-    guidePositionLine.setLocationMode(Constant.angleLocationMode);
-    positionLine.setLocationMode(Constant.angleLocationMode);
-    join.setCategory(VectorCategory.Point.TestBasePoint);
-  }
-
-  //综合定位法
-  setLocationByAll(testPointId) {
-    let basePoint = this.isFocusBasePoint();
-    if (!basePoint) {
-      return;
-    }
-
-    let testPoint = dataService.getPoint(testPointId);
-    testPoint.setLinkedBasePointId(basePoint.vectorId);
-    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);
-    join = pointService.create(join); //经过待测点且与基准线垂直的线段,与基准线的交点
-    join.setCategory(VectorCategory.Point.TestBasePoint);
-    join.setLocationMode(Constant.allLocationMode);
-    join.setLinkedBasePointId(basePoint.vectorId);
-    join.setLinkedTestPointId(testPointId);
-    //待测点与基准线的垂直线
-    lineService.createByPointId(
-      testPointId,
-      join.vectorId,
-      VectorCategory.Line.PositionLine
-    );
-    //暂时没有其他待测点
-    if (this.testPointIds.length == 0) {
-      //待测点与基准线点的连线
-      lineService.createByPointId(
-        basePoint.vectorId,
-        testPointId,
-        VectorCategory.Line.PositionLine
-      );
-    } else {
-      //取上一个待测点
-      lineService.createByPointId(
-        this.testPointIds[this.testPointIds.length - 1],
-        testPointId,
-        VectorCategory.Line.PositionLine
-      );
-      testPoint.setLinkedTestPointId(
-        this.testPointIds[this.testPointIds.length - 1]
-      );
-    }
-  }
-
-  setLocationByNormal(testPointId) {
-    let testPoint = dataService.getPoint(testPointId);
-    if (testPoint.getCategory() != VectorCategory.Point.TestPoint) {
-      return;
-    }
-    if (!Settings.baseLineId) {
-      return;
-    }
-    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.getIntersectionPoint(vLine, line);
-    join = pointService.create(join);
-    join.setCategory(VectorCategory.Point.TestBasePoint);
-    join.setLocationMode(Constant.normalLocationMode);
-    join.setLinkedTestPointId(testPointId);
-    lineService.createByPointId(
-      testPointId,
-      join.vectorId,
-      VectorCategory.Line.PositionLine
-    );
-  }
-
   deleteTestPoints() {
     for (let i = 0; i < this.testPointIds.length; ++i) {
       pointService.deletePoint(this.testPointIds[i]);

+ 46 - 2
src/graphic/Controls/LocationModeControl.js

@@ -7,6 +7,7 @@ import { lineService } from "../Service/LineService";
 import { pointService } from "../Service/PointService";
 import VectorCategory from "../enum/VectorCategory";
 import Constant from "../Constant";
+import { uiService } from "../Service/UIService";
 
 export default class LocationModeControl {
   constructor() {}
@@ -15,6 +16,7 @@ export default class LocationModeControl {
   setAngle() {
     let selectBasePoint = this.isFocusBasePoint();
     if (selectBasePoint) {
+      this.deleteOldLines();
       let points = dataService.getPoints();
       for (let key in points) {
         let point = dataService.getPoint(key);
@@ -37,11 +39,14 @@ export default class LocationModeControl {
     let startPoint = dataService.getPoint(baseLine.startId);
     let endPoint = dataService.getPoint(baseLine.endId);
 
+    fixPoint.linkedBasePointId = basePoint.vectorId;
+
     let baseLineGeometry = mathUtil.createLine1(startPoint, endPoint);
     let vLine = mathUtil.getVerticalLine(baseLineGeometry, fixPoint);
-    let join = mathUtil.getJoinLinePoint(basePoint, vLine);
+    let join = mathUtil.getIntersectionPoint(baseLineGeometry, vLine); //固定点到基准线的垂直线与基准线的交点
     join = pointService.create(join);
     join.setLocationMode(Constant.angleLocationMode);
+    join.setCategory(VectorCategory.Point.TestBasePoint);
 
     let locationLineByFixPoint = lineService.createByPointId(
       fixPointId,
@@ -49,17 +54,23 @@ export default class LocationModeControl {
       VectorCategory.Line.LocationLineByFixPoint
     );
     locationLineByFixPoint.setLocationMode(Constant.angleLocationMode);
+    locationLineByFixPoint.setLinkedBasePointId(basePointId);
+    locationLineByFixPoint.setLinkedFixPointId(fixPointId);
 
-    let locationLineByBasePoint = mathUtil.getVerticalLine(vLine, basePoint);
+    let locationLineByBasePoint = mathUtil.getVerticalLine(vLine, basePoint); //基准点1条垂直线的垂直线
     join = mathUtil.getIntersectionPoint(locationLineByBasePoint, vLine);
     join = pointService.create(join);
     join.setLocationMode(Constant.angleLocationMode);
+    join.setCategory(VectorCategory.Point.TestBasePoint);
+
     locationLineByBasePoint = lineService.createByPointId(
       basePointId,
       join.vectorId,
       VectorCategory.Line.LocationLineByBasePoint
     );
     locationLineByBasePoint.setLocationMode(Constant.angleLocationMode);
+    locationLineByBasePoint.setLinkedBasePointId(basePointId);
+    locationLineByBasePoint.setLinkedFixPointId(fixPointId);
 
     let guideLocationLine = lineService.createByPointId(
       fixPointId,
@@ -67,6 +78,8 @@ export default class LocationModeControl {
       VectorCategory.Line.GuideLocationLine
     );
     guideLocationLine.setLocationMode(Constant.angleLocationMode);
+    guideLocationLine.setLinkedBasePointId(basePointId);
+    guideLocationLine.setLinkedFixPointId(fixPointId);
   }
 
   /******************************************************************************************************************************************************/
@@ -77,6 +90,23 @@ export default class LocationModeControl {
   /******************************************************************************************************************************************************/
 
   isFocusBasePoint() {
+    let basePointCount = 0;
+    let selectBasePointId = null;
+    if (!Settings.selectBasePointId) {
+      let points = dataService.getPoints();
+      for (let key in points) {
+        let point = dataService.getPoint(key);
+        if (point.getCategory() == VectorCategory.Point.BasePoint) {
+          ++basePointCount;
+          selectBasePointId = key;
+        }
+      }
+    }
+
+    if (basePointCount == 1) {
+      uiService.setSelectBasePointId(selectBasePointId);
+    }
+
     if (Settings.selectBasePointId) {
       let point = dataService.getPoint(Settings.selectBasePointId);
       if (point.getCategory() == VectorCategory.Point.BasePoint) {
@@ -85,6 +115,20 @@ export default class LocationModeControl {
     }
     return null;
   }
+
+  //设置定位法前,需要删除和定位法相关的线条
+  deleteOldLines() {
+    let lines = dataService.getLines();
+    for (let key in lines) {
+      let line = dataService.getLine(key);
+      if (
+        line.getLinkedFixPointId() != null ||
+        line.getLinkedBasePointId() != null
+      ) {
+        dataService.deleteLine(key);
+      }
+    }
+  }
 }
 
 const locationModeControl = new LocationModeControl();

+ 89 - 79
src/graphic/Controls/MoveLine.js

@@ -1,91 +1,18 @@
 import Constant from "../Constant";
+import Settings from "../Settings";
+
 import { dataService } from "../Service/DataService";
 import { lineService } from "../Service/LineService";
 import { pointService } from "../Service/PointService";
 import { movePoint } from "./MovePoint";
 import { mathUtil } from "../Util/MathUtil";
 import VectorCategory from "../enum/VectorCategory";
+import { locationModeControl } from "./LocationModeControl";
+import { uiService } from "../Service/UIService";
 
 export default class MoveLine {
   constructor() {}
 
-  // moveLine(lineId, dx, dy) {
-  //   dx = dx;
-  //   dy = -dy;
-  //   let line = dataService.getLine(lineId);
-  //   let startPoint = dataService.getPoint(line.startId);
-  //   let endPoint = dataService.getPoint(line.endId);
-
-  //   //垂直移动
-  //   if (line.getCategory() == VectorCategory.Line.PositionLine && line.getLocationMode() == Constant.angleLocationMode) {
-  //     let point1 = {
-  //       x: startPoint.x + dx,
-  //       y: startPoint.y + dy,
-  //     };
-  //     let point2 = {
-  //       x: endPoint.x + dx,
-  //       y: endPoint.y + dy,
-  //     };
-  //     let lineGeometry = mathUtil.createLine1(point1, point2);
-  //     point1 = mathUtil.getJoinLinePoint(startPoint, lineGeometry);
-  //     //startPoint本来是基准点
-  //     if (startPoint.getCategory() == VectorCategory.Point.BasePoint) {
-  //       //达到一定距离才能移动
-  //       if (mathUtil.getDistance(startPoint, point1) < Constant.minAdsorbPix) {
-  //         return false;
-  //       }
-  //       let newStartPoint = pointService.create(point1);
-  //       let extendedPositionLine = lineService.createByPointId(startPoint.vectorId, newStartPoint.vectorId, VectorCategory.Line.ExtendedPositionLine);
-  //       extendedPositionLine.setLocationMode(Constant.angleLocationMode);
-  //       dataService.deletePointParent(startPoint.vectorId, lineId);
-  //       line.startId = newStartPoint.vectorId;
-  //       newStartPoint.setPointParent(line.vectorId, 'start');
-  //       newStartPoint.setCategory(VectorCategory.Point.TestBasePoint);
-  //     } else {
-  //       startPoint.x = point1.x;
-  //       startPoint.y = point1.y;
-  //       let parents = Object.keys(startPoint.parent);
-  //       let extendedLine = dataService.getLine(parents[0]);
-  //       if (extendedLine.getCategory() != VectorCategory.Line.ExtendedPositionLine) {
-  //         extendedLine = dataService.getLine(parents[1]);
-  //       }
-  //       if (extendedLine.getCategory() == VectorCategory.Line.ExtendedPositionLine) {
-  //         //point1是基准点
-  //         point1 = dataService.getPoint(extendedLine.startId);
-  //         point2 = dataService.getPoint(extendedLine.endId);
-  //         if (mathUtil.getDistance(point1, point2) < Constant.minAdsorbPix) {
-  //           dataService.deleteLine(extendedLine.vectorId);
-  //           dataService.deletePoint(extendedLine.endId);
-
-  //           line.startId = point1.vectorId;
-  //           point1.setPointParent(line.vectorId, 'start');
-
-  //           lineGeometry = mathUtil.createLine3(lineGeometry, point1);
-  //         }
-  //       }
-  //     }
-
-  //     point2 = mathUtil.getJoinLinePoint(endPoint, lineGeometry);
-  //     endPoint.x = point2.x;
-  //     endPoint.y = point2.y;
-  //   } else {
-  //     //综合定位和垂线定位,拖动基准线更新位置
-  //     if (line.getCategory() == VectorCategory.Line.BaseLine) {
-  //       let points = dataService.vectorData.points;
-  //       for (let key in points) {
-  //         if (points[key].category == VectorCategory.Point.TestPoint && (points[key].locationMode == Constant.allLocationMode || points[key].locationMode == Constant.normalLocationMode)) {
-  //           movePoint.updatePositionByTestPoint(points[key].vectorId);
-  //         }
-  //       }
-  //     }
-  //     startPoint.x += dx;
-  //     startPoint.y += dy;
-  //     endPoint.x += dx;
-  //     endPoint.y += dy;
-  //   }
-  //   return true;
-  // }
-
   moveLine(lineId, dx, dy) {
     dx = dx;
     dy = -dy;
@@ -93,10 +20,16 @@ export default class MoveLine {
     let startPoint = dataService.getPoint(line.startId);
     let endPoint = dataService.getPoint(line.endId);
 
+    let baseLine = dataService.getLine(Settings.baseLineId);
+    if (baseLine) {
+      let baseStartPoint = dataService.getPoint(baseLine.startId);
+      let baseEndPoint = dataService.getPoint(baseLine.endId);
+      baseLine = mathUtil.createLine1(baseStartPoint, baseEndPoint);
+    }
+
     //垂直移动,直角定位法只支持定位线的拖拽
     if (
-      (line.getCategory() == VectorCategory.Line.LocationLineByFixPoint ||
-        line.getCategory() == VectorCategory.Line.LocationLineByBasePoint) &&
+      line.getCategory() == VectorCategory.Line.LocationLineByBasePoint &&
       line.getLocationMode() == Constant.angleLocationMode
     ) {
       let point1 = {
@@ -122,6 +55,9 @@ export default class MoveLine {
           VectorCategory.Line.ExtendedPositionLine
         );
         extendedPositionLine.setLocationMode(Constant.angleLocationMode);
+        extendedPositionLine.setLinkedBasePointId(line.getLinkedBasePointId());
+        extendedPositionLine.setLinkedFixPointId(line.getLinkedFixPointId());
+
         dataService.deletePointParent(startPoint.vectorId, lineId);
         line.startId = newStartPoint.vectorId;
         newStartPoint.setPointParent(line.vectorId, "start");
@@ -157,6 +93,75 @@ export default class MoveLine {
       point2 = mathUtil.getJoinLinePoint(endPoint, lineGeometry);
       endPoint.x = point2.x;
       endPoint.y = point2.y;
+    } else if (
+      line.getCategory() == VectorCategory.Line.LocationLineByFixPoint &&
+      line.getLocationMode() == Constant.angleLocationMode
+    ) {
+      let point1 = {
+        x: startPoint.x + dx,
+        y: startPoint.y + dy,
+      };
+      let point2 = {
+        x: endPoint.x + dx,
+        y: endPoint.y + dy,
+      };
+      let lineGeometry = mathUtil.createLine1(point1, point2);
+      point1 = mathUtil.getJoinLinePoint(startPoint, lineGeometry);
+      if (startPoint.getCategory() == VectorCategory.Point.FixPoint) {
+        //达到一定距离才能移动
+        if (mathUtil.getDistance(startPoint, point1) < Constant.minAdsorbPix) {
+          return false;
+        }
+        let newStartPoint = pointService.create(point1);
+        let extendedPositionLine = lineService.createByPointId(
+          startPoint.vectorId,
+          newStartPoint.vectorId,
+          VectorCategory.Line.ExtendedPositionLine
+        );
+        extendedPositionLine.setLocationMode(Constant.angleLocationMode);
+        extendedPositionLine.setLinkedBasePointId(line.getLinkedBasePointId());
+        extendedPositionLine.setLinkedFixPointId(line.getLinkedFixPointId());
+
+        dataService.deletePointParent(startPoint.vectorId, lineId);
+        line.startId = newStartPoint.vectorId;
+        newStartPoint.setPointParent(line.vectorId, "start");
+        newStartPoint.setCategory(VectorCategory.Point.TestBasePoint);
+        let join = mathUtil.getIntersectionPoint(lineGeometry, baseLine);
+        mathUtil.clonePoint(endPoint, join);
+      } else {
+        let extendedPositionLine = mathUtil.createLine3(baseLine, startPoint);
+        let join = mathUtil.getIntersectionPoint(
+          lineGeometry,
+          extendedPositionLine
+        );
+        mathUtil.clonePoint(startPoint, join);
+        join = mathUtil.getIntersectionPoint(lineGeometry, baseLine);
+        mathUtil.clonePoint(endPoint, join);
+
+        let parent = startPoint.getParent();
+        for (let key in parent) {
+          if (key == lineId) {
+            continue;
+          } else {
+            extendedPositionLine = dataService.getLine(key);
+          }
+        }
+        startPoint = dataService.getPoint(extendedPositionLine.startId);
+        if (mathUtil.getDistance(point1, startPoint) < Constant.minAdsorbPix) {
+          let otherPointId = extendedPositionLine.getOtherPointId(
+            startPoint.vectorId
+          );
+          let otherPoint = dataService.getPoint(otherPointId);
+          if (startPoint.getCategory() == VectorCategory.Point.FixPoint) {
+            dataService.deleteLine(extendedPositionLine.vectorId);
+            dataService.deletePoint(otherPoint.vectorId);
+            line.startId = startPoint.vectorId;
+            startPoint.setPointParent(line.vectorId, "start");
+          }
+          join = mathUtil.getJoinLinePoint(startPoint, baseLine);
+          mathUtil.clonePoint(endPoint, join);
+        }
+      }
     } else {
       //综合定位和垂线定位,拖动基准线更新位置
       //缺
@@ -164,6 +169,11 @@ export default class MoveLine {
       startPoint.y += dy;
       endPoint.x += dx;
       endPoint.y += dy;
+      if (line.getCategory() == VectorCategory.Line.BaseLine) {
+        if (uiService.getSelectLocationMode() == Constant.angleLocationMode) {
+          locationModeControl.setAngle();
+        }
+      }
     }
     return true;
   }

+ 76 - 52
src/graphic/Controls/MovePoint.js

@@ -6,60 +6,31 @@ import VectorCategory from "../enum/VectorCategory";
 import { listenLayer } from "../ListenLayer";
 import { uiService } from "../Service/UIService";
 import { mathUtil } from "../Util/MathUtil";
+import { moveText } from "./MoveText";
+import { locationModeControl } from "./LocationModeControl";
 
 export default class MovePoint {
   constructor() {}
-
   movePoint(position, pointId) {
     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);
+    if (point.getCategory() == VectorCategory.Point.BasePoint) {
+      this.updateBasePoint(position, pointId);
+    } else if (point.getCategory() == VectorCategory.Point.FixPoint) {
+      this.updateFixPoint(position, pointId);
     } else {
+      point.x = position.x;
+      point.y = position.y;
       let parent = point.getParent();
-      for (let key in parent) {
-        let line = dataService.getLine(key);
-        line.setValue(null);
-        //拖拽的点是基准线
-        if (line.category == VectorCategory.Line.BaseLine) {
-          let points = dataService.getPoints();
-          for (let key in points) {
-            let testPoint = dataService.getPoint(key);
-            if (testPoint.category == VectorCategory.Point.TestPoint) {
-              this.updatePositionByTestPoint(key);
-            }
-          }
+      let line = dataService.getLine(Object.keys(parent)[0]);
+      if (line.getCategory() == VectorCategory.Line.BaseLine) {
+        if (uiService.getSelectLocationMode() == Constant.angleLocationMode) {
+          locationModeControl.setAngle();
         }
       }
     }
   }
 
   finish(pointId) {
-    // if (
-    //   pointId &&
-    //   listenLayer.modifyPoint &&
-    //   listenLayer.modifyPoint.linkedPointId
-    // ) {
-    //   let linkedPoint = dataService.getPoint(
-    //     listenLayer.modifyPoint.linkedPointId
-    //   );
-    //   const category = linkedPoint.getCategory();
-    //   if (
-    //     category != VectorCategory.Point.BasePoint &&
-    //     category != VectorCategory.Point.TestBasePoint &&
-    //     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;
-    //   }
-    // }
     if (
       pointId &&
       listenLayer.modifyPoint &&
@@ -71,8 +42,7 @@ export default class MovePoint {
       const category = linkedPoint.getCategory();
       if (
         category != VectorCategory.Point.BasePoint &&
-        category != VectorCategory.Point.TestBasePoint &&
-        category != VectorCategory.Point.TestPoint
+        category != VectorCategory.Point.TestBasePoint
       ) {
         pointService.mergePoint(pointId, listenLayer.modifyPoint.linkedPointId);
         Settings.selectBasePointId = null;
@@ -99,7 +69,6 @@ export default class MovePoint {
       if (point.getCategory() == VectorCategory.Point.TestBasePoint) {
         if (
           point.getLinkedBasePointId() == basePointId &&
-          point.getLinkedTestPointId() == testPointId &&
           point.getLocationMode() == locationMode
         ) {
           return point;
@@ -213,17 +182,72 @@ export default class MovePoint {
     mathUtil.clonePoint(testBasePoint, join);
   }
 
-  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
+  updateBasePoint(position, basePointId) {
+    let lineGeometry = dataService.getLine(Settings.baseLineId);
+    let startPoint = dataService.getPoint(lineGeometry.startId);
+    let endPoint = dataService.getPoint(lineGeometry.endId);
+    lineGeometry = mathUtil.createLine1(startPoint, endPoint);
+    let basePoint = dataService.getPoint(basePointId);
+    let parent = basePoint.getParent();
+    for (let key in parent) {
+      let line = dataService.getLine(key);
+      if (line.getCategory() == VectorCategory.Line.LocationLineByBasePoint) {
+        let otherPointId = line.getOtherPointId(basePointId);
+        let otherPoint = dataService.getPoint(otherPointId);
+        let otherLine = mathUtil.getLineForPoint(lineGeometry, otherPoint);
+        line = mathUtil.createLine3(lineGeometry, position);
+        let join = mathUtil.getIntersectionPoint(line, otherLine);
+        mathUtil.clonePoint(otherPoint, join);
+        mathUtil.clonePoint(basePoint, position);
+      } else if (
+        line.getCategory() == VectorCategory.Line.ExtendedPositionLine
+      ) {
+        let otherPointId = line.getOtherPointId(basePointId);
+        let otherPoint = dataService.getPoint(otherPointId);
+        let otherLine = mathUtil.createLine3(lineGeometry, otherPoint);
+        let join = mathUtil.getJoinLinePoint(position, otherLine);
+        mathUtil.clonePoint(otherPoint, join);
+        mathUtil.clonePoint(basePoint, position);
+      }
+    }
+  }
+
+  updateFixPoint(position, fixPointId) {
+    let fixPoint = dataService.getPoint(fixPointId);
+    let basePoint = dataService.getPoint(fixPoint.linkedBasePointId);
+    let baseLine = dataService.getLine(Settings.baseLineId);
+    let startPoint = dataService.getPoint(baseLine.startId);
+    let endPoint = dataService.getPoint(baseLine.endId);
+
+    let baseLineGeometry = mathUtil.createLine1(startPoint, endPoint);
+    let vLine = mathUtil.getVerticalLine(baseLineGeometry, position);
+    let join = mathUtil.getIntersectionPoint(baseLineGeometry, vLine);
+
+    let parent = fixPoint.getParent();
+    for (let key in parent) {
+      let line = dataService.getLine(key);
+      if (line.getCategory() == VectorCategory.Line.LocationLineByFixPoint) {
+        let otherPointId = line.getOtherPointId(fixPointId);
+        let otherPoint = dataService.getPoint(otherPointId);
+        mathUtil.clonePoint(otherPoint, join);
+        moveText.moveFullText(position, fixPoint.linkedTextId);
+      } else if (line.getCategory() == VectorCategory.Line.GuideLocationLine) {
+        let otherPointId = line.getOtherPointId(fixPointId);
+        let otherPoint = dataService.getPoint(otherPointId);
+        let line2 = mathUtil.createLine3(baseLineGeometry, otherPoint);
+        join = mathUtil.getIntersectionPoint(line2, vLine);
+        mathUtil.clonePoint(otherPoint, join);
+      } else if (
+        line.getCategory() == VectorCategory.Line.ExtendedPositionLine
       ) {
-        this.updatePositionByTestPoint(key);
+        let otherPointId = line.getOtherPointId(fixPointId);
+        let otherPoint = dataService.getPoint(otherPointId);
+        let line2 = mathUtil.createLine3(baseLineGeometry, fixPoint);
+        join = mathUtil.getJoinLinePoint(otherPoint, line2);
+        mathUtil.clonePoint(otherPoint, join);
       }
     }
+    mathUtil.clonePoint(fixPoint, position);
   }
 
   /*****************************************************************************曲线上的点********************************************************************************/

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

@@ -6,7 +6,9 @@ export default class MoveText {
 
   moveFullText(position, textId) {
     let text = dataService.getText(textId);
-    mathUtil.clonePoint(text.center, position);
+    if (text) {
+      mathUtil.clonePoint(text.center, position);
+    }
   }
 }
 

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

@@ -30,6 +30,7 @@ import Message from "@/components/base/components/message/message.vue";
 import { pointService } from "../Service/PointService.js";
 import Settings from "../Settings.js";
 import { addPoint } from "./AddPoint.js";
+import { locationModeControl } from "./LocationModeControl.js";
 import { curveRoadPointService } from "../Service/CurveRoadPointService.js";
 import { roadService } from "../Service/RoadService.js";
 import { curveRoadService } from "../Service/CurveRoadService.js";
@@ -115,6 +116,11 @@ export default class UIControl {
           stateService.setEventName(LayerEvents.AddRoadTemplate);
         } else if (uiService.isBelongRoadStructure(selectUI)) {
           stateService.setEventName(LayerEvents.AddRoadStructure);
+        } else if (selectUI == Constant.angleLocationMode) {
+          uiService.setSelectLocationMode(Constant.angleLocationMode);
+          locationModeControl.setAngle();
+          this.layer.history.save();
+          this.layer.renderer.autoRedraw();
         }
       }
     }

+ 11 - 2
src/graphic/Geometry/Geometry.js

@@ -134,11 +134,20 @@ export default class Geometry {
     this.locationMode = value;
   }
 
+  getLinkedBasePointId() {
+    return this.linkedBasePointId;
+  }
+
   setLinkedBasePointId(id) {
     this.linkedBasePointId = id;
   }
-  setLinkedTestPointId(id) {
-    this.linkedTestPointId = id;
+
+  getLinkedFixPointId() {
+    return this.linkedFixPointId;
+  }
+
+  setLinkedFixPointId(id) {
+    this.linkedFixPointId = id;
   }
 
   getLocationMode() {

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

@@ -13,6 +13,8 @@ export default class Line extends Geometry {
     this.endId = endId;
     this.category = Settings.selectLineCategory;
     this.locationMode = null;
+    this.linkedFixPointId = null;
+    this.linkedBasePointId = null;
     this.color = Style.SingleArrowLine.strokeStyle; //箭头类型会用到
     this.value = null; //测量线会用到
     this.geoType = VectorType.Line;
@@ -37,4 +39,14 @@ export default class Line extends Geometry {
       return null;
     }
   }
+
+  getOtherPointId(pointId) {
+    if (this.startId == pointId) {
+      return this.endId;
+    } else if (this.endId == pointId) {
+      return this.startId;
+    } else {
+      return null;
+    }
+  }
 }

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

@@ -10,8 +10,8 @@ export default class Point extends Geometry {
     this.y = null;
     this.parent = {};
     this.linkedBasePointId = null; //关联基准点
-    this.linkedTestPointId = null; //关联待测点
     this.locationMode = null; //如果该点是待测点,采用的定位法是哪种
+    this.linkedTextId = null; //固定点,关联文本
     this.category = Settings.selectPointCategory;
     this.geoType = VectorType.Point;
     this.setId(vectorId);
@@ -32,14 +32,6 @@ export default class Point extends Geometry {
     this.linkedBasePointId = pointId;
   }
 
-  setLinkedTestPointId(pointId) {
-    this.linkedTestPointId = pointId;
-  }
-
-  getLinkedTestPointId() {
-    return this.linkedTestPointId;
-  }
-
   //基准点:BasePoint
   setCategory(value) {
     if (!value) {

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

@@ -134,7 +134,6 @@ export default class History {
         let point = pointService.create(item.point, item.point.id);
         point.setCategory(item.point.category);
         point.setLinkedBasePointId(item.point.linkedBasePointId);
-        point.setLinkedTestPointId(item.point.linkedTestPointId);
         point.setLocationMode(item.point.locationMode);
         point.parent = JSON.parse(JSON.stringify(item.point.parent));
       } else if (item.handle == HistoryEvents.ModifyPoint) {
@@ -482,7 +481,6 @@ export default class History {
         let newPoint = pointService.create(item.point, item.point.id);
         newPoint.setCategory(item.point.category);
         newPoint.setLinkedBasePointId(item.point.linkedBasePointId);
-        newPoint.setLinkedTestPointId(item.point.linkedTestPointId);
         newPoint.setLocationMode(item.point.locationMode);
         historyUtil.assignPointFromPoint(newPoint, item.point);
       } else if (item.handle == HistoryEvents.DeletePoint) {

+ 24 - 5
src/graphic/History/HistoryUtil.js

@@ -15,7 +15,7 @@ export default class HistoryUtil {
       point1.category == point2.category &&
       point1.locationMode == point2.locationMode &&
       point1.linkedBasePointId == point2.linkedBasePointId &&
-      point1.linkedTestPointId == point2.linkedTestPointId
+      point1.linkedTextId == point2.linkedTextId
     ) {
       return false;
     } else {
@@ -29,6 +29,8 @@ export default class HistoryUtil {
       line1.endId == line2.endId &&
       line1.category == line2.category &&
       line1.locationMode == line2.locationMode &&
+      line1.linkedFixPointId == line2.linkedFixPointId &&
+      line1.linkedBasePointId == line2.linkedBasePointId &&
       line1.style == line2.style &&
       line1.weight == line2.weight
     ) {
@@ -82,7 +84,8 @@ export default class HistoryUtil {
       text1.value == text2.value &&
       text1.angle == text2.angle &&
       text1.fontSize == text2.fontSize &&
-      text1.color == text2.color
+      text1.color == text2.color &&
+      text1.linkedTextId == text2.linkedTextId
     ) {
       return false;
     } else {
@@ -342,7 +345,7 @@ export default class HistoryUtil {
     pointInfo.parent = JSON.parse(JSON.stringify(point2.parent));
     pointInfo.locationMode = point2.locationMode;
     pointInfo.linkedBasePointId = point2.linkedBasePointId;
-    pointInfo.linkedTestPointId = point2.linkedTestPointId;
+    pointInfo.linkedTextId == point2.linkedTextId;
     pointInfo.category = point2.category;
     this.setPointInfo(pointInfo);
   }
@@ -354,6 +357,8 @@ export default class HistoryUtil {
     lineInfo.end = line2.end;
     lineInfo.category = line2.category;
     lineInfo.locationMode = line2.locationMode;
+    lineInfo.linkedFixPointId = line2.linkedFixPointId;
+    lineInfo.linkedBasePointId = line2.linkedBasePointId;
     lineInfo.value = line2.value;
     lineInfo.style = line2.style;
     lineInfo.weight = line2.weight;
@@ -398,6 +403,7 @@ export default class HistoryUtil {
     textInfo.angle = text2.angle;
     textInfo.color = text2.color;
     textInfo.fontSize = text2.fontSize;
+    textInfo.linkedPointId = text2.linkedPointId;
     this.setTextInfo(textInfo);
   }
 
@@ -520,6 +526,9 @@ export default class HistoryUtil {
       curveRoadInfo.singleCurveRoadWidth = curveRoad2.singleCurveRoadWidth;
       curveRoadInfo.singleCurveRoadDrivewayCount =
         curveRoad2.singleCurveRoadDrivewayCount;
+      curveRoadInfo.singleLanes = JSON.parse(
+        JSON.stringify(curveRoad2.singleLanes)
+      );
       curveRoadInfo.singleLanesCurves = JSON.parse(
         JSON.stringify(curveRoad2.singleLanesCurves)
       );
@@ -537,6 +546,12 @@ export default class HistoryUtil {
       curveRoadInfo.rightLanesCurves = JSON.parse(
         JSON.stringify(curveRoad2.rightLanesCurves)
       );
+      curveRoadInfo.leftLanes = JSON.parse(
+        JSON.stringify(curveRoad2.leftLanes)
+      );
+      curveRoadInfo.rightLanes = JSON.parse(
+        JSON.stringify(curveRoad2.rightLanes)
+      );
     }
     curveRoadInfo.points = [];
     for (let i = 0; i < curveRoad2.points.length; ++i) {
@@ -589,7 +604,6 @@ export default class HistoryUtil {
     data.category = point.category;
     data.locationMode = point.locationMode;
     data.linkedBasePointId = point.linkedBasePointId;
-    data.linkedTestPointId = point.linkedTestPointId;
     data.type = point.geoType;
     return data;
   }
@@ -601,6 +615,8 @@ export default class HistoryUtil {
     data.end = line.endId;
     data.category = line.category;
     data.locationMode = line.locationMode;
+    data.linkedFixPointId = line.linkedFixPointId;
+    data.linkedBasePointId = line.linkedBasePointId;
     data.type = line.geoType;
     data.style = line.style;
     data.weight = line.weight;
@@ -827,7 +843,7 @@ export default class HistoryUtil {
     point.category = pointInfo.category;
     point.locationMode = pointInfo.locationMode;
     point.linkedBasePointId = pointInfo.linkedBasePointId;
-    point.linkedTestPointId = pointInfo.linkedTestPointId;
+    point.linkedTextId = pointInfo.linkedTextId;
     return point;
   }
 
@@ -837,6 +853,8 @@ export default class HistoryUtil {
     line.endId = lineInfo.end;
     line.category = lineInfo.category;
     line.locationMode = lineInfo.locationMode;
+    line.linkedFixPointId = lineInfo.linkedFixPointId;
+    line.linkedBasePointId = lineInfo.linkedBasePointId;
     line.value = lineInfo.value;
     line.style = lineInfo.style;
     line.weight = lineInfo.weight;
@@ -884,6 +902,7 @@ export default class HistoryUtil {
     text.angle = textInfo.angle;
     text.fontSize = textInfo.fontSize;
     text.color = textInfo.color;
+    text.linkedPointId = textInfo.linkedPointId;
   }
 
   setMagnifierInfo(magnifierInfo) {

+ 12 - 8
src/graphic/Layer.js

@@ -154,7 +154,7 @@ export default class Layer {
       //   break;
       case LayerEvents.AddPoint:
         stateService.setEventName(LayerEvents.MovePoint);
-        const newPoint = addPoint.buildPoint2(position);
+        const newPoint = addPoint.buildPoint(position);
         if (newPoint) {
           stateService.setSelectItem(
             newPoint.vectorId,
@@ -593,9 +593,14 @@ export default class Layer {
         if (addLine.newLine != null) {
           exceptLineId = addLine.newLine.vectorId;
           exceptPointId = addLine.newLine.endId;
+          if (exceptPointId) {
+            let exceptPoint = dataService.getPoint(exceptPointId);
+            exceptLineId = exceptPoint.getParent();
+          }
         }
         listenLayer.start(position, {
-          exceptLineId: exceptLineId,
+          //exceptLineId: exceptLineId,
+          exceptLineIds: exceptLineId,
           exceptPointId: exceptPointId,
         });
         if (listenLayer.modifyPoint) {
@@ -835,7 +840,7 @@ export default class Layer {
           point = dataService.getPoint(draggingItem.vectorId);
           listenLayer.start(position, {
             exceptPointId: draggingItem.vectorId,
-            exceptLineId: point.parent,
+            exceptLineIds: point.parent,
           });
 
           // if (listenLayer.modifyPoint) {  //原本是这样的,不知用途,下面修改为了修复拖动点经过放大镜导致NaN或者错位
@@ -850,10 +855,6 @@ export default class Layer {
             };
           }
           movePoint.movePoint(position, draggingItem.vectorId);
-          point = dataService.getPoint(draggingItem.vectorId);
-          if (point.getCategory() == VectorCategory.Point.FixPoint) {
-            moveText.moveFullText(position, point.linkedTextId);
-          }
           needAutoRedraw = true;
           if (!point) {
             stateService.clearEventName();
@@ -920,7 +921,10 @@ export default class Layer {
       case LayerEvents.MoveText:
         needAutoRedraw = true;
         if (draggingItem != null) {
-          moveText.moveFullText(position, draggingItem.vectorId);
+          let vectorText = dataService.getText(draggingItem.vectorId);
+          if (!vectorText.linkedPointId) {
+            moveText.moveFullText(position, draggingItem.vectorId);
+          }
         }
         break;
       case LayerEvents.MoveSVG:

+ 27 - 10
src/graphic/ListenLayer.js

@@ -24,7 +24,8 @@ export default class ListenLayer {
    *
    * @param exceptVectorIds:{
           exceptPointId,
-          exceptLineId,
+          //exceptLineId,
+          exceptLineIds,
           exceptCurvePointId,
           exceptCurveLineId,
           exceptRoadPointId,
@@ -62,11 +63,16 @@ export default class ListenLayer {
     );
     selectInfo.pointInfo = this.isSelectPoint(
       position,
-      exceptVectorIds.exceptPointId
+      exceptVectorIds.exceptPointId,
+      exceptVectorIds.exceptLineIds
     );
+    // selectInfo.pointInfo = this.isSelectPoint(
+    //   position,
+    //   exceptVectorIds.exceptPointId
+    // );
     selectInfo.lineInfo = this.isSelectLine(
       position,
-      exceptVectorIds.exceptLineId
+      exceptVectorIds.exceptLineIds
     );
     selectInfo.curvePointInfo = this.isSelectCurvePoint(
       position,
@@ -221,27 +227,39 @@ export default class ListenLayer {
     return curveLineInfo;
   }
 
-  isSelectPoint(position, exceptPointId) {
+  isSelectPoint(position, exceptPointId, exceptLineIds) {
     let pointInfo = {
       pointId: null,
       type: null,
       distance: null,
     };
 
+    let exceptPointIds = [];
+    if (exceptLineIds) {
+      for (let key in exceptLineIds) {
+        let exceptLine = dataService.getLine(key);
+        exceptPointIds.push(exceptLine.startId);
+        exceptPointIds.push(exceptLine.endId);
+      }
+    }
+
     let seqInfo = {};
     const points = dataService.getPoints();
     for (const pointId in points) {
       if (pointId == exceptPointId) {
         continue;
       }
-      const point = dataService.getPoint(pointId);
 
+      const point = dataService.getPoint(pointId);
       if (point.getCategory() == VectorCategory.Point.TestBasePoint) {
         continue;
       }
 
       const distance = this.getDistance(position, point);
       if (distance < Constant.minAdsorbPix) {
+        if (exceptPointIds.indexOf(pointId) > -1) {
+          continue;
+        }
         if (pointInfo.pointId == null) {
           pointInfo = {
             pointId: pointId,
@@ -306,7 +324,7 @@ export default class ListenLayer {
     return pointInfo;
   }
 
-  isSelectLine(position, exceptLineId) {
+  isSelectLine(position, exceptLineIds) {
     let lineInfo = {
       lineId: null,
       type: null,
@@ -314,15 +332,14 @@ export default class ListenLayer {
     };
     const lines = dataService.getLines();
     for (const lineId in lines) {
-      if (
-        exceptLineId &&
-        (exceptLineId == lineId || exceptLineId.hasOwnProperty(lineId))
-      ) {
+      if (exceptLineIds && exceptLineIds.hasOwnProperty(lineId)) {
         continue;
       }
 
       const line = dataService.getLine(lineId);
       if (
+        line.getCategory() == VectorCategory.Line.ExtendedPositionLine ||
+        line.getCategory() == VectorCategory.Line.GuideLocationLine ||
         line.getCategory() == VectorCategory.Line.GuidePositionLine ||
         (line.getCategory() == VectorCategory.Line.PositionLine &&
           line.getLocationMode() != Constant.angleLocationMode)

+ 32 - 2
src/graphic/Load.js

@@ -22,6 +22,7 @@ import CurveRoad from "./Geometry/CurveRoad.js";
 import { edgeService } from "./Service/EdgeService.js";
 import { curvePointService } from "./Service/CurvePointService.js";
 import { curveEdgeService } from "./Service/CurveEdgeService.js";
+import Constant from "./Constant.js";
 
 export default class Load {
   constructor(layer) {
@@ -97,7 +98,7 @@ export default class Load {
           point.setDisplay(dataLocal.points[key].display);
           point.setLocationMode(dataLocal.points[key].locationMode);
           point.setLinkedBasePointId(dataLocal.points[key].linkedBasePointId);
-          point.setLinkedTestPointId(dataLocal.points[key].linkedTestPointId);
+          point.linkedTextId == dataLocal.points[key].linkedTextId;
         }
 
         // let points = dataService.vectorData.points;
@@ -149,6 +150,13 @@ export default class Load {
           if (dataLocal.lines[key].locationMode) {
             line.setLocationMode(dataLocal.lines[key].locationMode);
           }
+          if (dataLocal.lines[key].linkedFixPointId) {
+            line.setLinkedFixPointId(dataLocal.lines[key].linkedFixPointId);
+          }
+          if (dataLocal.lines[key].linkedBasePointId) {
+            line.setLinkedBasePointId(dataLocal.lines[key].linkedBasePointId);
+          }
+
           line.setDisplay(dataLocal.lines[key].display);
           if (line.getCategory() == VectorCategory.Line.BaseLine) {
             Settings.baseLineId = key;
@@ -241,15 +249,18 @@ export default class Load {
             newEdge.setWeight(edge.weight);
           }
           newEdge.setLineWidth(edge.lineWidth);
+          newEdge.setParent(edge.parent);
         }
       }
 
       if (dataLocal.curveRoadPoints) {
         for (let key in dataLocal.curveRoadPoints) {
-          curveRoadPointService.create(
+          let curveRoadPoint = curveRoadPointService.create(
             dataLocal.curveRoadPoints[key],
             dataLocal.curveRoadPoints[key].vectorId
           );
+          curveRoadPoint.setIndex(dataLocal.curveRoadPoints[key].index);
+          curveRoadPoint.setParent(dataLocal.curveRoadPoints[key].parent);
         }
       }
 
@@ -265,6 +276,7 @@ export default class Load {
           );
           curveRoadEdge.setStyle(curveRoadEdgeData.style);
           curveRoadEdge.setWeight(curveRoadEdgeData.weight);
+          curveRoadEdge.setParent(curveRoadEdgeData.parent);
           curveEdgeService.setCurves(curveRoadEdge);
         }
       }
@@ -297,6 +309,9 @@ export default class Load {
           curveRoad.singleLanesCurves = JSON.parse(
             JSON.stringify(curveRoadData.singleLanesCurves)
           );
+          curveRoad.singleLanesCurves = JSON.parse(
+            JSON.stringify(curveRoadData.singleLanes)
+          );
           curveRoad.leftWidth = curveRoadData.leftWidth;
           curveRoad.rightWidth = curveRoadData.rightWidth;
           curveRoad.leftDrivewayCount = curveRoadData.leftDrivewayCount;
@@ -310,6 +325,12 @@ export default class Load {
           curveRoad.rightLanesCurves = JSON.parse(
             JSON.stringify(curveRoadData.rightLanesCurves)
           );
+          curveRoad.leftLanes = JSON.parse(
+            JSON.stringify(curveRoadData.leftLanes)
+          );
+          curveRoad.rightLanes = JSON.parse(
+            JSON.stringify(curveRoadData.rightLanes)
+          );
         }
       }
 
@@ -342,6 +363,7 @@ export default class Load {
           text.setColor(dataLocal.texts[key].color);
           text.setDisplay(dataLocal.texts[key].display);
           text.setAngle(dataLocal.texts[key].angle || 0);
+          text.linkedPointId = dataLocal.texts[key].linkedPointId;
         }
       }
 
@@ -365,6 +387,14 @@ export default class Load {
           }
         } catch (e) {}
         if (data3d.meterPerPixel) {
+          uiService.setSingleLaneWidth(
+            (Constant.defaultSingleLaneWidth * coordinate.res) /
+              data3d.meterPerPixel
+          );
+          uiService.setRoadMidDivideWidth(
+            (Constant.defaultMidDivideWidth * coordinate.res) /
+              data3d.meterPerPixel
+          );
           coordinate.setRes(data3d.meterPerPixel);
         }
         const width = bgImg.imageData.width;

+ 57 - 32
src/graphic/Renderer/Draw.js

@@ -509,12 +509,15 @@ export default class Draw {
     }
 
     this.drawRoadEdge(vector, isTemp);
-    vector.leftLanes &&
-      vector.leftLanes.forEach((g) => this.drawLan(g, !!label));
-    vector.rightLanes &&
-      vector.rightLanes.forEach((g) => this.drawLan(g, !!label));
-    vector.singleLanes &&
-      vector.singleLanes.forEach((g) => this.drawLan(g, !!label));
+    if (vector.way === "oneWay") {
+      vector.singleLanes &&
+        vector.singleLanes.forEach((g) => this.drawLan(g, !!label));
+    } else {
+      vector.leftLanes &&
+        vector.leftLanes.forEach((g) => this.drawLan(g, !!label));
+      vector.rightLanes &&
+        vector.rightLanes.forEach((g) => this.drawLan(g, !!label));
+    }
   }
 
   drawLan(lan, focus) {
@@ -833,6 +836,27 @@ export default class Draw {
     this.drawPoint(vector);
   }
 
+  drawLineArrow(line, doubleArrow = false) {
+    const ctx = this.context;
+    const [start, end] = line;
+    const dires = doubleArrow
+      ? [
+          [start, end],
+          [end, start],
+        ]
+      : [[start, end]];
+
+    ctx.save();
+    for (let [start, end] of dires) {
+      const lines = mathUtil.getArrow(start, end);
+      ctx.moveTo(lines[0].x, lines[0].y);
+      ctx.lineTo(lines[1].x, lines[1].y);
+      ctx.lineTo(lines[2].x, lines[2].y);
+    }
+    ctx.stroke();
+    ctx.restore();
+  }
+
   drawArrow(vector) {
     const startReal = dataService.getPoint(vector.startId);
     const start = coordinate.getScreenXY(startReal);
@@ -842,26 +866,11 @@ export default class Draw {
 
     ctx.save();
 
-    const [style] = help.setVectorStyle(this.context, vector);
+    help.setVectorStyle(this.context, vector);
     if (vector.color) {
       ctx.strokeStyle = vector.color;
     }
-
-    const dires =
-      vector.category === UIEvents.DoubleArrow
-        ? [
-            [start, end],
-            [end, start],
-          ]
-        : [[start, end]];
-    for (let [start, end] of dires) {
-      const lines = mathUtil.getArrow(start, end);
-      ctx.moveTo(lines[0].x, lines[0].y);
-      ctx.lineTo(lines[1].x, lines[1].y);
-      ctx.lineTo(lines[2].x, lines[2].y);
-    }
-    ctx.stroke();
-    ctx.restore();
+    this.drawLineArrow([start, end], vector.category === UIEvents.DoubleArrow);
   }
 
   drawMagnifier(vector) {
@@ -914,20 +923,23 @@ export default class Draw {
 
         imgBound = [left, top, size, size];
       } else {
-        const size = help.getReal(style.target.realRadius);
         const backImg = dataService.getBackgroundImg();
+        const size = help.getReal(style.target.realRadius);
         img = backImg.imageData;
         const imgCenter = coordinate.getScreenXY(backImg.center);
+        const width = img.width * backImg.scale;
+        const height = img.height * backImg.scale;
         const start = {
-          x: imgCenter.x - help.getReal(img.width) / 2,
-          y: imgCenter.y - help.getReal(img.height) / 2,
+          x: imgCenter.x - help.getReal(width) / 2,
+          y: imgCenter.y - help.getReal(height) / 2,
         };
-        const ro = img.width / help.getReal(img.width);
+        const pts = pt;
+        const ro = width / help.getReal(width);
         imgBound = [
-          (pt.x - start.x - size) * ro,
-          (pt.y - start.y - size) * ro,
-          size * 2 * ro,
-          size * 2 * ro,
+          ((pts.x - start.x - size) * ro) / backImg.scale,
+          ((pts.y - start.y - size) * ro) / backImg.scale,
+          (size * 2 * ro) / backImg.scale,
+          (size * 2 * ro) / backImg.scale,
         ];
       }
       const size = style.target.radius;
@@ -1003,6 +1015,7 @@ export default class Draw {
   }
 
   drawPoint(vector, screenSave) {
+    console.log(vector);
     const screenNotDrawTypes = [VectorCategory.Point.NormalPoint];
     if (!screenSave) {
       if (
@@ -1131,6 +1144,7 @@ export default class Draw {
 
   // 文字
   drawText(vector) {
+    console.log(vector);
     this.context.save();
     help.setVectorStyle(this.context, vector);
     this.context.fillStyle = vector.color;
@@ -1315,7 +1329,7 @@ export default class Draw {
     }
 
     help.drawStyleLine(this.context, [start, end], vector.style, vector.weight);
-
+    // vector.category = VectorCategory.Line.LocationLineByFixPoint;
     switch (vector.category) {
       case VectorCategory.Line.SingleArrowLine:
         this.drawArrow(vector);
@@ -1326,10 +1340,21 @@ export default class Draw {
       case VectorCategory.Line.BaseLine:
         this.drawBaseLineLabel(vector);
         break;
+      case VectorCategory.Line.LocationLineByFixPoint:
+      case VectorCategory.Line.LocationLineByBasePoint:
       case VectorCategory.Line.FreeMeasureLine:
       case VectorCategory.Line.MeasureLine:
       case VectorCategory.Line.PositionLine:
         this.drawLineText(vector, style.text);
+
+        if (
+          [
+            VectorCategory.Line.LocationLineByFixPoint,
+            VectorCategory.Line.LocationLineByBasePoint,
+          ].includes(vector.category)
+        ) {
+          this.drawLineArrow([start, end], true);
+        }
         break;
     }
     this.context.restore();

+ 8 - 6
src/graphic/Service/CurveRoadService.js

@@ -125,9 +125,6 @@ export default class CurveRoadService extends RoadService {
     newEndPoint.setIndex(1); //addCPoint执行后会自动增加
 
     newCurveRoad.setWay(curveRoad.way);
-    newCurveRoad.singleRoadWidth = curveRoad.singleRoadWidth;
-    newCurveRoad.leftWidth = curveRoad.leftWidth;
-    newCurveRoad.rightWidth = curveRoad.rightWidth;
 
     let edgePoints;
     if (newCurveRoad.way == Constant.oneWay) {
@@ -188,6 +185,8 @@ export default class CurveRoadService extends RoadService {
     }
     leftEdge.start = uiService.getNewPositionForPop(leftCurveEdge.start);
     leftEdge.end = uiService.getNewPositionForPop(leftCurveEdge.end);
+    leftEdge.setStyle(leftCurveEdge.getStyle());
+    leftEdge.setWeight(leftCurveEdge.getWeight());
 
     const rightCurveEdge = dataService.getCurveRoadEdge(curveRoad.rightEdgeId);
     for (let i = 0; i < rightEdge.points.length; ++i) {
@@ -197,12 +196,15 @@ export default class CurveRoadService extends RoadService {
     }
     rightEdge.start = uiService.getNewPositionForPop(rightCurveEdge.start);
     rightEdge.end = uiService.getNewPositionForPop(rightCurveEdge.end);
+    rightEdge.setStyle(rightCurveEdge.getStyle());
+    rightEdge.setWeight(rightCurveEdge.getWeight());
 
     curveEdgeService.setCurves(leftEdge);
     curveEdgeService.setCurves(rightEdge);
     newCurveRoad.singleRoadDrivewayCount = curveRoad.singleRoadDrivewayCount;
     newCurveRoad.leftDrivewayCount = curveRoad.leftDrivewayCount;
     newCurveRoad.rightDrivewayCount = curveRoad.rightDrivewayCount;
+    newCurveRoad.singleRoadWidth = curveRoad.singleRoadWidth;
     newCurveRoad.leftWidth = curveRoad.leftWidth;
     newCurveRoad.rightWidth = curveRoad.rightWidth;
     this.setLanes(newCurveRoad.vectorId);
@@ -1132,14 +1134,14 @@ export default class CurveRoadService extends RoadService {
 
     if (curveRoad.way == Constant.oneWay) {
       for (let i = 0; i < curveRoad.singleLanesCurves.length; ++i) {
-        lineService.createCurveLineByPoints(curveRoad.singleLanesCurves[i]);
+        lineService.createCurveLineByPoints(curveRoad.singleLanes[i]);
       }
     } else if (curveRoad.way == Constant.twoWay) {
       for (let i = 0; i < curveRoad.leftLanesCurves.length; ++i) {
-        lineService.createCurveLineByPoints(curveRoad.leftLanesCurves[i]);
+        lineService.createCurveLineByPoints(curveRoad.leftLanes[i]);
       }
       for (let i = 0; i < curveRoad.rightLanesCurves.length; ++i) {
-        lineService.createCurveLineByPoints(curveRoad.rightLanesCurves[i]);
+        lineService.createCurveLineByPoints(curveRoad.rightLanes[i]);
       }
       // let leftMidDivide = lineService.createCurveLineByPoints(
       //   curveRoad.midDivide.leftMidDivide

+ 5 - 3
src/graphic/Service/DataService.js

@@ -138,12 +138,13 @@ export class DataService {
       return;
     }
     let start = this.getPoint(line.startId);
-    if (start && start.getCategory() != VectorCategory.Point.BasePoint) {
+    if (start) {
       let startParent = start.getParent();
       delete startParent[lineId];
       if (
         Object.keys(startParent).length == 0 &&
-        start.getCategory() != VectorCategory.Point.BasePoint
+        start.getCategory() != VectorCategory.Point.BasePoint &&
+        start.getCategory() != VectorCategory.Point.FixPoint
       ) {
         this.deletePoint(line.startId);
       }
@@ -156,7 +157,8 @@ export class DataService {
 
       if (
         Object.keys(endParent).length == 0 &&
-        end.getCategory() != VectorCategory.Point.BasePoint
+        end.getCategory() != VectorCategory.Point.BasePoint &&
+        end.getCategory() != VectorCategory.Point.FixPoint
       ) {
         this.deletePoint(line.endId);
       }

+ 1 - 2
src/graphic/Service/LineService.js

@@ -53,8 +53,7 @@ export default class LineService {
         let category = point.getCategory();
         if (
           category == VectorCategory.Point.BasePoint ||
-          category == VectorCategory.Point.TestBasePoint ||
-          category == VectorCategory.Point.TestPoint
+          category == VectorCategory.Point.TestBasePoint
         ) {
           dataService.deletePoint(key);
         }

+ 44 - 26
src/graphic/Service/PointService.js

@@ -52,15 +52,10 @@ export default class PointService {
         dataService.deletePoint(pointId); //暂时简单粗暴
       } else if (category == VectorCategory.Point.BasePoint) {
         this.deleteBasePoint(pointId);
-      } else if (
-        category == VectorCategory.Point.TestPoint ||
-        category == VectorCategory.Point.TestBasePoint
-      ) {
+      } else if (category == VectorCategory.Point.TestBasePoint) {
         this.deleteTestPoint(pointId);
       } else if (category == VectorCategory.Point.FixPoint) {
-        let textId = point.linkedTextId;
-        dataService.deletePoint(pointId); //暂时简单粗暴
-        dataService.deleteText(textId);
+        this.deleteFixPoint(pointId);
       }
     }
   }
@@ -73,32 +68,57 @@ export default class PointService {
       }
     }
   }
+  // 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;
+  //   }
+  //   this.updateBasePointIds();
+  // }
+
   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
-      ) {
+      if (line.getLinkedBasePointId() == basePointId) {
         dataService.deleteLine(key);
       }
     }
     dataService.deletePoint(basePointId);
-    if (Settings.selectBasePointId == basePointId) {
-      Settings.selectBasePointId = null;
+  }
+
+  deleteFixPoint(fixPointId) {
+    let lines = dataService.getLines();
+    for (let key in lines) {
+      let line = dataService.getLine(key);
+      if (line.getLinkedFixPointId() == fixPointId) {
+        dataService.deleteLine(key);
+      }
     }
-    this.updateBasePointIds();
+    let fixPoint = dataService.getPoint(fixPointId);
+    let textId = fixPoint.linkedTextId;
+    dataService.deletePoint(fixPointId);
+    dataService.deleteText(textId);
   }
 
   deleteTestPoint(testPointId) {
@@ -111,8 +131,6 @@ export default class PointService {
       }
       if (point.vectorId == testPointId) {
         needDeletePointIds.push(testPointId);
-      } else if (point.linkedTestPointId == testPointId) {
-        needDeletePointIds.push(key);
       }
     }
     let lines = dataService.getLines();

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

@@ -134,10 +134,14 @@ export default class RoadService {
     let oldLeftEdge = dataService.getRoadEdge(road.leftEdgeId);
     leftEdge.start = uiService.getNewPositionForPop(oldLeftEdge.start);
     leftEdge.end = uiService.getNewPositionForPop(oldLeftEdge.end);
+    leftEdge.setStyle(oldLeftEdge.getStyle());
+    leftEdge.setWeight(oldLeftEdge.getWeight());
 
     let oldRightEdge = dataService.getRoadEdge(road.rightEdgeId);
     rightEdge.start = uiService.getNewPositionForPop(oldRightEdge.start);
     rightEdge.end = uiService.getNewPositionForPop(oldRightEdge.end);
+    rightEdge.setStyle(oldRightEdge.getStyle());
+    rightEdge.setWeight(oldRightEdge.getWeight());
 
     newRoad.singleRoadDrivewayCount = road.singleRoadDrivewayCount;
     newRoad.leftDrivewayCount = road.leftDrivewayCount;

+ 9 - 16
src/graphic/Service/UIService.js

@@ -79,11 +79,9 @@ export default class UIService {
       return true;
     } else if (ui == UIEvents.Line) {
       this.setSelectLineCategory(VectorCategory.Line.NormalLine);
-      this.setSelectLocationMode(Constant.null);
       return true;
     } else if (ui == UIEvents.FreeMeasureLine) {
       this.setSelectLineCategory(VectorCategory.Line.FreeMeasureLine);
-      this.setSelectLocationMode(Constant.freeLocationMode);
       return true;
     } else if (ui == UIEvents.BaseLine) {
       this.setSelectLineCategory(VectorCategory.Line.BaseLine);
@@ -93,21 +91,8 @@ export default class UIService {
   }
 
   isBelongPoint(ui) {
-    if (ui == UIEvents.NormalLocationMode) {
-      this.setSelectPointCategory(VectorCategory.Point.TestPoint);
-      this.setSelectLocationMode(Constant.normalLocationMode);
-      return true;
-    } else if (ui == UIEvents.AngleLocationMode) {
-      this.setSelectPointCategory(VectorCategory.Point.TestPoint);
-      this.setSelectLocationMode(Constant.angleLocationMode);
-      return true;
-    } else if (ui == UIEvents.AllLocationMode) {
-      this.setSelectPointCategory(VectorCategory.Point.TestPoint);
-      this.setSelectLocationMode(Constant.allLocationMode);
-      return true;
-    } else if (ui == UIEvents.BasePoint) {
+    if (ui == UIEvents.BasePoint) {
       this.setSelectPointCategory(VectorCategory.Point.BasePoint);
-      this.setSelectLocationMode(null);
       return true;
     } else if (ui == UIEvents.FixPoint) {
       this.setSelectPointCategory(VectorCategory.Point.FixPoint);
@@ -162,6 +147,10 @@ export default class UIService {
     Settings.wayType = value;
   }
 
+  setSelectBasePointId(value) {
+    Settings.selectBasePointId = value;
+  }
+
   setSingleRoadDrivewayCount(value) {
     Settings.singleRoadDrivewayCount = value;
   }
@@ -223,6 +212,10 @@ export default class UIService {
     Settings.selectLocationMode = value;
   }
 
+  getSelectLocationMode() {
+    return Settings.selectLocationMode;
+  }
+
   setSelectSVGType(value) {
     Settings.selectSVGType = value;
   }

+ 0 - 2
src/graphic/Util/MathUtil.js

@@ -384,11 +384,9 @@ export default class MathUtil {
     let parameter = {};
     if (line.a == 0 || typeof line.a == "undefined") {
       if (line.hasOwnProperty("x")) {
-        parameter.x = line.x;
         parameter.y = point.y;
       } else if (line.hasOwnProperty("y")) {
         parameter.x = point.x;
-        parameter.y = line.y;
       }
     } else {
       parameter.a = -1 / line.a;

+ 1 - 2
src/graphic/enum/VectorCategory.js

@@ -16,13 +16,12 @@ const VectorCategory = {
     //重做定位
     GuideLocationLine: "GuideLocationLine", //定位辅助线
     LocationLineByFixPoint: "LocationLineByFixPoint", //经过固定点的定位线
-    LocationLineByBasePoint: "LocationLineByFixPoint", //经过基础点的定位线
+    LocationLineByBasePoint: "LocationLineByBasePoint", //经过基础点的定位线
     LocationLineByFixPointToFixPoint: "LocationLineByFixPointToFixPoint", //经过固定点到固定点的定位线,综合定位法
     LocationLineByFixPointToBasePoint: "LocationLineByFixPointToBasePoint", //经过固定点到基础点的定位线,综合定位法
   },
   Point: {
     BasePoint: "BasePoint", //基准点
-    TestPoint: "TestPoint", //待测点
     NormalPoint: "NormalPoint", //正常点
     TestBasePoint: "TestBasePoint", //待测基准点,待测点与基准线相交的点
     FixPoint: "FixPoint", //固定点

+ 6 - 2
src/views/graphic/geos/road.vue

@@ -18,7 +18,11 @@ import GraphicAction from "@/components/button-pane/index.vue";
 import VectorEvents from "@/graphic/enum/VectorEvents";
 
 const props = defineProps<{ geo: FocusVector }>();
-const vector = computed(() => dataService.getRoad(props.geo.vectorId));
+const vector = computed(
+  () =>
+    dataService.getRoad(props.geo.vectorId) ||
+    dataService.getCurveRoad(props.geo.vectorId)
+);
 const clickHandlerFactory = (key) => {
   return () => {
     drawRef.value.uiControl.updateVectorForSelectUI(key);
@@ -75,9 +79,9 @@ const menus = ref([
   },
 ]);
 
-console.log(vector.value);
 watchEffect(() => {
   if (vector.value) {
+    console.log(vector.value);
     menus.value[1].disabled =
       vector.value?.leftLanes.length +
         vector.value?.rightLanes.length +

+ 10 - 10
src/views/roads/tabulation.vue

@@ -10,7 +10,7 @@
       <div class="content" ref="layoutRef">
         <table>
           <tr>
-            <td class="value title" colspan="6" height="62">
+            <td class="value title" colspan="6" height="46">
               <span v-if="downMode">{{ roadPhoto.title }}</span>
               <ui-input
                 v-else
@@ -22,7 +22,7 @@
             </td>
           </tr>
           <tr>
-            <td class="label" width="150" height="50">到达事故现场时间</td>
+            <td class="label" width="150" height="42">到达事故现场时间</td>
             <td class="value">
               <span v-if="downMode">{{ history.value.arrivalTime }}</span>
               <ui-input
@@ -70,7 +70,7 @@
             </td>
           </tr>
           <tr>
-            <td class="image" colspan="6" height="676">
+            <td class="image" colspan="6" height="569">
               <div class="photo-layout">
                 <img
                   :src="useStaticUrl(roadPhoto.url).value"
@@ -90,7 +90,7 @@
             </td>
           </tr>
           <tr>
-            <td class="value textarea-layout" colspan="6" height="73">
+            <td class="value textarea-layout" colspan="6" height="62">
               <span v-if="downMode">{{ history.value.illustrate }}</span>
               <ui-input
                 class="textarea"
@@ -104,7 +104,7 @@
             </td>
           </tr>
           <tr>
-            <td class="value date" colspan="6" height="50">
+            <td class="value date" colspan="6" height="44">
               {{ formatDate(new Date(), "yyyy年MM月dd日hh时mm分") }}
             </td>
           </tr>
@@ -334,12 +334,12 @@ const saveHandler = async () => {
 .downMode {
   .title {
     span {
-      height: 62px !important;
-      font-size: 54px !important;
+      height: 52px !important;
+      font-size: 46px !important;
       font-family: SimSun-Regular, SimSun;
       font-weight: 400;
       color: #000000;
-      line-height: 63px;
+      line-height: 52px;
       letter-spacing: 13px;
     }
   }
@@ -347,8 +347,8 @@ const saveHandler = async () => {
   .content {
     width: 1485px;
     height: 1050px;
-    // padding: 125px 100px 75px 100px;
-    padding: 30px 28px 26px;
+    padding: 125px 100px 75px 100px;
+    // padding: 30px 28px 26px;
     overflow: hidden;
   }
   .content table .textarea-layout {

+ 24 - 20
src/views/scene/covers/basePoints.vue

@@ -3,29 +3,34 @@
     v-for="point in basePoints"
     :key="point.id"
     :pos="point.pos"
-    @change-pos="pos => point.pos = pos"
+    @change-pos="(pos) => (point.pos = pos)"
     :active="customMap.activeBasePoint === point"
-    @blur="() => customMap.activeBasePoint = customMap.activeBasePoint === point ? null : customMap.activeBasePoint"
-    @focus="() => customMap.activeBasePoint = point"
+    @blur="
+      () =>
+        (customMap.activeBasePoint =
+          customMap.activeBasePoint === point ? null : customMap.activeBasePoint)
+    "
+    @focus="() => (customMap.activeBasePoint = point)"
   />
 
-<!--  <ActionsPanel :menus="activeActionMenus" v-if="active" />-->
+  <!--  <ActionsPanel :menus="activeActionMenus" v-if="active" />-->
   <div ref="menu" @touchstart.stop class="action-menus">
     <ActionMenus
-        v-if="customMap.activeBasePoint"
-        :menus="activeActionMenus"
-        dire="row"
+      v-if="customMap.activeBasePoint"
+      :menus="activeActionMenus"
+      :active-key="customMap.activeBasePoint"
+      dire="row"
     />
   </div>
 </template>
 
 <script setup lang="ts">
-import { basePoints } from '@/store/basePoint'
-import BasePoint from './basePoint.vue'
-import {ref} from "vue";
-import {FixPoint} from "@/store/fixPoint";
+import { basePoints } from "@/store/basePoint";
+import BasePoint from "./basePoint.vue";
+import { ref } from "vue";
+import { FixPoint } from "@/store/fixPoint";
 import ActionsPanel from "@/views/scene/covers/actions.vue";
-import {customMap} from "@/hook";
+import { customMap } from "@/hook";
 import ActionMenus from "@/components/group-button/index.vue";
 
 const activeActionMenus = [
@@ -36,19 +41,18 @@ const activeActionMenus = [
     color: "#FF4D4F",
     iconColor: "#fff",
     onClick() {
-      const index = basePoints.value.indexOf(customMap.activeBasePoint)
-      console.log(index)
+      const index = basePoints.value.indexOf(customMap.activeBasePoint);
+      console.log(index);
       if (~index) {
-        basePoints.value.splice(index, 1)
-        customMap.activeBasePoint = null
+        basePoints.value.splice(index, 1);
+        customMap.activeBasePoint = null;
       }
-    }
-  }
-]
+    },
+  },
+];
 </script>
 
 <style scoped>
-
 .action-menus {
   position: absolute;
   bottom: var(--boundMargin);

+ 60 - 39
src/views/scene/covers/fixPoints.vue

@@ -4,34 +4,43 @@
     :key="point.id"
     :data="point"
     :active="point === customMap.activeFixPoint"
-    @change-pos="pos => point.pos = pos"
-    @focus="() => customMap.activeFixPoint = point"
-    @blur="() => customMap.activeFixPoint = customMap.activeFixPoint === point ? null : customMap.activeFixPoint"
+    @change-pos="(pos) => (point.pos = pos)"
+    @focus="() => (customMap.activeFixPoint = point)"
+    @blur="
+      () =>
+        (customMap.activeFixPoint =
+          customMap.activeFixPoint === point ? null : customMap.activeFixPoint)
+    "
   />
 
   <div ref="menu" @touchstart.stop class="action-menus">
-<!--    <ActionsPanel :menus="activeActionMenus" v-show="customMap.activeFixPoint" />-->
+    <!--    <ActionsPanel :menus="activeActionMenus" v-show="customMap.activeFixPoint" />-->
     <ActionMenus
-        v-if="customMap.activeFixPoint"
-        :menus="activeActionMenus"
-        :active-key="edit ? 'edit' : null"
-        dire="row"
+      v-if="customMap.activeFixPoint"
+      :menus="activeActionMenus"
+      :active-key="edit ? 'edit' : null"
+      dire="row"
     />
   </div>
 
-  <div class="edit-fix-point" v-if="edit" ref="dom"  @touchstart.stop>
+  <div class="edit-fix-point" v-if="edit" ref="dom" @touchstart.stop>
     <div class="header">
       <h3>添加名称</h3>
       <ui-icon type="close" ctrl @click="edit = null" />
     </div>
-    <ui-input type="text" v-model="edit.text" width="100%" maxlength="20" />
+    <ui-input
+      type="text"
+      v-model="edit.text"
+      width="100%"
+      maxlength="20"
+      class="search-fix"
+    />
     <div class="select">
       <span>常用名称</span>
       <p
         v-for="option in options"
         :key="option"
-        class="fun-ctrl"
-        :class="{active: option === edit.text}"
+        :class="{ active: option === edit.text }"
         @click="edit.text = option"
       >
         {{ option }}
@@ -41,15 +50,15 @@
 </template>
 
 <script setup lang="ts">
-import { fixPoints, FixPoint } from '@/store/fixPoint'
-import FixPointPanel from './fixPoint.vue'
-import {ref, watch, watchEffect} from "vue";
-import {customMap} from '@/hook'
+import { fixPoints, FixPoint } from "@/store/fixPoint";
+import FixPointPanel from "./fixPoint.vue";
+import { ref, watch, watchEffect } from "vue";
+import { customMap } from "@/hook";
 import UiIcon from "@/components/base/components/icon/index.vue";
 import UiInput from "@/components/base/components/input/index.vue";
 import ActionMenus from "@/components/group-button/index.vue";
 
-const edit = ref<FixPoint>()
+const edit = ref<FixPoint>();
 const options = [
   "轿车 / 平面",
   "客车 / 平面",
@@ -63,7 +72,7 @@ const options = [
   "散落物",
   "岗台",
   "桥",
-]
+];
 const activeActionMenus = [
   {
     key: "edit",
@@ -72,8 +81,9 @@ const activeActionMenus = [
     color: "#161A1A",
     iconColor: "#2F8FFF",
     onClick() {
-      edit.value = edit.value === customMap.activeFixPoint ? null : customMap.activeFixPoint
-    }
+      edit.value =
+        edit.value === customMap.activeFixPoint ? null : customMap.activeFixPoint;
+    },
   },
   {
     key: "delete",
@@ -82,35 +92,34 @@ const activeActionMenus = [
     color: "#FF4D4F",
     iconColor: "#fff",
     onClick() {
-      const index = fixPoints.value.indexOf(customMap.activeFixPoint)
+      const index = fixPoints.value.indexOf(customMap.activeFixPoint);
       if (~index) {
-        fixPoints.value.splice(index, 1)
-        edit.value = null
-        customMap.activeFixPoint = null
+        fixPoints.value.splice(index, 1);
+        edit.value = null;
+        customMap.activeFixPoint = null;
       }
-    }
-  }
-]
+    },
+  },
+];
 
-const dom = ref<HTMLDivElement>()
-const menu = ref<HTMLDivElement>()
+const dom = ref<HTMLDivElement>();
+const menu = ref<HTMLDivElement>();
 watchEffect((onCleanup) => {
   if (edit.value && dom.value) {
     const handler = (ev) => {
-      console.log(ev.target)
+      console.log(ev.target);
       if (!dom.value.contains(ev.target) && !menu.value.contains(ev.target)) {
-        edit.value = null
+        edit.value = null;
       }
-    }
+    };
     // document.documentElement.addEventListener("click", handler)
-    document.documentElement.addEventListener("touchstart", handler)
+    document.documentElement.addEventListener("touchstart", handler);
     onCleanup(() => {
       // document.documentElement.removeEventListener("click", handler)
-      document.documentElement.removeEventListener("touchstart", handler)
-    })
+      document.documentElement.removeEventListener("touchstart", handler);
+    });
   }
-})
-
+});
 </script>
 
 <style lang="scss" scoped>
@@ -121,7 +130,7 @@ watchEffect((onCleanup) => {
   bottom: 0;
   overflow-y: auto;
   z-index: 2;
-  background-color: #161A1A;
+  background-color: #161a1a;
   width: 240px;
   padding: 10px;
 
@@ -137,12 +146,20 @@ watchEffect((onCleanup) => {
   }
 
   .select {
-    span, p {
+    span,
+    p {
       color: #fff;
     }
     p {
       padding: 14px 6px;
       font-size: 14px;
+      position: relative;
+
+      &.active {
+        background: var(--colors-primary-base);
+        margin: 0 -10px;
+        padding: 14px 16px;
+      }
     }
     span {
       display: inline-block;
@@ -169,4 +186,8 @@ watchEffect((onCleanup) => {
 .action-menus .menu.active {
   background: none;
 }
+
+.search-fix.ui-input .text.suffix input {
+  padding-right: 50px;
+}
 </style>

BIN
src/views/scene/covers/icon/loading.zip


+ 21 - 5
src/views/scene/menus/actions.ts

@@ -7,12 +7,13 @@ import {
 import { list, MeasureAtom, MeasureType } from "@/store/measure";
 import { baseLines } from "@/store/baseLine";
 import { basePoints } from "@/store/basePoint";
-import { Ref, watch } from "vue";
+import { nextTick, Ref, watch } from "vue";
 import {
   activeBasePointStack,
   activeFixPointStack,
   customMap,
   useConfirm,
+  useSDK,
 } from "@/hook";
 import { getCoverPos } from "../linkage/cover";
 import { Pos3D } from "@/sdk";
@@ -149,7 +150,12 @@ const menuActions = {
     return trackMeasureMenuAction(
       "L_LINE",
       menu,
-      (data) => list.value.push(data),
+      (data) => {
+        list.value.push(data);
+        nextTick(() => {
+          useSDK().carry.measureMap.get(data).selected(true);
+        });
+      },
       onComplete,
       "测量线"
     );
@@ -158,7 +164,12 @@ const menuActions = {
     return trackMeasureMenuAction(
       "V_LINE",
       menu,
-      (data) => list.value.push(data),
+      (data) => {
+        list.value.push(data);
+        nextTick(() => {
+          useSDK().carry.measureMap.get(data).selected(true);
+        });
+      },
       onComplete,
       "测量线"
     );
@@ -167,7 +178,12 @@ const menuActions = {
     return trackMeasureMenuAction(
       "LINE",
       menu,
-      (data) => list.value.push(data),
+      (data) => {
+        list.value.push(data);
+        nextTick(() => {
+          useSDK().carry.measureMap.get(data).selected(true);
+        });
+      },
       onComplete,
       "测量线"
     );
@@ -183,7 +199,7 @@ const menuActions = {
     );
   },
   [menuEnum.CLEAR]: async (menu, onComplete) => {
-    if (await useConfirm("确认情况?该操作无法撤销")) {
+    if (await useConfirm("确认清空?该操作无法撤销")) {
       list.value = [];
       baseLines.value = [];
       basePoints.value = [];

+ 88 - 80
src/views/scene/menus/menus.ts

@@ -1,42 +1,45 @@
-import {findMenuByAttr, generateMixMenus as generateMixMenusRaw} from '@/utils/menus'
-import {nextTick, ref} from "vue";
-import {useAsyncSDK, useSDK} from "@/hook";
-import {laserModeStack, modeDisabled} from '@/hook/custom/index'
-import {Mode} from "@/sdk";
-import {baseLines} from "@/store/baseLine";
-import {fixPoints} from "@/store/fixPoint";
-import {basePoints} from "@/store/basePoint";
-import {list} from "@/store/measure";
+import {
+  findMenuByAttr,
+  generateMixMenus as generateMixMenusRaw,
+} from "@/utils/menus";
+import { nextTick, ref } from "vue";
+import { useAsyncSDK, useSDK } from "@/hook";
+import { laserModeStack, modeDisabled } from "@/hook/custom/index";
+import { Mode } from "@/sdk";
+import { baseLines } from "@/store/baseLine";
+import { fixPoints } from "@/store/fixPoint";
+import { basePoints } from "@/store/basePoint";
+import { list } from "@/store/measure";
 
 export type MenuRaw = {
-  key: string,
-  text: string,
-  continued?: boolean
-  defaultSelect?: true | (() => boolean),
-  icon?: string,
-  disabled?: boolean | (() => boolean),
-  border?: boolean,
-  children?: MenuRaw[],
-  onClick?: () => void | (() => void)
-}
+  key: string;
+  text: string;
+  continued?: boolean;
+  defaultSelect?: true | (() => boolean);
+  icon?: string;
+  disabled?: boolean | (() => boolean);
+  border?: boolean;
+  children?: MenuRaw[];
+  onClick?: () => void | (() => void);
+};
 
 export enum menuEnum {
-  SAVE = 'save',
-  CLEAR = 'clear',
-  MEASURE_ROW = 'L_LINE',
-  MEASURE_COLUMN = 'V_LINE',
-  MEASURE_FREE = 'LINE',
-  FIX_POINT = 'fixPoint',
-  BASE_LINE = 'baseLine',
-  BASE_POINT = 'basePoint',
+  SAVE = "save",
+  CLEAR = "clear",
+  MEASURE_ROW = "L_LINE",
+  MEASURE_COLUMN = "V_LINE",
+  MEASURE_FREE = "LINE",
+  FIX_POINT = "fixPoint",
+  BASE_LINE = "baseLine",
+  BASE_POINT = "basePoint",
 }
 
-const vView = ref(false)
-useAsyncSDK().then(sdk => {
-  sdk.scene.on('viewChange', (view) => {
-    vView.value = view === "Top" || view === "Bottom"
-  })
-})
+const vView = ref(false);
+useAsyncSDK().then((sdk) => {
+  sdk.scene.on("viewChange", (view) => {
+    vView.value = view === "Top" || view === "Bottom";
+  });
+});
 
 export const menus: MenuRaw[] = [
   // {
@@ -46,10 +49,15 @@ export const menus: MenuRaw[] = [
   // },
   {
     icon: "clear",
-    text: "清",
+    text: "清",
     key: menuEnum.CLEAR,
-    disabled: () => (baseLines.value.length + fixPoints.value.length + list.value.length + basePoints.value.length) === 0,
-    border: true
+    disabled: () =>
+      baseLines.value.length +
+        fixPoints.value.length +
+        list.value.length +
+        basePoints.value.length ===
+      0,
+    border: true,
   },
   {
     icon: "measure",
@@ -61,22 +69,22 @@ export const menus: MenuRaw[] = [
         continued: true,
         text: "水平",
         defaultSelect: true,
-        key: menuEnum.MEASURE_ROW
+        key: menuEnum.MEASURE_ROW,
       },
       {
         icon: "line_v",
         continued: true,
         disabled: () => vView.value,
         text: "垂直",
-        key: menuEnum.MEASURE_COLUMN
+        key: menuEnum.MEASURE_COLUMN,
       },
       {
         icon: "line_f",
         continued: true,
         text: "自由",
-        key: menuEnum.MEASURE_FREE
-      }
-    ]
+        key: menuEnum.MEASURE_FREE,
+      },
+    ],
   },
   {
     icon: "point_f",
@@ -87,30 +95,31 @@ export const menus: MenuRaw[] = [
         defaultSelect: true,
         icon: "point_a",
         text: "固定点",
-        key: menuEnum.FIX_POINT
+        key: menuEnum.FIX_POINT,
       },
-    ]
+    ],
   },
   {
     icon: "standard",
     text: "基准",
     key: "baseLineOrPoint",
     onClick() {
-      const sdk = useSDK()
-      const doms = document.querySelectorAll("#navCube, #home") as NodeListOf<HTMLElement>;
-      laserModeStack.push(ref(Mode.cloud))
-      modeDisabled.push(ref(true))
-      doms.forEach(dom => dom.style.display = "none");
-      nextTick(() => sdk.enterTopView())
-
+      const sdk = useSDK();
+      const doms = document.querySelectorAll(
+        "#navCube, #home"
+      ) as NodeListOf<HTMLElement>;
+      laserModeStack.push(ref(Mode.cloud));
+      modeDisabled.push(ref(true));
+      doms.forEach((dom) => (dom.style.display = "none"));
+      nextTick(() => sdk.enterTopView());
 
       return () => {
-        doms.forEach(dom => dom.style.display = "block");
-        sdk.leaveTopView()
-        modeDisabled.pop()
-        laserModeStack.pop()
-        console.log("pop")
-      }
+        doms.forEach((dom) => (dom.style.display = "block"));
+        sdk.leaveTopView();
+        modeDisabled.pop();
+        laserModeStack.pop();
+        console.log("pop");
+      };
     },
     children: [
       {
@@ -118,44 +127,43 @@ export const menus: MenuRaw[] = [
         icon: "line",
         text: "基准线",
         key: menuEnum.BASE_LINE,
-        disabled: () => !!baseLines.value.length
+        disabled: () => !!baseLines.value.length,
       },
       {
         defaultSelect: true,
         icon: "point",
         continued: true,
         text: "基准点",
-        key: menuEnum.BASE_POINT
+        key: menuEnum.BASE_POINT,
       },
-    ]
-  }
-]
+    ],
+  },
+];
 
 export const generateMixMenus = <T extends {}, K extends keyof MenuRaw>(
   childKey: K,
   generateFn: (men: MenuRaw) => T,
   mainMenus: MenuRaw[] = menus
 ) => {
-  const itemActiveKey = ref("")
+  const itemActiveKey = ref("");
   return {
     ...generateMixMenusRaw(
-        childKey,
-        generateFn,
-        mainMenus,
-        menu => {
-          if (itemActiveKey.value === menu.key) {
-            itemActiveKey.value = null
-          } else {
-            menu.onClick && menu.onClick()
-            itemActiveKey.value = menu.key
-          }
-
-        },
-        () => itemActiveKey.value
-      ),
-    itemActiveKey
-  }
-}
+      childKey,
+      generateFn,
+      mainMenus,
+      (menu) => {
+        if (itemActiveKey.value === menu.key) {
+          itemActiveKey.value = null;
+        } else {
+          menu.onClick && menu.onClick();
+          itemActiveKey.value = menu.key;
+        }
+      },
+      () => itemActiveKey.value
+    ),
+    itemActiveKey,
+  };
+};
 
 export const findMenuByKey = (value: menuEnum) =>
-  findMenuByAttr(value, 'key', menus)
+  findMenuByAttr(value, "key", menus);

+ 62 - 56
src/views/scene/menus/pane.vue

@@ -1,99 +1,106 @@
 <template>
   <ActionMenus
-      v-if="!store.child.value"
-      class="menus"
-      :class="{level: level === 2}"
-      :menus="store.menus as any"
-      :active-key="store.activeMenuKey.value"
-      dire="column"
+    v-if="!store.child.value"
+    class="menus"
+    :class="{ level: level === 2 }"
+    :menus="store.menus as any"
+    :active-key="store.activeMenuKey.value"
+    dire="column"
   />
   <scene-menus
-      v-if="store.child.value"
-      @back="store.child.value = null"
-      :menus="store.child.value as MenuRaw[]"
-      :level="level + 1"
+    :parentKey="store.activeMenuKey.value"
+    v-if="store.child.value"
+    @back="store.child.value = null"
+    :menus="store.child.value as MenuRaw[]"
+    :level="level + 1"
   />
 </template>
 
 <script lang="ts" setup>
 import ActionMenus from "@/components/group-button/index.vue";
-import {generateMixMenus, MenuRaw, menus, findMenuByKey} from './menus'
-import {joinActions} from './actions'
-import {computed, onMounted, onUnmounted, watchEffect} from "vue";
-import {disabledMap} from "@/hook";
+import { generateMixMenus, MenuRaw, menus, findMenuByKey } from "./menus";
+import { joinActions } from "./actions";
+import { computed, onMounted, onUnmounted, ref, watchEffect } from "vue";
+import { disabledMap, laserModeStack } from "@/hook";
+import { Mode } from "@/sdk";
 
 const props = withDefaults(
-  defineProps<{ menus?: MenuRaw[], level?: number }>(),
-  {level: 1}
-)
+  defineProps<{ menus?: MenuRaw[]; level?: number; parentKey?: string }>(),
+  { level: 1 }
+);
 const emit = defineEmits<{
-  (e: 'back'): void,
-  (e: 'enterChild'): void,
-  (e: 'leaveChild'): void,
+  (e: "back"): void;
+  (e: "enterChild"): void;
+  (e: "leaveChild"): void;
 }>();
 const backMenu = {
   icon: "return",
   text: "",
   key: "back",
-  onClick: () => emit("back")
-}
+  onClick: () => emit("back"),
+};
 
-const menusMix = computed(() =>
-  props.level === 1 ? menus : [backMenu, ...props.menus]
-)
-const store = generateMixMenus(
-  'children',
-  m => m,
-  menusMix.value
-)
+const menusMix = computed(() => (props.level === 1 ? menus : [backMenu, ...props.menus]));
+const store = generateMixMenus("children", (m) => m, menusMix.value);
 
 watchEffect(() => {
-  const menu = findMenuByKey(store.itemActiveKey.value as any)
+  const menu = findMenuByKey(store.itemActiveKey.value as any);
   if (menu?.disabled && menu?.disabled()) {
-    store.itemActiveKey.value = null
+    store.itemActiveKey.value = null;
   }
-})
+});
 
 watchEffect((onCleanup) => {
-  const menu = store.activeMenuKey.value && findMenuByKey(store.activeMenuKey.value)
+  const menu = store.activeMenuKey.value && findMenuByKey(store.activeMenuKey.value);
   if (store.child && menu?.onClick) {
-    const leaveHook = menu.onClick()
-    leaveHook && onCleanup(leaveHook)
+    const leaveHook = menu.onClick();
+    leaveHook && onCleanup(leaveHook);
   } else {
-    onCleanup(() => {})
+    onCleanup(() => {});
   }
-})
+});
 
 if (props.level === 1) {
   watchEffect(() => {
-    disabledMap.photo = !store.child.value?.length
-  })
+    disabledMap.photo = !store.child.value?.length;
+  });
   watchEffect(() => {
     if (store.child.value) {
-      emit('enterChild')
+      emit("enterChild");
     } else {
-      emit('leaveChild')
+      emit("leaveChild");
     }
-  })
+  });
 }
 
-onUnmounted(joinActions(store.itemActiveKey));
+const stopWatch = joinActions(store.itemActiveKey);
+onUnmounted(() => {
+  stopWatch();
+  if (props.parentKey === "measure") {
+    laserModeStack.pop();
+  }
+});
 onMounted(() => {
   if (props.level > 1) {
-    const defaultMenu = props.menus.find(menu => {
-      if (typeof menu.defaultSelect === 'function') {
-        return menu.defaultSelect()
+    const defaultMenu = props.menus.find((menu) => {
+      if (typeof menu.defaultSelect === "function") {
+        return menu.defaultSelect();
       } else {
-        return menu.defaultSelect
+        return menu.defaultSelect;
       }
-    })
-    console.log(defaultMenu)
-    store.itemActiveKey.value = defaultMenu?.key
+    });
+    console.log(defaultMenu);
+    store.itemActiveKey.value = defaultMenu?.key;
     // store.activeMenuKey.value =
+    if (props.parentKey === "measure") {
+      laserModeStack.push(ref(Mode.cloud));
+    }
   }
-})
+});
+</script>
+<script lang="ts">
+export default { name: "scene-menus" };
 </script>
-<script lang="ts"> export default {name: 'scene-menus'}</script>
 
 <style lang="scss" scoped>
 .menus {
@@ -107,7 +114,7 @@ onMounted(() => {
 
 <style lang="scss">
 .level div:first-child {
-  background-color: rgba(255, 255, 255, .3);
+  background-color: rgba(255, 255, 255, 0.3);
   height: 50px;
   width: 50px;
   min-width: 50px;
@@ -125,8 +132,7 @@ onMounted(() => {
     left: 10px;
     right: 10px;
     bottom: -15px;
-    background-color: rgba(255, 255, 255, .2);
-
+    background-color: rgba(255, 255, 255, 0.2);
   }
 }
 </style>

+ 6 - 8
src/views/scene/mode.vue

@@ -2,7 +2,7 @@
   <GroupButton
     class="scene-mode-tabs"
     :menus="menus"
-    :active-key="activeKey"
+    :active-key="customMap.mode"
     v-if="!disabledMap.mode"
   />
 </template>
@@ -29,20 +29,18 @@ const tabs = [
 
 const key = params.m + "model";
 
-const activeKey = ref(Number(localStorage.getItem(key) || 0));
 const menus = computed(() =>
   tabs.map((tab) => ({
-    icon: tab.mode === activeKey.value ? tab.activeIcon : tab.icon,
+    icon: tab.mode === customMap.mode ? tab.activeIcon : tab.icon,
     key: tab.mode,
-    onClick: () => (activeKey.value = tab.mode),
+    onClick: () => (customMap.mode = tab.mode),
   }))
 );
-
+customMap.mode = Number(localStorage.getItem(key)) || Mode.pano;
 watch(
-  activeKey,
+  () => customMap.mode,
   () => {
-    customMap.mode = activeKey.value;
-    localStorage.setItem(key, activeKey.value.toString());
+    localStorage.setItem(key, customMap.mode.toString());
   },
   { immediate: true }
 );

+ 4 - 0
后续要继续做的内容.txt

@@ -0,0 +1,4 @@
+1. 定位法
+2. res和ratio要合并到res中
+3. ListenLayer的细节
+4. 删除线,点,路的时候,关联的删除