|
@@ -6,19 +6,11 @@ import Constant from "../Constant";
|
|
|
export default class HistoryUtil {
|
|
|
constructor() {}
|
|
|
|
|
|
- isDifferentForRoads(road1, road2) {
|
|
|
- if (road1.startId == road2.startId && road1.endId == road2.endId) {
|
|
|
- return false;
|
|
|
- } else {
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
isDifferentForPoints(point1, point2) {
|
|
|
if (
|
|
|
point1.x == point2.x &&
|
|
|
point1.y == point2.y &&
|
|
|
- JSON.stringify(point1.parent) == JSON.stringify(point2.parent) &&
|
|
|
+ mathUtil.equalJSON(point1.parent, point1.parent) &&
|
|
|
point1.category == point2.category &&
|
|
|
point1.locationMode == point2.locationMode &&
|
|
|
point1.linkedBasePointId == point2.linkedBasePointId &&
|
|
@@ -90,7 +82,7 @@ export default class HistoryUtil {
|
|
|
isDifferentForRoadPoints(roadPoint1, roadPoint2) {
|
|
|
if (
|
|
|
mathUtil.equalPoint(roadPoint1, roadPoint2) &&
|
|
|
- JSON.stringify(roadPoint1.parent) == JSON.stringify(roadPoint2.parent)
|
|
|
+ mathUtil.equalJSON(roadPoint1.parent, roadPoint2.parent)
|
|
|
) {
|
|
|
return false;
|
|
|
} else {
|
|
@@ -147,6 +139,71 @@ export default class HistoryUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ isDifferentForCurveRoadPoints(curveRoadPoint1, curveRoadPoint2) {
|
|
|
+ if (
|
|
|
+ mathUtil.equalPoint(curveRoadPoint1, curveRoadPoint2) &&
|
|
|
+ mathUtil.equalJSON(curveRoadPoint1.parent, curveRoadPoint2.parent) &&
|
|
|
+ curveRoadPoint1.index == curveRoadPoint2.index
|
|
|
+ ) {
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ isDifferentForCurveRoadEdges(curveRoadEdge1, curveRoadEdge2) {
|
|
|
+ if (
|
|
|
+ mathUtil.equalPoint(curveRoadEdge1.start, curveRoadEdge2.start) &&
|
|
|
+ mathUtil.equalPoint(curveRoadEdge1.end, curveRoadEdge2.end) &&
|
|
|
+ mathUtil.equalPoints(curveRoadEdge1.points, curveRoadEdge2.points) &&
|
|
|
+ curveRoadEdge1.parent == curveRoadEdge2.parent
|
|
|
+ ) {
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ isDifferentForCurveRoads(curveRoad1, curveRoad2) {
|
|
|
+ if (
|
|
|
+ curveRoad1.startId == curveRoad2.startId &&
|
|
|
+ curveRoad1.endId == curveRoad2.endId &&
|
|
|
+ mathUtil.equalPoints(curveRoad1.points, curveRoad2.points) &&
|
|
|
+ curveRoad1.leftEdgeId == curveRoad2.leftEdgeId &&
|
|
|
+ curveRoad1.rightEdgeId == curveRoad2.rightEdgeId &&
|
|
|
+ curveRoad1.way == curveRoad2.way
|
|
|
+ ) {
|
|
|
+ if (curveRoad1.way == Constant.oneWay) {
|
|
|
+ if (
|
|
|
+ curveRoad1.singleRoadWidth == curveRoad2.singleRoadWidth &&
|
|
|
+ curveRoad1.singleRoadDrivewayCount ==
|
|
|
+ curveRoad2.singleRoadDrivewayCount
|
|
|
+ ) {
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ } else if (curveRoad1.way == Constant.twoWay) {
|
|
|
+ if (
|
|
|
+ curveRoad1.leftWidth == curveRoad2.leftWidth &&
|
|
|
+ curveRoad1.rightWidth == curveRoad2.rightWidth &&
|
|
|
+ curveRoad1.leftDrivewayCount == curveRoad2.leftDrivewayCount &&
|
|
|
+ curveRoad1.rightDrivewayCount == curveRoad2.rightDrivewayCount &&
|
|
|
+ curveRoad1.midDivide.midDivideWidth ==
|
|
|
+ curveRoad2.midDivide.midDivideWidth
|
|
|
+ ) {
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
isDifferentForCrossPoints(crossPoint1, crossPoint2) {
|
|
|
if (
|
|
|
mathUtil.equalPoint(crossPoint1, crossPoint2) &&
|
|
@@ -264,6 +321,79 @@ export default class HistoryUtil {
|
|
|
this.setRoadInfo(roadInfo);
|
|
|
}
|
|
|
|
|
|
+ assignCurveRoadPointFromCurveRoadPoint(curveRoadPoint1, curveRoadPoint2) {
|
|
|
+ const curveRoadPointInfo = {};
|
|
|
+ curveRoadPointInfo.vectorId = curveRoadPoint1.vectorId;
|
|
|
+ curveRoadPointInfo.position = {
|
|
|
+ x: curveRoadPoint2.position.x,
|
|
|
+ y: curveRoadPoint2.position.y,
|
|
|
+ };
|
|
|
+ curveRoadPointInfo.parent = JSON.parse(
|
|
|
+ JSON.stringify(curveRoadPoint2.parent)
|
|
|
+ );
|
|
|
+ curveRoadPointInfo.index = curveRoadPoint1.index;
|
|
|
+ this.setCurveRoadPointInfo(curveRoadPointInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ assignCurveRoadEdgeFromCurveRoadEdge(curveRoadEdge1, curveRoadEdge2) {
|
|
|
+ const curveRoadEdgeInfo = {};
|
|
|
+ curveRoadEdgeInfo.vectorId = curveRoadEdge1.vectorId;
|
|
|
+ curveRoadEdgeInfo.start = {
|
|
|
+ x: curveRoadEdge2.start.x,
|
|
|
+ y: curveRoadEdge2.start.y,
|
|
|
+ };
|
|
|
+ curveRoadEdgeInfo.end = {
|
|
|
+ x: curveRoadEdge2.end.x,
|
|
|
+ y: curveRoadEdge2.end.y,
|
|
|
+ };
|
|
|
+ curveRoadEdgeInfo.points = JSON.parse(
|
|
|
+ JSON.stringify(curveRoadEdge2.points)
|
|
|
+ );
|
|
|
+ curveRoadEdgeInfo.curves = JSON.parse(
|
|
|
+ JSON.stringify(curveRoadEdge2.curves)
|
|
|
+ );
|
|
|
+ curveRoadEdgeInfo.parent = curveRoadEdge2.parent;
|
|
|
+ this.setCurveRoadEdgeInfo(curveRoadEdgeInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ assignCurveRoadFromCurveRoad(curveRoad1, curveRoad2) {
|
|
|
+ const curveRoadInfo = {};
|
|
|
+ curveRoadInfo.vectorId = curveRoad1.vectorId;
|
|
|
+ curveRoadInfo.startId = curveRoad2.startId;
|
|
|
+ curveRoadInfo.endId = curveRoad2.endId;
|
|
|
+ curveRoadInfo.leftEdgeId = curveRoad2.leftEdgeId;
|
|
|
+ curveRoadInfo.rightEdgeId = curveRoad2.rightEdgeId;
|
|
|
+ curveRoadInfo.way = curveRoad2.way;
|
|
|
+ if (curveRoad2.way == Constant.oneWay) {
|
|
|
+ curveRoadInfo.singleRoadWidth = curveRoad2.singleRoadWidth;
|
|
|
+ curveRoadInfo.singleRoadDrivewayCount =
|
|
|
+ curveRoad2.singleRoadDrivewayCount;
|
|
|
+ curveRoadInfo.singleLanes = JSON.parse(
|
|
|
+ JSON.stringify(curveRoad2.singleLanes)
|
|
|
+ );
|
|
|
+ } else if (curveRoad2.way == Constant.twoWay) {
|
|
|
+ curveRoadInfo.leftWidth = curveRoad2.leftWidth;
|
|
|
+ curveRoadInfo.rightWidth = curveRoad2.rightWidth;
|
|
|
+ curveRoadInfo.leftDrivewayCount = curveRoad2.leftDrivewayCount;
|
|
|
+ curveRoadInfo.rightDrivewayCount = curveRoad2.rightDrivewayCount;
|
|
|
+ curveRoadInfo.midDivide = JSON.parse(
|
|
|
+ JSON.stringify(curveRoad2.midDivide)
|
|
|
+ );
|
|
|
+ curveRoadInfo.leftLanes = JSON.parse(
|
|
|
+ JSON.stringify(curveRoad2.leftLanes)
|
|
|
+ );
|
|
|
+ curveRoadInfo.rightLanes = JSON.parse(
|
|
|
+ JSON.stringify(curveRoad2.rightLanes)
|
|
|
+ );
|
|
|
+ }
|
|
|
+ curveRoadInfo.points = [];
|
|
|
+ for (let i = 0; i < curveRoad2.points.length; ++i) {
|
|
|
+ curveRoadInfo.points[i] = {};
|
|
|
+ curveRoadInfo.points[i].vectorId = curveRoad2.points[i].vectorId;
|
|
|
+ }
|
|
|
+ this.setCurveRoadInfo(curveRoadInfo);
|
|
|
+ }
|
|
|
+
|
|
|
assignCrossPointFromCrossPoint(crossPoint1, crossPoint2) {
|
|
|
const crossPointInfo = {};
|
|
|
crossPointInfo.vectorId = crossPoint1.vectorId;
|
|
@@ -507,6 +637,61 @@ export default class HistoryUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ setCurveRoadPointInfo(curveRoadPointInfo) {
|
|
|
+ let curveRoadPoint = dataService.getCurveRoadPoint(
|
|
|
+ curveRoadPointInfo.vectorId
|
|
|
+ );
|
|
|
+ curveRoadPoint.vectorId = curveRoadPointInfo.vectorId;
|
|
|
+ mathUtil.clonePoint(curveRoadPoint, curveRoadPointInfo.position);
|
|
|
+ curveRoadPoint.parent = JSON.parse(
|
|
|
+ JSON.stringify(curveRoadPointInfo.parent)
|
|
|
+ );
|
|
|
+ curveRoadPoint.index = curveRoadPointInfo.index;
|
|
|
+ }
|
|
|
+
|
|
|
+ setCurveRoadEdgeInfo(curveRoadEdgeInfo) {
|
|
|
+ let curveRoadEdge = dataService.getCurveRoadEdge(
|
|
|
+ curveRoadEdgeInfo.vectorId
|
|
|
+ );
|
|
|
+ curveRoadEdge.vectorId = curveRoadEdgeInfo.vectorId;
|
|
|
+ mathUtil.clonePoint(curveRoadEdge.start, curveRoadEdgeInfo.start);
|
|
|
+ mathUtil.clonePoint(curveRoadEdge.end, curveRoadEdgeInfo.end);
|
|
|
+ mathUtil.clonePoints(curveRoadEdge.points, curveRoadEdgeInfo.points);
|
|
|
+ curveRoadEdge.name = curveRoadEdgeInfo.name;
|
|
|
+ }
|
|
|
+
|
|
|
+ setCurveRoadInfo(curveRoadInfo) {
|
|
|
+ let curveRoad = dataService.getCurveRoad(curveRoadInfo.vectorId);
|
|
|
+ curveRoad.vectorId = curveRoadInfo.vectorId;
|
|
|
+ curveRoad.startId = curveRoadInfo.startId;
|
|
|
+ curveRoad.endId = curveRoadInfo.endId;
|
|
|
+ curveRoad.leftEdgeId = curveRoadInfo.leftEdgeId;
|
|
|
+ curveRoad.rightEdgeId = curveRoadInfo.rightEdgeId;
|
|
|
+ for (let i = 0; i < curveRoadInfo.points.length; ++i) {
|
|
|
+ curveRoad.points[i] = dataService.getCurveRoadPoint(
|
|
|
+ curveRoadInfo.points[i]
|
|
|
+ );
|
|
|
+ }
|
|
|
+ curveRoad.way = curveRoadInfo.way;
|
|
|
+ if (curveRoad.way == Constant.oneWay) {
|
|
|
+ curveRoad.singleRoadWidth = curveRoadInfo.singleRoadWidth;
|
|
|
+ curveRoad.singleRoadDrivewayCount = curveRoadInfo.singleRoadDrivewayCount;
|
|
|
+ curveRoad.singleLanes = JSON.parse(
|
|
|
+ JSON.stringify(curveRoadInfo.singleLanes)
|
|
|
+ );
|
|
|
+ } else if (curveRoad.way == Constant.twoWay) {
|
|
|
+ curveRoad.leftWidth = curveRoadInfo.leftWidth;
|
|
|
+ curveRoad.rightWidth = curveRoadInfo.rightWidth;
|
|
|
+ curveRoad.leftDrivewayCount = curveRoadInfo.leftDrivewayCount;
|
|
|
+ curveRoad.rightDrivewayCount = curveRoadInfo.rightDrivewayCount;
|
|
|
+ curveRoad.midDivide = JSON.parse(JSON.stringify(curveRoadInfo.midDivide));
|
|
|
+ curveRoad.leftLanes = JSON.parse(JSON.stringify(curveRoadInfo.leftLanes));
|
|
|
+ curveRoad.rightLanes = JSON.parse(
|
|
|
+ JSON.stringify(curveRoadInfo.rightLanes)
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
setCrossPointInfo(crossPointInfo) {
|
|
|
let crossPoint = dataService.getCrossPoint3(crossPointInfo.vectorId);
|
|
|
crossPoint.vectorId = crossPointInfo.vectorId;
|