jinx 1 年間 前
コミット
e8dc6f2404

+ 9 - 8
src/graphic/Constant.js

@@ -1,3 +1,4 @@
+import { drawSetting } from "@/store/drawSetting";
 const Constant = {
   /*
         最小距离
@@ -34,13 +35,13 @@ const Constant = {
   maxAngle: 170,
   minRoadSideWidth: 30,
   maxRoadSideWidth: 800,
-  oneWay: 'oneWay', //one表示单向,two表示双向
-  twoWay: 'twoWay', //one表示单向,two表示双向
-  defaultSingleLaneWidth: 3.5, //单个车道的宽度
-  defaultMidDivideWidth: 0.2, //隔离带的宽度
-  angleLocationMode: 'AngleLocationMode', //直角定位
-  allLocationMode: 'AllLocationMode', //综合定位
-  normalLocationMode: 'NormalLocationMode', //垂线定位
-  freeLocationMode: 'FreeLocationMode', //自由测量
+  oneWay: "oneWay", //one表示单向,two表示双向
+  twoWay: "twoWay", //one表示单向,two表示双向
+  defaultSingleLaneWidth: drawSetting.value?.defaultSingleLaneWidth || 3.5, //单个车道的宽度
+  defaultMidDivideWidth: drawSetting.value?.defaultMidDivideWidth || 0.2, //隔离带的宽度
+  angleLocationMode: "AngleLocationMode", //直角定位
+  allLocationMode: "AllLocationMode", //综合定位
+  normalLocationMode: "NormalLocationMode", //垂线定位
+  freeLocationMode: "FreeLocationMode", //自由测量
 };
 export default Constant;

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

@@ -35,6 +35,8 @@ import { roadService } from "../Service/RoadService.js";
 import { curveRoadService } from "../Service/CurveRoadService.js";
 import Msg from "../enum/Msg.js";
 import RoadStructure from "../enum/RoadStructure";
+import { drawSetting } from "@/store/drawSetting";
+
 export default class UIControl {
   constructor(layer, newsletter, graphicStateUI) {
     this._prompts = [];
@@ -688,6 +690,7 @@ export default class UIControl {
     Constant.defaultSingleLaneWidth = setting.singleRoadWidth;
     uiService.setLineWidth(setting.lineWidth);
     this.layer.renderer.autoRedraw();
+    this.saveSettings(setting);
   }
 
   // 获取默认设置
@@ -701,4 +704,14 @@ export default class UIControl {
       lineWidth: lineWidth,
     };
   }
+
+  saveSettings(setting) {
+    let origin = drawSetting.value;
+    let newData = {
+      defaultSingleLaneWidth: setting.singleRoadWidth,
+      defaultMidDivideWidth: setting.roadQuarantineWidth,
+      lineWidth: setting.lineWidth,
+    };
+    origin = Object.assign(origin, newData);
+  }
 }

+ 2 - 2
src/graphic/Settings.js

@@ -1,9 +1,9 @@
 import Constant from "./Constant";
 import VectorCategory from "./enum/VectorCategory";
 import { os } from "@/utils/vue.ts";
-
+import { drawSetting } from "@/store/drawSetting";
 const Settings = {
-  lineWidth: 1,
+  lineWidth: drawSetting.value?.lineWidth || 1,
   roadLeftDrivewayCount: 1,
   screenMode: false,
   roadRightDrivewayCount: 1,

+ 9 - 0
src/store/drawSetting.ts

@@ -0,0 +1,9 @@
+import { ref } from "vue";
+
+export const drawSetting = ref({
+  defaultSingleLaneWidth: 3.5, //单个车道的宽度
+  defaultMidDivideWidth: 0.2, //隔离带的宽度
+  lineWidth: 1, //基本线宽
+});
+
+(window as any).drawSetting = drawSetting;

+ 6 - 4
src/store/sync.ts

@@ -15,6 +15,7 @@ import { defaultUses, uses } from "@/store/SVGLabel";
 import { imageRotate } from "@/utils/image-rotate";
 import { sceneSeting } from "./sceneSeting";
 import { tables } from "./tables";
+import { drawSetting } from "./drawSetting";
 
 const global = window as any;
 
@@ -216,7 +217,8 @@ const loadStore = async () => {
   roadPhotos.value = data?.roadPhotos || [];
   uses.value = data?.uses || defaultUses;
   tables.value = data?.tables || {};
-
+  drawSetting.value = data?.drawSetting || {};
+  
   syncSceneStore();
 };
 
@@ -246,16 +248,16 @@ const syncSceneStore = () => {
       accidentPhotos: accidentPhotos.value,
       roadPhotos: roadPhotos.value,
       tables: tables.value,
+      drawSetting: drawSetting.value,
     }),
     (data) => {
-      console.error("收到数据源更新")
+      console.error("收到数据源更新");
       updateSceneStore(data);
     },
-    { deep: true, flush: 'sync' }
+    { deep: true, flush: "sync" }
   );
 };
 
-
 loadStore().catch((e) => {
   console.error(e);
   alert("场景数据加载失败");