jinx 2 년 전
부모
커밋
1d13e27c32
2개의 변경된 파일75개의 추가작업 그리고 83개의 파일을 삭제
  1. 1 1
      server/test/a0k4xu045_202305311600080410/attach/sceneStore
  2. 74 82
      src/graphic/Controls/UIControl.js

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 1
server/test/a0k4xu045_202305311600080410/attach/sceneStore


+ 74 - 82
src/graphic/Controls/UIControl.js

@@ -1,37 +1,37 @@
-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 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 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 { 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 { ellipticService } from "../Service/EllipticService.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 { ellipticService } from '../Service/EllipticService.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) {
@@ -87,7 +87,7 @@ export default class UIControl {
         }
 
         //执行新的事件
-        if (uiService.isBelongRoad(selectUI) || selectUI == "road") {
+        if (uiService.isBelongRoad(selectUI) || selectUI == 'road') {
           stateService.setEventName(LayerEvents.AddRoad);
         } else if (selectUI == UIEvents.CurveRoad) {
           stateService.setEventName(LayerEvents.AddCurveRoad);
@@ -121,17 +121,34 @@ export default class UIControl {
 
   updateVectorForSelectUI(selectUI) {
     const focusItem = stateService.getFocusItem();
-    if (uiService.isBelongRoadEdgeStyle(selectUI)) {
-      let roadEdge = dataService.getRoadEdge(focusItem.vectorId);
-      if (roadEdge) {
-        roadEdge.setStyle(selectUI);
-      } else {
-        roadEdge = dataService.getCurveRoadEdge(focusItem.vectorId);
-        roadEdge.setStyle(selectUI);
+    if (selectUI == VectorStyle.Bold || selectUI == VectorStyle.Thinning) {
+      if (focusItem.type == VectorType.Line) {
+        let Line = dataService.getLine(focusItem.vectorId);
+        Line.setStyle(selectUI);
+      } else if (focusItem.type == VectorType.RoadEdge) {
+        let roadEdge = dataService.getRoadEdge(focusItem.vectorId);
+        if (roadEdge) {
+          roadEdge.setStyle(selectUI);
+        } else {
+          roadEdge = dataService.getCurveRoadEdge(focusItem.vectorId);
+          roadEdge.setStyle(selectUI);
+        }
       }
       this.layer.history.save();
       this.layer.renderer.autoRedraw();
-    } else if (selectUI == VectorEvents.AddLane) {
+    }
+    // else if (uiService.isBelongRoadEdgeStyle(selectUI)) {
+    //   let roadEdge = dataService.getRoadEdge(focusItem.vectorId);
+    //   if (roadEdge) {
+    //     roadEdge.setStyle(selectUI);
+    //   } else {
+    //     roadEdge = dataService.getCurveRoadEdge(focusItem.vectorId);
+    //     roadEdge.setStyle(selectUI);
+    //   }
+    //   this.layer.history.save();
+    //   this.layer.renderer.autoRedraw();
+    // }
+    else if (selectUI == VectorEvents.AddLane) {
       if (focusItem && focusItem.vectorId) {
         stateService.setEventName(VectorEvents.AddLane);
       }
@@ -379,18 +396,18 @@ export default class UIControl {
   }
 
   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
@@ -398,38 +415,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;
   }
   /****************************************************************************针对菜单*******************************************************************************/
 
@@ -488,9 +486,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));
   }
 
   // 进入持续添加出确认与取消框
@@ -498,7 +494,7 @@ export default class UIControl {
     this.graphicStateUI.continuedMode = true;
   }
   confirmEntry() {
-    console.log("确认");
+    console.log('确认');
     this.graphicStateUI.continuedMode = false;
     this.layer.exit();
     uiService.setSelectLineCategory(VectorCategory.Line.NormalLine);
@@ -507,7 +503,7 @@ export default class UIControl {
     this.layer.renderer.autoRedraw();
   }
   confirmCancel() {
-    console.log("取消");
+    console.log('取消');
     this.graphicStateUI.continuedMode = false;
     addPoint.deleteTestPoints();
     this.layer.exit();
@@ -519,14 +515,10 @@ export default class UIControl {
 
   // 设置默认设置
   setDefaultSetting(setting) {
-    console.log("获得设置", setting);
-
-    uiService.setRoadMidDivideWidth(
-      setting.roadQuarantineWidth / coordinate.res
-    );
-    uiService.setCurveRoadMidDivideWidth(
-      setting.roadQuarantineWidth / coordinate.res
-    );
+    console.log('获得设置', setting);
+
+    uiService.setRoadMidDivideWidth(setting.roadQuarantineWidth / coordinate.res);
+    uiService.setCurveRoadMidDivideWidth(setting.roadQuarantineWidth / coordinate.res);
     uiService.setSingleLaneWidth(setting.singleRoadWidth / coordinate.res);
     uiService.setLineWidth(setting.lineWidth / 1000 / coordinate.res);
   }
@@ -540,7 +532,7 @@ export default class UIControl {
       singleRoadWidth: singleLaneWidth * coordinate.res,
       roadQuarantineWidth: roadMidDivideWidth * coordinate.res,
       // lineWidth: lineWidth * coordinate.res * 1000,
-      lineWidth: lineWidth ,
+      lineWidth: lineWidth,
     };
   }