bill 1 ano atrás
pai
commit
03168ef860

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

@@ -157,7 +157,7 @@ export const help = {
   },
   getRealDistance(p1, p2) {
     return Math.round(
-      (mathUtil.getDistance(p1, p2) * coordinate.res * 100) / coordinate.ratio
+      (mathUtil.getDistance(p1, p2) * coordinate.res * 1000) / coordinate.ratio
     );
   },
   getPerpendicularPoint(p1, p2, p3, d) {
@@ -198,6 +198,7 @@ export const help = {
     const vline = mathUtil.getVerticalLineByDistance(start, end, fontSize);
     const center = mathUtil.lineCenter(vline[0], vline[1]);
     // console.log(center, start, end);
+
     ctx.save();
     ctx.translate(center.x, center.y);
     ctx.rotate((angle * Math.PI) / 180);
@@ -657,6 +658,8 @@ export default class Draw {
           );
         }
 
+        console.log(edgeVector);
+        edgeVector.style = VectorStyle.SingleSolidLine;
         help.drawStyleLine(
           ctx,
           points,
@@ -936,7 +939,7 @@ export default class Draw {
     this.drawPoint(vector);
   }
 
-  drawLineArrow(line, doubleArrow = false) {
+  drawLineArrow(line, doubleArrow = false, len = 20) {
     const ctx = this.context;
     const [start, end] = line;
     const dires = doubleArrow
@@ -948,7 +951,7 @@ export default class Draw {
 
     ctx.save();
     for (let [start, end] of dires) {
-      const lines = mathUtil.getArrow(start, end);
+      const lines = mathUtil.getArrow(start, end, 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);
@@ -1525,7 +1528,7 @@ export default class Draw {
             VectorCategory.Line.LocationLineByBasePoint,
           ].includes(vector.category)
         ) {
-          this.drawLineArrow([start, end], true);
+          this.drawLineArrow([start, end], true, 10);
         }
         break;
     }

+ 5 - 1
src/graphic/Util/MathUtil.js

@@ -89,6 +89,10 @@ export default class MathUtil {
     perpendicularVector.x /= length;
     perpendicularVector.y /= length;
 
+    if (slope === 1) {
+      perpendicularVector.y = 0;
+    }
+
     // 计算垂直方向平移后的新坐标
     var newP1 = {
       x: p1.x + perpendicularVector.x * translationDistance,
@@ -434,7 +438,7 @@ export default class MathUtil {
     return (fi * 180) / Math.PI;
   }
 
-  getArrow(start, end, ange = 30, L = 20) {
+  getArrow(start, end, ange = 30, L = 14) {
     let a = Math.atan2(end.y - start.y, end.x - start.x);
     let xC = end.x - L * Math.cos(a + (ange * Math.PI) / 180); // θ=30
     let yC = end.y - L * Math.sin(a + (ange * Math.PI) / 180);

+ 2 - 0
src/views/graphic/childMenus.vue

@@ -9,6 +9,7 @@
         v-for="menu in menus"
         :key="menu.key"
         class="menu"
+        :style="{ pointerEvents: disable ? 'none' : 'all' }"
         :class="{ active: uiType.current === menu.key }"
         @click="clickHandler(menu)"
       >
@@ -27,6 +28,7 @@ import { computed } from "vue";
 
 const props = defineProps<{ menus: MenusRaw }>();
 const title = computed(() => findMainMenuByAttr(props.menus)?.text);
+const disable = computed(() => !!findMainMenuByAttr(props.menus)?.disable);
 
 const emit = defineEmits<{ (e: "quit") }>();
 const clickHandler = (menu) => {

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

@@ -13,6 +13,7 @@ import DelAndCopu from "@/views/graphic/geos/delAndCopu.vue";
 export const GlobalComp = Del;
 
 export default {
+  ["ZebraCrossing"]: DelAndCopu,
   [VectorType.SVG]: DelAndCopu,
   [VectorType.Road]: Road,
   [VectorType.RoadEdge]: RoadEdge,
@@ -23,6 +24,7 @@ export default {
   // [VectorCategory.Line.MeasureLine]: Arrow,
   [VectorCategory.Line.NormalLine]: NormalLine,
   [VectorType.CurveLine]: NormalLine,
+
   [VectorType.Text]: Text,
   [VectorCategory.Point.FixPoint]: Text,
   [VectorType.Circle]: Circle,

+ 8 - 1
src/views/graphic/header.vue

@@ -72,7 +72,7 @@ import { AccidentPhoto, accidentPhotos, types } from "@/store/accidentPhotos";
 import { useData } from "./data";
 import UiInput from "@/components/base/components/input/index.vue";
 import { roadPhotos } from "@/store/roadPhotos";
-import { uploadImage } from "@/store/sync";
+import { downloadImage, uploadImage } from "@/store/sync";
 import { genUseLoading } from "@/hook";
 import { loadData, bus } from "@/hook/useGraphic";
 
@@ -184,10 +184,17 @@ const saveStore = genUseLoading(async () => {
     origin.push(newData);
   }
   data.value = newData;
+  if (!isRoad.value) {
+    await downloadImage(blob);
+  }
 });
 
 const saveHandler = async () => {
   await saveStore();
+  console.error("isRoad.value", isRoad.value);
+  if (isRoad.value) {
+    Message.success(`保存成功`);
+  }
   await router.replace({
     name: isRoad.value ? writeRouteName.roads : writeRouteName.accidents,
   });

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

@@ -38,6 +38,7 @@ export type MenuRaw = {
   icon?: string;
   children?: MenusRaw;
   extend?: MenusRaw;
+  disable?: boolean;
 };
 export type MenusRaw = Array<MenuRaw>;
 
@@ -192,6 +193,7 @@ export const mainMenusRaw: MenusRaw = [
         icon: "r_structure",
         text: "道路模板",
         extend: templateMenusRaw,
+        disable: true,
       },
     ],
   },

+ 4 - 4
src/views/graphic/setting.vue

@@ -8,8 +8,8 @@
             <span>单位: mm</span>
           </p>
           <ui-input
-            :modelValue="data.singleRoadWidth * 100"
-            @update:modelValue="(val) => (data.singleRoadWidth = val / 100)"
+            :modelValue="data.singleRoadWidth * 1000"
+            @update:modelValue="(val) => (data.singleRoadWidth = val / 1000)"
             width="100%"
           >
             <template v-slot:icon>
@@ -28,8 +28,8 @@
             <span>单位: mm</span>
           </p>
           <ui-input
-            :modelValue="data.roadQuarantineWidth * 100"
-            @update:modelValue="(val) => (data.roadQuarantineWidth = val / 100)"
+            :modelValue="data.roadQuarantineWidth * 1000"
+            @update:modelValue="(val) => (data.roadQuarantineWidth = val / 1000)"
             width="100%"
           >
             <template v-slot:icon>

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

@@ -53,7 +53,7 @@
     >
       <template v-slot="{ data }">
         <p v-if="currentType === TypeEnum.Table">
-          {{ (data as any).title || "默认标题" }}
+          <!-- {{ (data as any).title || "默认标题" }} -->
         </p>
       </template>
     </Photos>

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

@@ -72,7 +72,10 @@
             <div
               class="right-btn"
               @click="
-                router.push({ name: writeRouteName.roads, params: { type: 'table' } })
+                router.push({
+                  name: writeRouteName.roads,
+                  params: { type: 'table', back: 1 },
+                })
               "
             >
               现场绘图({{ sceneSortPhotos.length }})