Selaa lähdekoodia

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

xushiting 1 vuosi sitten
vanhempi
commit
6538a98bda

+ 9 - 7
src/graphic/Layer.js

@@ -258,6 +258,7 @@ export default class Layer {
             if (rightEdge.roadSide) {
               rightEdge.initRoadSide();
             }
+            roadService.initRoadWidthTipsPos(road);
           } else {
             road = dataService.getCurveRoad(selectItem.vectorId);
             if (road) {
@@ -270,15 +271,16 @@ export default class Layer {
               }
               let leftEdge = dataService.getRoadEdge(road.leftEdgeId);
               let rightEdge = dataService.getRoadEdge(road.rightEdgeId);
-              if (leftEdge.roadSide) {
-                leftEdge.initCurveRoadSide();
-              }
-              if (rightEdge.roadSide) {
-                rightEdge.initCurveRoadSide();
-              }
+              // 暂时屏蔽 曲路暂时还没有 会报错
+              // if (leftEdge.roadSide) {
+              //   leftEdge.initCurveRoadSide();
+              // }
+              // if (rightEdge.roadSide) {
+              //   rightEdge.initCurveRoadSide();
+              // }
             }
           }
-          roadService.initRoadWidthTipsPos(road);
+          // roadService.initRoadWidthTipsPos(road);
           this.history.save();
           this.renderer.autoRedraw();
         }

+ 52 - 7
src/graphic/Renderer/Draw.js

@@ -11,6 +11,7 @@ import SVGIcons from "../CanvasStyle/ImageLabels/SVGIcons";
 import VectorStyle from "@/graphic/enum/VectorStyle.js";
 import VectorWeight from "@/graphic/enum/VectorWeight.js";
 import router from "@/router/index";
+import VectorType from "../enum/VectorType.js";
 
 const isScreenStyle = () =>
   Settings.screenMode && router.currentRoute.value.params.mode === "0";
@@ -424,6 +425,7 @@ export const help = {
         ctx.stroke();
         ctx.closePath();
         ctx.restore();
+
         return;
     }
 
@@ -659,13 +661,29 @@ export default class Draw {
         }
 
         // console.log(edgeVector);
-        edgeVector.style = VectorStyle.SingleSolidLine;
+        // edgeVector.style = VectorStyle.SingleSolidLine;
         help.drawStyleLine(
           ctx,
           points,
           edgeVector.roadSide ? VectorStyle.RoadSide : edgeVector.style,
           edgeVector.roadSide ? edgeVector.roadSide.width : edgeVector.weight
         );
