|
@@ -10,6 +10,7 @@ import { svgService } from "../Service/SVGService";
|
|
|
import { roadPointService } from "../Service/RoadPointService";
|
|
|
import { lineService } from "../Service/LineService";
|
|
|
import { circleService } from "../Service/CircleService";
|
|
|
+import { pointService } from "../Service/PointService";
|
|
|
|
|
|
export default class History {
|
|
|
constructor(layer) {
|
|
@@ -110,11 +111,15 @@ export default class History {
|
|
|
if (item.handle == HistoryEvents.AddPoint) {
|
|
|
dataService.deletePoint(item.point.id);
|
|
|
} else if (item.handle == HistoryEvents.DeletePoint) {
|
|
|
- let point = roadPointService.create(item.point, item.point.id);
|
|
|
+ let point = pointService.create(
|
|
|
+ item.point,
|
|
|
+ item.category,
|
|
|
+ item.point.id
|
|
|
+ );
|
|
|
point.parent = JSON.parse(JSON.stringify(item.point.parent));
|
|
|
} else if (item.handle == HistoryEvents.ModifyPoint) {
|
|
|
const prePoint = item.prePoint;
|
|
|
- let currentPoint = dataService.getRoadPoint(item.curPoint.id);
|
|
|
+ let currentPoint = dataService.getPoint(item.curPoint.id);
|
|
|
historyUtil.assignPointFromPoint(currentPoint, prePoint);
|
|
|
}
|
|
|
}
|
|
@@ -127,7 +132,7 @@ export default class History {
|
|
|
dataService.deleteLine(item.line.id);
|
|
|
} else if (item.handle == HistoryEvents.DeleteLine) {
|
|
|
const preLine = item.line;
|
|
|
- let newLine = lineService.create(
|
|
|
+ let newLine = lineService.createByPointId(
|
|
|
preLine.start,
|
|
|
preLine.end,
|
|
|
preLine.category,
|
|
@@ -149,10 +154,9 @@ export default class History {
|
|
|
dataService.deleteCircle(item.circle.id);
|
|
|
} else if (item.handle == HistoryEvents.DeleteCircle) {
|
|
|
const preCircle = item.circle;
|
|
|
- let newCircle = lineService.createCircle(
|
|
|
- preCircle.start,
|
|
|
- preCircle.end,
|
|
|
- preCircle.category,
|
|
|
+ let newCircle = circleService.create(
|
|
|
+ preCircle.center,
|
|
|
+ preCircle.radius,
|
|
|
preCircle.id
|
|
|
);
|
|
|
historyUtil.assignCircleFromCircle(newCircle, preCircle);
|
|
@@ -200,13 +204,17 @@ export default class History {
|
|
|
for (let i = 0; i < itemForPoints.length; ++i) {
|
|
|
const item = itemForPoints[i];
|
|
|
if (item.handle == HistoryEvents.AddPoint) {
|
|
|
- let newPoint = roadPointService.create(item.point, item.point.id);
|
|
|
+ let newPoint = pointService.create(
|
|
|
+ item.point,
|
|
|
+ item.category,
|
|
|
+ item.point.id
|
|
|
+ );
|
|
|
historyUtil.assignPointFromPoint(newPoint, item.point);
|
|
|
} else if (item.handle == HistoryEvents.DeletePoint) {
|
|
|
dataService.deletePoint(item.point.id);
|
|
|
} else if (item.handle == HistoryEvents.ModifyPoint) {
|
|
|
const currentPoint = item.curPoint;
|
|
|
- let prePoint = dataService.getRoadPoint(item.curPoint.id);
|
|
|
+ let prePoint = dataService.getPoint(item.curPoint.id);
|
|
|
historyUtil.assignPointFromPoint(prePoint, currentPoint);
|
|
|
}
|
|
|
}
|
|
@@ -217,7 +225,7 @@ export default class History {
|
|
|
const item = itemForLines[i];
|
|
|
if (item.handle == HistoryEvents.AddLine) {
|
|
|
const preLine = item.line;
|
|
|
- let newLine = lineService.create(
|
|
|
+ let newLine = lineService.createByPointId(
|
|
|
preLine.start,
|
|
|
preLine.end,
|
|
|
preLine.category,
|