xushiting %!s(int64=2) %!d(string=hai) anos
pai
achega
1b19e7559f

+ 34 - 35
src/graphic/CanvasStyle/default.js

@@ -6,43 +6,42 @@ const Road = {
   //   strokeStyle: "rgba(255,0,0,0.5)",
   //   fillStyle: "rgba(255,0,0,0.8)",
   // },
-}
+};
 
 const RoadEdge = {
   ...Road,
   lineWidth: 1,
   strokeStyle: "#000",
-}
+};
 
 const Lane = {
   ...RoadEdge,
   lineWidth: 1,
   strokeStyle: "#000",
-  dash: [8, 8]
-}
+  dash: [8, 8],
+};
 
 const CurveRoad = {
   ...Road,
-}
+};
 
 const CurveRoadEdge = {
   ...CurveRoad,
-  ...RoadEdge
-}
+  ...RoadEdge,
+};
 
 const CurveLan = {
   ...CurveRoad,
-  ...Lane
-}
-
+  ...Lane,
+};
 
-const Tag = {
+const Text = {
   strokeStyle: "rgb(255,255,255,1)",
   fillStyle: "rgb(255,255,255,1)",
   strokeStyle_adding: "rgba(243, 255, 0, 0.8)",
   fillStyle_adding: "rgba(243, 255, 0, 0.8)",
   lineWidth: 1,
-}
+};
 
 const CanvasFont = {
   font: "14px Microsoft YaHei",
@@ -52,73 +51,73 @@ const CanvasFont = {
   textBaseline: "middle",
   miterLimit: 10,
   direction: "ltr",
-}
+};
 
 const Point = {
   strokeStyle: "#3290FF",
   fillStyle: "#fff",
   radius: 4,
   lineWidth: 4,
-}
+};
 
 const RoadPoint = {
-  ...Point
-}
+  ...Point,
+};
 
 const CurvePoint = {
-  ...Point
-}
+  ...Point,
+};
 
 const ControlPoint = {
   ...Point,
   strokeStyle: "#3290FF",
-  radius: 8
-}
+  radius: 8,
+};
 
 const Text = {
-  ...Tag,
+  ...Text,
   ...CanvasFont,
   font: "12px Microsoft YaHei",
   fillStyle: "rgba(0,0,0,0.7)",
   strokeStyle: "rgba(0,0,0,0.7)",
-}
+};
 
 const Measure = {
   txt: "rgba(255,255,255,1)", //画墙/选墙的时候 测量值的颜色
   strokeStyle: "rgba(255,255,255,1)",
   lineWidth: 1,
-}
+};
 
 const Element = {
   AddingPoint: {
     radius: 4,
-      fillStyle: "yellow",
-      strokeStyle: "green",
+    fillStyle: "yellow",
+    strokeStyle: "green",
   },
   NewRoad: {
     lineWidth: 4,
-      strokeStyle: "rgba(100,100,100,0.3)",
-      errorStrokeStyle: "rgb(250,63,72,0.3)",
+    strokeStyle: "rgba(100,100,100,0.3)",
+    errorStrokeStyle: "rgb(250,63,72,0.3)",
   },
   CheckLinesX: {
     lineWidth: 2,
-      strokeStyle: "#CED806",
+    strokeStyle: "#CED806",
   },
   CheckLinesY: {
     lineWidth: 2,
-      strokeStyle: "#CED806",
+    strokeStyle: "#CED806",
   },
   VCheckLinesX: {
     lineWidth: 2,
-      strokeStyle: "#CED806",
+    strokeStyle: "#CED806",
     //strokeStyle: 'rgba(100,149,237,0.5)',
   },
   VCheckLinesY: {
     lineWidth: 2,
-      strokeStyle: "#CED806",
+    strokeStyle: "#CED806",
     //strokeStyle: 'rgba(100,149,237,0.5)',
   },
-}
+};
 
 export default {
   Road,
@@ -128,7 +127,7 @@ export default {
   Lane,
   CurveLan,
   Point,
-  Tag,
+  Text,
   ControlPoint,
   CurvePoint,
   Text,
@@ -136,5 +135,5 @@ export default {
   Measure,
   Element,
   RoadPoint,
-  bgColor: "#fff"
-}
+  bgColor: "#fff",
+};

+ 17 - 19
src/graphic/CanvasStyle/focus.js

@@ -1,63 +1,61 @@
-import def from './default.js'
+import def from "./default.js";
 
 const Road = {
   ...def.Road,
   realLineWidth: 4,
   strokeStyle: "#3290FF",
-}
+};
 
 const CurveRoad = {
   ...def.CurveRoad,
-  ...Road
-}
+  ...Road,
+};
 
-const Tag = {
-  ...def.Tag,
+const Text = {
+  ...def.Text,
   strokeStyle: "#00C8AF",
   fillStyle: "#00C8AF",
-}
+};
 
 const Point = {
   ...def.Point,
   fillStyle: "#3290FF",
-}
+};
 
 const RoadPoint = {
   ...Point,
-}
+};
 
 const CurvePoint = {
   ...def.CurvePoint,
-  ...Point
-}
+  ...Point,
+};
 
 const ControlPoint = {
   ...def.ControlPoint,
   fillStyle: "#3290FF",
-}
-
+};
 
 const RoadEdge = {
   ...def.RoadEdge,
   lineWidth: 2,
   strokeStyle: "#3290FF",
-}
+};
 
 const CurveRoadEdge = {
   ...def.CurveRoadEdge,
   lineWidth: 2,
   strokeStyle: "#3290FF",
-}
-
+};
 
 export default {
   Road,
-  Tag,
+  Text,
   Point,
   RoadPoint,
   CurvePoint,
   ControlPoint,
   CurveRoad,
   RoadEdge,
-  CurveRoadEdge
-}
+  CurveRoadEdge,
+};

+ 18 - 18
src/graphic/CanvasStyle/select.js

