Browse Source

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

xzw 2 years ago
parent
commit
632c167cc7
42 changed files with 1064 additions and 496 deletions
  1. 1 1
      server/test/a0k4xu045_202305311600080410/attach/sceneStore
  2. 49 3
      src/components/base/components/icon/iconfont/demo_index.html
  3. 11 3
      src/components/base/components/icon/iconfont/iconfont.css
  4. 1 1
      src/components/base/components/icon/iconfont/iconfont.js
  5. 14 0
      src/components/base/components/icon/iconfont/iconfont.json
  6. BIN
      src/components/base/components/icon/iconfont/iconfont.ttf
  7. BIN
      src/components/base/components/icon/iconfont/iconfont.woff
  8. BIN
      src/components/base/components/icon/iconfont/iconfont.woff2
  9. 1 1
      src/components/photos/header.vue
  10. 28 1
      src/components/photos/index.vue
  11. 2 2
      src/graphic/CanvasStyle/ImageLabels/SVGIcons.js
  12. 1 0
      src/graphic/CanvasStyle/focus.js
  13. 35 66
      src/graphic/Controls/AddPoint.js
  14. 25 23
      src/graphic/Controls/MoveLine.js
  15. 88 16
      src/graphic/Controls/MovePoint.js
  16. 77 78
      src/graphic/Controls/UIControl.js
  17. 5 3
      src/graphic/Geometry/CurveRoad.js
  18. 7 0
      src/graphic/Geometry/Geometry.js
  19. 8 3
      src/graphic/Geometry/Road.js
  20. 4 0
      src/graphic/Geometry/SVG.js
  21. 391 161
      src/graphic/Layer.js
  22. 80 77
      src/graphic/ListenLayer.js
  23. 17 0
      src/graphic/Load.js
  24. 11 14
      src/graphic/Renderer/Draw.js
  25. 2 2
      src/graphic/Service/DataService.js
  26. 3 4
      src/graphic/Service/ElementService.js
  27. 29 2
      src/graphic/Service/PointService.js
  28. 16 1
      src/graphic/Service/SVGService.js
  29. 1 0
      src/graphic/Settings.js
  30. 2 3
      src/main.ts
  31. 16 0
      src/store/SVGLabel.ts
  32. 4 0
      src/store/sync.ts
  33. 1 1
      src/views/accidents/index.vue
  34. 3 3
      src/views/accidents/print.vue
  35. 69 0
      src/views/graphic/geos/delAndCopu.vue
  36. 2 0
      src/views/graphic/geos/index.ts
  37. 42 14
      src/views/graphic/imageLabel.vue
  38. 5 2
      src/views/graphic/index.vue
  39. 2 2
      src/views/graphic/menus.ts
  40. 1 1
      src/views/roads/index.vue
  41. 9 7
      src/views/roads/tabulation.vue
  42. 1 1
      src/views/scene/index.vue

File diff suppressed because it is too large
+ 1 - 1
server/test/a0k4xu045_202305311600080410/attach/sceneStore


+ 49 - 3
src/components/base/components/icon/iconfont/demo_index.html

@@ -55,6 +55,18 @@
           <ul class="icon_lists dib-box">
 
             <li class="dib">
+              <span class="icon iconfont">&#xe7a7;</span>
+                <div class="name">return_l</div>
+                <div class="code-name">&amp;#xe7a7;</div>
+              </li>
+
+            <li class="dib">
+              <span class="icon iconfont">&#xe7a6;</span>
+                <div class="name">measure_free</div>
+                <div class="code-name">&amp;#xe7a6;</div>
+              </li>
+
+            <li class="dib">
               <span class="icon iconfont">&#xe7a4;</span>
                 <div class="name">jtxx_fangxb</div>
                 <div class="code-name">&amp;#xe7a4;</div>
@@ -936,9 +948,9 @@
 <pre><code class="language-css"
 >@font-face {
   font-family: 'iconfont';
-  src: url('iconfont.woff2?t=1686900891221') format('woff2'),
-       url('iconfont.woff?t=1686900891221') format('woff'),
-       url('iconfont.ttf?t=1686900891221') format('truetype');
+  src: url('iconfont.woff2?t=1687679372862') format('woff2'),
+       url('iconfont.woff?t=1687679372862') format('woff'),
+       url('iconfont.ttf?t=1687679372862') format('truetype');
 }
 </code></pre>
           <h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
@@ -965,6 +977,24 @@
         <ul class="icon_lists dib-box">
 
           <li class="dib">
+            <span class="icon iconfont icon-return_l"></span>
+            <div class="name">
+              return_l
+            </div>
+            <div class="code-name">.icon-return_l
+            </div>
+          </li>
+
+          <li class="dib">
+            <span class="icon iconfont icon-measure_free"></span>
+            <div class="name">
+              measure_free
+            </div>
+            <div class="code-name">.icon-measure_free
+            </div>
+          </li>
+
+          <li class="dib">
             <span class="icon iconfont icon-jtxx_fangxb"></span>
             <div class="name">
               jtxx_fangxb
@@ -2289,6 +2319,22 @@
 
             <li class="dib">
                 <svg class="icon svg-icon" aria-hidden="true">
+                  <use xlink:href="#icon-return_l"></use>
+                </svg>
+                <div class="name">return_l</div>
+                <div class="code-name">#icon-return_l</div>
+            </li>
+
+            <li class="dib">
+                <svg class="icon svg-icon" aria-hidden="true">
+                  <use xlink:href="#icon-measure_free"></use>
+                </svg>
+                <div class="name">measure_free</div>
+                <div class="code-name">#icon-measure_free</div>
+            </li>
+
+            <li class="dib">
+                <svg class="icon svg-icon" aria-hidden="true">
                   <use xlink:href="#icon-jtxx_fangxb"></use>
                 </svg>
                 <div class="name">jtxx_fangxb</div>

+ 11 - 3
src/components/base/components/icon/iconfont/iconfont.css

@@ -1,8 +1,8 @@
 @font-face {
   font-family: "iconfont"; /* Project id 4084834 */
-  src: url('iconfont.woff2?t=1686900891221') format('woff2'),
-       url('iconfont.woff?t=1686900891221') format('woff'),
-       url('iconfont.ttf?t=1686900891221') format('truetype');
+  src: url('iconfont.woff2?t=1687679372862') format('woff2'),
+       url('iconfont.woff?t=1687679372862') format('woff'),
+       url('iconfont.ttf?t=1687679372862') format('truetype');
 }
 
 .iconfont {
@@ -13,6 +13,14 @@
   -moz-osx-font-smoothing: grayscale;
 }
 
+.icon-return_l:before {
+  content: "\e7a7";
+}
+
+.icon-measure_free:before {
+  content: "\e7a6";
+}
+
 .icon-jtxx_fangxb:before {
   content: "\e7a4";
 }

File diff suppressed because it is too large
+ 1 - 1
src/components/base/components/icon/iconfont/iconfont.js


+ 14 - 0
src/components/base/components/icon/iconfont/iconfont.json

