|
@@ -14,7 +14,7 @@ import VectorStyle from "../enum/VectorStyle.js";
|
|
|
export default class RoadService {
|
|
|
constructor() {}
|
|
|
|
|
|
- create(startId, endId, vectorId) {
|
|
|
+ create(startId, endId, vectorId, split) {
|
|
|
let road = new Road(startId, endId, vectorId);
|
|
|
dataService.addRoad(road);
|
|
|
|
|
@@ -42,6 +42,7 @@ export default class RoadService {
|
|
|
}
|
|
|
this.setLanes(road.vectorId);
|
|
|
this.initRoadWidthTipsPos(road);
|
|
|
+
|
|
|
return road;
|
|
|
}
|
|
|
|
|
@@ -168,7 +169,9 @@ export default class RoadService {
|
|
|
if (dir == "start") {
|
|
|
// 第一步把旧的road的另一端点对应的parent(旧的roadId)断开
|
|
|
delete endPoint.parent[roadId];
|
|
|
- newRoad = this.create(pointId, road.endId);
|
|
|
+
|
|
|
+ newRoad = this.create(pointId, road.endId, null);
|
|
|
+
|
|
|
// 更新旧公路的end
|
|
|
point.setPointParent(roadId, "end");
|
|
|
road.endId = pointId;
|
|
@@ -228,6 +231,22 @@ export default class RoadService {
|
|
|
mathUtil.clonePoint(rightEdge.end, oldRightEdgeEndPoint);
|
|
|
}
|
|
|
}
|
|
|
+ // console.error(endPoint.parent);
|
|
|
+ let newStartPoint = dataService.getRoadPoint(newRoad.startId);
|
|
|
+ let newEndPoint = dataService.getRoadPoint(newRoad.endId);
|
|
|
+ let parents = {};
|
|
|
+ if (Object.keys(newStartPoint.parent).length > 1) {
|
|
|
+ parents = newStartPoint.parent;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Object.keys(newEndPoint.parent).length > 1) {
|
|
|
+ parents = newEndPoint.parent;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (let key in parents) {
|
|
|
+ let road = dataService.getRoad(key);
|
|
|
+ this.initRoadWidthTipsPos(road);
|
|
|
+ }
|
|
|
|
|
|
return newRoad.vectorId;
|
|
|
}
|
|
@@ -1422,7 +1441,7 @@ export default class RoadService {
|
|
|
// start: crossList[i - 1],
|
|
|
// end: crossList[i],
|
|
|
// });
|
|
|
- console.error(middleEdgePoint1);
|
|
|
+ // console.error(middleEdgePoint1);
|
|
|
roadWidthTipsPos.push({
|
|
|
start: middleEdgePoint1,
|
|
|
end: middleEdgePoint2,
|