@@ -1,61 +1,61 @@
-import def from './default.js'
+import def from "./default.js";
 
 const Road = {
   ...def.Road,
   realLineWidth: 4,
   strokeStyle: "#3290FF",
-}
+};
 
 const CurveRoad = {
   ...def.CurveRoad,
-  ...Road
-}
+  ...Road,
+};
 
-const Tag = {
-  ...def.Tag,
+const Text = {
+  ...def.Text,
   strokeStyle: "#00C8AF",
   fillStyle: "#00C8AF",
-}
+};
 
 const RoadEdge = {
   ...def.RoadEdge,
   lineWidth: 2,
   strokeStyle: "#3290FF",
-}
+};
 
 const CurveRoadEdge = {
   ...def.CurveRoadEdge,
   lineWidth: 2,
   strokeStyle: "#3290FF",
-}
+};
 
 const Point = {
   ...def.Point,
   fillStyle: "#3290FF",
-}
+};
 
 const RoadPoint = {
-  ...Point
-}
+  ...Point,
+};
 
 const CurvePoint = {
   ...def.CurvePoint,
-  ...Point
-}
+  ...Point,
+};
 
 const ControlPoint = {
   ...def.ControlPoint,
   fillStyle: "#3290FF",
-}
+};
 
 export default {
   Road,
-  Tag,
+  Text,
   Point,
   RoadPoint,
   CurvePoint,
   ControlPoint,
   CurveRoad,
   RoadEdge,
-  CurveRoadEdge
-}
+  CurveRoadEdge,
+};

+ 0 - 15
src/graphic/Controls/MoveTag.js

@@ -1,15 +0,0 @@
-import { dataService } from "../Service/DataService";
-// import { mathUtil } from "../MathUtil.js";
-
-export default class MoveTag {
-  constructor() {}
-
-  moveFullTag(position, tagId) {
-    let tag = dataService.getTag(tagId);
-    mathUtil.clonePoint(tag.center, position);
-    tag.setPoints2d();
-  }
-}
-
-const moveTag = new MoveTag();
-export { moveTag };

+ 14 - 0
src/graphic/Controls/MoveText.js

@@ -0,0 +1,14 @@
+import { dataService } from "../Service/DataService";
+
+export default class MoveText {
+  constructor() {}
+
+  moveFullText(position, textId) {
+    let text = dataService.getText(textId);
+    mathUtil.clonePoint(text.center, position);
+    text.setPoints2d();
+  }
+}
+
+const moveText = new MoveText();
+export { moveText };

+ 3 - 3
src/graphic/Controls/UIControl.js

@@ -8,7 +8,7 @@ import { dataService } from "../Service/DataService.js";
 import { historyService } from "../Service/HistoryService.js";
 import { elementService } from "../Service/ElementService";
 import { mathUtil } from "../Util/MathUtil";
-import { tagService } from "../Service/TagService.js";
+import { textService } from "../Service/TextService.js/index.js";
 import Constant from "../Constant";
 // import { roomsUtil } from "../Room/RoomsUtil.js";
 import { addRoad } from "../Controls/AddRoad";