+
+        if (edgeVector.roadSide) {
+          console.log(edgeVector);
+          help.drawLineText(
+            ctx,
+            points[2],
+            points[3],
+            edgeVector.roadSide.width * 10,
+            {
+              fillColor: isScreenStyle() ? "#000" : "#fff",
+              padding: 6,
+              fontSize: 12,
+              backColor: style.strokeStyle,
+            }
+          );
+        }
       }
       if (import.meta.env.DEV) {
         this.drawTextByInfo(
@@ -763,7 +781,7 @@ export default class Draw {
     ctx.save();
     help.setVectorStyle(ctx, vector);
     ctx.beginPath();
-    if (!isScreenStyle()) {
+    if (!Settings.screenMode) {
       ctx.arc(
         extremePoint.x,
         extremePoint.y,
@@ -951,7 +969,7 @@ export default class Draw {
 
     ctx.save();
     for (let [start, end] of dires) {
-      const lines = mathUtil.getArrow(start, end, len);
+      const lines = mathUtil.getArrow(start, end, 30, len);
       ctx.moveTo(lines[0].x, lines[0].y);
       ctx.lineTo(lines[1].x, lines[1].y);
       ctx.lineTo(lines[2].x, lines[2].y);
@@ -973,7 +991,11 @@ export default class Draw {
     if (vector.color) {
       ctx.strokeStyle = vector.color;
     }
-    this.drawLineArrow([start, end], vector.category === UIEvents.DoubleArrow);
+    this.drawLineArrow(
+      [start, end],
+      vector.category === UIEvents.DoubleArrow,
+      40
+    );
   }
 
   drawMagnifier(vector) {
@@ -1121,7 +1143,7 @@ export default class Draw {
     const screenNotDrawTypes = [VectorCategory.Point.NormalPoint];
     if (!screenSave) {
       if (
-        (isScreenStyle() &&
+        (Settings.screenMode &&
           (!vector.category || screenNotDrawTypes.includes(vector.category))) ||
         vector.category === VectorCategory.Point.TestBasePoint
       ) {
@@ -1144,6 +1166,7 @@ export default class Draw {
         ctx.restore();
         return;
       }
+
       if (line.category !== "ZebraCrossing") {
         const [stylea, attr] = help.getVectorStyle(line, line.category);
         style = {
@@ -1152,6 +1175,19 @@ export default class Draw {
           fillStyle: attr ? "#fff" : stylea.strokeStyle,
         };
       }
+      if (
+        line &&
+        [VectorType.SingleArrowLine, VectorType.DoubleArrowLine].includes(
+          line.category
+        ) &&
+        line.color
+      ) {
+        style = {
+          ...style,
+          fillStyle: line.color,
+          strokeStyle: line.color,
+        };
+      }
     } else if (vector.category === VectorCategory.Point.FixPoint) {
       const text = dataService.getText(vector?.linkedTextId);
       if (text) {
@@ -1407,7 +1443,7 @@ export default class Draw {
       coordinate.getScreenXY(startReal),
       coordinate.getScreenXY(endReal),
       vector.value
-        ? Math.round(vector.value * 100) / 100
+        ? Math.round(vector.value * 1000)
         : help.getRealDistance(startReal, endReal),
       style
     );
@@ -1502,7 +1538,15 @@ export default class Draw {
       this.context.setLineDash(style.dash);
     }
 
-    console.log(vector);
+    if (
+      [VectorType.SingleArrowLine, VectorType.DoubleArrowLine].includes(
+        vector.category
+      ) &&
+      vector.color
+    ) {
+      this.context.strokeStyle = vector.color;
+    }
+    console.log(vector.style);
     help.drawStyleLine(this.context, [start, end], vector.style, vector.weight);
     // vector.category = VectorCategory.Line.LocationLineByFixPoint;
     switch (vector.category) {
@@ -1520,6 +1564,7 @@ export default class Draw {
       case VectorCategory.Line.FreeMeasureLine:
       case VectorCategory.Line.MeasureLine:
       case VectorCategory.Line.PositionLine:
+        console.log(vector);
         this.drawLineText(vector, style.text);
 
         if (

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

@@ -250,15 +250,33 @@ export default class RoadService {
       let newRoadLeftEdge = dataService.getRoadEdge(newRoad.leftEdgeId);
       mathUtil.clonePoint(newRoadLeftEdge.end, oldLeftEdgeEndPoint);
       //newRoadLeftEdge.roadSide = leftEdge.roadSide;
+      if(leftEdge.roadSide){
+        newRoadLeftEdge.initRoadSide()
+        newRoadLeftEdge.setRoadSideWidth(leftEdge.roadSide.width)
+      }
 
       let newRoadRightEdge = dataService.getRoadEdge(newRoad.rightEdgeId);
       mathUtil.clonePoint(newRoadRightEdge.end, oldRightEdgeEndPoint);
       //newRoadRightEdge.roadSide = rightEdge.roadSide;
+      if(rightEdge.roadSide){
+        newRoadRightEdge.initRoadSide()
+        newRoadRightEdge.setRoadSideWidth(rightEdge.roadSide.width)
+      }
 
       if (Object.keys(startPoint).length > 1) {
         mathUtil.clonePoint(leftEdge.start, oldLeftEdgeStartPoint);
         mathUtil.clonePoint(rightEdge.start, oldRightEdgeStartPoint);
       }
+      //修改路缘线end
+      if(leftEdge.roadSide){
+        leftEdge.initRoadSide()
+        leftEdge.setRoadSideWidth(leftEdge.roadSide.width)
+      }
+      if(rightEdge.roadSide){
+        leftEdge.initRoadSide()
+        rightEdge.setRoadSideWidth(rightEdge.roadSide.width)
+      }
+
     } else if (dir == "end") {
       let cpt = dataService.getCrossPointForEdgeId(road.leftEdgeId, "start");
       crossPointService.replaceEdgeId(cpt, road.leftEdgeId, newRoad.leftEdgeId);
@@ -273,15 +291,32 @@ export default class RoadService {
       let newRoadLeftEdge = dataService.getRoadEdge(newRoad.leftEdgeId);
       mathUtil.clonePoint(newRoadLeftEdge.start, oldLeftEdgeStartPoint);
       //newRoadLeftEdge.roadSide = leftEdge.roadSide;
+      if(leftEdge.roadSide){
+        newRoadLeftEdge.initRoadSide()
+        newRoadLeftEdge.setRoadSideWidth(leftEdge.roadSide.width)
+      }
 
       let newRoadRightEdge = dataService.getRoadEdge(newRoad.rightEdgeId);
       mathUtil.clonePoint(newRoadRightEdge.start, oldRightEdgeStartPoint);
       //newRoadRightEdge.roadSide = rightEdge.roadSide;
+      if(rightEdge.roadSide){
+        newRoadRightEdge.initRoadSide()
+        newRoadRightEdge.setRoadSideWidth(rightEdge.roadSide.width)
+      }
 
       if (Object.keys(endPoint).length > 1) {
         mathUtil.clonePoint(leftEdge.end, oldLeftEdgeEndPoint);
         mathUtil.clonePoint(rightEdge.end, oldRightEdgeEndPoint);
       }
+      //修改路缘线start
+      if(leftEdge.roadSide){
+        leftEdge.initRoadSide()
+        leftEdge.setRoadSideWidth(leftEdge.roadSide.width)
+      }
+      if(rightEdge.roadSide){
+        rightEdge.initRoadSide()
+        rightEdge.setRoadSideWidth(rightEdge.roadSide.width)
+      }
     }
     // let newStartPoint = dataService.getRoadPoint(newRoad.startId);
     // let newEndPoint = dataService.getRoadPoint(newRoad.endId);

+ 3 - 3
src/main.ts

@@ -1,9 +1,9 @@
 import VConsole from "vconsole";
 import { useParams } from "@/hook/useParams";
 
-// if (useParams().console === "true") {
-new VConsole();
-// }
+if (useParams().console === "true") {
+  new VConsole();
+}
 
 import "@/assets/theme.editor.scss";
 import "@/assets/public.scss";

+ 5 - 6
src/views/graphic/geos/roadEdge.vue

@@ -1,11 +1,10 @@
 <template>
   <GeoTeleport :menus="menus" class="geo-teleport-use" :active="active" />
   <GeoTeleport :menus="childMenus" v-if="childMenus" class="type-geo" />
-  {{ showChange }}
   <VRange
     v-if="showChange"
-    :max="100"
-    :min="10"
+    :max="1000"
+    :min="100"
     :step="1"
     unit="mm"
     v-model:value="(lineWidthMenu[2].desc as number)"
@@ -99,7 +98,7 @@ const lineWidthMenu = reactive([
     key: "setRoadEdageWidth",
     icon: "l_thin",
     text: "宽度",
-    desc: 20,
+    desc: 200,
     onClick: () => {
       showChange.value = !showChange.value;
       childMenus.value = null;
@@ -124,7 +123,7 @@ watchEffect(() => {
   if (style.value === VectorStyle.RoadSide) {
     console.log(vector.value.roadSide);
     menus.value[1] = lineWidthMenu[2];
-    lineWidthMenu[2].desc = vector.value.roadSide.width;
+    lineWidthMenu[2].desc = vector.value.roadSide.width * 10;
   } else {
     (menus.value[1] =
       vector.value?.weight === VectorWeight.Bold ? lineWidthMenu[0] : lineWidthMenu[1]),
@@ -133,7 +132,7 @@ watchEffect(() => {
 });
 watchEffect(() => {
   if (style.value === VectorStyle.RoadSide) {
-    vector.value.setRoadSideWidth(lineWidthMenu[2].desc);
+    vector.value.setRoadSideWidth((lineWidthMenu[2].desc as number) / 10);
     drawRef.value.renderer.autoRedraw();
   }
 });

+ 6 - 2
src/views/graphic/setting.vue

@@ -9,7 +9,9 @@
           </p>
           <ui-input
             :modelValue="data.singleRoadWidth * 1000"
-            @update:modelValue="(val) => (data.singleRoadWidth = val / 1000)"
+            @update:modelValue="
+              (val) => (data.singleRoadWidth = Number(val) ? val / 1000 : 0)
+            "
             width="100%"
           >
             <template v-slot:icon>
@@ -29,7 +31,9 @@
           </p>
           <ui-input
             :modelValue="data.roadQuarantineWidth * 1000"
-            @update:modelValue="(val) => (data.roadQuarantineWidth = val / 1000)"
+            @update:modelValue="
+              (val) => (data.roadQuarantineWidth = Number(val) ? val / 1000 : 0)
+            "
             width="100%"
           >
             <template v-slot:icon>

+ 7 - 6
src/views/roads/index.vue

@@ -113,12 +113,13 @@ const sortPhotos = computed(() =>
     .reverse()
 );
 const onBack = () => {
-  let back = router.currentRoute.value.query.back;
-  if (back) {
-    router.back();
-  } else {
-    api.closePage();
-  }
+  router.back();
+  // let back = router.currentRoute.value.query.back;
+  // if (back) {
+  //   router.back();
+  // } else {
+  //   api.closePage();
+  // }
 };
 
 const active = ref<RoadPhoto>();

+ 8 - 6
src/views/scene/covers/range.vue

@@ -44,10 +44,10 @@
 </template>
 
 <script setup lang="ts">
-import { Pos, SDK } from "@/sdk";
+import { Mode, Pos, SDK } from "@/sdk";
 import { computed, onMounted, onUnmounted, ref, watchEffect } from "vue";
 import { sceneSeting } from "@/store/sceneSeting";
-import { disabledMap, modeDisabled, useSDK } from "@/hook";
+import { customMap, disabledMap, modeDisabled, useSDK } from "@/hook";
 
 const props = defineProps<{ rangeKey: string }>();
 const topSetting = useSDK().scene.getSceneCropSetting().top;
@@ -82,23 +82,25 @@ watchEffect((onCleanup) => {
   if (props.rangeKey && cropApi.value) {
     const name = `${props.rangeKey[0].toUpperCase()}${props.rangeKey.substring(1)}`;
     cropApi.value[`enterSet${name}`]();
-    console.log(`enterSet${name}`)
+    console.log(`enterSet${name}`);
     onCleanup(() => {
       cropApi.value[`leaveSet${name}`]();
-      console.log(`leaveSet${name}`)
+      console.log(`leaveSet${name}`);
     });
   }
 });
 
+let oldMode;
 let pop;
 onMounted(() => {
-  console.log("enterCropSetting")
   cropApi.value = useSDK().scene.enterCropSetting();
+  oldMode = customMap.mode;
+  customMap.mode = Mode.cloud;
   pop = modeDisabled.push(ref(true));
 });
 onUnmounted(() => {
-  console.log("quit")
   cropApi.value && cropApi.value.quit();
+  customMap.mode = oldMode;
   modeDisabled.pop();
 });
 </script>

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

@@ -135,11 +135,7 @@ const enum TypeEnum {
   Table,
 }
 const currentType = ref(TypeEnum.Draw);
-const sceneSortPhotos = computed(() =>
-  roadPhotos.value
-    .filter((item) => (currentType.value === TypeEnum.Draw ? !item.table : !!item.table))
-    .reverse()
-);
+const sceneSortPhotos = computed(() => roadPhotos.value);
 
 const loaded = ref(false);
 const childPage = ref(false);

+ 12 - 12
src/views/scene/trackMeasureWidth.ts

@@ -1,20 +1,20 @@
-import { router } from '@/router';
-import writeRouteName from '../../router/constant';
-import { startMeasure, SuccessMeasureAtom } from '../scene/linkage/measure';
-import { ref, watchEffect } from 'vue';
-import { useAsyncSDK } from '@/hook/useLaser';
-import { customMap, laserModeStack } from '@/hook/custom/index';
-import { Mode } from '@/sdk';
-import { mount } from '@/components/base/utils/componentHelper';
-import TrackMeasure from '@/views/scene/TrackMeasure.vue';
-import { list } from '@/store/measure';
+import { router } from "@/router";
+import writeRouteName from "../../router/constant";
+import { startMeasure, SuccessMeasureAtom } from "../scene/linkage/measure";
+import { ref, watchEffect } from "vue";
+import { useAsyncSDK } from "@/hook/useLaser";
+import { customMap, laserModeStack } from "@/hook/custom/index";
+import { Mode } from "@/sdk";
+import { mount } from "@/components/base/utils/componentHelper";
+import TrackMeasure from "@/views/scene/TrackMeasure.vue";
+import { list } from "@/store/measure";
 
 export const trackMode = ref(false);
 
 export const trackMeasureWidth = async () => {
   trackMode.value = true;
   // await router.push({ name: writeRouteName.scene });
-  await router.push('/scene?full=1');
+  await router.push("/scene?full=1");
   const sdk = await useAsyncSDK();
 
   laserModeStack.push(ref(Mode.cloud));
@@ -38,7 +38,7 @@ export const trackMeasureWidth = async () => {
 
   trackMode.value = false;
   if (measure) {
-    return Number(measure.length.toFixed(2));
+    return Number(measure.length.toFixed(3));
   } else {
     return null;
   }