|
@@ -18,6 +18,7 @@ import { curveRoadPointService } from "../Service/CurveRoadPointService";
|
|
import { curveEdgeService } from "../Service/CurveEdgeService";
|
|
import { curveEdgeService } from "../Service/CurveEdgeService";
|
|
import { curveRoadService } from "../Service/CurveRoadService";
|
|
import { curveRoadService } from "../Service/CurveRoadService";
|
|
import { curvePointService } from "../Service/CurvePointService";
|
|
import { curvePointService } from "../Service/CurvePointService";
|
|
|
|
+import Settings from "../Settings";
|
|
|
|
|
|
export default class History {
|
|
export default class History {
|
|
constructor(layer) {
|
|
constructor(layer) {
|
|
@@ -95,6 +96,7 @@ export default class History {
|
|
|
|
|
|
// 撤销
|
|
// 撤销
|
|
goPreState() {
|
|
goPreState() {
|
|
|
|
+ this.layer.exit();
|
|
const item = historyService.getHistoryRecord();
|
|
const item = historyService.getHistoryRecord();
|
|
if (item) {
|
|
if (item) {
|
|
stateService.clear();
|
|
stateService.clear();
|
|
@@ -114,6 +116,7 @@ export default class History {
|
|
this.goPreForCurveRoadEdges(item.curveRoadEdges);
|
|
this.goPreForCurveRoadEdges(item.curveRoadEdges);
|
|
this.goPreForCurveRoads(item.curveRoads);
|
|
this.goPreForCurveRoads(item.curveRoads);
|
|
this.goPreForCrossPoints(item.crossPoints);
|
|
this.goPreForCrossPoints(item.crossPoints);
|
|
|
|
+ this.goPreForSettings(item.settings);
|
|
historyService.undoHistoryRecord();
|
|
historyService.undoHistoryRecord();
|
|
change.saveCurrentInfo();
|
|
change.saveCurrentInfo();
|
|
this.setState();
|
|
this.setState();
|
|
@@ -129,7 +132,7 @@ export default class History {
|
|
dataService.deletePoint(item.point.id);
|
|
dataService.deletePoint(item.point.id);
|
|
} else if (item.handle == HistoryEvents.DeletePoint) {
|
|
} else if (item.handle == HistoryEvents.DeletePoint) {
|
|
let point = pointService.create(item.point, item.point.id);
|
|
let point = pointService.create(item.point, item.point.id);
|
|
- point.setCategory(item.category);
|
|
|
|
|
|
+ point.setCategory(item.point.category);
|
|
point.parent = JSON.parse(JSON.stringify(item.point.parent));
|
|
point.parent = JSON.parse(JSON.stringify(item.point.parent));
|
|
} else if (item.handle == HistoryEvents.ModifyPoint) {
|
|
} else if (item.handle == HistoryEvents.ModifyPoint) {
|
|
const prePoint = item.prePoint;
|
|
const prePoint = item.prePoint;
|
|
@@ -455,12 +458,23 @@ export default class History {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ goPreForSettings(itemForSettings) {
|
|
|
|
+ if (
|
|
|
|
+ itemForSettings &&
|
|
|
|
+ itemForSettings.handle == HistoryEvents.ModifySettings
|
|
|
|
+ ) {
|
|
|
|
+ const preSettings = itemForSettings.preSettings;
|
|
|
|
+ historyUtil.assignSettingsFromSettings(Settings, preSettings);
|
|
|
|
+ this.layer.updateForLocation();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
goNextForPoints(itemForPoints) {
|
|
goNextForPoints(itemForPoints) {
|
|
for (let i = 0; i < itemForPoints.length; ++i) {
|
|
for (let i = 0; i < itemForPoints.length; ++i) {
|
|
const item = itemForPoints[i];
|
|
const item = itemForPoints[i];
|
|
if (item.handle == HistoryEvents.AddPoint) {
|
|
if (item.handle == HistoryEvents.AddPoint) {
|
|
let newPoint = pointService.create(item.point, item.point.id);
|
|
let newPoint = pointService.create(item.point, item.point.id);
|
|
- newPoint.setCategory(item.category);
|
|
|
|
|
|
+ newPoint.setCategory(item.point.category);
|
|
historyUtil.assignPointFromPoint(newPoint, item.point);
|
|
historyUtil.assignPointFromPoint(newPoint, item.point);
|
|
} else if (item.handle == HistoryEvents.DeletePoint) {
|
|
} else if (item.handle == HistoryEvents.DeletePoint) {
|
|
dataService.deletePoint(item.point.id);
|
|
dataService.deletePoint(item.point.id);
|
|
@@ -783,8 +797,20 @@ export default class History {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ goNextForSettings(itemForSettings) {
|
|
|
|
+ if (
|
|
|
|
+ itemForSettings &&
|
|
|
|
+ itemForSettings.handle == HistoryEvents.ModifySettings
|
|
|
|
+ ) {
|
|
|
|
+ const currentSettings = itemForSettings.curSettings;
|
|
|
|
+ historyUtil.assignSettingsFromSettings(Settings, currentSettings);
|
|
|
|
+ this.layer.updateForLocation();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
// 恢复
|
|
// 恢复
|
|
goNextState() {
|
|
goNextState() {
|
|
|
|
+ this.layer.exit();
|
|
historyService.redoHistoryRecord();
|
|
historyService.redoHistoryRecord();
|
|
const item = historyService.getHistoryRecord();
|
|
const item = historyService.getHistoryRecord();
|
|
if (item) {
|
|
if (item) {
|
|
@@ -805,6 +831,7 @@ export default class History {
|
|
this.goNextForCurveRoadEdges(item.curveRoadEdges);
|
|
this.goNextForCurveRoadEdges(item.curveRoadEdges);
|
|
this.goNextForCurveRoads(item.curveRoads);
|
|
this.goNextForCurveRoads(item.curveRoads);
|
|
this.goNextForCrossPoints(item.crossPoints);
|
|
this.goNextForCrossPoints(item.crossPoints);
|
|
|
|
+ this.goNextForSettings(item.settings);
|
|
change.saveCurrentInfo();
|
|
change.saveCurrentInfo();
|
|
this.setState();
|
|
this.setState();
|
|
} else {
|
|
} else {
|