@@ -72,8 +72,8 @@ export default class UIControl {
           stateService.setEventName(LayerEvents.AddCurveRoad);
         } else if (selectUI == UIEvents.Line) {
           stateService.setEventName(LayerEvents.AddLine);
-        } else if (selectUI == UIEvents.Tag) {
-          stateService.setEventName(LayerEvents.AddTag);
+        } else if (selectUI == UIEvents.Text) {
+          stateService.setEventName(LayerEvents.AddText);
         } else if (selectUI == UIEvents.Img) {
           stateService.setEventName(LayerEvents.Img);
         } else if (selectUI == UIEvents.AddMeasureLine) {

+ 0 - 21
src/graphic/Geometry/GuideLine.js

@@ -1,21 +0,0 @@
-import VectorType from "../enum/VectorType.js";
-import Geometry from "./Geometry";
-export default class GuideLine extends Geometry {
-  constructor(start, end, vectorId) {
-    super();
-    this.start = {};
-    this.end = {};
-    this.geoType = VectorType.Line;
-    this.setId(vectorId);
-
-    this.setPositions(start, end);
-  }
-
-  setPositions(point1, point2) {
-    this.start.x = point1.x;
-    this.start.y = point1.y;
-
-    this.end.x = point2.x;
-    this.end.y = point2.y;
-  }
-}

+ 10 - 4
src/graphic/Geometry/MeasureLine.js

@@ -1,17 +1,23 @@
 import VectorType from "../enum/VectorType.js";
-import Geometry from "./Geometry";
+import Geometry from "./Geometry.js";
 
-export default class MeasureLine extends Geometry {
+//与Line不同的是start和end是二维坐标。Line的start和end表示point的Id
+export default class SimpleLine extends Geometry {
   constructor(start, end, vectorId) {
     super();
     this.start = {};
     this.end = {};
-    this.geoType = VectorType.MeasureLine;
+    this.category = null;
+    this.geoType = VectorType.SimpleLine;
     this.setId(vectorId);
-
     this.setPositions(start, end);
   }
 
+  //GuideLine,MeasureLine,BaseLine
+  setCategory(value) {
+    this.category = value;
+  }
+
   setPositions(point1, point2) {
     this.start.x = point1.x;
     this.start.y = point1.y;

+ 4 - 4
src/graphic/Geometry/Tag.js

@@ -1,11 +1,11 @@
 import VectorType from "../enum/VectorType.js";
-import Geometry from "./Geometry";
+import Geometry from "./Geometry.js";
 import { mathUtil } from "../Util/MathUtil.js";
-import { coordinate } from "../Coordinate";
+import { coordinate } from "../Coordinate.js";
 import Constant from "../Constant.js";
 
 //不靠墙
-export default class Tag extends Geometry {
+export default class Text extends Geometry {
   constructor(center, vectorId) {
     super();
     this.center = center;
@@ -19,7 +19,7 @@ export default class Tag extends Geometry {
     this.sideWidth = 30; //像素
     this.sideThickness = 30; //像素
 
-    this.geoType = VectorType.Tag;
+    this.geoType = VectorType.Text;
     this.setId(vectorId);
   }
 

+ 23 - 23
src/graphic/History/Change.js

@@ -24,12 +24,12 @@ export default class Change {
 
     this.comparePoints();
     this.compareRoads();
-    this.compareTags();
+    this.compareTexts();
 
     if (
       this.currentData.points.length == 0 &&
       this.currentData.roads.length == 0 &&
-      this.currentData.tags.length == 0
+      this.currentData.texts.length == 0
     ) {
       this.saveCurrentInfo();
       return false;
@@ -121,43 +121,43 @@ export default class Change {
     }
   }
 
-  compareTags() {
-    this.currentData.tags = [];
-    const tags = dataService.getTags();
+  compareTexts() {
+    this.currentData.texts = [];
+    const texts = dataService.getTexts();
 
-    for (const key in tags) {
-      const tag = tags[key];
-      const lastTag = this.lastData.tags[key];
+    for (const key in texts) {
+      const text = texts[key];
+      const lastText = this.lastData.texts[key];
 
       // 不存在意味着增加
-      if (!lastTag) {
+      if (!lastText) {
         const item = {
-          handle: HistoryEvents.AddTag,
-          tag: historyUtil.getDataForTag(tag),
+          handle: HistoryEvents.AddText,
+          text: historyUtil.getDataForText(text),
         };
-        this.currentData.tags.push(item);
+        this.currentData.texts.push(item);
       } else {
-        if (!historyUtil.isDifferentForTags(tag, lastTag)) {
-          delete this.lastData.tags[key];
+        if (!historyUtil.isDifferentForTexts(text, lastText)) {
+          delete this.lastData.texts[key];
           continue;
         } else {
           const item = {
-            handle: HistoryEvents.ModifyTag,
-            preTag: historyUtil.getDataForTag(lastTag),
-            curTag: historyUtil.getDataForTag(tag),
+            handle: HistoryEvents.ModifyText,
+            preText: historyUtil.getDataForText(lastText),
+            curText: historyUtil.getDataForText(text),
           };
-          this.currentData.tags.push(item);
+          this.currentData.texts.push(item);
         }
       }
-      delete this.lastData.tags[key];
+      delete this.lastData.texts[key];
     }
 
-    for (const key in this.lastData.tags) {
+    for (const key in this.lastData.texts) {
       const item = {
-        handle: HistoryEvents.DeleteTag,
-        tag: historyUtil.getDataForTag(this.lastData.tags[key]),
+        handle: HistoryEvents.DeleteText,
+        text: historyUtil.getDataForText(this.lastData.texts[key]),
       };
-      this.currentData.tags.push(item);
+      this.currentData.texts.push(item);
     }
   }
 }

+ 27 - 27
src/graphic/History/History.js

@@ -4,7 +4,7 @@ import { change } from "./Change";
 import { stateService } from "../Service/StateService";
 import HistoryEvents from "../enum/HistoryEvents";
 import { historyService } from "../Service/HistoryService";
-import { tagService } from "../Service/TagService";
+import { textService } from "../Service/TextService";
 import { roadService } from "../Service/RoadService";
 import { roadPointService } from "../Service/RoadPointService";
 
@@ -115,7 +115,7 @@ export default class History {
       item.type = "pre";
       this.goPreForPoints(item.points);
       this.goPreForRoads(item.roads);
-      this.goPreForTags(item.tags);
+      this.goPreForTexts(item.texts);
 
       historyService.undoHistoryRecord();
       change.saveCurrentInfo();
@@ -171,18 +171,18 @@ export default class History {
     }
   }
 
-  goPreForTags(itemForTags) {
-    for (let i = 0; i < itemForTags.length; ++i) {
-      const item = itemForTags[i];
-      if (item.handle == HistoryEvents.AddTag) {
-        dataService.deleteTag(item.tag.id);
-      } else if (item.handle == HistoryEvents.DeleteTag) {
-        let newTag = tagService.createTag(item.tag.center, item.tag.id);
-        historyUtil.assignTagFromTag(newTag, item.tag);
-      } else if (item.handle == HistoryEvents.ModifyTag) {
-        const preTag = item.preTag;
-        let currentTag = dataService.getTag(item.curTag.id);
-        historyUtil.assignTagFromTag(currentTag, preTag);
+  goPreForTexts(itemForTexts) {
+    for (let i = 0; i < itemForTexts.length; ++i) {
+      const item = itemForTexts[i];
+      if (item.handle == HistoryEvents.AddText) {
+        dataService.deleteText(item.text.id);
+      } else if (item.handle == HistoryEvents.DeleteText) {
+        let newText = textService.createText(item.text.center, item.text.id);
+        historyUtil.assignTextFromText(newText, item.text);
+      } else if (item.handle == HistoryEvents.ModifyText) {
+        const preText = item.preText;
+        let currentText = dataService.getText(item.curText.id);
+        historyUtil.assignTextFromText(currentText, preText);
       }
     }
   }
@@ -224,18 +224,18 @@ export default class History {
     }
   }
 
-  goNextForTags(itemForTags) {
-    for (let i = 0; i < itemForTags.length; ++i) {
-      const item = itemForTags[i];
-      if (item.handle == HistoryEvents.AddTag) {
-        let vTag = tagService.createTag(item.tag.center, item.tag.id);
-        historyUtil.assignTagFromTag(vTag, item.tag);
-      } else if (item.handle == HistoryEvents.DeleteTag) {
-        dataService.deleteTag(item.tag.id);
-      } else if (item.handle == HistoryEvents.ModifyTag) {
-        const currentTag = item.curTag;
-        let preTag = dataService.getTag(item.curTag.id);
-        historyUtil.assignTagFromTag(preTag, currentTag);
+  goNextForTexts(itemForTexts) {
+    for (let i = 0; i < itemForTexts.length; ++i) {
+      const item = itemForTexts[i];
+      if (item.handle == HistoryEvents.AddText) {
+        let vText = textService.createText(item.text.center, item.text.id);
+        historyUtil.assignTextFromText(vText, item.text);
+      } else if (item.handle == HistoryEvents.DeleteText) {
+        dataService.deleteText(item.text.id);
+      } else if (item.handle == HistoryEvents.ModifyText) {
+        const currentText = item.curText;
+        let preText = dataService.getText(item.curText.id);
+        historyUtil.assignTextFromText(preText, currentText);
       }
     }
   }
@@ -250,7 +250,7 @@ export default class History {
       //this.layer.uiControl.currentUI = null;
       this.goNextForPoints(item.points);
       this.goNextForRoads(item.roads);
-      this.goNextForTags(item.tags);
+      this.goNextForTexts(item.texts);
       change.saveCurrentInfo();
       this.setState();
 

+ 27 - 24
src/graphic/History/HistoryUtil.js

@@ -1,6 +1,6 @@
 import { mathUtil } from "../Util/MathUtil";
 import { dataService } from "../Service/DataService";
-import { tagService } from "../Service/TagService";
+import { textService } from "../Service/TextService";
 
 export default class HistoryUtil {
   constructor() {}
@@ -13,8 +13,11 @@ export default class HistoryUtil {
     }
   }
 
-  isDifferentForTags(tag1, tag2) {
-    if (mathUtil.equalPoint(tag1.center, tag2.center) && tag1.des == tag2.des) {
+  isDifferentForTexts(text1, text2) {
+    if (
+      mathUtil.equalPoint(text1.center, text2.center) &&
+      text1.des == text2.des
+    ) {
       return false;
     } else {
       return true;
@@ -38,14 +41,14 @@ export default class HistoryUtil {
     this.setPointInfo(pointInfo);
   }
 
-  assignTagFromTag(tag1, tag2) {
-    const tagInfo = {};
-    tagInfo.vectorId = tag1.vectorId;
-    tagInfo.des = tag2.des;
-    tagInfo.center = JSON.parse(JSON.stringify(tag2.center));
-    tagInfo.points2d = JSON.parse(JSON.stringify(tag2.points));
-    tagInfo.adding = false;
-    this.setTagInfo(tagInfo);
+  assignTextFromText(text1, text2) {
+    const textInfo = {};
+    textInfo.vectorId = text1.vectorId;
+    textInfo.des = text2.des;
+    textInfo.center = JSON.parse(JSON.stringify(text2.center));
+    textInfo.points2d = JSON.parse(JSON.stringify(text2.points));
+    textInfo.adding = false;
+    this.setTextInfo(textInfo);
   }
 
   deletePoint(pointId) {
@@ -74,14 +77,14 @@ export default class HistoryUtil {
     return data;
   }
 
-  getDataForTag(tag) {
+  getDataForText(text) {
     const data = {};
-    data.id = tag.vectorId;
-    data.type = tag.geoType;
+    data.id = text.vectorId;
+    data.type = text.geoType;
     data.center = {};
-    mathUtil.clonePoint(data.center, tag.center);
-    data.points = [].concat(tag.points2d);
-    data.des = tag.des;
+    mathUtil.clonePoint(data.center, text.center);
+    data.points = [].concat(text.points2d);
+    data.des = text.des;
     return data;
   }
 
@@ -103,13 +106,13 @@ export default class HistoryUtil {
     return point;
   }
 
-  setTagInfo(tagInfo) {
-    let tag = dataService.getTag(tagInfo.vectorId);
-    tag.vectorId = tagInfo.vectorId;
-    tag.center = JSON.parse(JSON.stringify(tagInfo.center));
-    tag.points2d = JSON.parse(JSON.stringify(tagInfo.points2d));
-    tag.des = tagInfo.des;
-    tag.adding = tagInfo.adding;
+  setTextInfo(textInfo) {
+    let text = dataService.getText(textInfo.vectorId);
+    text.vectorId = textInfo.vectorId;
+    text.center = JSON.parse(JSON.stringify(textInfo.center));
+    text.points2d = JSON.parse(JSON.stringify(textInfo.points2d));
+    text.des = textInfo.des;
+    text.adding = textInfo.adding;
   }
 }
 

+ 13 - 13
src/graphic/Layer.js

@@ -3,11 +3,11 @@ import { stateService } from "./Service/StateService";
 import { elementService } from "./Service/ElementService";
 import { dataService } from "./Service/DataService";
 import { measureService } from "./Service/MeasureService";
-import { tagService } from "./Service/TagService";
+import { textService } from "./Service/TextService";
 import { historyService } from "./Service/HistoryService";
 import UIControl from "./Controls/UIControl";
 // import { moveRectangle } from "./Controls/MoveRectangle";
-import { moveTag } from "./Controls/MoveTag";
+import { moveText } from "./Controls/MoveText";
 import { addRoad } from "./Controls/AddRoad";
 import { addLine } from "./Controls/AddLine";
 import { moveRoad } from "./Controls/MoveRoad";
@@ -419,26 +419,26 @@ export default class Layer {
         }
         needAutoRedraw = true;
         break;
-      case LayerEvents.AddTag:
+      case LayerEvents.AddText:
         needAutoRedraw = true;
         if (draggingItem == null) {
-          const tag = tagService.createTag(position);
-          if (tag.vectorId) {
+          const text = textService.createText(position);
+          if (text.vectorId) {
             stateService.setSelectItem(
-              tag.vectorId,
-              VectorType.Tag,
+              text.vectorId,
+              VectorType.Text,
               SelectState.Select
             );
             stateService.setDraggingItem(stateService.selectItem);
           }
         } else {
-          moveTag.moveFullTag(position, draggingItem.vectorId);
+          moveText.moveFullText(position, draggingItem.vectorId);
         }
         break;
-      case LayerEvents.MoveTag:
+      case LayerEvents.MoveText:
         needAutoRedraw = true;
         if (draggingItem != null) {
-          moveTag.moveFullTag(position, draggingItem.vectorId);
+          moveText.moveFullText(position, draggingItem.vectorId);
         }
         break;
     }
@@ -598,9 +598,9 @@ export default class Layer {
         needAutoRedraw = true;
         this.history.save();
         break;
-      case LayerEvents.MoveTag:
+      case LayerEvents.MoveText:
         needAutoRedraw = true;
-        if (focusItem != null && focusItem.type == VectorType.Tag) {
+        if (focusItem != null && focusItem.type == VectorType.Text) {
           this.uiControl.currentUI = focusItem.type;
         }
         this.history.save();
@@ -837,7 +837,7 @@ export default class Layer {
         }
       }
     } else if (eventType == "mouseUp") {
-      if (eventName == LayerEvents.AddTag) {
+      if (eventName == LayerEvents.AddText) {
         //可连续添加
         //stateService.clearEventName()
       }

+ 1 - 1
src/graphic/Load.js

@@ -2,7 +2,7 @@ import { dataService } from "./Service/DataService.js";
 import { stateService } from "./Service/StateService.js";
 import { coordinate } from "./Coordinate.js";
 import Constant from "./Constant";
-import { tagService } from "./Service/TagService";
+import { textService } from "./Service/TextService.js";
 import { mathUtil } from "./Util/MathUtil";
 import { measureService } from "./Service/MeasureService";
 import { cameraService } from "./Service/CameraService";

+ 46 - 45
src/graphic/Renderer/Draw.js

@@ -154,15 +154,15 @@ export default class Draw {
         ctx.moveTo(startScreen.x, startScreen.y);
         ctx.lineTo(endScreen.x, endScreen.y);
         ctx.stroke();
-      }
+      };
 
       ctx.save();
       const vectorStyle = help.setVectorStyle(ctx, vector);
-      ctx.lineWidth = vector.midDivideWidth
-      draw()
-      ctx.strokeStyle = Style.bgColor
-      ctx.lineWidth = vector.midDivideWidth - vectorStyle.realLineWidth
-      draw()
+      ctx.lineWidth = vector.midDivideWidth;
+      draw();
+      ctx.strokeStyle = Style.bgColor;
+      ctx.lineWidth = vector.midDivideWidth - vectorStyle.realLineWidth;
+      draw();
       ctx.restore();
     }
 
@@ -253,10 +253,14 @@ export default class Draw {
 
   drawControlPoint(vector) {
     const start = coordinate.getScreenXY(
-      dataService.getRoadEdge(vector.edgeInfo1.id).getPosition(vector.edgeInfo1.dir)
+      dataService
+        .getRoadEdge(vector.edgeInfo1.id)
+        .getPosition(vector.edgeInfo1.dir)
     );
     const end = coordinate.getScreenXY(
-      dataService.getRoadEdge(vector.edgeInfo2.id).getPosition(vector.edgeInfo2.dir)
+      dataService
+        .getRoadEdge(vector.edgeInfo2.id)
+        .getPosition(vector.edgeInfo2.dir)
     );
     const pt2 = this.twoOrderBezier(
       0.5,
@@ -289,20 +293,19 @@ export default class Draw {
     ctx.quadraticCurveTo(pt.x, pt.y, end.x, end.y);
     ctx.stroke();
     ctx.restore();
-
   }
 
   drawCurveRoad(vector) {
-    console.log(vector)
+    console.log(vector);
     const [coves] = help.transformCoves([vector.curves]);
     const ctx = this.context;
 
     ctx.save();
     const vectorStyle = help.setVectorStyle(ctx, vector);
-    ctx.lineWidth = vector?.midDivideWidth || vectorStyle.lineWidth
+    ctx.lineWidth = vector?.midDivideWidth || vectorStyle.lineWidth;
     help.drawCoves(ctx, coves);
-    ctx.lineWidth = ctx.lineWidth - vectorStyle.realLineWidth
-    ctx.strokeStyle = Style.bgColor
+    ctx.lineWidth = ctx.lineWidth - vectorStyle.realLineWidth;
+    ctx.strokeStyle = Style.bgColor;
     help.drawCoves(ctx, coves);
     ctx.restore();
 
@@ -350,14 +353,12 @@ export default class Draw {
   }
 
   drawRoadPoint(vector) {
-    this.drawPoint(vector)
+    this.drawPoint(vector);
   }
   drawPoint(vector) {
     const pt = coordinate.getScreenXY({ x: vector.x, y: vector.y });
     const ctx = this.context;
-    const draw = () => {
-
-    }
+    const draw = () => {};
 
     help.setVectorStyle(ctx, vector, vector.geoType || "Point");
     ctx.beginPath();
@@ -421,7 +422,7 @@ export default class Draw {
   drawText(position, txt, angle) {
     const ctx = this.context;
     ctx.save();
-    help.setVectorStyle(ctx, null,"Text");
+    help.setVectorStyle(ctx, null, "Text");
 
     const pt = coordinate.getScreenXY(position);
     if (angle) {
@@ -434,56 +435,56 @@ export default class Draw {
     ctx.restore();
   }
 
-  drawTag(geometry, styleType, hide) {
+  drawText(geometry, styleType, hide) {
     this.context.save();
 
-    this.context.lineWidth = Style.Tag.lineWidth * coordinate.ratio;
-    this.context.strokeStyle = Style.Tag.strokeStyle;
-    this.context.fillStyle = Style.Tag.fillStyle;
+    this.context.lineWidth = Style.Text.lineWidth * coordinate.ratio;
+    this.context.strokeStyle = Style.Text.strokeStyle;
+    this.context.fillStyle = Style.Text.fillStyle;
 
     if (styleType) {
       if (styleType == "style-1") {
         this.context.lineWidth =
-          Style.DownLoad.style1.Tag.lineWidth * coordinate.ratio;
-        this.context.strokeStyle = Style.DownLoad.style1.Tag.strokeStyle;
-        this.context.fillStyle = Style.DownLoad.style1.Tag.fillStyle;
+          Style.DownLoad.style1.Text.lineWidth * coordinate.ratio;
+        this.context.strokeStyle = Style.DownLoad.style1.Text.strokeStyle;
+        this.context.fillStyle = Style.DownLoad.style1.Text.fillStyle;
       } else if (styleType == "style-2") {
         this.context.lineWidth =
-          Style.DownLoad.style2.Tag.lineWidth * coordinate.ratio;
-        this.context.strokeStyle = Style.DownLoad.style2.Tag.strokeStyle;
-        this.context.fillStyle = Style.DownLoad.style2.Tag.fillStyle;
+          Style.DownLoad.style2.Text.lineWidth * coordinate.ratio;
+        this.context.strokeStyle = Style.DownLoad.style2.Text.strokeStyle;
+        this.context.fillStyle = Style.DownLoad.style2.Text.fillStyle;
       } else if (styleType == "style-3") {
         this.context.lineWidth =
-          Style.DownLoad.style3.Tag.lineWidth * coordinate.ratio;
-        this.context.strokeStyle = Style.DownLoad.style3.Tag.strokeStyle;
-        this.context.fillStyle = Style.DownLoad.style3.Tag.fillStyle;
+          Style.DownLoad.style3.Text.lineWidth * coordinate.ratio;
+        this.context.strokeStyle = Style.DownLoad.style3.Text.strokeStyle;
+        this.context.fillStyle = Style.DownLoad.style3.Text.fillStyle;
       } else if (styleType == "style-4") {
         this.context.lineWidth =
-          Style.DownLoad.style4.Tag.lineWidth * coordinate.ratio;
-        this.context.strokeStyle = Style.DownLoad.style4.Tag.strokeStyle;
-        this.context.fillStyle = Style.DownLoad.style4.Tag.fillStyle;
+          Style.DownLoad.style4.Text.lineWidth * coordinate.ratio;
+        this.context.strokeStyle = Style.DownLoad.style4.Text.strokeStyle;
+        this.context.fillStyle = Style.DownLoad.style4.Text.fillStyle;
       }
     } else {
       const selectItem = stateService.getSelectItem();
       const draggingItem = stateService.getDraggingItem();
       const focusItem = stateService.getFocusItem();
 
-      if (selectItem && selectItem.type == VectorType.Tag) {
+      if (selectItem && selectItem.type == VectorType.Text) {
         if (geometry.vectorId == selectItem.vectorId) {
-          this.context.strokeStyle = Style.Select.Tag.strokeStyle;
-          this.context.fillStyle = Style.Select.Tag.fillStyle;
+          this.context.strokeStyle = Style.Select.Text.strokeStyle;
+          this.context.fillStyle = Style.Select.Text.fillStyle;
         }
-      } else if (draggingItem && draggingItem.type == VectorType.Tag) {
+      } else if (draggingItem && draggingItem.type == VectorType.Text) {
         if (geometry.vectorId == draggingItem.vectorId) {
-          this.context.strokeStyle = Style.Select.Tag.strokeStyle;
-          this.context.fillStyle = Style.Select.Tag.fillStyle;
+          this.context.strokeStyle = Style.Select.Text.strokeStyle;
+          this.context.fillStyle = Style.Select.Text.fillStyle;
         }
       }
 
-      if (focusItem && focusItem.type == VectorType.Tag) {
+      if (focusItem && focusItem.type == VectorType.Text) {
         if (geometry.vectorId == focusItem.vectorId) {
-          this.context.strokeStyle = Style.Focus.Tag.strokeStyle;
-          this.context.fillStyle = Style.Focus.Tag.fillStyle;
+          this.context.strokeStyle = Style.Focus.Text.strokeStyle;
+          this.context.fillStyle = Style.Focus.Text.fillStyle;
         }
       }
     }
@@ -499,8 +500,8 @@ export default class Draw {
         });
       }
 
-      this.context.strokeStyle = Style.Tag.strokeStyle_adding;
-      this.context.fillStyle = Style.Tag.fillStyle_adding;
+      this.context.strokeStyle = Style.Text.strokeStyle_adding;
+      this.context.fillStyle = Style.Text.fillStyle_adding;
       this.context.beginPath();
       this.context.moveTo(points[0].x, points[0].y);
       this.context.lineTo(points[1].x, points[1].y);

+ 13 - 16
src/graphic/Renderer/Render.js

@@ -30,11 +30,11 @@ export default class Render {
       case VectorType.ControlPoint:
         draw.drawControlPoint(vector);
         return;
-      case VectorType.Tag:
-        draw.drawTag(vector, styleType, flag);
-        return;
-      case VectorType.MeasureLine:
-        draw.drawMeasures(vector, styleType);
+      case VectorType.Line:
+        draw.drawLine(vector); //需要修改,start和end是point的id
+        break;
+      case VectorType.Text:
+        draw.drawText(vector, styleType, flag);
         return;
       case VectorType.BackgroundImg:
         draw.drawBackGroundImg();
@@ -53,15 +53,12 @@ export default class Render {
       case VectorType.RoadPoint:
         draw.drawCircle(vector);
         break;
-      case VectorType.Line:
-        draw.drawLine(vector);
+      case VectorType.SimpleLine:
+        draw.drawLine(vector); //需要修改,有几种情况:测量,校准,基准
         break;
       case VectorType.Road:
         draw.drawRoad(vector, true);
         break;
-      case VectorType.MeasureLine:
-        draw.drawMeasureLine(vector, true);
-        break;
     }
   }
 
@@ -135,9 +132,9 @@ export default class Render {
       this.drawGeometry(controlPoints[key]);
     }
 
-    let tags = dataService.getTags();
-    for (let key in tags) {
-      this.drawGeometry(tags[key]);
+    let texts = dataService.getTexts();
+    for (let key in texts) {
+      this.drawGeometry(texts[key]);
     }
 
     //this.drawGeometry(dataService.getImg());
@@ -167,9 +164,9 @@ export default class Render {
       this.drawGeometry(points[key]);
     }
 
-    let tags = dataService.getTags();
-    for (let key in tags) {
-      this.drawGeometry(tags[key]);
+    let texts = dataService.getTexts();
+    for (let key in texts) {
+      this.drawGeometry(texts[key]);
     }
   }
 

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

@@ -391,20 +391,20 @@ export class DataService {
   /**
    * 对标注的操作
    */
-  addTag(tag) {
-    this.vectorData.tags[tag.vectorId] = tag;
+  addText(text) {
+    this.vectorData.texts[text.vectorId] = text;
   }
 
-  getTag(tagId) {
-    return this.vectorData.tags[tagId];
+  getText(textId) {
+    return this.vectorData.texts[textId];
   }
 
-  deleteTag(tagId) {
-    delete this.vectorData.tags[tagId];
+  deleteText(textId) {
+    delete this.vectorData.texts[textId];
   }
 
-  getTags() {
-    return this.vectorData.tags;
+  getTexts() {
+    return this.vectorData.texts;
   }
 
   clear() {

+ 14 - 8
src/graphic/Service/ElementService.js

@@ -1,15 +1,15 @@
 import Point from "../Geometry/Point.js";
-import GuideLine from "../Geometry/GuideLine.js";
 import Road from "../Geometry/Road.js";
 import RoadEdge from "../Geometry/RoadEdge.js";
-import MeasureLine from "../Geometry/MeasureLine.js";
 import ElementEvents from "../enum/ElementEvents.js";
+import VectorCategory from "../enum/VectorCategory.js";
 import { listenLayer } from "../ListenLayer";
 import Constant from "../Constant";
 import { dataService } from "./DataService.js";
 import { mathUtil } from "../Util/MathUtil";
 import { coordinate } from "../Coordinate.js";
 import { edgeService } from "./EdgeService.js";
+import SimpleLine from "../Geometry/SimpleLine.js";
 
 export class ElementService {
   constructor() {
@@ -37,22 +37,28 @@ export class ElementService {
     this.newRoad = this.createTempRoad();
     this.newRoad.name = ElementEvents.NewRoad;
 
-    this.newLine = new GuideLine({ x: 0, y: 0 }, { x: 1, y: 1 });
+    this.newLine = new SimpleLine({ x: 0, y: 0 }, { x: 1, y: 1 });
+    this.newLine.setCategory(VectorCategory.Line.GuideLine);
     this.newLine.name = ElementEvents.NewLine;
 
-    this.newMeasureLine = new MeasureLine({ x: 0, y: 0 }, { x: 1, y: 1 });
+    this.newMeasureLine = new SimpleLine({ x: 0, y: 0 }, { x: 1, y: 1 });
+    this.newLine.setCategory(VectorCategory.Line.MeasureLine);
     this.newMeasureLine.name = ElementEvents.NewMeasureLine;
 
-    this.checkLines.X = new GuideLine({ x: 0, y: 0 }, { x: 1, y: 1 });
+    this.checkLines.X = new SimpleLine({ x: 0, y: 0 }, { x: 1, y: 1 });
+    this.newLine.setCategory(VectorCategory.Line.GuideLine);
     this.checkLines.X.name = ElementEvents.CheckLinesX;
 
-    this.checkLines.Y = new GuideLine({ x: 0, y: 0 }, { x: 1, y: 1 });
+    this.checkLines.Y = new SimpleLine({ x: 0, y: 0 }, { x: 1, y: 1 });
+    this.newLine.setCategory(VectorCategory.Line.GuideLine);
     this.checkLines.Y.name = ElementEvents.CheckLinesY;
 
-    this.vCheckLines.X = new GuideLine({ x: 0, y: 0 }, { x: 1, y: 1 });
+    this.vCheckLines.X = new SimpleLine({ x: 0, y: 0 }, { x: 1, y: 1 });
+    this.newLine.setCategory(VectorCategory.Line.GuideLine);
     this.vCheckLines.X.name = ElementEvents.VCheckLinesX;
 
-    this.vCheckLines.Y = new GuideLine({ x: 0, y: 0 }, { x: 1, y: 1 });
+    this.vCheckLines.Y = new SimpleLine({ x: 0, y: 0 }, { x: 1, y: 1 });
+    this.newLine.setCategory(VectorCategory.Line.GuideLine);
     this.vCheckLines.Y.name = ElementEvents.VCheckLinesY;
 
     this.hideAll();

+ 1 - 1
src/graphic/Service/StateService.js

@@ -27,7 +27,7 @@ export default class StateService {
     this.selectItem.vectorId = vectorId;
     this.selectItem.type = type;
 
-    if (type == VectorType.Tag) {
+    if (type == VectorType.Text) {
       if (state == SelectState.Select) {
         this.selectItem.selectIndex = SelectState.Select;
       } else {

+ 0 - 37
src/graphic/Service/TagService.js

@@ -1,37 +0,0 @@
-import Tag from "../Geometry/Tag.js";
-import { dataService } from "./DataService.js";
-import { mathUtil } from "../Util/MathUtil.js";
-
-export default class TagService {
-  constructor() {}
-
-  // 新建tag
-  createTag(position, tagId, floor) {
-    let tag = new Tag(position, tagId);
-    tag.setPoints2d();
-    dataService.addTag(tag, floor);
-    return tag;
-  }
-
-  clearDefaultTags() {
-    for (let i = 0; i < floorplanData.floors.length; ++i) {
-      let tags = floorplanData.floors[i].tags;
-      for (let key in tags) {
-        let tag = tags[key];
-        if (
-          (tag.title == null || tag.title.trim() == "") &&
-          (tag.des == null || tag.des == "")
-        ) {
-          dataService.deleteTag(tag.vectorId, i);
-        }
-      }
-    }
-  }
-
-  getTags(floorNum) {
-    return floorplanData.floors[floorNum].tags;
-  }
-}
-
-const tagService = new TagService();
-export { tagService };

+ 18 - 0
src/graphic/Service/TextService.js

@@ -0,0 +1,18 @@
+import Text from "../Geometry/Text.js";
+import { dataService } from "./DataService.js";
+import { mathUtil } from "../Util/MathUtil.js";
+
+export default class TextService {
+  constructor() {}
+
+  // 新建text
+  createText(position, textId, floor) {
+    let text = new Text(position, textId);
+    text.setPoints2d();
+    dataService.addText(text, floor);
+    return text;
+  }
+}
+
+const textService = new TextService();
+export { textService };

+ 1 - 1
src/graphic/Service/UIService.js

@@ -1,4 +1,4 @@
-import Tag from "../Geometry/Tag.js";
+import Text from "../Geometry/Text.js";
 import { dataService } from "./DataService.js";
 import { mathUtil } from "../Util/MathUtil.js";
 import Setting from "../Setting";

+ 5 - 5
src/graphic/Style1.js

@@ -30,7 +30,7 @@ const CurveLan = {
   ...CurveRoadEdge,
 };
 
-const Tag = {
+const Text = {
   strokeStyle: "rgb(255,255,255,1)",
   fillStyle: "rgb(255,255,255,1)",
   strokeStyle_adding: "rgba(243, 255, 0, 0.8)",
@@ -66,10 +66,10 @@ const Style = {
   Lane,
   CurveLan,
   Point,
-  Tag,
+  Text,
   CurvePoint,
   Text: {
-    ...Tag,
+    ...Text,
     ...Font,
     font: "12px Microsoft YaHei",
   },
@@ -77,7 +77,7 @@ const Style = {
     Road: {
       strokeStyle: "rgba(243, 255, 0, 1)",
     },
-    Tag: {
+    Text: {
       strokeStyle: "#00C8AF",
       fillStyle: "#00C8AF",
     },
@@ -92,7 +92,7 @@ const Style = {
     Road: {
       strokeStyle: "rgba(243, 255, 0, 1)",
     },
-    Tag: {
+    Text: {
       strokeStyle: "#00C8AF",
       fillStyle: "#00C8AF",
     },

+ 3 - 3
src/graphic/enum/HistoryEvents.js

@@ -7,8 +7,8 @@ const HistoryEvents = {
   DeleteRoad: "deleteRoad",
   ModifyRoad: "modifyRoad",
 
-  AddTag: "addTag",
-  DeleteTag: "deleteTag",
-  ModifyTag: "modifyTag",
+  AddText: "addText",
+  DeleteText: "deleteText",
+  ModifyText: "modifyText",
 };
 export default HistoryEvents;

+ 2 - 2
src/graphic/enum/LayerEvents.js

@@ -22,8 +22,8 @@ const LayerEvents = {
 
   MoveCurveLine: "moveCurveLine",
   MoveLine: "moveLine",
-  AddTag: "addTag",
-  MoveTag: "moveTag",
+  AddText: "addText",
+  MoveText: "moveText",
 
   Img: "Img",
   AddMeasureLine: "addMeasureLine",

+ 1 - 10
src/graphic/enum/UIEvents.js

@@ -6,7 +6,7 @@ const UIEvents = {
   // 测量
   MeasureLine: "measure",
   // 文字
-  Tag: "tag", //这个是标注,暂时这样
+  Text: "text", //这个是标注,暂时这样
   // 放大镜
   magnifier: "magnifier",
 
@@ -95,7 +95,6 @@ const UIEvents = {
   // 高速路段
   HighwaySection: "HighwaySection",
 
-
   // ------------控制方法----------
   // 回退
   GoBack: "GoBack",
@@ -108,7 +107,6 @@ const UIEvents = {
   // 底图关
   BasemapClose: "BasemapClose",
 
-
   // ------------选中组件时的UI控制-----------
   // 加控制点
   AddControlPoint: "AddControlPoint",
@@ -145,17 +143,10 @@ const UIEvents = {
   // 减车道
   DelLane: "DelLane",
 
-
   Road: "road",
   CurveRoad: "curveRoad",
-
-
 };
 
-
-
-
-
 // export const Furnitures = {
 //   TV: UIEvents.TV, //电视
 //   CombinationSofa: UIEvents.CombinationSofa, //组合沙发

+ 11 - 0
src/graphic/enum/VectorCategory.js

@@ -0,0 +1,11 @@
+const VectorCategory = {
+  Line: {
+    BaseLine: "BaseLine",
+    MeasureLine: "MeasureLine",
+    GuideLine: "GuideLine",
+  },
+  Point: {
+    BasePoint: "BasePoint",
+  },
+};
+export default VectorCategory;

+ 2 - 3
src/graphic/enum/VectorType.js

@@ -4,9 +4,9 @@ const VectorType = {
   Img: "Img",
   Point: "Point",
   Line: "Line",
+  SimpleLine: "SimpleLine",
   CurvePoint: "CurvePoint",
   CurveLine: "CurveLine",
-  MeasureLine: "MeasureLine",
   MeasureArrow: "MeasureArrow",
   Road: "Road",
   RoadEdge: "RoadEdge",
@@ -14,8 +14,7 @@ const VectorType = {
   CurveRoad: "CurveRoad",
   CurveRoadEdge: "CurveRoadEdge",
   CurveRoadPoint: "CurveRoadPoint",
-
-  Tag: "Tag",
+  Text: "Text",
   BackgroundImg: "BackgroundImg",
 };
 export default VectorType;