@@ -6,6 +6,20 @@
   "description": "交通事故现场勘验系统",
   "glyphs": [
     {
+      "icon_id": "36128160",
+      "name": "return_l",
+      "font_class": "return_l",
+      "unicode": "e7a7",
+      "unicode_decimal": 59303
+    },
+    {
+      "icon_id": "36080980",
+      "name": "measure_free",
+      "font_class": "measure_free",
+      "unicode": "e7a6",
+      "unicode_decimal": 59302
+    },
+    {
       "icon_id": "36017753",
       "name": "jtxx_fangxb",
       "font_class": "jtxx_fangxb",

BIN
src/components/base/components/icon/iconfont/iconfont.ttf


BIN
src/components/base/components/icon/iconfont/iconfont.woff


BIN
src/components/base/components/icon/iconfont/iconfont.woff2


+ 1 - 1
src/components/photos/header.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="photos-header">
     <div>
-      <ui-icon :type="type || 'return'" ctrl style="margin-right: 10px" @click="() => onBack ? onBack() : back()" />
+      <ui-icon :type="type || 'return_l'" ctrl style="margin-right: 10px" @click="() => onBack ? onBack() : back()" />
       <span>{{ title }}</span>
     </div>
     <span class="center" v-if="count">

+ 28 - 1
src/components/photos/index.vue

@@ -8,7 +8,10 @@
           @click="selectMode ? changeSelects(photo, !selects.includes(photo)) : $emit('update:active', photo)"
       >
         <div class="img-layout">
-          <img :src="useStaticUrl(getURL ? getURL(photo) : photo.url).value" />
+          <div class="occupying" v-if="!urls.get(photo).value" :style="{paddingTop: ratio}">
+            <ui-icon type="map" />
+          </div>
+          <img :src="urls.get(photo).value" v-else />
           <ui-input
               width="24px"
               height="24px"
@@ -30,6 +33,7 @@
 import { useStaticUrl } from '@/hook/useStaticUrl'
 import UiInput from "@/components/base/components/input/index.vue";
 import Undata from "./undata.vue";
+import {computed, reactive, Ref} from "vue";
 
 type Item = { url: string, id: string }
 
@@ -47,6 +51,14 @@ const emit = defineEmits<{
   (e: "update:selects", a: Item[]): void,
 }>()
 
+const urls = computed(() => {
+  const urls = reactive(new Map<Item, Ref<string>>())
+  props.data.forEach(item => {
+    urls.set(item, useStaticUrl(props.getURL ? props.getURL(item) : item.url))
+  })
+  return urls
+})
+const ratio = (window.innerHeight / window.innerWidth) * 100 + '%'
 const changeSelects = (item: Item, selected: boolean) => {
   const olSelected = props.selects.includes(item)
   if (selected !== olSelected) {
@@ -89,12 +101,27 @@ const changeSelects = (item: Item, selected: boolean) => {
   position: relative;
   height: 100%;
 }
+.occupying,
 .photo img {
   width: 100%;
   height: 100%;
   object-fit: contain;
   border-radius: 4px;
 }
+
+.occupying {
+  background: #1A1A1A;
+  position: relative;
+
+  .icon {
+    position: absolute;
+    top: 50%;
+    font-size: 30px;
+    left: 50%;
+    transform: translate(-50%, -50%);
+    color: rgba(255, 255, 255, 0.10);
+  }
+}
 </style>
 
 <style lang="scss">

+ 2 - 2
src/graphic/CanvasStyle/ImageLabels/SVGIcons.js

@@ -601,7 +601,7 @@ const SVGIcons = {
     }
 
   }, "huoche_p.svg": {
-    text: "货车面",
+    text: "货车平面面",
     draw: function (ctx) {
       ctx.save();
       //// ctx.strokeStyle = "rgba(0,0,0,0)";
@@ -820,7 +820,7 @@ const SVGIcons = {
     }
 
   }, "jiaoche_p.svg": {
-    text: "车平面",
+    text: "轿车平面",
     draw: function (ctx) {
       ctx.save();
       //// ctx.strokeStyle = "rgba(0,0,0,0)";

+ 1 - 0
src/graphic/CanvasStyle/focus.js

@@ -129,6 +129,7 @@ export default {
   CurveRoad,
   MeasureLine,
   TestPoint,
+  PositionLine: MeasureLine,
   FreeMeasureLine: MeasureLine,
   Circle,
   CurveLine,

+ 35 - 66
src/graphic/Controls/AddPoint.js

@@ -1,16 +1,16 @@
-import { dataService } from "../Service/DataService";
-import { lineService } from "../Service/LineService";
-import { pointService } from "../Service/PointService";
-import VectorCategory from "../enum/VectorCategory";
-import Point from "../Geometry/Point.js";
-import { mathUtil } from "../Util/MathUtil";
-import addLine from "./AddLine";
-import Settings from "../Settings";
-import { stateService } from "../Service/StateService";
-import LayerEvents from "../enum/LayerEvents";
-import VectorType from "../enum/VectorType";
-import Constant from "../Constant";
-import { listenLayer } from "../ListenLayer";
+import { dataService } from '../Service/DataService';
+import { lineService } from '../Service/LineService';
+import { pointService } from '../Service/PointService';
+import VectorCategory from '../enum/VectorCategory';
+import Point from '../Geometry/Point.js';
+import { mathUtil } from '../Util/MathUtil';
+import addLine from './AddLine';
+import Settings from '../Settings';
+import { stateService } from '../Service/StateService';
+import LayerEvents from '../enum/LayerEvents';
+import VectorType from '../enum/VectorType';
+import Constant from '../Constant';
+import { listenLayer } from '../ListenLayer';
 
 export default class AddPoint {
   constructor() {
@@ -18,48 +18,37 @@ export default class AddPoint {
   }
 
   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
-      ) {
+      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
-      ) {
+      } 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
-        ) {
+      } 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)
-      ) {
+      } 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.getLocationMode() == Constant.allLocationMode || newPoint.getLocationMode() == Constant.angleLocationMode || newPoint.getLocationMode() == Constant.normalLocationMode) &&
         newPoint.getCategory() == VectorCategory.Point.TestPoint
       ) {
         this.testPointIds.push(newPoint.vectorId);
@@ -101,18 +90,12 @@ export default class AddPoint {
     join.setLocationMode(Constant.angleLocationMode);
     join.setLinkedBasePointId(basePoint.vectorId);
     join.setLinkedTestPointId(testPointId);
-    lineService.createByPointId(
-      testPointId,
-      join.vectorId,
-      VectorCategory.Line.GuidePositionLine
-    );
+    let guidePositionLine = lineService.createByPointId(testPointId, join.vectorId, VectorCategory.Line.GuidePositionLine);
 
-    let guidePositionLine = lineService.createByPointId(
-      basePoint.vectorId,
-      join.vectorId,
-      VectorCategory.Line.PositionLine
-    );
+    let positionLine = lineService.createByPointId(basePoint.vectorId, join.vectorId, VectorCategory.Line.PositionLine);
     guidePositionLine.setLocationMode(Constant.angleLocationMode);
+    positionLine.setLocationMode(Constant.angleLocationMode);
+    join.setCategory(VectorCategory.Point.TestBasePoint);
   }
 
   //综合定位法
@@ -135,29 +118,15 @@ export default class AddPoint {
     join.setLinkedBasePointId(basePoint.vectorId);
     join.setLinkedTestPointId(testPointId);
     //待测点与基准线的垂直线
-    lineService.createByPointId(
-      testPointId,
-      join.vectorId,
-      VectorCategory.Line.PositionLine
-    );
+    lineService.createByPointId(testPointId, join.vectorId, VectorCategory.Line.PositionLine);
     //暂时没有其他待测点
     if (this.testPointIds.length == 0) {
       //待测点与基准线点的连线
-      lineService.createByPointId(
-        basePoint.vectorId,
-        testPointId,
-        VectorCategory.Line.PositionLine
-      );
+      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]
-      );
+      lineService.createByPointId(this.testPointIds[this.testPointIds.length - 1], testPointId, VectorCategory.Line.PositionLine);
+      testPoint.setLinkedTestPointId(this.testPointIds[this.testPointIds.length - 1]);
     }
   }
 
@@ -179,11 +148,7 @@ export default class AddPoint {
     join.setCategory(VectorCategory.Point.TestBasePoint);
     join.setLocationMode(Constant.normalLocationMode);
     join.setLinkedTestPointId(testPointId);
-    lineService.createByPointId(
-      testPointId,
-      join.vectorId,
-      VectorCategory.Line.PositionLine
-    );
+    lineService.createByPointId(testPointId, join.vectorId, VectorCategory.Line.PositionLine);
   }
 
   deleteTestPoints() {
@@ -192,6 +157,10 @@ export default class AddPoint {
     }
     this.testPointIds = [];
   }
+
+  resetTestPoints(){
+    this.testPointIds = [];
+  }
 }
 
 const addPoint = new AddPoint();

+ 25 - 23
src/graphic/Controls/MoveLine.js

@@ -1,9 +1,10 @@
-import Constant from "../Constant";
-import { dataService } from "../Service/DataService";
-import { lineService } from "../Service/LineService";
-import { pointService } from "../Service/PointService";
-import { mathUtil } from "../Util/MathUtil";
-import VectorCategory from "../enum/VectorCategory";
+import Constant from '../Constant';
+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';
 
 export default class MoveLine {
   constructor() {}
@@ -14,11 +15,9 @@ export default class MoveLine {
     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
-    ) {
+    if (line.getCategory() == VectorCategory.Line.PositionLine && line.getLocationMode() == Constant.angleLocationMode) {
       let point1 = {
         x: startPoint.x + dx,
         y: startPoint.y + dy,
@@ -36,27 +35,21 @@ export default class MoveLine {
           return false;
         }
         let newStartPoint = pointService.create(point1);
-        lineService.createByPointId(
-          startPoint.vectorId,
-          newStartPoint.vectorId,
-          VectorCategory.Line.ExtendedPositionLine
-        );
+        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.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
-        ) {
+        if (extendedLine.getCategory() != VectorCategory.Line.ExtendedPositionLine) {
           extendedLine = dataService.getLine(parents[1]);
         }
-        if (
-          extendedLine.getCategory() == VectorCategory.Line.ExtendedPositionLine
-        ) {
+        if (extendedLine.getCategory() == VectorCategory.Line.ExtendedPositionLine) {
           //point1是基准点
           point1 = dataService.getPoint(extendedLine.startId);
           point2 = dataService.getPoint(extendedLine.endId);
@@ -65,7 +58,7 @@ export default class MoveLine {
             dataService.deletePoint(extendedLine.endId);
 
             line.startId = point1.vectorId;
-            point1.setPointParent(line.vectorId, "start");
+            point1.setPointParent(line.vectorId, 'start');
 
             lineGeometry = mathUtil.createLine3(lineGeometry, point1);
           }
@@ -76,6 +69,15 @@ export default class MoveLine {
       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;

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

@@ -17,6 +17,7 @@ export default class MovePoint {
     if (point.getCategory() == VectorCategory.Point.TestPoint) {
       this.updatePositionByTestPoint(pointId);
     } else if (point.getCategory() == VectorCategory.Point.BasePoint) {
+
       this.updateBasePoint(pointId);
     } else {
       let parent = point.getParent();
@@ -38,6 +39,28 @@ export default class MovePoint {
   }
 
   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 &&
@@ -54,10 +77,18 @@ export default class MovePoint {
       ) {
         pointService.mergePoint(pointId, listenLayer.modifyPoint.linkedPointId);
         Settings.selectBasePointId = null;
-      } else if (category == VectorCategory.Point.BasePoint) {
-        Settings.selectBasePointId = pointId;
+
       } else {
-        Settings.selectBasePointId = null;
+        let point = dataService.getPoint(pointId);
+        const parent = point.getParent();
+        for (let key in parent) {
+          let line = dataService.getLine(key);
+          let startPoint = dataService.getPoint(line.startId);
+          let endPoint = dataService.getPoint(line.endId);
+          if (mathUtil.getDistance(startPoint, endPoint) == 0) {
+            pointService.deletePoint(pointId);
+          }
+        }
       }
     }
   }
@@ -93,21 +124,61 @@ export default class MovePoint {
   }
 
   //更新待测点(直角定位法)
+  // updateTestPointByAngle(testPointId) {
+  //   let testPoint = dataService.getPoint(testPointId);
+  //   let basePoint = dataService.getPoint(testPoint.getLinkedBasePointId());
+  //   let lineGeometry = dataService.getLine(Settings.baseLineId);
+  //   let startPoint = dataService.getPoint(lineGeometry.startId);
+  //   let endPoint = dataService.getPoint(lineGeometry.endId);
+  //   let line = mathUtil.createLine1(startPoint, endPoint);
+  //   let vLine = mathUtil.getVerticalLine(line, testPoint);
+  //   let join = mathUtil.getJoinLinePoint(basePoint, vLine);
+  //   let testBasePoint = this.getTestBasePoint(
+  //     basePoint.vectorId,
+  //     testPointId,
+  //     Constant.angleLocationMode
+  //   );
+  //   mathUtil.clonePoint(testBasePoint, join);
+  // }
   updateTestPointByAngle(testPointId) {
     let testPoint = dataService.getPoint(testPointId);
-    let basePoint = dataService.getPoint(testPoint.getLinkedBasePointId());
-    let lineGeometry = dataService.getLine(Settings.baseLineId);
-    let startPoint = dataService.getPoint(lineGeometry.startId);
-    let endPoint = dataService.getPoint(lineGeometry.endId);
-    let line = mathUtil.createLine1(startPoint, endPoint);
-    let vLine = mathUtil.getVerticalLine(line, testPoint);
-    let join = mathUtil.getJoinLinePoint(basePoint, vLine);
-    let testBasePoint = this.getTestBasePoint(
-      basePoint.vectorId,
-      testPointId,
-      Constant.angleLocationMode
-    );
-    mathUtil.clonePoint(testBasePoint, join);
+    //let basePoint = dataService.getPoint(testPoint.getLinkedBasePointId());
+
+    let parent = testPoint.getParent();
+    let guidePositionLine = dataService.getLine(Object.keys(parent)[0]);
+    let otherPointId = null;
+    if (guidePositionLine.startId == testPointId) {
+      otherPointId = guidePositionLine.endId;
+    } else if (guidePositionLine.endId == testPointId) {
+      otherPointId = guidePositionLine.startId;
+    }
+    let otherPoint = dataService.getPoint(otherPointId);
+    parent = otherPoint.getParent();
+    for (let key in parent) {
+      if (key == guidePositionLine.vectorId) {
+        continue;
+      } else {
+        let positionLine = dataService.getLine(key);
+        let startPoint = dataService.getPoint(positionLine.startId);
+        let endPoint = dataService.getPoint(positionLine.endId);
+        let positionLineGeometry = mathUtil.createLine1(startPoint, endPoint);
+        if (!positionLineGeometry) {
+          let lineGeometry = dataService.getLine(Settings.baseLineId);
+          let baseStartPoint = dataService.getPoint(lineGeometry.startId);
+          let baseEndPoint = dataService.getPoint(lineGeometry.endId);
+          let baseLine = mathUtil.createLine1(baseStartPoint, baseEndPoint);
+          positionLineGeometry = mathUtil.createLine3(baseLine, testPoint);
+        }
+        let join = mathUtil.getJoinLinePoint(testPoint, positionLineGeometry);
+        mathUtil.clonePoint(otherPoint, join);
+        // if (
+        //   mathUtil.getDistance(startPoint, endPoint) < Constant.minAdsorbPix
+        // ) {
+        //   pointService.deletePoint(positionLine.startId);
+        // }
+        break;
+      }
+    }
   }
 
   //更新待测点(综合定位法)
@@ -118,6 +189,7 @@ export default class MovePoint {
     let startPoint = dataService.getPoint(lineGeometry.startId);
     let endPoint = dataService.getPoint(lineGeometry.endId);
     let line = mathUtil.createLine1(startPoint, endPoint);
+
     let join = mathUtil.getJoinLinePoint(testPoint, line);
     let testBasePoint = this.getTestBasePoint(
       basePoint.vectorId,

+ 77 - 78
src/graphic/Controls/UIControl.js

@@ -1,37 +1,38 @@
-import { coordinate } from "../Coordinate.js";
-import LayerEvents from "../enum/LayerEvents.js";
-import UIEvents from "../enum/UIEvents.js";
-import RoadTemplate from "../enum/RoadTemplate.js";
-import RoadStructure from "../enum/RoadStructure.js";
-import VectorType from "../enum/VectorType.js";
-import VectorStyle from "../enum/VectorStyle.js";
-import VectorWeight from "../enum/VectorWeight.js";
-import GeoActions from "../enum/GeoActions.js";
-import VectorEvents from "../enum/VectorEvents.js";
-import SVGType from "../enum/SVGType.js";
-import { stateService } from "../Service/StateService.js";
-import { uiService } from "../Service/UIService.js";
-import { dataService } from "../Service/DataService.js";
-import { historyService } from "../Service/HistoryService.js";
-import { elementService } from "../Service/ElementService";
-import { lineService } from "../Service/LineService.js";
-import { circleService } from "../Service/CircleService.js";
-import { textService } from "../Service/TextService.js";
-import { magnifierService } from "../Service/MagnifierService.js";
-import { mathUtil } from "../Util/MathUtil";
-import Constant from "../Constant";
+import { coordinate } from '../Coordinate.js';
+import LayerEvents from '../enum/LayerEvents.js';
+import UIEvents from '../enum/UIEvents.js';
+import RoadTemplate from '../enum/RoadTemplate.js';
+import RoadStructure from '../enum/RoadStructure.js';
+import VectorType from '../enum/VectorType.js';
+import VectorStyle from '../enum/VectorStyle.js';
+import VectorWeight from '../enum/VectorWeight.js';
+import GeoActions from '../enum/GeoActions.js';
+import VectorEvents from '../enum/VectorEvents.js';
+import SVGType from '../enum/SVGType.js';
+import { stateService } from '../Service/StateService.js';
+import { uiService } from '../Service/UIService.js';
+import { dataService } from '../Service/DataService.js';
+import { historyService } from '../Service/HistoryService.js';
+import { elementService } from '../Service/ElementService';
+import { lineService } from '../Service/LineService.js';
+import { circleService } from '../Service/CircleService.js';
+import { textService } from '../Service/TextService.js';
+import { svgService } from '../Service/SVGService.js';
+import { magnifierService } from '../Service/MagnifierService.js';
+import { mathUtil } from '../Util/MathUtil';
+import Constant from '../Constant';
 // import { roomsUtil } from "../Room/RoomsUtil.js";
-import { addRoad } from "../Controls/AddRoad";
-import { addLine } from "./AddLine.js";
-import VectorCategory from "../enum/VectorCategory.js";
+import { addRoad } from '../Controls/AddRoad';
+import { addLine } from './AddLine.js';
+import VectorCategory from '../enum/VectorCategory.js';
 // import { floorplanData } from "../VectorData.js";
-import Message from "@/components/base/components/message/message.vue";
-import { pointService } from "../Service/PointService.js";
-import Settings from "../Settings.js";
-import { addPoint } from "./AddPoint.js";
-import { curveRoadPointService } from "../Service/CurveRoadPointService.js";
-import { roadService } from "../Service/RoadService.js";
-import { curveRoadService } from "../Service/CurveRoadService.js";
+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 { curveRoadPointService } from '../Service/CurveRoadPointService.js';
+import { roadService } from '../Service/RoadService.js';
+import { curveRoadService } from '../Service/CurveRoadService.js';
 
 export default class UIControl {
   constructor(layer, newsletter, graphicStateUI) {
@@ -86,11 +87,10 @@ export default class UIControl {
           this.layer.exit();
         }
 
-
         //执行新的事件
-        if (uiService.isBelongRoad(selectUI) || selectUI == "road") {
+        if (uiService.isBelongRoad(selectUI) || selectUI == 'road') {
           stateService.setEventName(LayerEvents.AddRoad);
-        }  else if (selectUI == UIEvents.CurveRoad) {
+        } else if (selectUI == UIEvents.CurveRoad) {
           stateService.setEventName(LayerEvents.AddCurveRoad);
         } else if (uiService.isBelongLine(selectUI)) {
           stateService.setEventName(LayerEvents.AddLine);
@@ -119,7 +119,7 @@ export default class UIControl {
   }
 
   updateVectorForSelectUI(selectUI) {
-    console.log("selectUI", selectUI);
+    console.log('selectUI', selectUI);
     const focusItem = stateService.getFocusItem();
 
     // if (selectUI == VectorStyle.Bold || selectUI == VectorStyle.Thinning) {
@@ -142,11 +142,10 @@ export default class UIControl {
     if (uiService.isBelongRoadEdgeStyle(selectUI)) {
       let key = null;
       if (VectorStyle[selectUI]) {
-        key = "setStyle";
+        key = 'setStyle';
       } else if (VectorWeight[selectUI]) {
-        key = "setWeight";
+        key = 'setWeight';
       }
-      console.log(key);
 
       if (focusItem.type == VectorType.Line) {
         let Line = dataService.getLine(focusItem.vectorId);
@@ -330,10 +329,25 @@ export default class UIControl {
         pointService.deletePoint(vectorId);
         break;
       case VectorType.Line:
+        let line = dataService.getLine(vectorId);
+
         dataService.deleteLine(vectorId);
         if (vectorId == Settings.baseLineId) {
           this.layer.initLocation();
           Settings.baseLineId = null;
+        } else if (
+          line.getCategory() == VectorCategory.Line.ExtendedPositionLine ||
+          line.getCategory() == VectorCategory.Line.PositionLine ||
+          line.getCategory() == VectorCategory.Line.GuidePositionLine
+        ) {
+          let startPoint = dataService.getPoint(line.startId);
+          let endPoint = dataService.getPoint(line.endId);
+          if (startPoint.getCategory() != VectorCategory.Point.BasePoint) {
+            pointService.deletePoint(line.startId);
+          }
+          if (endPoint.getCategory() != VectorCategory.Point.BasePoint) {
+            pointService.deletePoint(line.endId);
+          }
         }
         break;
       case VectorType.CurveLine:
@@ -391,6 +405,9 @@ export default class UIControl {
       case VectorType.Magnifier:
         await magnifierService.copy(vectorId);
         break;
+      case VectorType.SVG:
+        svgService.copy(vectorId);
+        break;
     }
   }
 
@@ -399,32 +416,32 @@ export default class UIControl {
     let canvas = this.layer.canvas;
     this.menu_view_reset();
     //隐藏grid
-    Settings.screenMode = true
+    Settings.screenMode = true;
     dataService.setGridDisplay(false);
     this.layer.renderer.autoRedraw();
     // this.downloadCadImg(canvas, "test.jpg");
     const blob = await this.getCadBlob(canvas);
     //显示grid
     dataService.setGridDisplay(true);
-    Settings.screenMode = false
+    Settings.screenMode = false;
     this.layer.renderer.autoRedraw();
 
     return blob;
   }
 
   getCadBlob(canvas) {
-    var type = "jpg";
+    var type = 'jpg';
     return new Promise((resolve) => canvas.toBlob(resolve, `${type}/image`));
   }
 
   downloadCadImg(canvas, filename) {
     // 图片导出为 jpg 格式
-    var type = "jpg";
+    var type = 'jpg';
     var imgData = canvas.toDataURL(type, 3);
     canvas.toBlob(`${type}/image`);
 
     // 加工image data,替换mime type
-    imgData = imgData.replace(this._fixType(type), "image/octet-stream");
+    imgData = imgData.replace(this._fixType(type), 'image/octet-stream');
     // 下载后的图片名
     //var filename = 'cad_' + new Date().getTime() + '.' + type
     // download
@@ -432,38 +449,19 @@ export default class UIControl {
   }
 
   saveFile(data, filename) {
-    var save_link = document.createElementNS(
-      "http://www.w3.org/1999/xhtml",
-      "a"
-    );
+    var save_link = document.createElementNS('http://www.w3.org/1999/xhtml', 'a');
     save_link.href = data;
     save_link.download = filename;
 
-    var event = document.createEvent("MouseEvents");
-    event.initMouseEvent(
-      "click",
-      true,
-      false,
-      window,
-      0,
-      0,
-      0,
-      0,
-      0,
-      false,
-      false,
-      false,
-      false,
-      0,
-      null
-    );
+    var event = document.createEvent('MouseEvents');
+    event.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
     save_link.dispatchEvent(event);
   }
 
   _fixType(type) {
-    type = type.toLowerCase().replace(/jpg/i, "jpeg");
+    type = type.toLowerCase().replace(/jpg/i, 'jpeg');
     var r = type.match(/png|jpeg|bmp|gif/)[0];
-    return "image/" + r;
+    return 'image/' + r;
   }
   /****************************************************************************针对菜单*******************************************************************************/
 
@@ -522,9 +520,7 @@ export default class UIControl {
   /******************************************************************************************************************************************************************/
 
   prompt(msg) {
-    this._prompts.push(
-      Message.success(typeof msg === "string" ? { msg } : msg)
-    );
+    this._prompts.push(Message.success(typeof msg === 'string' ? { msg } : msg));
   }
 
   // 进入持续添加出确认与取消框
@@ -532,16 +528,19 @@ export default class UIControl {
     this.graphicStateUI.continuedMode = true;
   }
   confirmEntry() {
-    console.log("确认");
+    console.log('确认');
+    Settings.selectLocationMode = null;
     this.graphicStateUI.continuedMode = false;
     this.layer.exit();
     uiService.setSelectLineCategory(VectorCategory.Line.NormalLine);
     uiService.setSelectPointCategory(VectorCategory.Point.NormalPoint);
+    addPoint.resetTestPoints(); //重置testPoints数组
     this.layer.history.save();
     this.layer.renderer.autoRedraw();
   }
   confirmCancel() {
-    console.log("取消");
+    console.log('取消');
+    Settings.selectLocationMode = null;
     this.graphicStateUI.continuedMode = false;
     addPoint.deleteTestPoints();
     addLine.deleteTestLines();
@@ -554,22 +553,22 @@ export default class UIControl {
 
   // 设置默认设置
   setDefaultSetting(setting) {
-    console.log("获得设置", setting);
+    console.log('获得设置', setting);
 
     uiService.setRoadMidDivideWidth(
       // (setting.roadQuarantineWidth / coordinate.res) * coordinate.ratio
-      (setting.roadQuarantineWidth / coordinate.res)
+      setting.roadQuarantineWidth / coordinate.res
     );
     uiService.setCurveRoadMidDivideWidth(
       // (setting.roadQuarantineWidth / coordinate.res) * coordinate.ratio
-      (setting.roadQuarantineWidth / coordinate.res)
+      setting.roadQuarantineWidth / coordinate.res
     );
     uiService.setSingleLaneWidth(
       // (setting.singleRoadWidth / coordinate.res) * coordinate.ratio
-      (setting.singleRoadWidth / coordinate.res)
+      setting.singleRoadWidth / coordinate.res
     );
     // uiService.setLineWidth(setting.lineWidth / 1000 / coordinate.res);
-    uiService.setLineWidth(setting.lineWidth );
+    uiService.setLineWidth(setting.lineWidth);
     this.layer.renderer.autoRedraw();
   }
 

+ 5 - 3
src/graphic/Geometry/CurveRoad.js

@@ -1,6 +1,7 @@
 import VectorType from "../enum/VectorType.js";
 import Road from "./Road.js";
 import Settings from "../Settings";
+import Constant from "../Constant.js";
 
 export default class CurveRoad extends Road {
   constructor(startId, endId, vectorId) {
@@ -12,9 +13,9 @@ export default class CurveRoad extends Road {
     this.leftDrivewayCount = Settings.curveRoadLeftDrivewayCount; //左边的车道个数
     this.rightDrivewayCount = Settings.curveRoadRightDrivewayCount; //右边的车道个数
     this.leftWidth =
-      Settings.curveRoadLeftDrivewayCount * Settings.singleLaneWidth;
+      (Settings.curveRoadLeftDrivewayCount * Settings.singleLaneWidth)* window.coordinate.ratio;
     this.rightWidth =
-      Settings.curveRoadRightDrivewayCount * Settings.singleLaneWidth;
+      (Settings.curveRoadRightDrivewayCount * Settings.singleLaneWidth)* window.coordinate.ratio;
     this.midDivide = {
       leftMidDivide: [],
       leftMidDivideCurves: [],
@@ -25,8 +26,9 @@ export default class CurveRoad extends Road {
     this.curves = [];
     this.singleCurveRoadDrivewayCount = Settings.singleCurveRoadDrivewayCount;
     this.singleCurveRoadWidth =
-      Settings.singleCurveRoadDrivewayCount * Settings.singleLaneWidth;
+      Settings.singleCurveRoadDrivewayCount * Settings.singleLaneWidth* window.coordinate.ratio;
     this.geoType = VectorType.CurveRoad;
+    this.setWay(Constant.twoWay)
     this.setId(vectorId);
   }
 

+ 7 - 0
src/graphic/Geometry/Geometry.js

@@ -127,6 +127,13 @@ export default class Geometry {
     this.locationMode = value;
   }
 
+  setLinkedBasePointId(id){
+    this.linkedBasePointId = id;
+  }
+  setLinkedTestPointId(id){
+    this.linkedTestPointId = id;
+  }
+
   getLocationMode() {
     return this.locationMode;
   }

+ 8 - 3
src/graphic/Geometry/Road.js

@@ -3,6 +3,8 @@ import Geometry from "./Geometry.js";
 import Settings from "../Settings";
 import Constant from "../Constant";
 
+import {coordinate} from '../Coordinate.js'
+
 export default class Road extends Geometry {
   constructor(startId, endId, vectorId) {
     super();
@@ -24,14 +26,17 @@ export default class Road extends Geometry {
     this.leftDrivewayCount = Settings.roadLeftDrivewayCount; //左边的车道个数
     this.rightDrivewayCount = Settings.roadRightDrivewayCount; //右边的车道个数
     this.geoType = VectorType.Road;
-    this.leftWidth = Settings.roadLeftDrivewayCount * Settings.singleLaneWidth;
+
+    
+    this.leftWidth = (Settings.roadLeftDrivewayCount * Settings.singleLaneWidth) * window.coordinate.ratio;
     this.rightWidth =
-      Settings.roadRightDrivewayCount * Settings.singleLaneWidth;
+      Settings.roadRightDrivewayCount * Settings.singleLaneWidth* window.coordinate.ratio;
     this.singleRoadDrivewayCount = Settings.singleRoadDrivewayCount;
     this.singleRoadWidth =
-      Settings.singleRoadDrivewayCount * Settings.singleLaneWidth;
+      Settings.singleRoadDrivewayCount * Settings.singleLaneWidth* window.coordinate.ratio;
     this.way = Settings.wayType;
     this.setId(vectorId);
+    
   }
 
   setWidth(value, dir) {

+ 4 - 0
src/graphic/Geometry/SVG.js

@@ -93,6 +93,10 @@ export default class SVG extends Geometry {
   setPoints(points){
     this.points = points
   }
+  setScale(scale) {
+    this.scale = scale
+  }
+
 
   setBoundingVertexs2(position, pointIndex) {
     if (mathUtil.getDistance(position, this.center) < Constant.minAdsorbPix) {

+ 391 - 161
src/graphic/Layer.js

@@ -1,47 +1,47 @@
-import Load from './Load';
-import { stateService } from './Service/StateService';
-import { elementService } from './Service/ElementService';
-import { dataService } from './Service/DataService';
-import { textService } from './Service/TextService';
-import { historyService } from './Service/HistoryService';
-import UIControl from './Controls/UIControl';
+import Load from "./Load";
+import { stateService } from "./Service/StateService";
+import { elementService } from "./Service/ElementService";
+import { dataService } from "./Service/DataService";
+import { textService } from "./Service/TextService";
+import { historyService } from "./Service/HistoryService";
+import UIControl from "./Controls/UIControl";
 // import { moveRectangle } from "./Controls/MoveRectangle";
-import { moveText } from './Controls/MoveText';
-import { moveSVG } from './Controls/MoveSVG';
-import { moveMagnifier } from './Controls/MoveMagnifier';
-import { addRoad } from './Controls/AddRoad';
-import { addCrossRoad } from './Controls/AddCrossRoad';
-import { addLine } from './Controls/AddLine';
-import { addPoint } from './Controls/AddPoint';
-import { addCircle } from './Controls/AddCircle';
-import { addText } from './Controls/AddText';
-import { addMagnifier } from './Controls/AddMagnifier';
-import { addSVG } from './Controls/AddSVG';
-import { moveRoad } from './Controls/MoveRoad';
-import { moveLine } from './Controls/MoveLine';
-import { movePoint } from './Controls/MovePoint';
-import { moveCircle } from './Controls/MoveCircle';
-import { coordinate } from './Coordinate';
-import Render from './Renderer/Render';
-import { draw } from './Renderer/Draw';
-import { listenLayer } from './ListenLayer';
-import LayerEvents from './enum/LayerEvents.js';
-import UIEvents from './enum/UIEvents.js';
-import SelectState from './enum/SelectState.js';
-import VectorType from './enum/VectorType';
-import { mathUtil } from './Util/MathUtil';
-import History from './History/History';
-import mitt from 'mitt';
-import { roadService } from './Service/RoadService';
-import { edgeService } from './Service/EdgeService';
-import { roadPointService } from './Service/RoadPointService';
-import { curveRoadService } from './Service/CurveRoadService';
-import VectorCategory from './enum/VectorCategory';
-import Settings from './Settings';
-import Constant from './Constant';
-import { uiService } from './Service/UIService';
-import { imageService } from './Service/ImageService';
-import VectorEvents from './enum/VectorEvents';
+import { moveText } from "./Controls/MoveText";
+import { moveSVG } from "./Controls/MoveSVG";
+import { moveMagnifier } from "./Controls/MoveMagnifier";
+import { addRoad } from "./Controls/AddRoad";
+import { addCrossRoad } from "./Controls/AddCrossRoad";
+import { addLine } from "./Controls/AddLine";
+import { addPoint } from "./Controls/AddPoint";
+import { addCircle } from "./Controls/AddCircle";
+import { addText } from "./Controls/AddText";
+import { addMagnifier } from "./Controls/AddMagnifier";
+import { addSVG } from "./Controls/AddSVG";
+import { moveRoad } from "./Controls/MoveRoad";
+import { moveLine } from "./Controls/MoveLine";
+import { movePoint } from "./Controls/MovePoint";
+import { moveCircle } from "./Controls/MoveCircle";
+import { coordinate } from "./Coordinate";
+import Render from "./Renderer/Render";
+import { draw } from "./Renderer/Draw";
+import { listenLayer } from "./ListenLayer";
+import LayerEvents from "./enum/LayerEvents.js";
+import UIEvents from "./enum/UIEvents.js";
+import SelectState from "./enum/SelectState.js";
+import VectorType from "./enum/VectorType";
+import { mathUtil } from "./Util/MathUtil";
+import History from "./History/History";
+import mitt from "mitt";
+import { roadService } from "./Service/RoadService";
+import { edgeService } from "./Service/EdgeService";
+import { roadPointService } from "./Service/RoadPointService";
+import { curveRoadService } from "./Service/CurveRoadService";
+import VectorCategory from "./enum/VectorCategory";
+import Settings from "./Settings";
+import Constant from "./Constant";
+import { uiService } from "./Service/UIService";
+import { imageService } from "./Service/ImageService";
+import VectorEvents from "./enum/VectorEvents";
 
 const minDragDis = 10;
 const minZoom = 20;
@@ -76,25 +76,25 @@ export default class Layer {
   }
 
   bindEvents() {
-    this.canvas.addEventListener('contextmenu', function (e) {
+    this.canvas.addEventListener("contextmenu", function (e) {
       e.preventDefault();
     });
-    this.canvas.addEventListener('mousedown', this.onMouseDown.bind(this));
-    this.canvas.addEventListener('mousemove', this.onMouseMove.bind(this));
-    this.canvas.addEventListener('mouseup', this.onMouseUp.bind(this));
+    this.canvas.addEventListener("mousedown", this.onMouseDown.bind(this));
+    this.canvas.addEventListener("mousemove", this.onMouseMove.bind(this));
+    this.canvas.addEventListener("mouseup", this.onMouseUp.bind(this));
 
-    this.canvas.addEventListener('touchstart', this.onMouseDown.bind(this));
-    this.canvas.addEventListener('touchmove', this.onMouseMove.bind(this));
-    this.canvas.addEventListener('touchend', this.onMouseUp.bind(this));
+    this.canvas.addEventListener("touchstart", this.onMouseDown.bind(this));
+    this.canvas.addEventListener("touchmove", this.onMouseMove.bind(this));
+    this.canvas.addEventListener("touchend", this.onMouseUp.bind(this));
 
-    this.canvas.addEventListener('mousewheel', this.onWheel.bind(this));
-    this.canvas.addEventListener('DOMMouseScroll', this.onWheel.bind(this));
-    this.canvas.addEventListener('resize', this.reSize.bind(this));
-    document.addEventListener('keydown', this.onKeydown.bind(this));
+    this.canvas.addEventListener("mousewheel", this.onWheel.bind(this));
+    this.canvas.addEventListener("DOMMouseScroll", this.onWheel.bind(this));
+    this.canvas.addEventListener("resize", this.reSize.bind(this));
+    document.addEventListener("keydown", this.onKeydown.bind(this));
   }
 
   reSize = function () {
-    console.log('resize');
+    console.log("resize");
     coordinate.updateForCanvas();
     this.renderer.autoRedraw();
   };
@@ -130,16 +130,16 @@ export default class Layer {
     let selectItem = stateService.getSelectItem();
     let focusItem = stateService.getFocusItem();
 
-    this.setEventName('mouseDown');
+    this.setEventName("mouseDown");
     const eventName = stateService.getEventName();
     switch (eventName) {
       case LayerEvents.AddRoad:
         stateService.setEventName(LayerEvents.AddingRoad);
-        addRoad.setNewRoadPoint('start', position);
+        addRoad.setNewRoadPoint("start", position);
         break;
       case LayerEvents.AddCurveRoad:
         stateService.setEventName(LayerEvents.AddingCurveRoad);
-        addRoad.setNewRoadPoint('start', position);
+        addRoad.setNewRoadPoint("start", position);
         break;
       case LayerEvents.AddLine:
         stateService.setEventName(LayerEvents.AddingLine);
@@ -153,11 +153,21 @@ export default class Layer {
         stateService.setEventName(LayerEvents.MovePoint);
         const newPoint = addPoint.buildPoint(position);
         if (newPoint) {
-          stateService.setSelectItem(newPoint.vectorId, VectorType.Point, SelectState.Select);
+          stateService.setSelectItem(
+            newPoint.vectorId,
+            VectorType.Point,
+            SelectState.Select
+          );
           this.history.save();
           this.renderer.autoRedraw();
         } else {
-          this.uiControl.prompt({ msg: '请先选择基准点', time: 1000 });
+          if(Settings.basePointIds.length>1){
+            this.uiControl.prompt({ msg: '请先选择基准点', time: 1000 });
+          }else{
+            this.uiControl.prompt({ msg: '请先添加基准点', time: 1000 });
+          }
+
+          // this.uiControl.prompt({ msg: '请先选择基准点', time: 1000 });
         }
         break;
       case LayerEvents.AddCircle:
@@ -167,7 +177,11 @@ export default class Layer {
       case LayerEvents.AddText:
         stateService.setEventName(LayerEvents.MoveText);
         addText.buildText(position);
-        stateService.setSelectItem(addText.newText.vectorId, VectorType.Text, SelectState.Select);
+        stateService.setSelectItem(
+          addText.newText.vectorId,
+          VectorType.Text,
+          SelectState.Select
+        );
         addText.clear();
         break;
       case LayerEvents.AddSVG:
@@ -181,7 +195,11 @@ export default class Layer {
       case LayerEvents.AddMagnifier:
         stateService.setEventName(LayerEvents.MoveMagnifier);
         addMagnifier.buildMagnifier(position);
-        stateService.setSelectItem(addMagnifier.newMagnifier.vectorId, VectorType.Magnifier, SelectState.Select);
+        stateService.setSelectItem(
+          addMagnifier.newMagnifier.vectorId,
+          VectorType.Magnifier,
+          SelectState.Select
+        );
         addMagnifier.clear();
         break;
       case VectorEvents.AddLane:
@@ -189,18 +207,34 @@ export default class Layer {
           let road = dataService.getRoad(selectItem.vectorId);
           if (road) {
             let roadLanCount = road.getLanesCount(selectItem.dir);
-            if (selectItem.dir == 'left') {
-              roadService.updateForAddSubtractLanesCount(road.vectorId, roadLanCount + 1, selectItem.dir);
+            if (selectItem.dir == "left") {
+              roadService.updateForAddSubtractLanesCount(
+                road.vectorId,
+                roadLanCount + 1,
+                selectItem.dir
+              );
             } else {
-              roadService.updateForAddSubtractLanesCount(road.vectorId, roadLanCount + 1, selectItem.dir);
+              roadService.updateForAddSubtractLanesCount(
+                road.vectorId,
+                roadLanCount + 1,
+                selectItem.dir
+              );
             }
           } else {
             road = dataService.getCurveRoad(selectItem.vectorId);
             let curveRoadLanCount = road.getLanesCount(selectItem.dir);
-            if (selectItem.dir == 'left') {
-              curveRoadService.updateForAddSubtractLanesCount(road.vectorId, curveRoadLanCount + 1, selectItem.dir);
+            if (selectItem.dir == "left") {
+              curveRoadService.updateForAddSubtractLanesCount(
+                road.vectorId,
+                curveRoadLanCount + 1,
+                selectItem.dir
+              );
             } else {
-              curveRoadService.updateForAddSubtractLanesCount(road.vectorId, curveRoadLanCount + 1, selectItem.dir);
+              curveRoadService.updateForAddSubtractLanesCount(
+                road.vectorId,
+                curveRoadLanCount + 1,
+                selectItem.dir
+              );
             }
           }
           stateService.clearEventName();
@@ -213,18 +247,34 @@ export default class Layer {
           let road = dataService.getRoad(selectItem.vectorId);
           if (road) {
             let roadLanCount = road.getLanesCount(selectItem.dir);
-            if (selectItem.dir == 'left') {
-              roadService.updateForAddSubtractLanesCount(road.vectorId, roadLanCount - 1, selectItem.dir);
+            if (selectItem.dir == "left") {
+              roadService.updateForAddSubtractLanesCount(
+                road.vectorId,
+                roadLanCount - 1,
+                selectItem.dir
+              );
             } else {
-              roadService.updateForAddSubtractLanesCount(road.vectorId, roadLanCount - 1, selectItem.dir);
+              roadService.updateForAddSubtractLanesCount(
+                road.vectorId,
+                roadLanCount - 1,
+                selectItem.dir
+              );
             }
           } else {
             road = dataService.getCurveRoad(selectItem.vectorId);
             let curveRoadLanCount = road.getLanesCount(selectItem.dir);
-            if (selectItem.dir == 'left') {
-              curveRoadService.updateForAddSubtractLanesCount(road.vectorId, curveRoadLanCount - 1, selectItem.dir);
+            if (selectItem.dir == "left") {
+              curveRoadService.updateForAddSubtractLanesCount(
+                road.vectorId,
+                curveRoadLanCount - 1,
+                selectItem.dir
+              );
             } else {
-              curveRoadService.updateForAddSubtractLanesCount(road.vectorId, curveRoadLanCount - 1, selectItem.dir);
+              curveRoadService.updateForAddSubtractLanesCount(
+                road.vectorId,
+                curveRoadLanCount - 1,
+                selectItem.dir
+              );
             }
           }
           stateService.clearEventName();
@@ -235,12 +285,18 @@ export default class Layer {
       case VectorEvents.AddCrossPoint:
         if (focusItem && focusItem.vectorId) {
           const curveRoad = dataService.getCurveRoad(focusItem.vectorId);
-          let index = mathUtil.getIndexForCurvesPoints(position, curveRoad.points);
+          let index = mathUtil.getIndexForCurvesPoints(
+            position,
+            curveRoad.points
+          );
           if (index != -1) {
             curveRoadService.addCPoint(curveRoad, position, index);
           } else {
             const dis1 = mathUtil.getDistance(curveRoad.points[0], position);
-            const dis2 = mathUtil.getDistance(curveRoad.points[curveRoad.points.length - 1], position);
+            const dis2 = mathUtil.getDistance(
+              curveRoad.points[curveRoad.points.length - 1],
+              position
+            );
             if (dis1 > dis2) {
               index = curveRoad.points.length - 2;
               // curveRoadService.addCPoint(
@@ -255,7 +311,10 @@ export default class Layer {
             curveRoadService.addCPoint(curveRoad, position, index);
           }
           //curveRoadService.setLanes(curveRoad.vectorId);
-          curveRoadService.updateForMovePoint(curveRoad.points[index + 1].vectorId, position);
+          curveRoadService.updateForMovePoint(
+            curveRoad.points[index + 1].vectorId,
+            position
+          );
           stateService.clearEventName();
           this.history.save();
           this.renderer.autoRedraw();
@@ -336,14 +395,24 @@ export default class Layer {
       y: position.y,
     };
     const eventName = stateService.getEventName();
-    if (!this.dragging && Math.abs(X - this.startX) < minDragDis && Math.abs(Y - this.startY) < minDragDis) {
+    if (
+      !this.dragging &&
+      Math.abs(X - this.startX) < minDragDis &&
+      Math.abs(Y - this.startY) < minDragDis
+    ) {
       return;
     }
     this.dragging = true;
-    if (Math.abs(X - this.startX) > minDragDis || Math.abs(Y - this.startY) > minDragDis) {
+    if (
+      Math.abs(X - this.startX) > minDragDis ||
+      Math.abs(Y - this.startY) > minDragDis
+    ) {
       // 是否拖拽了
       if (eventName != null) {
-        if (eventName == LayerEvents.MoveMagnifier && stateService.getSelectItem().state != 0) {
+        if (
+          eventName == LayerEvents.MoveMagnifier &&
+          stateService.getSelectItem().state != 0
+        ) {
         } else {
           stateService.clearFocusItem();
           this.uiControl.focusVector = null;
@@ -364,15 +433,17 @@ export default class Layer {
         needAutoRedraw = listenLayer.start(position);
         let seleteItem = stateService.getSelectItem();
         if (seleteItem != null) {
-          console.log('选中:' + seleteItem.vectorId);
+          console.log("选中:" + seleteItem.vectorId);
         } else {
         }
         break;
       case LayerEvents.PanBackGround:
         stateService.clearItems();
         let center = {};
-        center.x = coordinate.center.x - (dx * coordinate.defaultZoom) / coordinate.zoom;
-        center.y = coordinate.center.y + (dy * coordinate.defaultZoom) / coordinate.zoom;
+        center.x =
+          coordinate.center.x - (dx * coordinate.defaultZoom) / coordinate.zoom;
+        center.y =
+          coordinate.center.y + (dy * coordinate.defaultZoom) / coordinate.zoom;
         let tempCenter = {};
         mathUtil.clonePoint(tempCenter, coordinate.center);
         mathUtil.clonePoint(coordinate.center, center);
@@ -467,12 +538,12 @@ export default class Layer {
         elementService.setNewRoad(addRoad.startInfo.position, position);
         elementService.showNewRoad();
 
-        addRoad.setNewRoadPoint('end', position);
+        addRoad.setNewRoadPoint("end", position);
         addRoad.canAdd = addRoad.canAddRoadForEnd(position);
         if (!addRoad.canAdd) {
-          elementService.setNewRoadState('error');
+          elementService.setNewRoadState("error");
         } else {
-          elementService.setNewRoadState('normal');
+          elementService.setNewRoadState("normal");
         }
         elementService.showPoint();
         this.showElementLine(position, eventName);
@@ -566,9 +637,16 @@ export default class Layer {
         let road = dataService.getRoad(draggingItem.vectorId);
         let start = dataService.getRoadPoint(road.startId);
         let end = dataService.getRoadPoint(road.endId);
-        if (Object.keys(start.getParent()).length == 1 && Object.keys(end.getParent()).length == 1) {
+        if (
+          Object.keys(start.getParent()).length == 1 &&
+          Object.keys(end.getParent()).length == 1
+        ) {
           //拖拽的路只有一条
-          moveRoad.moveRoad(draggingItem.vectorId, (dx * coordinate.defaultZoom) / coordinate.zoom, (dy * coordinate.defaultZoom) / coordinate.zoom);
+          moveRoad.moveRoad(
+            draggingItem.vectorId,
+            (dx * coordinate.defaultZoom) / coordinate.zoom,
+            (dy * coordinate.defaultZoom) / coordinate.zoom
+          );
         }
         break;
       case LayerEvents.MoveRoadPoint:
@@ -579,7 +657,10 @@ export default class Layer {
         });
         if (
           listenLayer.modifyPoint &&
-          (listenLayer.modifyPoint.linkedRoadPointId || listenLayer.modifyPoint.linkedRoadId || listenLayer.modifyPoint.linkedRoadPointIdX || listenLayer.modifyPoint.linkedRoadPointIdY)
+          (listenLayer.modifyPoint.linkedRoadPointId ||
+            listenLayer.modifyPoint.linkedRoadId ||
+            listenLayer.modifyPoint.linkedRoadPointIdX ||
+            listenLayer.modifyPoint.linkedRoadPointIdY)
         ) {
           position = {
             x: listenLayer.modifyPoint.x,
@@ -589,7 +670,11 @@ export default class Layer {
           listenLayer.modifyPoint = null;
         }
 
-        let flag = moveRoad.moveingRoadPoint(draggingItem.vectorId, position, listenLayer.modifyPoint);
+        let flag = moveRoad.moveingRoadPoint(
+          draggingItem.vectorId,
+          position,
+          listenLayer.modifyPoint
+        );
         if (!flag) {
           elementService.hideAll();
         } else {
@@ -620,25 +705,28 @@ export default class Layer {
             y: listenLayer.modifyPoint.y,
           };
         }
-
         elementService.execute(addRoad.startInfo.position, position);
         elementService.setPoint(position);
         elementService.setNewRoad(addRoad.startInfo.position, position);
         elementService.showNewRoad();
 
-        addRoad.setNewRoadPoint('end', position);
+        addRoad.setNewRoadPoint("end", position);
         addRoad.canAdd = addRoad.canAddRoadForEnd(position);
         if (!addRoad.canAdd) {
-          elementService.setNewRoadState('error');
+          elementService.setNewRoadState("error");
         } else {
-          elementService.setNewRoadState('normal');
+          elementService.setNewRoadState("normal");
         }
         elementService.showPoint();
         this.showElementLine(position, eventName);
         break;
       case LayerEvents.MoveCurveRoad:
         needAutoRedraw = true;
-        moveRoad.moveCurveRoad(draggingItem.vectorId, (dx * coordinate.defaultZoom) / coordinate.zoom, (dy * coordinate.defaultZoom) / coordinate.zoom);
+        moveRoad.moveCurveRoad(
+          draggingItem.vectorId,
+          (dx * coordinate.defaultZoom) / coordinate.zoom,
+          (dy * coordinate.defaultZoom) / coordinate.zoom
+        );
         break;
       case LayerEvents.MoveCurveRoadPoint:
         if (!draggingItem || !draggingItem.vectorId) {
@@ -681,13 +769,21 @@ export default class Layer {
         break;
       case LayerEvents.MoveCurveEdge:
         if (listenLayer.modifyPoint) {
-          moveRoad.moveCurveEdge(draggingItem.vectorId, listenLayer.modifyPoint.selectIndex, position);
+          moveRoad.moveCurveEdge(
+            draggingItem.vectorId,
+            listenLayer.modifyPoint.selectIndex,
+            position
+          );
         }
         needAutoRedraw = true;
         break;
       case LayerEvents.MoveLine:
         if (draggingItem != null) {
-          let flag = moveLine.moveLine(draggingItem.vectorId, (dx * coordinate.defaultZoom) / coordinate.zoom, (dy * coordinate.defaultZoom) / coordinate.zoom);
+          let flag = moveLine.moveLine(
+            draggingItem.vectorId,
+            (dx * coordinate.defaultZoom) / coordinate.zoom,
+            (dy * coordinate.defaultZoom) / coordinate.zoom
+          );
           if (!flag) {
             this.lastX = this.lastX - dx / coordinate.ratio;
             this.lastY = this.lastY - dy / coordinate.ratio;
@@ -709,8 +805,13 @@ export default class Layer {
             };
           }
           movePoint.movePoint(position, draggingItem.vectorId);
-          this.showElementLine(point, eventName);
+          point = dataService.getPoint(draggingItem.vectorId);
           needAutoRedraw = true;
+          if (!point) {
+            stateService.clearEventName();
+          } else {
+            this.showElementLine(point, eventName);
+          }
         }
         break;
       case LayerEvents.MoveCurvePoint:
@@ -733,16 +834,33 @@ export default class Layer {
         break;
       case LayerEvents.MoveCurveLine:
         if (draggingItem != null) {
-          moveLine.moveCurveLine(draggingItem.vectorId, (dx * coordinate.defaultZoom) / coordinate.zoom, (dy * coordinate.defaultZoom) / coordinate.zoom);
+          moveLine.moveCurveLine(
+            draggingItem.vectorId,
+            (dx * coordinate.defaultZoom) / coordinate.zoom,
+            (dy * coordinate.defaultZoom) / coordinate.zoom
+          );
           needAutoRedraw = true;
         }
         break;
       case LayerEvents.MoveCircle:
         if (draggingItem != null) {
           if (draggingItem.state == -1) {
-            moveCircle.moveFull(draggingItem.vectorId, (dx * coordinate.defaultZoom) / coordinate.zoom, (dy * coordinate.defaultZoom) / coordinate.zoom);
-          } else if (draggingItem.state == 0 || draggingItem.state == 1 || draggingItem.state == 2 || draggingItem.state == 3) {
-            moveCircle.movePoint(position, draggingItem.vectorId, draggingItem.state);
+            moveCircle.moveFull(
+              draggingItem.vectorId,
+              (dx * coordinate.defaultZoom) / coordinate.zoom,
+              (dy * coordinate.defaultZoom) / coordinate.zoom
+            );
+          } else if (
+            draggingItem.state == 0 ||
+            draggingItem.state == 1 ||
+            draggingItem.state == 2 ||
+            draggingItem.state == 3
+          ) {
+            moveCircle.movePoint(
+              position,
+              draggingItem.vectorId,
+              draggingItem.state
+            );
           } else {
             debugger;
           }
@@ -761,14 +879,22 @@ export default class Layer {
           if (draggingItem.state == -1) {
             moveSVG.moveFullSVG(position, draggingItem.vectorId);
           } else {
-            moveSVG.movePoint(position, draggingItem.vectorId, draggingItem.state);
+            moveSVG.movePoint(
+              position,
+              draggingItem.vectorId,
+              draggingItem.state
+            );
           }
         }
         break;
       case LayerEvents.MoveMagnifier:
         needAutoRedraw = true;
         if (draggingItem != null) {
-          moveMagnifier.moveFullMagnifier(position, draggingItem.vectorId, draggingItem.state);
+          moveMagnifier.moveFullMagnifier(
+            position,
+            draggingItem.vectorId,
+            draggingItem.state
+          );
         }
         break;
     }
@@ -830,6 +956,7 @@ export default class Layer {
         stateService.clearFocusItem();
         this.uiControl.focusVector = null;
         this.uiControl.currentUI = null;
+        Settings.selectBasePointId = null;
         break;
       case LayerEvents.MoveRoadPoint:
         if (!draggingItem || !draggingItem.vectorId) {
@@ -843,19 +970,40 @@ export default class Layer {
             exceptPointId: draggingItem.vectorId,
             exceptRoadIds: point.parent,
           });
-          if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty('linkedRoadPointId')) {
-            moveRoad.moveTo(draggingItem.vectorId, listenLayer.modifyPoint.linkedRoadPointId);
-          } else if (listenLayer.modifyPoint && (listenLayer.modifyPoint.linkedRoadPointIdX || listenLayer.modifyPoint.linkedRoadPointIdY)) {
+          if (
+            listenLayer.modifyPoint &&
+            listenLayer.modifyPoint.hasOwnProperty("linkedRoadPointId")
+          ) {
+            moveRoad.moveTo(
+              draggingItem.vectorId,
+              listenLayer.modifyPoint.linkedRoadPointId
+            );
+          } else if (
+            listenLayer.modifyPoint &&
+            (listenLayer.modifyPoint.linkedRoadPointIdX ||
+              listenLayer.modifyPoint.linkedRoadPointIdY)
+          ) {
             mathUtil.clonePoint(point, listenLayer.modifyPoint);
-          } else if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty('linkedRoadId')) {
+          } else if (
+            listenLayer.modifyPoint &&
+            listenLayer.modifyPoint.hasOwnProperty("linkedRoadId")
+          ) {
             point = roadPointService.create({
               x: listenLayer.modifyPoint.x,
               y: listenLayer.modifyPoint.y,
             });
-            roadService.splitRoad(listenLayer.modifyPoint.linkedRoadId, point.vectorId, 'start');
+            roadService.splitRoad(
+              listenLayer.modifyPoint.linkedRoadId,
+              point.vectorId,
+              "start"
+            );
             moveRoad.moveTo(draggingItem.vectorId, point.vectorId);
           } else if (moveRoad.splitRoadId != null) {
-            roadService.splitRoad(moveRoad.splitRoadId, draggingItem.vectorId, 'start');
+            roadService.splitRoad(
+              moveRoad.splitRoadId,
+              draggingItem.vectorId,
+              "start"
+            );
           }
           //draggingItem.vectorId所在的墙面与其他墙角相交
           moveRoad.updateForAbsorbRoadPoints();
@@ -994,8 +1142,11 @@ export default class Layer {
         break;
       case LayerEvents.AddPoint:
         if (
-          (Settings.selectBasePointId != null && (Settings.selectLocationMode == Constant.angleLocationMode || Settings.selectLocationMode == Constant.allLocationMode)) ||
-          (Settings.baseLineId != null && Settings.selectLocationMode == Constant.normalLocationMode)
+          (Settings.selectBasePointId != null &&
+            (Settings.selectLocationMode == Constant.angleLocationMode ||
+              Settings.selectLocationMode == Constant.allLocationMode)) ||
+          (Settings.baseLineId != null &&
+            Settings.selectLocationMode == Constant.normalLocationMode)
         ) {
           this.uiControl.showConfirm();
           needAutoRedraw = true;
@@ -1009,7 +1160,7 @@ export default class Layer {
         break;
     }
 
-    this.setEventName('mouseUp');
+    this.setEventName("mouseUp");
     stateService.clearDraggingItem();
     if (needAutoRedraw) {
       this.renderer.autoRedraw();
@@ -1019,9 +1170,11 @@ export default class Layer {
   onWheel(e) {
     e.preventDefault();
     const type = e.type;
-    if (type == 'DOMMouseScroll' || type == 'mousewheel') {
+    if (type == "DOMMouseScroll" || type == "mousewheel") {
       // 当在canvas用滚轮滚动时
-      const delta = e.wheelDelta ? (e.wheelDelta / 120) * 20 : (-(e.detail || 0) / 3) * 20;
+      const delta = e.wheelDelta
+        ? (e.wheelDelta / 120) * 20
+        : (-(e.detail || 0) / 3) * 20;
       const zoom = coordinate.zoom + delta;
       let X = e.offsetX || e.layerX;
       let Y = e.offsetY || e.layerY;
@@ -1058,10 +1211,10 @@ export default class Layer {
   //测试用
   onKeydown(e) {
     let focusItem = stateService.getFocusItem();
-    let dir = 'left';
+    let dir = "left";
     if (focusItem) {
-      console.log('键盘(foucus有效):' + e.code);
-      if (e.code == 'Delete') {
+      console.log("键盘(foucus有效):" + e.code);
+      if (e.code == "Delete") {
         //删除
         const road = dataService.getRoad(focusItem.vectorId);
         roadService.subtraRoadFromIntersect(road.startId, focusItem.vectorId);
@@ -1072,105 +1225,142 @@ export default class Layer {
         this.history.save();
       }
       //加宽
-      else if (e.code == 'KeyA') {
+      else if (e.code == "KeyA") {
         let road = dataService.getRoad(focusItem.vectorId);
         if (road) {
           roadService.updateForWidth(road.vectorId, road.leftWidth + 50, dir);
         } else {
           road = dataService.getCurveRoad(focusItem.vectorId);
-          curveRoadService.updateForWidth(road.vectorId, road.leftWidth + 50, dir);
+          curveRoadService.updateForWidth(
+            road.vectorId,
+            road.leftWidth + 50,
+            dir
+          );
         }
 
         this.renderer.autoRedraw();
         this.history.save();
       }
       //变窄
-      else if (e.code == 'KeyB') {
+      else if (e.code == "KeyB") {
         let road = dataService.getRoad(focusItem.vectorId);
         if (road) {
           roadService.updateForWidth(road.vectorId, road.leftWidth - 25, dir);
         } else {
           road = dataService.getCurveRoad(focusItem.vectorId);
-          curveRoadService.updateForWidth(road.vectorId, road.leftWidth - 25, dir);
+          curveRoadService.updateForWidth(
+            road.vectorId,
+            road.leftWidth - 25,
+            dir
+          );
         }
         this.renderer.autoRedraw();
         this.history.save();
       }
       //添加左车道
-      else if (e.code == 'KeyQ') {
+      else if (e.code == "KeyQ") {
         let road = dataService.getRoad(focusItem.vectorId);
         if (road) {
-          roadService.updateForAddSubtractLanesCount(focusItem.vectorId, road.leftDrivewayCount + 1, 'left');
+          roadService.updateForAddSubtractLanesCount(
+            focusItem.vectorId,
+            road.leftDrivewayCount + 1,
+            "left"
+          );
         } else {
           road = dataService.getCurveRoad(focusItem.vectorId);
           curveRoadService.updateForAddSubtractLanesCount(
             road,
             road.leftDrivewayCount + 1, //rightDrivewayCount
-            'left'
+            "left"
           );
         }
         this.renderer.autoRedraw();
         this.history.save();
       }
       //减少左车道
-      else if (e.code == 'KeyW') {
+      else if (e.code == "KeyW") {
         let road = dataService.getRoad(focusItem.vectorId);
         if (road) {
-          roadService.updateForAddSubtractLanesCount(focusItem.vectorId, road.leftDrivewayCount - 1, 'left');
+          roadService.updateForAddSubtractLanesCount(
+            focusItem.vectorId,
+            road.leftDrivewayCount - 1,
+            "left"
+          );
         } else {
           road = dataService.getCurveRoad(focusItem.vectorId);
           curveRoadService.updateForAddSubtractLanesCount(
             road,
             road.leftDrivewayCount - 1, //rightDrivewayCount
-            'left'
+            "left"
           );
         }
         this.renderer.autoRedraw();
         this.history.save();
       }
       //添加右车道
-      else if (e.code == 'KeyE') {
+      else if (e.code == "KeyE") {
         let road = dataService.getRoad(focusItem.vectorId);
         if (road) {
-          roadService.updateForAddSubtractLanesCount(focusItem.vectorId, road.rightDrivewayCount + 1, 'right');
+          roadService.updateForAddSubtractLanesCount(
+            focusItem.vectorId,
+            road.rightDrivewayCount + 1,
+            "right"
+          );
         } else {
           road = dataService.getCurveRoad(focusItem.vectorId);
           curveRoadService.updateForAddSubtractLanesCount(
             road,
             road.rightDrivewayCount + 1, //rightDrivewayCount
-            'right'
+            "right"
           );
         }
         this.renderer.autoRedraw();
         this.history.save();
       }
       //减少右车道
-      else if (e.code == 'KeyR') {
+      else if (e.code == "KeyR") {
         let road = dataService.getRoad(focusItem.vectorId);
         if (road) {
-          roadService.updateForAddSubtractLanesCount(focusItem.vectorId, road.rightDrivewayCount - 1, 'right');
+          roadService.updateForAddSubtractLanesCount(
+            focusItem.vectorId,
+            road.rightDrivewayCount - 1,
+            "right"
+          );
         } else {
           road = dataService.getCurveRoad(focusItem.vectorId);
           curveRoadService.updateForAddSubtractLanesCount(
             road,
             road.rightDrivewayCount - 1, //rightDrivewayCount
-            'right'
+            "right"
           );
         }
         this.renderer.autoRedraw();
         this.history.save();
       }
       //弯路添加控制点
-      else if (e.code == 'KeyT') {
+      else if (e.code == "KeyT") {
         const curveRoad = dataService.getCurveRoad(focusItem.vectorId);
-        let index = mathUtil.getIndexForCurvesPoints(this.mousePosition, curveRoad.points);
+        let index = mathUtil.getIndexForCurvesPoints(
+          this.mousePosition,
+          curveRoad.points
+        );
         if (index != -1) {
           curveRoadService.addCPoint(curveRoad, this.mousePosition, index);
         } else {
-          const dis1 = mathUtil.getDistance(curveRoad.points[0], this.mousePosition);
-          const dis2 = mathUtil.getDistance(curveRoad.points[curveRoad.points.length - 1], this.mousePosition);
+          const dis1 = mathUtil.getDistance(
+            curveRoad.points[0],
+            this.mousePosition
+          );
+          const dis2 = mathUtil.getDistance(
+            curveRoad.points[curveRoad.points.length - 1],
+            this.mousePosition
+          );
           if (dis1 > dis2) {
-            curveRoadService.addCPoint(curveRoad, this.mousePosition, curveRoad.points.length - 2);
+            curveRoadService.addCPoint(
+              curveRoad,
+              this.mousePosition,
+              curveRoad.points.length - 2
+            );
           } else {
             curveRoadService.addCPoint(curveRoad, this.mousePosition, 1);
           }
@@ -1179,7 +1369,7 @@ export default class Layer {
         this.history.save();
       }
       //弯路删除控制点
-      else if (e.code == 'KeyY') {
+      else if (e.code == "KeyY") {
         const curvePoint = dataService.getCurveRoadPoint(focusItem.vectorId);
         const curveRoad = dataService.getCurveRoad(curvePoint.parent);
         curveRoadService.subCPoint(curveRoad, curvePoint.getIndex());
@@ -1187,14 +1377,14 @@ export default class Layer {
         this.history.save();
       }
     } else {
-      console.log('键盘(foucus无效):' + e.code);
+      console.log("键盘(foucus无效):" + e.code);
     }
   }
 
   setEventName(eventType) {
     let eventName = stateService.getEventName();
 
-    if (eventType == 'mouseDown') {
+    if (eventType == "mouseDown") {
       if (eventName == null) {
         const selectItem = stateService.getSelectItem();
         if (selectItem == null) {
@@ -1231,7 +1421,7 @@ export default class Layer {
           stateService.setEventName(LayerEvents.MoveSVG);
         }
       }
-    } else if (eventType == 'mouseUp') {
+    } else if (eventType == "mouseUp") {
       if (eventName == LayerEvents.AddingRoad) {
         if (Settings.isMobile) {
           stateService.clearEventName();
@@ -1263,8 +1453,11 @@ export default class Layer {
       } else if (
         (eventName == LayerEvents.AddPoint &&
           Settings.selectBasePointId != null &&
-          (Settings.selectLocationMode == Constant.angleLocationMode || Settings.selectLocationMode == Constant.allLocationMode)) ||
-        (eventName == LayerEvents.AddPoint && Settings.baseLineId != null && Settings.selectLocationMode == Constant.normalLocationMode)
+          (Settings.selectLocationMode == Constant.angleLocationMode ||
+            Settings.selectLocationMode == Constant.allLocationMode)) ||
+        (eventName == LayerEvents.AddPoint &&
+          Settings.baseLineId != null &&
+          Settings.selectLocationMode == Constant.normalLocationMode)
       ) {
       } else {
         stateService.clearEventName();
@@ -1281,7 +1474,10 @@ export default class Layer {
 
   stopAddVector() {
     let eventName = stateService.getEventName();
-    if (eventName != LayerEvents.AddingRoad && eventName != LayerEvents.AddingLine) {
+    if (
+      eventName != LayerEvents.AddingRoad &&
+      eventName != LayerEvents.AddingLine
+    ) {
       stateService.clearEventName();
     } else if (eventName == LayerEvents.AddingRoad) {
       stateService.setEventName(LayerEvents.AddRoad);
@@ -1419,23 +1615,57 @@ export default class Layer {
     let otherPoint1 = null;
     let otherPoint2 = null;
     if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedRoadPointIdX) {
-      otherPoint1 = dataService.getRoadPoint(listenLayer.modifyPoint.linkedRoadPointIdX);
-    } else if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedCurveRoadPointIdX) {
-      otherPoint1 = dataService.getCurveRoadPoint(listenLayer.modifyPoint.linkedCurvePointIdX);
-    } else if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedPointIdX) {
-      otherPoint1 = dataService.getPoint(listenLayer.modifyPoint.linkedPointIdX);
-    } else if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedCurvePointIdX) {
-      otherPoint1 = dataService.getCurvePoint(listenLayer.modifyPoint.linkedCurvePointIdX);
+      otherPoint1 = dataService.getRoadPoint(
+        listenLayer.modifyPoint.linkedRoadPointIdX
+      );
+    } else if (
+      listenLayer.modifyPoint &&
+      listenLayer.modifyPoint.linkedCurveRoadPointIdX
+    ) {
+      otherPoint1 = dataService.getCurveRoadPoint(
+        listenLayer.modifyPoint.linkedCurvePointIdX
+      );
+    } else if (
+      listenLayer.modifyPoint &&
+      listenLayer.modifyPoint.linkedPointIdX
+    ) {
+      otherPoint1 = dataService.getPoint(
+        listenLayer.modifyPoint.linkedPointIdX
+      );
+    } else if (
+      listenLayer.modifyPoint &&
+      listenLayer.modifyPoint.linkedCurvePointIdX
+    ) {
+      otherPoint1 = dataService.getCurvePoint(
+        listenLayer.modifyPoint.linkedCurvePointIdX
+      );
     }
 
     if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedRoadPointIdY) {
-      otherPoint2 = dataService.getRoadPoint(listenLayer.modifyPoint.linkedRoadPointIdY);
-    } else if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedCurvePointIdY) {
-      otherPoint2 = dataService.getCurveRoadPoint(listenLayer.modifyPoint.linkedCurvePointIdY);
-    } else if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedPointIdY) {
-      otherPoint2 = dataService.getPoint(listenLayer.modifyPoint.linkedPointIdY);
-    } else if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedCurvePointIdY) {
-      otherPoint2 = dataService.getCurvePoint(listenLayer.modifyPoint.linkedCurvePointIdY);
+      otherPoint2 = dataService.getRoadPoint(
+        listenLayer.modifyPoint.linkedRoadPointIdY
+      );
+    } else if (
+      listenLayer.modifyPoint &&
+      listenLayer.modifyPoint.linkedCurvePointIdY
+    ) {
+      otherPoint2 = dataService.getCurveRoadPoint(
+        listenLayer.modifyPoint.linkedCurvePointIdY
+      );
+    } else if (
+      listenLayer.modifyPoint &&
+      listenLayer.modifyPoint.linkedPointIdY
+    ) {
+      otherPoint2 = dataService.getPoint(
+        listenLayer.modifyPoint.linkedPointIdY
+      );
+    } else if (
+      listenLayer.modifyPoint &&
+      listenLayer.modifyPoint.linkedCurvePointIdY
+    ) {
+      otherPoint2 = dataService.getCurvePoint(
+        listenLayer.modifyPoint.linkedCurvePointIdY
+      );
     }
 
     let otherPoint = {};
@@ -1445,7 +1675,7 @@ export default class Layer {
     }
     if (otherPoint2) {
       otherPoint.y = otherPoint2.y;
-      if (!otherPoint.hasOwnProperty('x')) {
+      if (!otherPoint.hasOwnProperty("x")) {
         otherPoint.x = otherPoint2.x;
       }
     }

+ 80 - 77
src/graphic/ListenLayer.js

@@ -307,6 +307,9 @@ export default class ListenLayer {
       let startPoint = dataService.getPoint(line.startId);
       let endPoint = dataService.getPoint(line.endId);
       const comLine = mathUtil.createLine1(startPoint, endPoint);
+      if (!comLine) {
+        continue;
+      }
       const join = mathUtil.getJoinLinePoint(position, comLine);
       const distance = this.getDistance(position, join);
       if (!mathUtil.isContainForSegment(join, startPoint, endPoint)) {
@@ -957,12 +960,82 @@ export default class ListenLayer {
     */
   setModifyPoint(position, info) {
     //优先级最高
-    if (
+    this.modifyPoint = {};
+    if (info && info.textInfo.textId) {
+      this.modifyPoint = {};
+      this.modifyPoint.textId = info.textInfo.textId;
+      this.modifyPoint.x = info.textInfo.x;
+      this.modifyPoint.y = info.textInfo.y;
+    } else if (info && info.magnifierInfo.magnifierId) {
+      this.modifyPoint = {};
+      this.modifyPoint.magnifierId = info.magnifierInfo.magnifierId;
+      this.modifyPoint.index = info.magnifierInfo.index;
+      this.modifyPoint.x = info.magnifierInfo.x;
+      this.modifyPoint.y = info.magnifierInfo.y;
+    } else if (info && info.circleInfo.circleId) {
+      this.modifyPoint = {};
+      this.modifyPoint.linkedCircleId = info.circleInfo.circleId;
+      this.modifyPoint.index = info.circleInfo.index;
+      this.modifyPoint.x = info.circleInfo.x;
+      this.modifyPoint.y = info.circleInfo.y;
+    } else if (
+      info &&
+      (info.pointInfo.pointId || info.curvePointInfo.curvePointId)
+    ) {
+      this.modifyPoint = {};
+      if (info.pointInfo.pointId && info.curvePointInfo.curvePointId) {
+        if (info.pointInfo.distance < info.curvePointInfo.distance) {
+          this.modifyPoint.linkedPointId = info.pointInfo.pointId;
+          this.modifyPoint.x = info.pointInfo.x;
+          this.modifyPoint.y = info.pointInfo.y;
+        } else {
+          this.modifyPoint.linkedCurvePointId =
+            info.curvePointInfo.curvePointId;
+          this.modifyPoint.x = info.curvePointInfo.x;
+          this.modifyPoint.y = info.curvePointInfo.y;
+        }
+      } else if (info.pointInfo.pointId) {
+        this.modifyPoint.linkedPointId = info.pointInfo.pointId;
+        this.modifyPoint.x = info.pointInfo.x;
+        this.modifyPoint.y = info.pointInfo.y;
+      } else if (info.curvePointInfo.curvePointId) {
+        this.modifyPoint.linkedCurvePointId = info.curvePointInfo.curvePointId;
+        this.modifyPoint.x = info.curvePointInfo.x;
+        this.modifyPoint.y = info.curvePointInfo.y;
+      }
+    } else if (
+      info &&
+      (info.lineInfo.lineId || info.curveLineInfo.curveLineId)
+    ) {
+      this.modifyPoint = {};
+      if (info.lineInfo.lineId && info.curveLineInfo.curveLineId) {
+        if (info.lineInfo.distance < info.curveLineInfo.distance) {
+          this.modifyPoint.linkedLineId = info.lineInfo.lineId;
+          this.modifyPoint.x = info.lineInfo.x;
+          this.modifyPoint.y = info.lineInfo.y;
+        } else {
+          this.modifyPoint.linkedCurveLineId = info.curveLineInfo.curveLineId;
+          this.modifyPoint.x = info.curveLineInfo.x;
+          this.modifyPoint.y = info.curveLineInfo.y;
+        }
+      } else if (info.lineInfo.lineId) {
+        this.modifyPoint.linkedLineId = info.lineInfo.lineId;
+        this.modifyPoint.x = info.lineInfo.x;
+        this.modifyPoint.y = info.lineInfo.y;
+      } else if (info.curveLineInfo.curveLineId) {
+        this.modifyPoint.linkedCurveLineId = info.curveLineInfo.curveLineId;
+        this.modifyPoint.x = info.curveLineInfo.x;
+        this.modifyPoint.y = info.curveLineInfo.y;
+      }
+    } else if (info && info.svgInfo.svgId) {
+      this.modifyPoint = {};
+      this.modifyPoint.svgId = info.svgInfo.svgId;
+      this.modifyPoint.index = info.svgInfo.index;
+    } else if (
       info &&
       (info.roadPointInfo.roadPointId ||
         info.curveRoadPointInfo.curveRoadPointId)
     ) {
-      this.modifyPoint = {};
       if (
         info.roadPointInfo.roadPointId &&
         info.curveRoadPointInfo.curveRoadPointId
@@ -989,31 +1062,6 @@ export default class ListenLayer {
       }
     } else if (
       info &&
-      (info.pointInfo.pointId || info.curvePointInfo.curvePointId)
-    ) {
-      this.modifyPoint = {};
-      if (info.pointInfo.pointId && info.curvePointInfo.curvePointId) {
-        if (info.pointInfo.distance < info.curvePointInfo.distance) {
-          this.modifyPoint.linkedPointId = info.pointInfo.pointId;
-          this.modifyPoint.x = info.pointInfo.x;
-          this.modifyPoint.y = info.pointInfo.y;
-        } else {
-          this.modifyPoint.linkedCurvePointId =
-            info.curvePointInfo.curvePointId;
-          this.modifyPoint.x = info.curvePointInfo.x;
-          this.modifyPoint.y = info.curvePointInfo.y;
-        }
-      } else if (info.pointInfo.pointId) {
-        this.modifyPoint.linkedPointId = info.pointInfo.pointId;
-        this.modifyPoint.x = info.pointInfo.x;
-        this.modifyPoint.y = info.pointInfo.y;
-      } else if (info.curvePointInfo.curvePointId) {
-        this.modifyPoint.linkedCurvePointId = info.curvePointInfo.curvePointId;
-        this.modifyPoint.x = info.curvePointInfo.x;
-        this.modifyPoint.y = info.curvePointInfo.y;
-      }
-    } else if (
-      info &&
       (info.roadEdgeInfo.roadId || info.curveRoadEdgeInfo.curveRoadId)
     ) {
       this.modifyPoint = {};
@@ -1040,23 +1088,6 @@ export default class ListenLayer {
         this.modifyPoint.y = info.curveRoadEdgeInfo.y;
         this.modifyPoint.dir = info.curveRoadEdgeInfo.dir;
       }
-    } else if (info && info.crossPointInfo.crossCrossPointId) {
-      this.modifyPoint = {};
-      this.modifyPoint.linkedCrossCrossPointId =
-        info.crossPointInfo.crossCrossPointId;
-      this.modifyPoint.x = info.crossPointInfo.x;
-      this.modifyPoint.y = info.crossPointInfo.y;
-    } else if (info && info.textInfo.textId) {
-      this.modifyPoint = {};
-      this.modifyPoint.textId = info.textInfo.textId;
-      this.modifyPoint.x = info.textInfo.x;
-      this.modifyPoint.y = info.textInfo.y;
-    } else if (info && info.magnifierInfo.magnifierId) {
-      this.modifyPoint = {};
-      this.modifyPoint.magnifierId = info.magnifierInfo.magnifierId;
-      this.modifyPoint.index = info.magnifierInfo.index;
-      this.modifyPoint.x = info.magnifierInfo.x;
-      this.modifyPoint.y = info.magnifierInfo.y;
     } else if (
       info &&
       (info.roadEdgeInfo.edgeId || info.curveRoadEdgeInfo.curveEdgeId)
@@ -1084,40 +1115,12 @@ export default class ListenLayer {
         this.modifyPoint.x = info.curveRoadEdgeInfo.x;
         this.modifyPoint.y = info.curveRoadEdgeInfo.y;
       }
-    } else if (
-      info &&
-      (info.lineInfo.lineId || info.curveLineInfo.curveLineId)
-    ) {
-      this.modifyPoint = {};
-      if (info.lineInfo.lineId && info.curveLineInfo.curveLineId) {
-        if (info.lineInfo.distance < info.curveLineInfo.distance) {
-          this.modifyPoint.linkedLineId = info.lineInfo.lineId;
-          this.modifyPoint.x = info.lineInfo.x;
-          this.modifyPoint.y = info.lineInfo.y;
-        } else {
-          this.modifyPoint.linkedCurveLineId = info.curveLineInfo.curveLineId;
-          this.modifyPoint.x = info.curveLineInfo.x;
-          this.modifyPoint.y = info.curveLineInfo.y;
-        }
-      } else if (info.lineInfo.lineId) {
-        this.modifyPoint.linkedLineId = info.lineInfo.lineId;
-        this.modifyPoint.x = info.lineInfo.x;
-        this.modifyPoint.y = info.lineInfo.y;
-      } else if (info.curveLineInfo.curveLineId) {
-        this.modifyPoint.linkedCurveLineId = info.curveLineInfo.curveLineId;
-        this.modifyPoint.x = info.curveLineInfo.x;
-        this.modifyPoint.y = info.curveLineInfo.y;
-      }
-    } else if (info && info.circleInfo.circleId) {
-      this.modifyPoint = {};
-      this.modifyPoint.linkedCircleId = info.circleInfo.circleId;
-      this.modifyPoint.index = info.circleInfo.index;
-      this.modifyPoint.x = info.circleInfo.x;
-      this.modifyPoint.y = info.circleInfo.y;
-    } else if (info && info.svgInfo.svgId) {
+    } else if (info && info.crossPointInfo.crossCrossPointId) {
       this.modifyPoint = {};
-      this.modifyPoint.svgId = info.svgInfo.svgId;
-      this.modifyPoint.index = info.svgInfo.index;
+      this.modifyPoint.linkedCrossCrossPointId =
+        info.crossPointInfo.crossCrossPointId;
+      this.modifyPoint.x = info.crossPointInfo.x;
+      this.modifyPoint.y = info.crossPointInfo.y;
     } else if (info && info.roadPointInfo.linkedRoadPointIdX) {
       this.modifyPoint = {};
       this.modifyPoint.linkedRoadPointIdX =

+ 17 - 0
src/graphic/Load.js

@@ -78,7 +78,24 @@ export default class Load {
             JSON.parse(JSON.stringify(dataLocal.points[key].parent))
           );
           point.setDisplay(dataLocal.points[key].display);
+          point.setLocationMode(dataLocal.points[key].locationMode);
+          point.setLinkedBasePointId(dataLocal.points[key].linkedBasePointId);
+          point.setLinkedTestPointId(dataLocal.points[key].linkedTestPointId);
         }
+    
+        // let points = dataService.vectorData.points;
+        let points = dataLocal.points;
+        Settings.basePointIds =[]
+        for (let key in points) {
+          if (points[key].category == VectorCategory.Point.BasePoint) {
+            Settings.basePointIds.push(points[key].vectorId)
+          }
+        }
+        // if(  Settings.basePointIds.length==1){
+        //   Settings.selectBasePointId =  Settings.basePointIds[0];
+        // }else{
+        //   // Settings.selectBasePointId =null
+        // }
       }
       if (dataLocal.svgs) {
         for (let key in dataLocal.svgs) {

+ 11 - 14
src/graphic/Renderer/Draw.js

@@ -811,7 +811,16 @@ export default class Draw {
       let img, imgBound;
       if (vector.photoImage) {
         img = vector.photoImage;
-        imgBound = [0, 0, img.width, img.height];
+        let top = 0, left = 0, size = 0
+        if (img.width > img.height) {
+          size = img.height
+          left = (img.width - size) / 2
+        } else {
+          size = img.width
+          top = (img.height - size) / 2
+        }
+
+        imgBound = [left, top, size, size];
       } else {
         const size = help.getReal(style.target.realRadius);
         const backImg = dataService.getBackgroundImg();
@@ -923,9 +932,6 @@ export default class Draw {
         ...style,
         ...stylea
       }
-      // if (!attr) {
-      //   return;
-      // }
     }
 
     if (vector.color) {
@@ -945,14 +951,7 @@ export default class Draw {
       ctx.fill();
       ctx.restore();
     };
-    let points = dataService.vectorData.points;
-    for (let key in points) {
-      if (points[key].category == VectorCategory.Point.BasePoint) {
-        Settings.selectBasePointId = points[key].vectorId;
-      }
-    }
-    let focusItem = stateService.getFocusItem()
-    if (Settings.selectBasePointId === vector.vectorId && focusItem?.vectorId == vector.vectorId ) {
+    if (Settings.selectBasePointId === vector.vectorId  ) {
       style = {
         ...style,
         strokeStyle: "rgba(255,255,255,1)",
@@ -963,7 +962,6 @@ export default class Draw {
       };
     }
 
-
     draw(style);
     if (style.out) {
       draw(style.out);
@@ -1050,7 +1048,6 @@ export default class Draw {
     const dires = [points[0], { ...points[0], x: 10000 }, points[1]];
     let angle = mathUtil.Angle(...dires) * (Math.PI / 180);
     angle = mathUtil.isClockwise(dires) ? angle : -angle;
-
     this.context.save();
     this.context.translate(points[0].x, points[0].y);
     this.context.rotate(angle);

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

@@ -138,7 +138,7 @@ export class DataService {
       return
     }
     let start = this.getPoint(line.startId);
-    if (start) {
+    if (start  && start.getCategory()!= VectorCategory.Point.BasePoint) {
       let startParent = start.getParent();
       delete startParent[lineId];
       if (
@@ -153,6 +153,7 @@ export class DataService {
     if (end) {
       let endParent = end.getParent();
       delete endParent[lineId];
+      
       if (
         Object.keys(endParent).length == 0 &&
         end.getCategory() != VectorCategory.Point.BasePoint
@@ -160,7 +161,6 @@ export class DataService {
         this.deletePoint(line.endId);
       }
     }
-
     delete this.vectorData.lines[lineId];
   }
 

+ 3 - 4
src/graphic/Service/ElementService.js

@@ -174,20 +174,19 @@ export class ElementService {
     this.newRoad.start.setPosition(point1);
     this.newRoad.end.setPosition(point2);
     this.newRoad.setWay(Settings.wayType);
-
     //需要更新Edge坐标
     if (!mathUtil.equalPoint(point1, point2)) {
       let edgePoints = null;
       if (this.newRoad.way == Constant.oneWay) {
-        this.newRoad.singleRoadWidth = Settings.singleRoadWidth;
+        this.newRoad.singleRoadWidth = Settings.singleRoadWidth* window.coordinate.ratio;
         edgePoints = mathUtil.RectangleVertex(
           point1,
           point2,
           this.newRoad.singleRoadWidth
         );
       } else if (this.newRoad.way == Constant.twoWay) {
-        this.newRoad.leftWidth = Settings.leftRoadWidth;
-        this.newRoad.rightWidth = Settings.rightRoadWidth;
+        this.newRoad.leftWidth = Settings.leftRoadWidth* window.coordinate.ratio;
+        this.newRoad.rightWidth = Settings.rightRoadWidth* window.coordinate.ratio;
         edgePoints = mathUtil.RectangleVertex(
           point1,
           point2,

+ 29 - 2
src/graphic/Service/PointService.js

@@ -11,6 +11,7 @@ export default class PointService {
   create(position, vectorId) {
     let point = new Point(position, vectorId);
     dataService.addPoint(point);
+    this.updateBasePointIds()
     return point;
   }
 
@@ -51,12 +52,23 @@ export default class PointService {
         dataService.deletePoint(pointId); //暂时简单粗暴
       } else if (category == VectorCategory.Point.BasePoint) {
         this.deleteBasePoint(pointId);
-      } else if (category == VectorCategory.Point.TestPoint) {
+      } else if (
+        category == VectorCategory.Point.TestPoint ||
+        category == VectorCategory.Point.TestBasePoint
+      ) {
         this.deleteTestPoint(pointId);
       }
     }
   }
-
+  updateBasePointIds() {
+    let points = dataService.vectorData.points;
+    Settings.basePointIds = [];
+    for (let key in points) {
+      if (points[key].category == VectorCategory.Point.BasePoint) {
+        Settings.basePointIds.push(points[key].vectorId);
+      }
+    }
+  }
   deleteBasePoint(basePointId) {
     let points = dataService.getPoints();
     let needDeletePointIds = [];
@@ -82,13 +94,18 @@ export default class PointService {
     if (Settings.selectBasePointId == basePointId) {
       Settings.selectBasePointId = null;
     }
+    this.updateBasePointIds()
   }
 
   deleteTestPoint(testPointId) {
     let points = dataService.getPoints();
     let needDeletePointIds = [];
     for (let key in points) {
+    
       let point = dataService.getPoint(key);
+      if(point.getCategory() == VectorCategory.Point.BasePoint){
+        continue
+      }
       if (point.vectorId == testPointId) {
         needDeletePointIds.push(testPointId);
       } else if (point.linkedTestPointId == testPointId) {
@@ -98,15 +115,25 @@ export default class PointService {
     let lines = dataService.getLines();
     for (let key in lines) {
       let line = dataService.getLine(key);
+      let startPoint = dataService.getPoint(line.startId);
+      let endPoint = dataService.getPoint(line.endId);
       if (
         needDeletePointIds.indexOf(line.startId) > -1 ||
         needDeletePointIds.indexOf(line.endId) > -1
       ) {
         dataService.deleteLine(key);
+        if (needDeletePointIds.indexOf(line.startId) > -1&& endPoint.getCategory()!= VectorCategory.Point.BasePoint) {
+          this.deleteTestPoint(line.endId);
+        }
+        if (needDeletePointIds.indexOf(line.endId) > -1 && startPoint.getCategory()!= VectorCategory.Point.BasePoint) {
+          this.deleteTestPoint(line.startId);
+        }
       }
     }
     dataService.deletePoint(testPointId);
   }
+
+
 }
 
 const pointService = new PointService();

+ 16 - 1
src/graphic/Service/SVGService.js

@@ -1,7 +1,7 @@
 import SVG from "../Geometry/SVG.js";
 import { dataService } from "./DataService.js";
 import { mathUtil } from "../Util/MathUtil.js";
-
+import { uiService } from "./UIService.js";
 export default class SVGService {
   constructor() {}
 
@@ -10,6 +10,21 @@ export default class SVGService {
     dataService.addSVG(svg);
     return svg;
   }
+
+  copy(vectorId) {
+    let SVG = dataService.getSVG(vectorId);
+    let newCenter = uiService.getNewPositionForPop(SVG.center);
+    let newSVG = this.create(newCenter, SVG.type);
+    newSVG.setScale(SVG.scale);
+    for (let i = 0; i < SVG.points.length; ++i) {
+      let dx = SVG.points[i].x - SVG.center.x;
+      let dy = SVG.points[i].y - SVG.center.y;
+
+      newSVG.points[i].x = newSVG.center.x + dx;
+      newSVG.points[i].y = newSVG.center.y + dy;
+    }
+    return newSVG;
+  }
 }
 
 const svgService = new SVGService();

+ 1 - 0
src/graphic/Settings.js

@@ -30,6 +30,7 @@ const Settings = {
   selectSVGType: null, //图例
   selectRoadTemplate: null, //道路模板
   selectRoadStructure: null, //道路结构
+  basePointIds:[],//基准点
 };
 console.error(os.isPc);
 export default Settings;

+ 2 - 3
src/main.ts

@@ -1,8 +1,7 @@
 import VConsole from 'vconsole';
-console.log(import.meta.env.MODE)
-if (import.meta.env.MODE === "test") {
+if (import.meta.env.MODE !== "production") {
   if (!os.isPc) {
-    new VConsole();
+    // new VConsole();
   }
 }
 

+ 16 - 0
src/store/SVGLabel.ts

@@ -0,0 +1,16 @@
+import {ref} from "vue";
+
+type Use = {count: number, key: string, lastUpdateTime?: number}
+
+export const defaultUses: Use[] = [
+  { count: 0, key: "keche_p.svg" },
+  { count: 0, key: "keche_s.svg" },
+  { count: 0, key: "jiaoche_p.svg" },
+  { count: 0, key: "jiaoche_s.svg" },
+  { count: 0, key: "huoche_p.svg" },
+  { count: 0, key: "huoche_s1.svg" },
+  { count: 0, key: "huoche_s2.svg" },
+  { count: 0, key: "rt_rt.svg" },
+  { count: 0, key: "rt_st.svg" },
+]
+export const uses = ref<Use[]>([])

+ 4 - 0
src/store/sync.ts

@@ -11,6 +11,7 @@ import {watch} from "vue";
 import {params} from "@/hook";
 import router, {writeRouteName} from "@/router";
 import {baseURL} from "@/dbo/main";
+import {defaultUses, uses} from '@/store/SVGLabel'
 
 const global = window as any;
 
@@ -51,6 +52,7 @@ export const api =
           ]
           const notBase64 = notBase64BaseTypes.some(type => paths[paths.length - 1].includes(type))
           if (notBase64) {
+            // await new Promise(resolve => setTimeout(resolve, 2000))
             return baseURL + url
           } else {
             const data = await axios.get(url, { responseType: "blob" });
@@ -207,6 +209,7 @@ const loadStore = async () => {
   photos.value = data?.photos || [];
   accidentPhotos.value = data?.accidentPhotos || [];
   roadPhotos.value = data?.roadPhotos || [];
+  uses.value = data?.uses || defaultUses
 
   syncSceneStore();
   console.log("开始同步syncSceneStore")
@@ -240,6 +243,7 @@ const syncSceneStore = () => {
       basePoints: basePoints.value,
       fixPoints: fixPoints.value,
       photos: photos.value,
+      uses: uses.value,
       accidentPhotos: accidentPhotos.value,
       roadPhotos: roadPhotos.value,
     }),

+ 1 - 1
src/views/accidents/index.vue

@@ -1,7 +1,7 @@
 <template>
   <MainPanel>
     <template v-slot:header>
-      <Header type="close" :count="selects.length" :title="`已标注照片(${sortPhotos.length})`">
+      <Header type="return_l" :count="selects.length" :title="`已标注照片(${sortPhotos.length})`">
         <ui-button
             :type="selectMode ? 'primary' : 'normal'"
             @click="selectMode = !selectMode"

+ 3 - 3
src/views/accidents/print.vue

@@ -1,7 +1,7 @@
 <template>
   <MainPanel>
     <template v-slot:header>
-      <Header  title="生成A4">
+      <Header  title="生成A4" type="return">
         <ui-button
             type="primary"
             @click="saveHandler"
@@ -42,7 +42,7 @@ const genAccidentPhotos = computed<AccidentPhoto[]>(() => {
   let route, params
   if (((route = router.currentRoute.value).name === writeRouteName.gena4)
     && (params = route.params)
-    && params.id1 
+    && params.id1
     && params.id2) {
     return accidentPhotos.value?.filter(data => [params.id1, params.id2].includes(data.id))
   }
@@ -100,4 +100,4 @@ const saveHandler = async () => {
     object-fit: cover;
   }
 }
-</style>
+</style>

+ 69 - 0
src/views/graphic/geos/delAndCopu.vue

@@ -0,0 +1,69 @@
+<template>
+  <GeoTeleport
+      :menus="menus"
+      class="geo-teleport-use"
+      v-if="!hideTypes.includes(geo.type) && !hideTypes.includes(geo.category)"
+  />
+</template>
+
+<script setup lang="ts">
+import GeoTeleport from "@/views/graphic/geos/geo-teleport.vue";
+import {drawRef, FocusVector, VectorType} from '@/hook/useGraphic'
+import GeoActions from "@/graphic/enum/GeoActions"
+import VectorCategory from "@/graphic/enum/VectorCategory";
+
+const props = defineProps<{geo: FocusVector}>()
+const hideTypes = [
+  VectorType.RoadPoint,
+  VectorType.CurveRoadPoint,
+  VectorCategory.Point.NormalPoint
+]
+console.log(props)
+const menus = [
+  {
+    key: 'copy',
+    icon: 'copy',
+    text: "复制",
+    onClick: () => {
+      drawRef.value.uiControl.handleGeo(GeoActions.CopyAction)
+    }
+  },
+  {
+    key: 'del',
+    text: "删除",
+    icon: 'del',
+    onClick: () => {
+      drawRef.value.uiControl.handleGeo(GeoActions.DeleteAction)
+    }
+  }
+]
+</script>
+
+<style scoped lang="scss">
+.color {
+  width: 18px;
+  height: 18px;
+  border: 2px solid #fff;
+  border-radius: 50%;
+}
+
+.icon {
+  font-size: 16px;
+}
+
+.geo-input {
+  position: absolute;
+  left: 0;
+  right: 0;
+  top: 0;
+  bottom: 0;
+  z-index: 1;
+  opacity: 0;
+}
+</style>
+
+<style lang="scss">
+.select-floating.select-float.dire-top {
+  margin-top: -10px;
+}
+</style>

+ 2 - 0
src/views/graphic/geos/index.ts

@@ -8,11 +8,13 @@ import RoadEdge from './roadEdge.vue'
 import Road from './road.vue'
 import NormalLine from './normalLine.vue'
 import VectorCategory from "@/graphic/enum/VectorCategory";
+import DelAndCopu from "@/views/graphic/geos/delAndCopu.vue";
 
 
 export const GlobalComp = Del
 
 export default {
+  [VectorType.SVG]: DelAndCopu,
   [VectorType.Road]: Road,
   [VectorType.RoadEdge]: RoadEdge,
   [VectorType.CurveRoad]: Road,

+ 42 - 14
src/views/graphic/imageLabel.vue

@@ -21,7 +21,7 @@
             :key="menu.key"
             class="menu"
             :class="{active: uiType.current === menu.key}"
-            @click="uiType.change(menu.key as any)"
+            @click="clickHandler(menu.key)"
         >
           <ui-icon :type="menu.icon" class="icon" />
           <p>{{ menu.text }}</p>
@@ -37,6 +37,7 @@ import { uiType } from '@/hook/useGraphic'
 import icons, {typeKeys} from "@/graphic/CanvasStyle/ImageLabels/SVGIcons"
 import {computed, ref, watch} from "vue";
 import UiInput from "@/components/base/components/input/index.vue";
+import {uses} from '@/store/SVGLabel'
 
 
 const typeMenusRaw = typeKeys.map(({type, children}) => ({
@@ -48,25 +49,52 @@ const typeMenusRaw = typeKeys.map(({type, children}) => ({
   }))
 }))
 const keyword = ref("")
-console.log(typeMenusRaw)
-const typeMenus = computed(() => typeMenusRaw
-  .map(
-    (typeMenu) => ({
-      ...typeMenu,
-      children: typeMenu.children
-        .filter(item => item.text.includes(keyword.value))
-        .sort((a, b) => a.icon.localeCompare(b.icon))
-    })
-  )
-  .filter(typeMenu => typeMenu.children.length > 0)
-)
+const typeMenus = computed(() => {
+  const raws = typeMenusRaw.map((typeMenu) => ({
+    ...typeMenu,
+    children: typeMenu.children
+      .filter(item => item.text.includes(keyword.value))
+      .sort((a, b) => a.icon.localeCompare(b.icon))
+  }));
+  const items = [
+    {
+      title: "常用",
+      children: uses.value
+        .sort((item1, item2) => (item2.count || 0) - (item1.count || 0)).slice(0, 10)
+        .map(item => {
+          for (let menu of typeMenusRaw) {
+            const findItem = menu.children.find(menuItem => menuItem.key === item.key);
+            if (findItem) {
+              return findItem
+            }
+          }
+        })
+        .filter(item => !!item)
+    },
+    ...raws
+  ]
+
+
+  return items.filter(item => item.children.length)
+})
 const showTypeMenu = ref()
 watch(
   typeMenus,
   () => showTypeMenu.value = typeMenus.value[0],
   { immediate: true }
 )
-console.log(typeMenus, showTypeMenu.value)
+
+const clickHandler = (key) => {
+  const findUse = uses.value.find(use => use.key === key);
+  const lastUpdateTime = new Date().getTime()
+  if (findUse) {
+    findUse.count++
+    findUse.lastUpdateTime = lastUpdateTime
+  } else {
+    uses.value.push({ key, count: 1, lastUpdateTime })
+  }
+  uiType.change(key as any)
+}
 
 defineEmits<{ (e: "quit") }>();
 

+ 5 - 2
src/views/graphic/index.vue

@@ -1,7 +1,9 @@
 <template>
-  <MainPanel :menus="graphicState.continuedMode ? null : store.menus as any" :active-menu-key="store.activeMenuKey.value">
+  <MainPanel
+      :menus="graphicState.continuedMode ? null : store.menus as any"
+      :active-menu-key="store.activeMenuKey.value">
     <template v-slot:header>
-      <Header />
+      <Header :class="{disabled: graphicState.continuedMode}" />
     </template>
     <Container />
     <ChildMenus
@@ -63,6 +65,7 @@ const store = computed(() => generateMixMenus(
 const focusMenus = computed(() => focusMenuRaw[currentVector.value?.type])
 const geoComponent = computed(() => {
   if (currentVector.value) {
+    console.log(currentVector.value)
     return geos[currentVector.value?.type] || geos[currentVector.value?.category] || GlobalComp
   }
 })

+ 2 - 2
src/views/graphic/menus.ts

@@ -124,7 +124,7 @@ export const measureMenusRaw = [
   {
     key: UIType.FreeMeasureLine,
     text: '自由测量',
-    icon: 'measure'
+    icon: 'measure_free'
   },
 ];
 
@@ -158,7 +158,7 @@ export const mainMenusRaw: MenusRaw = [
       { key: UIType.TwoEdgeTwoLanRoad, icon: 'road_dd', text: '' },
       { key: UIType.TwoEdgeThreeLanRoad, icon: 'road_dt', text: '' },
       { key: UIType.CurveRoad, icon: 'road_wl', text: '' },
-      { key: UITypeExtend.structure, icon: 'r_template', text: '道路结构', extend: structureMenusRaw },
+      // { key: UITypeExtend.structure, icon: 'r_template', text: '道路结构', extend: structureMenusRaw },
       { key: UITypeExtend.template, icon: 'r_structure', text: '道路模板', extend: templateMenusRaw },
     ],
   },

+ 1 - 1
src/views/roads/index.vue

@@ -1,7 +1,7 @@
 <template>
   <MainPanel>
     <template v-slot:header>
-      <Header :count="selects.length" :title="`现场图管理(${sortPhotos.length})`" type="close">
+      <Header :count="selects.length" :title="`现场图管理(${sortPhotos.length})`" type="return_l">
         <ui-button
             :type="selectMode ? 'primary' : 'normal'"
             @click="selectMode = !selectMode"

+ 9 - 7
src/views/roads/tabulation.vue

@@ -1,7 +1,7 @@
 <template>
   <MainPanel>
     <template v-slot:header>
-      <Header title="现场绘图 | 制表" :on-back="onBack">
+      <Header title="现场绘图 | 制表" :on-back="onBack" type="return">
         <ui-button
             type="primary"
             @click="saveHandler"
@@ -178,17 +178,19 @@ const { cssMatrix: photoCSSMatrix, matrix: photoMatrix } = useHand(
 )
 
 const proportion = ref(1)
+const photoLoaded = ref(false)
 watchEffect(() => {
   if (!roadPhoto.value || !photoRef.value) {
     return;
   }
+  if (!photoLoaded.value) {
+    photoRef.value.onload = () => photoLoaded.value = true
+  }
   const scale = roadPhoto.value.data.scale || 1
   const martrixScale = photoMatrix.value[0]
-  photoRef.value.onload = () => {
-    const photoWidth = photoRef.value.naturalWidth
-    const prop = ((photoWidth / photoRef.value.offsetWidth) * scale) / martrixScale
-    proportion.value = Math.ceil(prop * 100) / 100
-  }
+  const photoWidth = photoRef.value.naturalWidth
+  const prop = ((photoWidth / photoRef.value.offsetWidth) * scale) / martrixScale
+  proportion.value = Math.ceil(prop * 100) / 100
 })
 
 
@@ -372,4 +374,4 @@ const saveHandler = async () => {
     line-height: 48px !important;
   }
 }
-</style>
+</style>

+ 1 - 1
src/views/scene/index.vue

@@ -8,7 +8,7 @@
     <Measures />
     <Photo />
     <ButtonPane class="back fun-ctrl" size="48" @click="back" v-if="!childPage">
-      <ui-icon type="close" class="icon" />
+      <ui-icon type="return_l" class="icon" />
     </ButtonPane>
     <Mode />
   </template>