|
@@ -1,47 +1,47 @@
|
|
|
-import Load from './Load';
|
|
|
-import { stateService } from './Service/StateService';
|
|
|
-import { elementService } from './Service/ElementService';
|
|
|
-import { dataService } from './Service/DataService';
|
|
|
-import { textService } from './Service/TextService';
|
|
|
-import { historyService } from './Service/HistoryService';
|
|
|
-import UIControl from './Controls/UIControl';
|
|
|
+import Load from "./Load";
|
|
|
+import { stateService } from "./Service/StateService";
|
|
|
+import { elementService } from "./Service/ElementService";
|
|
|
+import { dataService } from "./Service/DataService";
|
|
|
+import { textService } from "./Service/TextService";
|
|
|
+import { historyService } from "./Service/HistoryService";
|
|
|
+import UIControl from "./Controls/UIControl";
|
|
|
// import { moveRectangle } from "./Controls/MoveRectangle";
|
|
|
-import { moveText } from './Controls/MoveText';
|
|
|
-import { moveSVG } from './Controls/MoveSVG';
|
|
|
-import { moveMagnifier } from './Controls/MoveMagnifier';
|
|
|
-import { addRoad } from './Controls/AddRoad';
|
|
|
-import { addCrossRoad } from './Controls/AddCrossRoad';
|
|
|
-import { addLine } from './Controls/AddLine';
|
|
|
-import { addPoint } from './Controls/AddPoint';
|
|
|
-import { addCircle } from './Controls/AddCircle';
|
|
|
-import { addText } from './Controls/AddText';
|
|
|
-import { addMagnifier } from './Controls/AddMagnifier';
|
|
|
-import { addSVG } from './Controls/AddSVG';
|
|
|
-import { moveRoad } from './Controls/MoveRoad';
|
|
|
-import { moveLine } from './Controls/MoveLine';
|
|
|
-import { movePoint } from './Controls/MovePoint';
|
|
|
-import { moveCircle } from './Controls/MoveCircle';
|
|
|
-import { coordinate } from './Coordinate';
|
|
|
-import Render from './Renderer/Render';
|
|
|
-import { draw } from './Renderer/Draw';
|
|
|
-import { listenLayer } from './ListenLayer';
|
|
|
-import LayerEvents from './enum/LayerEvents.js';
|
|
|
-import UIEvents from './enum/UIEvents.js';
|
|
|
-import SelectState from './enum/SelectState.js';
|
|
|
-import VectorType from './enum/VectorType';
|
|
|
-import { mathUtil } from './Util/MathUtil';
|
|
|
-import History from './History/History';
|
|
|
-import mitt from 'mitt';
|
|
|
-import { roadService } from './Service/RoadService';
|
|
|
-import { edgeService } from './Service/EdgeService';
|
|
|
-import { roadPointService } from './Service/RoadPointService';
|
|
|
-import { curveRoadService } from './Service/CurveRoadService';
|
|
|
-import VectorCategory from './enum/VectorCategory';
|
|
|
-import Settings from './Settings';
|
|
|
-import Constant from './Constant';
|
|
|
-import { uiService } from './Service/UIService';
|
|
|
-import { imageService } from './Service/ImageService';
|
|
|
-import VectorEvents from './enum/VectorEvents';
|
|
|
+import { moveText } from "./Controls/MoveText";
|
|
|
+import { moveSVG } from "./Controls/MoveSVG";
|
|
|
+import { moveMagnifier } from "./Controls/MoveMagnifier";
|
|
|
+import { addRoad } from "./Controls/AddRoad";
|
|
|
+import { addCrossRoad } from "./Controls/AddCrossRoad";
|
|
|
+import { addLine } from "./Controls/AddLine";
|
|
|
+import { addPoint } from "./Controls/AddPoint";
|
|
|
+import { addCircle } from "./Controls/AddCircle";
|
|
|
+import { addText } from "./Controls/AddText";
|
|
|
+import { addMagnifier } from "./Controls/AddMagnifier";
|
|
|
+import { addSVG } from "./Controls/AddSVG";
|
|
|
+import { moveRoad } from "./Controls/MoveRoad";
|
|
|
+import { moveLine } from "./Controls/MoveLine";
|
|
|
+import { movePoint } from "./Controls/MovePoint";
|
|
|
+import { moveCircle } from "./Controls/MoveCircle";
|
|
|
+import { coordinate } from "./Coordinate";
|
|
|
+import Render from "./Renderer/Render";
|
|
|
+import { draw } from "./Renderer/Draw";
|
|
|
+import { listenLayer } from "./ListenLayer";
|
|
|
+import LayerEvents from "./enum/LayerEvents.js";
|
|
|
+import UIEvents from "./enum/UIEvents.js";
|
|
|
+import SelectState from "./enum/SelectState.js";
|
|
|
+import VectorType from "./enum/VectorType";
|
|
|
+import { mathUtil } from "./Util/MathUtil";
|
|
|
+import History from "./History/History";
|
|
|
+import mitt from "mitt";
|
|
|
+import { roadService } from "./Service/RoadService";
|
|
|
+import { edgeService } from "./Service/EdgeService";
|
|
|
+import { roadPointService } from "./Service/RoadPointService";
|
|
|
+import { curveRoadService } from "./Service/CurveRoadService";
|
|
|
+import VectorCategory from "./enum/VectorCategory";
|
|
|
+import Settings from "./Settings";
|
|
|
+import Constant from "./Constant";
|
|
|
+import { uiService } from "./Service/UIService";
|
|
|
+import { imageService } from "./Service/ImageService";
|
|
|
+import VectorEvents from "./enum/VectorEvents";
|
|
|
|
|
|
const minDragDis = 10;
|
|
|
const minZoom = 20;
|
|
@@ -76,25 +76,25 @@ export default class Layer {
|
|
|
}
|
|
|
|
|
|
bindEvents() {
|
|
|
- this.canvas.addEventListener('contextmenu', function (e) {
|
|
|
+ this.canvas.addEventListener("contextmenu", function (e) {
|
|
|
e.preventDefault();
|
|
|
});
|
|
|
- this.canvas.addEventListener('mousedown', this.onMouseDown.bind(this));
|
|
|
- this.canvas.addEventListener('mousemove', this.onMouseMove.bind(this));
|
|
|
- this.canvas.addEventListener('mouseup', this.onMouseUp.bind(this));
|
|
|
+ this.canvas.addEventListener("mousedown", this.onMouseDown.bind(this));
|
|
|
+ this.canvas.addEventListener("mousemove", this.onMouseMove.bind(this));
|
|
|
+ this.canvas.addEventListener("mouseup", this.onMouseUp.bind(this));
|
|
|
|
|
|
- this.canvas.addEventListener('touchstart', this.onMouseDown.bind(this));
|
|
|
- this.canvas.addEventListener('touchmove', this.onMouseMove.bind(this));
|
|
|
- this.canvas.addEventListener('touchend', this.onMouseUp.bind(this));
|
|
|
+ this.canvas.addEventListener("touchstart", this.onMouseDown.bind(this));
|
|
|
+ this.canvas.addEventListener("touchmove", this.onMouseMove.bind(this));
|
|
|
+ this.canvas.addEventListener("touchend", this.onMouseUp.bind(this));
|
|
|
|
|
|
- this.canvas.addEventListener('mousewheel', this.onWheel.bind(this));
|
|
|
- this.canvas.addEventListener('DOMMouseScroll', this.onWheel.bind(this));
|
|
|
- this.canvas.addEventListener('resize', this.reSize.bind(this));
|
|
|
- document.addEventListener('keydown', this.onKeydown.bind(this));
|
|
|
+ this.canvas.addEventListener("mousewheel", this.onWheel.bind(this));
|
|
|
+ this.canvas.addEventListener("DOMMouseScroll", this.onWheel.bind(this));
|
|
|
+ this.canvas.addEventListener("resize", this.reSize.bind(this));
|
|
|
+ document.addEventListener("keydown", this.onKeydown.bind(this));
|
|
|
}
|
|
|
|
|
|
reSize = function () {
|
|
|
- console.log('resize');
|
|
|
+ console.log("resize");
|
|
|
coordinate.updateForCanvas();
|
|
|
this.renderer.autoRedraw();
|
|
|
};
|
|
@@ -130,16 +130,16 @@ export default class Layer {
|
|
|
let selectItem = stateService.getSelectItem();
|
|
|
let focusItem = stateService.getFocusItem();
|
|
|
|
|
|
- this.setEventName('mouseDown');
|
|
|
+ this.setEventName("mouseDown");
|
|
|
const eventName = stateService.getEventName();
|
|
|
switch (eventName) {
|
|
|
case LayerEvents.AddRoad:
|
|
|
stateService.setEventName(LayerEvents.AddingRoad);
|
|
|
- addRoad.setNewRoadPoint('start', position);
|
|
|
+ addRoad.setNewRoadPoint("start", position);
|
|
|
break;
|
|
|
case LayerEvents.AddCurveRoad:
|
|
|
stateService.setEventName(LayerEvents.AddingCurveRoad);
|
|
|
- addRoad.setNewRoadPoint('start', position);
|
|
|
+ addRoad.setNewRoadPoint("start", position);
|
|
|
break;
|
|
|
case LayerEvents.AddLine:
|
|
|
stateService.setEventName(LayerEvents.AddingLine);
|
|
@@ -153,11 +153,21 @@ export default class Layer {
|
|
|
stateService.setEventName(LayerEvents.MovePoint);
|
|
|
const newPoint = addPoint.buildPoint(position);
|
|
|
if (newPoint) {
|
|
|
- stateService.setSelectItem(newPoint.vectorId, VectorType.Point, SelectState.Select);
|
|
|
+ stateService.setSelectItem(
|
|
|
+ newPoint.vectorId,
|
|
|
+ VectorType.Point,
|
|
|
+ SelectState.Select
|
|
|
+ );
|
|
|
this.history.save();
|
|
|
this.renderer.autoRedraw();
|
|
|
} else {
|
|
|
- this.uiControl.prompt({ msg: '请先选择基准点', time: 1000 });
|
|
|
+ if(Settings.basePointIds.length>1){
|
|
|
+ this.uiControl.prompt({ msg: '请先选择基准点', time: 1000 });
|
|
|
+ }else{
|
|
|
+ this.uiControl.prompt({ msg: '请先添加基准点', time: 1000 });
|
|
|
+ }
|
|
|
+
|
|
|
+ // this.uiControl.prompt({ msg: '请先选择基准点', time: 1000 });
|
|
|
}
|
|
|
break;
|
|
|
case LayerEvents.AddCircle:
|
|
@@ -167,7 +177,11 @@ export default class Layer {
|
|
|
case LayerEvents.AddText:
|
|
|
stateService.setEventName(LayerEvents.MoveText);
|
|
|
addText.buildText(position);
|
|
|
- stateService.setSelectItem(addText.newText.vectorId, VectorType.Text, SelectState.Select);
|
|
|
+ stateService.setSelectItem(
|
|
|
+ addText.newText.vectorId,
|
|
|
+ VectorType.Text,
|
|
|
+ SelectState.Select
|
|
|
+ );
|
|
|
addText.clear();
|
|
|
break;
|
|
|
case LayerEvents.AddSVG:
|
|
@@ -181,7 +195,11 @@ export default class Layer {
|
|
|
case LayerEvents.AddMagnifier:
|
|
|
stateService.setEventName(LayerEvents.MoveMagnifier);
|
|
|
addMagnifier.buildMagnifier(position);
|
|
|
- stateService.setSelectItem(addMagnifier.newMagnifier.vectorId, VectorType.Magnifier, SelectState.Select);
|
|
|
+ stateService.setSelectItem(
|
|
|
+ addMagnifier.newMagnifier.vectorId,
|
|
|
+ VectorType.Magnifier,
|
|
|
+ SelectState.Select
|
|
|
+ );
|
|
|
addMagnifier.clear();
|
|
|
break;
|
|
|
case VectorEvents.AddLane:
|
|
@@ -189,18 +207,34 @@ export default class Layer {
|
|
|
let road = dataService.getRoad(selectItem.vectorId);
|
|
|
if (road) {
|
|
|
let roadLanCount = road.getLanesCount(selectItem.dir);
|
|
|
- if (selectItem.dir == 'left') {
|
|
|
- roadService.updateForAddSubtractLanesCount(road.vectorId, roadLanCount + 1, selectItem.dir);
|
|
|
+ if (selectItem.dir == "left") {
|
|
|
+ roadService.updateForAddSubtractLanesCount(
|
|
|
+ road.vectorId,
|
|
|
+ roadLanCount + 1,
|
|
|
+ selectItem.dir
|
|
|
+ );
|
|
|
} else {
|
|
|
- roadService.updateForAddSubtractLanesCount(road.vectorId, roadLanCount + 1, selectItem.dir);
|
|
|
+ roadService.updateForAddSubtractLanesCount(
|
|
|
+ road.vectorId,
|
|
|
+ roadLanCount + 1,
|
|
|
+ selectItem.dir
|
|
|
+ );
|
|
|
}
|
|
|
} else {
|
|
|
road = dataService.getCurveRoad(selectItem.vectorId);
|
|
|
let curveRoadLanCount = road.getLanesCount(selectItem.dir);
|
|
|
- if (selectItem.dir == 'left') {
|
|
|
- curveRoadService.updateForAddSubtractLanesCount(road.vectorId, curveRoadLanCount + 1, selectItem.dir);
|
|
|
+ if (selectItem.dir == "left") {
|
|
|
+ curveRoadService.updateForAddSubtractLanesCount(
|
|
|
+ road.vectorId,
|
|
|
+ curveRoadLanCount + 1,
|
|
|
+ selectItem.dir
|
|
|
+ );
|
|
|
} else {
|
|
|
- curveRoadService.updateForAddSubtractLanesCount(road.vectorId, curveRoadLanCount + 1, selectItem.dir);
|
|
|
+ curveRoadService.updateForAddSubtractLanesCount(
|
|
|
+ road.vectorId,
|
|
|
+ curveRoadLanCount + 1,
|
|
|
+ selectItem.dir
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
stateService.clearEventName();
|
|
@@ -213,18 +247,34 @@ export default class Layer {
|
|
|
let road = dataService.getRoad(selectItem.vectorId);
|
|
|
if (road) {
|
|
|
let roadLanCount = road.getLanesCount(selectItem.dir);
|
|
|
- if (selectItem.dir == 'left') {
|
|
|
- roadService.updateForAddSubtractLanesCount(road.vectorId, roadLanCount - 1, selectItem.dir);
|
|
|
+ if (selectItem.dir == "left") {
|
|
|
+ roadService.updateForAddSubtractLanesCount(
|
|
|
+ road.vectorId,
|
|
|
+ roadLanCount - 1,
|
|
|
+ selectItem.dir
|
|
|
+ );
|
|
|
} else {
|
|
|
- roadService.updateForAddSubtractLanesCount(road.vectorId, roadLanCount - 1, selectItem.dir);
|
|
|
+ roadService.updateForAddSubtractLanesCount(
|
|
|
+ road.vectorId,
|
|
|
+ roadLanCount - 1,
|
|
|
+ selectItem.dir
|
|
|
+ );
|
|
|
}
|
|
|
} else {
|
|
|
road = dataService.getCurveRoad(selectItem.vectorId);
|
|
|
let curveRoadLanCount = road.getLanesCount(selectItem.dir);
|
|
|
- if (selectItem.dir == 'left') {
|
|
|
- curveRoadService.updateForAddSubtractLanesCount(road.vectorId, curveRoadLanCount - 1, selectItem.dir);
|
|
|
+ if (selectItem.dir == "left") {
|
|
|
+ curveRoadService.updateForAddSubtractLanesCount(
|
|
|
+ road.vectorId,
|
|
|
+ curveRoadLanCount - 1,
|
|
|
+ selectItem.dir
|
|
|
+ );
|
|
|
} else {
|
|
|
- curveRoadService.updateForAddSubtractLanesCount(road.vectorId, curveRoadLanCount - 1, selectItem.dir);
|
|
|
+ curveRoadService.updateForAddSubtractLanesCount(
|
|
|
+ road.vectorId,
|
|
|
+ curveRoadLanCount - 1,
|
|
|
+ selectItem.dir
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
stateService.clearEventName();
|
|
@@ -235,12 +285,18 @@ export default class Layer {
|
|
|
case VectorEvents.AddCrossPoint:
|
|
|
if (focusItem && focusItem.vectorId) {
|
|
|
const curveRoad = dataService.getCurveRoad(focusItem.vectorId);
|
|
|
- let index = mathUtil.getIndexForCurvesPoints(position, curveRoad.points);
|
|
|
+ let index = mathUtil.getIndexForCurvesPoints(
|
|
|
+ position,
|
|
|
+ curveRoad.points
|
|
|
+ );
|
|
|
if (index != -1) {
|
|
|
curveRoadService.addCPoint(curveRoad, position, index);
|
|
|
} else {
|
|
|
const dis1 = mathUtil.getDistance(curveRoad.points[0], position);
|
|
|
- const dis2 = mathUtil.getDistance(curveRoad.points[curveRoad.points.length - 1], position);
|
|
|
+ const dis2 = mathUtil.getDistance(
|
|
|
+ curveRoad.points[curveRoad.points.length - 1],
|
|
|
+ position
|
|
|
+ );
|
|
|
if (dis1 > dis2) {
|
|
|
index = curveRoad.points.length - 2;
|
|
|
// curveRoadService.addCPoint(
|
|
@@ -255,7 +311,10 @@ export default class Layer {
|
|
|
curveRoadService.addCPoint(curveRoad, position, index);
|
|
|
}
|
|
|
//curveRoadService.setLanes(curveRoad.vectorId);
|
|
|
- curveRoadService.updateForMovePoint(curveRoad.points[index + 1].vectorId, position);
|
|
|
+ curveRoadService.updateForMovePoint(
|
|
|
+ curveRoad.points[index + 1].vectorId,
|
|
|
+ position
|
|
|
+ );
|
|
|
stateService.clearEventName();
|
|
|
this.history.save();
|
|
|
this.renderer.autoRedraw();
|
|
@@ -336,14 +395,24 @@ export default class Layer {
|
|
|
y: position.y,
|
|
|
};
|
|
|
const eventName = stateService.getEventName();
|
|
|
- if (!this.dragging && Math.abs(X - this.startX) < minDragDis && Math.abs(Y - this.startY) < minDragDis) {
|
|
|
+ if (
|
|
|
+ !this.dragging &&
|
|
|
+ Math.abs(X - this.startX) < minDragDis &&
|
|
|
+ Math.abs(Y - this.startY) < minDragDis
|
|
|
+ ) {
|
|
|
return;
|
|
|
}
|
|
|
this.dragging = true;
|
|
|
- if (Math.abs(X - this.startX) > minDragDis || Math.abs(Y - this.startY) > minDragDis) {
|
|
|
+ if (
|
|
|
+ Math.abs(X - this.startX) > minDragDis ||
|
|
|
+ Math.abs(Y - this.startY) > minDragDis
|
|
|
+ ) {
|
|
|
// 是否拖拽了
|
|
|
if (eventName != null) {
|
|
|
- if (eventName == LayerEvents.MoveMagnifier && stateService.getSelectItem().state != 0) {
|
|
|
+ if (
|
|
|
+ eventName == LayerEvents.MoveMagnifier &&
|
|
|
+ stateService.getSelectItem().state != 0
|
|
|
+ ) {
|
|
|
} else {
|
|
|
stateService.clearFocusItem();
|
|
|
this.uiControl.focusVector = null;
|
|
@@ -364,15 +433,17 @@ export default class Layer {
|
|
|
needAutoRedraw = listenLayer.start(position);
|
|
|
let seleteItem = stateService.getSelectItem();
|
|
|
if (seleteItem != null) {
|
|
|
- console.log('选中:' + seleteItem.vectorId);
|
|
|
+ console.log("选中:" + seleteItem.vectorId);
|
|
|
} else {
|
|
|
}
|
|
|
break;
|
|
|
case LayerEvents.PanBackGround:
|
|
|
stateService.clearItems();
|
|
|
let center = {};
|
|
|
- center.x = coordinate.center.x - (dx * coordinate.defaultZoom) / coordinate.zoom;
|
|
|
- center.y = coordinate.center.y + (dy * coordinate.defaultZoom) / coordinate.zoom;
|
|
|
+ center.x =
|
|
|
+ coordinate.center.x - (dx * coordinate.defaultZoom) / coordinate.zoom;
|
|
|
+ center.y =
|
|
|
+ coordinate.center.y + (dy * coordinate.defaultZoom) / coordinate.zoom;
|
|
|
let tempCenter = {};
|
|
|
mathUtil.clonePoint(tempCenter, coordinate.center);
|
|
|
mathUtil.clonePoint(coordinate.center, center);
|
|
@@ -467,12 +538,12 @@ export default class Layer {
|
|
|
elementService.setNewRoad(addRoad.startInfo.position, position);
|
|
|
elementService.showNewRoad();
|
|
|
|
|
|
- addRoad.setNewRoadPoint('end', position);
|
|
|
+ addRoad.setNewRoadPoint("end", position);
|
|
|
addRoad.canAdd = addRoad.canAddRoadForEnd(position);
|
|
|
if (!addRoad.canAdd) {
|
|
|
- elementService.setNewRoadState('error');
|
|
|
+ elementService.setNewRoadState("error");
|
|
|
} else {
|
|
|
- elementService.setNewRoadState('normal');
|
|
|
+ elementService.setNewRoadState("normal");
|
|
|
}
|
|
|
elementService.showPoint();
|
|
|
this.showElementLine(position, eventName);
|
|
@@ -566,9 +637,16 @@ export default class Layer {
|
|
|
let road = dataService.getRoad(draggingItem.vectorId);
|
|
|
let start = dataService.getRoadPoint(road.startId);
|
|
|
let end = dataService.getRoadPoint(road.endId);
|
|
|
- if (Object.keys(start.getParent()).length == 1 && Object.keys(end.getParent()).length == 1) {
|
|
|
+ if (
|
|
|
+ Object.keys(start.getParent()).length == 1 &&
|
|
|
+ Object.keys(end.getParent()).length == 1
|
|
|
+ ) {
|
|
|
//拖拽的路只有一条
|
|
|
- moveRoad.moveRoad(draggingItem.vectorId, (dx * coordinate.defaultZoom) / coordinate.zoom, (dy * coordinate.defaultZoom) / coordinate.zoom);
|
|
|
+ moveRoad.moveRoad(
|
|
|
+ draggingItem.vectorId,
|
|
|
+ (dx * coordinate.defaultZoom) / coordinate.zoom,
|
|
|
+ (dy * coordinate.defaultZoom) / coordinate.zoom
|
|
|
+ );
|
|
|
}
|
|
|
break;
|
|
|
case LayerEvents.MoveRoadPoint:
|
|
@@ -579,7 +657,10 @@ export default class Layer {
|
|
|
});
|
|
|
if (
|
|
|
listenLayer.modifyPoint &&
|
|
|
- (listenLayer.modifyPoint.linkedRoadPointId || listenLayer.modifyPoint.linkedRoadId || listenLayer.modifyPoint.linkedRoadPointIdX || listenLayer.modifyPoint.linkedRoadPointIdY)
|
|
|
+ (listenLayer.modifyPoint.linkedRoadPointId ||
|
|
|
+ listenLayer.modifyPoint.linkedRoadId ||
|
|
|
+ listenLayer.modifyPoint.linkedRoadPointIdX ||
|
|
|
+ listenLayer.modifyPoint.linkedRoadPointIdY)
|
|
|
) {
|
|
|
position = {
|
|
|
x: listenLayer.modifyPoint.x,
|
|
@@ -589,7 +670,11 @@ export default class Layer {
|
|
|
listenLayer.modifyPoint = null;
|
|
|
}
|
|
|
|
|
|
- let flag = moveRoad.moveingRoadPoint(draggingItem.vectorId, position, listenLayer.modifyPoint);
|
|
|
+ let flag = moveRoad.moveingRoadPoint(
|
|
|
+ draggingItem.vectorId,
|
|
|
+ position,
|
|
|
+ listenLayer.modifyPoint
|
|
|
+ );
|
|
|
if (!flag) {
|
|
|
elementService.hideAll();
|
|
|
} else {
|
|
@@ -620,25 +705,28 @@ export default class Layer {
|
|
|
y: listenLayer.modifyPoint.y,
|
|
|
};
|
|
|
}
|
|
|
-
|
|
|
elementService.execute(addRoad.startInfo.position, position);
|
|
|
elementService.setPoint(position);
|
|
|
elementService.setNewRoad(addRoad.startInfo.position, position);
|
|
|
elementService.showNewRoad();
|
|
|
|
|
|
- addRoad.setNewRoadPoint('end', position);
|
|
|
+ addRoad.setNewRoadPoint("end", position);
|
|
|
addRoad.canAdd = addRoad.canAddRoadForEnd(position);
|
|
|
if (!addRoad.canAdd) {
|
|
|
- elementService.setNewRoadState('error');
|
|
|
+ elementService.setNewRoadState("error");
|
|
|
} else {
|
|
|
- elementService.setNewRoadState('normal');
|
|
|
+ elementService.setNewRoadState("normal");
|
|
|
}
|
|
|
elementService.showPoint();
|
|
|
this.showElementLine(position, eventName);
|
|
|
break;
|
|
|
case LayerEvents.MoveCurveRoad:
|
|
|
needAutoRedraw = true;
|
|
|
- moveRoad.moveCurveRoad(draggingItem.vectorId, (dx * coordinate.defaultZoom) / coordinate.zoom, (dy * coordinate.defaultZoom) / coordinate.zoom);
|
|
|
+ moveRoad.moveCurveRoad(
|
|
|
+ draggingItem.vectorId,
|
|
|
+ (dx * coordinate.defaultZoom) / coordinate.zoom,
|
|
|
+ (dy * coordinate.defaultZoom) / coordinate.zoom
|
|
|
+ );
|
|
|
break;
|
|
|
case LayerEvents.MoveCurveRoadPoint:
|
|
|
if (!draggingItem || !draggingItem.vectorId) {
|
|
@@ -681,13 +769,21 @@ export default class Layer {
|
|
|
break;
|
|
|
case LayerEvents.MoveCurveEdge:
|
|
|
if (listenLayer.modifyPoint) {
|
|
|
- moveRoad.moveCurveEdge(draggingItem.vectorId, listenLayer.modifyPoint.selectIndex, position);
|
|
|
+ moveRoad.moveCurveEdge(
|
|
|
+ draggingItem.vectorId,
|
|
|
+ listenLayer.modifyPoint.selectIndex,
|
|
|
+ position
|
|
|
+ );
|
|
|
}
|
|
|
needAutoRedraw = true;
|
|
|
break;
|
|
|
case LayerEvents.MoveLine:
|
|
|
if (draggingItem != null) {
|
|
|
- let flag = moveLine.moveLine(draggingItem.vectorId, (dx * coordinate.defaultZoom) / coordinate.zoom, (dy * coordinate.defaultZoom) / coordinate.zoom);
|
|
|
+ let flag = moveLine.moveLine(
|
|
|
+ draggingItem.vectorId,
|
|
|
+ (dx * coordinate.defaultZoom) / coordinate.zoom,
|
|
|
+ (dy * coordinate.defaultZoom) / coordinate.zoom
|
|
|
+ );
|
|
|
if (!flag) {
|
|
|
this.lastX = this.lastX - dx / coordinate.ratio;
|
|
|
this.lastY = this.lastY - dy / coordinate.ratio;
|
|
@@ -709,8 +805,13 @@ export default class Layer {
|
|
|
};
|
|
|
}
|
|
|
movePoint.movePoint(position, draggingItem.vectorId);
|
|
|
- this.showElementLine(point, eventName);
|
|
|
+ point = dataService.getPoint(draggingItem.vectorId);
|
|
|
needAutoRedraw = true;
|
|
|
+ if (!point) {
|
|
|
+ stateService.clearEventName();
|
|
|
+ } else {
|
|
|
+ this.showElementLine(point, eventName);
|
|
|
+ }
|
|
|
}
|
|
|
break;
|
|
|
case LayerEvents.MoveCurvePoint:
|
|
@@ -733,16 +834,33 @@ export default class Layer {
|
|
|
break;
|
|
|
case LayerEvents.MoveCurveLine:
|
|
|
if (draggingItem != null) {
|
|
|
- moveLine.moveCurveLine(draggingItem.vectorId, (dx * coordinate.defaultZoom) / coordinate.zoom, (dy * coordinate.defaultZoom) / coordinate.zoom);
|
|
|
+ moveLine.moveCurveLine(
|
|
|
+ draggingItem.vectorId,
|
|
|
+ (dx * coordinate.defaultZoom) / coordinate.zoom,
|
|
|
+ (dy * coordinate.defaultZoom) / coordinate.zoom
|
|
|
+ );
|
|
|
needAutoRedraw = true;
|
|
|
}
|
|
|
break;
|
|
|
case LayerEvents.MoveCircle:
|
|
|
if (draggingItem != null) {
|
|
|
if (draggingItem.state == -1) {
|
|
|
- moveCircle.moveFull(draggingItem.vectorId, (dx * coordinate.defaultZoom) / coordinate.zoom, (dy * coordinate.defaultZoom) / coordinate.zoom);
|
|
|
- } else if (draggingItem.state == 0 || draggingItem.state == 1 || draggingItem.state == 2 || draggingItem.state == 3) {
|
|
|
- moveCircle.movePoint(position, draggingItem.vectorId, draggingItem.state);
|
|
|
+ moveCircle.moveFull(
|
|
|
+ draggingItem.vectorId,
|
|
|
+ (dx * coordinate.defaultZoom) / coordinate.zoom,
|
|
|
+ (dy * coordinate.defaultZoom) / coordinate.zoom
|
|
|
+ );
|
|
|
+ } else if (
|
|
|
+ draggingItem.state == 0 ||
|
|
|
+ draggingItem.state == 1 ||
|
|
|
+ draggingItem.state == 2 ||
|
|
|
+ draggingItem.state == 3
|
|
|
+ ) {
|
|
|
+ moveCircle.movePoint(
|
|
|
+ position,
|
|
|
+ draggingItem.vectorId,
|
|
|
+ draggingItem.state
|
|
|
+ );
|
|
|
} else {
|
|
|
debugger;
|
|
|
}
|
|
@@ -761,14 +879,22 @@ export default class Layer {
|
|
|
if (draggingItem.state == -1) {
|
|
|
moveSVG.moveFullSVG(position, draggingItem.vectorId);
|
|
|
} else {
|
|
|
- moveSVG.movePoint(position, draggingItem.vectorId, draggingItem.state);
|
|
|
+ moveSVG.movePoint(
|
|
|
+ position,
|
|
|
+ draggingItem.vectorId,
|
|
|
+ draggingItem.state
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case LayerEvents.MoveMagnifier:
|
|
|
needAutoRedraw = true;
|
|
|
if (draggingItem != null) {
|
|
|
- moveMagnifier.moveFullMagnifier(position, draggingItem.vectorId, draggingItem.state);
|
|
|
+ moveMagnifier.moveFullMagnifier(
|
|
|
+ position,
|
|
|
+ draggingItem.vectorId,
|
|
|
+ draggingItem.state
|
|
|
+ );
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
@@ -830,6 +956,7 @@ export default class Layer {
|
|
|
stateService.clearFocusItem();
|
|
|
this.uiControl.focusVector = null;
|
|
|
this.uiControl.currentUI = null;
|
|
|
+ Settings.selectBasePointId = null;
|
|
|
break;
|
|
|
case LayerEvents.MoveRoadPoint:
|
|
|
if (!draggingItem || !draggingItem.vectorId) {
|
|
@@ -843,19 +970,40 @@ export default class Layer {
|
|
|
exceptPointId: draggingItem.vectorId,
|
|
|
exceptRoadIds: point.parent,
|
|
|
});
|
|
|
- if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty('linkedRoadPointId')) {
|
|
|
- moveRoad.moveTo(draggingItem.vectorId, listenLayer.modifyPoint.linkedRoadPointId);
|
|
|
- } else if (listenLayer.modifyPoint && (listenLayer.modifyPoint.linkedRoadPointIdX || listenLayer.modifyPoint.linkedRoadPointIdY)) {
|
|
|
+ if (
|
|
|
+ listenLayer.modifyPoint &&
|
|
|
+ listenLayer.modifyPoint.hasOwnProperty("linkedRoadPointId")
|
|
|
+ ) {
|
|
|
+ moveRoad.moveTo(
|
|
|
+ draggingItem.vectorId,
|
|
|
+ listenLayer.modifyPoint.linkedRoadPointId
|
|
|
+ );
|
|
|
+ } else if (
|
|
|
+ listenLayer.modifyPoint &&
|
|
|
+ (listenLayer.modifyPoint.linkedRoadPointIdX ||
|
|
|
+ listenLayer.modifyPoint.linkedRoadPointIdY)
|
|
|
+ ) {
|
|
|
mathUtil.clonePoint(point, listenLayer.modifyPoint);
|
|
|
- } else if (listenLayer.modifyPoint && listenLayer.modifyPoint.hasOwnProperty('linkedRoadId')) {
|
|
|
+ } else if (
|
|
|
+ listenLayer.modifyPoint &&
|
|
|
+ listenLayer.modifyPoint.hasOwnProperty("linkedRoadId")
|
|
|
+ ) {
|
|
|
point = roadPointService.create({
|
|
|
x: listenLayer.modifyPoint.x,
|
|
|
y: listenLayer.modifyPoint.y,
|
|
|
});
|
|
|
- roadService.splitRoad(listenLayer.modifyPoint.linkedRoadId, point.vectorId, 'start');
|
|
|
+ roadService.splitRoad(
|
|
|
+ listenLayer.modifyPoint.linkedRoadId,
|
|
|
+ point.vectorId,
|
|
|
+ "start"
|
|
|
+ );
|
|
|
moveRoad.moveTo(draggingItem.vectorId, point.vectorId);
|
|
|
} else if (moveRoad.splitRoadId != null) {
|
|
|
- roadService.splitRoad(moveRoad.splitRoadId, draggingItem.vectorId, 'start');
|
|
|
+ roadService.splitRoad(
|
|
|
+ moveRoad.splitRoadId,
|
|
|
+ draggingItem.vectorId,
|
|
|
+ "start"
|
|
|
+ );
|
|
|
}
|
|
|
//draggingItem.vectorId所在的墙面与其他墙角相交
|
|
|
moveRoad.updateForAbsorbRoadPoints();
|
|
@@ -994,8 +1142,11 @@ export default class Layer {
|
|
|
break;
|
|
|
case LayerEvents.AddPoint:
|
|
|
if (
|
|
|
- (Settings.selectBasePointId != null && (Settings.selectLocationMode == Constant.angleLocationMode || Settings.selectLocationMode == Constant.allLocationMode)) ||
|
|
|
- (Settings.baseLineId != null && Settings.selectLocationMode == Constant.normalLocationMode)
|
|
|
+ (Settings.selectBasePointId != null &&
|
|
|
+ (Settings.selectLocationMode == Constant.angleLocationMode ||
|
|
|
+ Settings.selectLocationMode == Constant.allLocationMode)) ||
|
|
|
+ (Settings.baseLineId != null &&
|
|
|
+ Settings.selectLocationMode == Constant.normalLocationMode)
|
|
|
) {
|
|
|
this.uiControl.showConfirm();
|
|
|
needAutoRedraw = true;
|
|
@@ -1009,7 +1160,7 @@ export default class Layer {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- this.setEventName('mouseUp');
|
|
|
+ this.setEventName("mouseUp");
|
|
|
stateService.clearDraggingItem();
|
|
|
if (needAutoRedraw) {
|
|
|
this.renderer.autoRedraw();
|
|
@@ -1019,9 +1170,11 @@ export default class Layer {
|
|
|
onWheel(e) {
|
|
|
e.preventDefault();
|
|
|
const type = e.type;
|
|
|
- if (type == 'DOMMouseScroll' || type == 'mousewheel') {
|
|
|
+ if (type == "DOMMouseScroll" || type == "mousewheel") {
|
|
|
// 当在canvas用滚轮滚动时
|
|
|
- const delta = e.wheelDelta ? (e.wheelDelta / 120) * 20 : (-(e.detail || 0) / 3) * 20;
|
|
|
+ const delta = e.wheelDelta
|
|
|
+ ? (e.wheelDelta / 120) * 20
|
|
|
+ : (-(e.detail || 0) / 3) * 20;
|
|
|
const zoom = coordinate.zoom + delta;
|
|
|
let X = e.offsetX || e.layerX;
|
|
|
let Y = e.offsetY || e.layerY;
|
|
@@ -1058,10 +1211,10 @@ export default class Layer {
|
|
|
//测试用
|
|
|
onKeydown(e) {
|
|
|
let focusItem = stateService.getFocusItem();
|
|
|
- let dir = 'left';
|
|
|
+ let dir = "left";
|
|
|
if (focusItem) {
|
|
|
- console.log('键盘(foucus有效):' + e.code);
|
|
|
- if (e.code == 'Delete') {
|
|
|
+ console.log("键盘(foucus有效):" + e.code);
|
|
|
+ if (e.code == "Delete") {
|
|
|
//删除
|
|
|
const road = dataService.getRoad(focusItem.vectorId);
|
|
|
roadService.subtraRoadFromIntersect(road.startId, focusItem.vectorId);
|
|
@@ -1072,105 +1225,142 @@ export default class Layer {
|
|
|
this.history.save();
|
|
|
}
|
|
|
//加宽
|
|
|
- else if (e.code == 'KeyA') {
|
|
|
+ else if (e.code == "KeyA") {
|
|
|
let road = dataService.getRoad(focusItem.vectorId);
|
|
|
if (road) {
|
|
|
roadService.updateForWidth(road.vectorId, road.leftWidth + 50, dir);
|
|
|
} else {
|
|
|
road = dataService.getCurveRoad(focusItem.vectorId);
|
|
|
- curveRoadService.updateForWidth(road.vectorId, road.leftWidth + 50, dir);
|
|
|
+ curveRoadService.updateForWidth(
|
|
|
+ road.vectorId,
|
|
|
+ road.leftWidth + 50,
|
|
|
+ dir
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
this.renderer.autoRedraw();
|
|
|
this.history.save();
|
|
|
}
|
|
|
//变窄
|
|
|
- else if (e.code == 'KeyB') {
|
|
|
+ else if (e.code == "KeyB") {
|
|
|
let road = dataService.getRoad(focusItem.vectorId);
|
|
|
if (road) {
|
|
|
roadService.updateForWidth(road.vectorId, road.leftWidth - 25, dir);
|
|
|
} else {
|
|
|
road = dataService.getCurveRoad(focusItem.vectorId);
|
|
|
- curveRoadService.updateForWidth(road.vectorId, road.leftWidth - 25, dir);
|
|
|
+ curveRoadService.updateForWidth(
|
|
|
+ road.vectorId,
|
|
|
+ road.leftWidth - 25,
|
|
|
+ dir
|
|
|
+ );
|
|
|
}
|
|
|
this.renderer.autoRedraw();
|
|
|
this.history.save();
|
|
|
}
|
|
|
//添加左车道
|
|
|
- else if (e.code == 'KeyQ') {
|
|
|
+ else if (e.code == "KeyQ") {
|
|
|
let road = dataService.getRoad(focusItem.vectorId);
|
|
|
if (road) {
|
|
|
- roadService.updateForAddSubtractLanesCount(focusItem.vectorId, road.leftDrivewayCount + 1, 'left');
|
|
|
+ roadService.updateForAddSubtractLanesCount(
|
|
|
+ focusItem.vectorId,
|
|
|
+ road.leftDrivewayCount + 1,
|
|
|
+ "left"
|
|
|
+ );
|
|
|
} else {
|
|
|
road = dataService.getCurveRoad(focusItem.vectorId);
|
|
|
curveRoadService.updateForAddSubtractLanesCount(
|
|
|
road,
|
|
|
road.leftDrivewayCount + 1, //rightDrivewayCount
|
|
|
- 'left'
|
|
|
+ "left"
|
|
|
);
|
|
|
}
|
|
|
this.renderer.autoRedraw();
|
|
|
this.history.save();
|
|
|
}
|
|
|
//减少左车道
|
|
|
- else if (e.code == 'KeyW') {
|
|
|
+ else if (e.code == "KeyW") {
|
|
|
let road = dataService.getRoad(focusItem.vectorId);
|
|
|
if (road) {
|
|
|
- roadService.updateForAddSubtractLanesCount(focusItem.vectorId, road.leftDrivewayCount - 1, 'left');
|
|
|
+ roadService.updateForAddSubtractLanesCount(
|
|
|
+ focusItem.vectorId,
|
|
|
+ road.leftDrivewayCount - 1,
|
|
|
+ "left"
|
|
|
+ );
|
|
|
} else {
|
|
|
road = dataService.getCurveRoad(focusItem.vectorId);
|
|
|
curveRoadService.updateForAddSubtractLanesCount(
|
|
|
road,
|
|
|
road.leftDrivewayCount - 1, //rightDrivewayCount
|
|
|
- 'left'
|
|
|
+ "left"
|
|
|
);
|
|
|
}
|
|
|
this.renderer.autoRedraw();
|
|
|
this.history.save();
|
|
|
}
|
|
|
//添加右车道
|
|
|
- else if (e.code == 'KeyE') {
|
|
|
+ else if (e.code == "KeyE") {
|
|
|
let road = dataService.getRoad(focusItem.vectorId);
|
|
|
if (road) {
|
|
|
- roadService.updateForAddSubtractLanesCount(focusItem.vectorId, road.rightDrivewayCount + 1, 'right');
|
|
|
+ roadService.updateForAddSubtractLanesCount(
|
|
|
+ focusItem.vectorId,
|
|
|
+ road.rightDrivewayCount + 1,
|
|
|
+ "right"
|
|
|
+ );
|
|
|
} else {
|
|
|
road = dataService.getCurveRoad(focusItem.vectorId);
|
|
|
curveRoadService.updateForAddSubtractLanesCount(
|
|
|
road,
|
|
|
road.rightDrivewayCount + 1, //rightDrivewayCount
|
|
|
- 'right'
|
|
|
+ "right"
|
|
|
);
|
|
|
}
|
|
|
this.renderer.autoRedraw();
|
|
|
this.history.save();
|
|
|
}
|
|
|
//减少右车道
|
|
|
- else if (e.code == 'KeyR') {
|
|
|
+ else if (e.code == "KeyR") {
|
|
|
let road = dataService.getRoad(focusItem.vectorId);
|
|
|
if (road) {
|
|
|
- roadService.updateForAddSubtractLanesCount(focusItem.vectorId, road.rightDrivewayCount - 1, 'right');
|
|
|
+ roadService.updateForAddSubtractLanesCount(
|
|
|
+ focusItem.vectorId,
|
|
|
+ road.rightDrivewayCount - 1,
|
|
|
+ "right"
|
|
|
+ );
|
|
|
} else {
|
|
|
road = dataService.getCurveRoad(focusItem.vectorId);
|
|
|
curveRoadService.updateForAddSubtractLanesCount(
|
|
|
road,
|
|
|
road.rightDrivewayCount - 1, //rightDrivewayCount
|
|
|
- 'right'
|
|
|
+ "right"
|
|
|
);
|
|
|
}
|
|
|
this.renderer.autoRedraw();
|
|
|
this.history.save();
|
|
|
}
|
|
|
//弯路添加控制点
|
|
|
- else if (e.code == 'KeyT') {
|
|
|
+ else if (e.code == "KeyT") {
|
|
|
const curveRoad = dataService.getCurveRoad(focusItem.vectorId);
|
|
|
- let index = mathUtil.getIndexForCurvesPoints(this.mousePosition, curveRoad.points);
|
|
|
+ let index = mathUtil.getIndexForCurvesPoints(
|
|
|
+ this.mousePosition,
|
|
|
+ curveRoad.points
|
|
|
+ );
|
|
|
if (index != -1) {
|
|
|
curveRoadService.addCPoint(curveRoad, this.mousePosition, index);
|
|
|
} else {
|
|
|
- const dis1 = mathUtil.getDistance(curveRoad.points[0], this.mousePosition);
|
|
|
- const dis2 = mathUtil.getDistance(curveRoad.points[curveRoad.points.length - 1], this.mousePosition);
|
|
|
+ const dis1 = mathUtil.getDistance(
|
|
|
+ curveRoad.points[0],
|
|
|
+ this.mousePosition
|
|
|
+ );
|
|
|
+ const dis2 = mathUtil.getDistance(
|
|
|
+ curveRoad.points[curveRoad.points.length - 1],
|
|
|
+ this.mousePosition
|
|
|
+ );
|
|
|
if (dis1 > dis2) {
|
|
|
- curveRoadService.addCPoint(curveRoad, this.mousePosition, curveRoad.points.length - 2);
|
|
|
+ curveRoadService.addCPoint(
|
|
|
+ curveRoad,
|
|
|
+ this.mousePosition,
|
|
|
+ curveRoad.points.length - 2
|
|
|
+ );
|
|
|
} else {
|
|
|
curveRoadService.addCPoint(curveRoad, this.mousePosition, 1);
|
|
|
}
|
|
@@ -1179,7 +1369,7 @@ export default class Layer {
|
|
|
this.history.save();
|
|
|
}
|
|
|
//弯路删除控制点
|
|
|
- else if (e.code == 'KeyY') {
|
|
|
+ else if (e.code == "KeyY") {
|
|
|
const curvePoint = dataService.getCurveRoadPoint(focusItem.vectorId);
|
|
|
const curveRoad = dataService.getCurveRoad(curvePoint.parent);
|
|
|
curveRoadService.subCPoint(curveRoad, curvePoint.getIndex());
|
|
@@ -1187,14 +1377,14 @@ export default class Layer {
|
|
|
this.history.save();
|
|
|
}
|
|
|
} else {
|
|
|
- console.log('键盘(foucus无效):' + e.code);
|
|
|
+ console.log("键盘(foucus无效):" + e.code);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
setEventName(eventType) {
|
|
|
let eventName = stateService.getEventName();
|
|
|
|
|
|
- if (eventType == 'mouseDown') {
|
|
|
+ if (eventType == "mouseDown") {
|
|
|
if (eventName == null) {
|
|
|
const selectItem = stateService.getSelectItem();
|
|
|
if (selectItem == null) {
|
|
@@ -1231,7 +1421,7 @@ export default class Layer {
|
|
|
stateService.setEventName(LayerEvents.MoveSVG);
|
|
|
}
|
|
|
}
|
|
|
- } else if (eventType == 'mouseUp') {
|
|
|
+ } else if (eventType == "mouseUp") {
|
|
|
if (eventName == LayerEvents.AddingRoad) {
|
|
|
if (Settings.isMobile) {
|
|
|
stateService.clearEventName();
|
|
@@ -1263,8 +1453,11 @@ export default class Layer {
|
|
|
} else if (
|
|
|
(eventName == LayerEvents.AddPoint &&
|
|
|
Settings.selectBasePointId != null &&
|
|
|
- (Settings.selectLocationMode == Constant.angleLocationMode || Settings.selectLocationMode == Constant.allLocationMode)) ||
|
|
|
- (eventName == LayerEvents.AddPoint && Settings.baseLineId != null && Settings.selectLocationMode == Constant.normalLocationMode)
|
|
|
+ (Settings.selectLocationMode == Constant.angleLocationMode ||
|
|
|
+ Settings.selectLocationMode == Constant.allLocationMode)) ||
|
|
|
+ (eventName == LayerEvents.AddPoint &&
|
|
|
+ Settings.baseLineId != null &&
|
|
|
+ Settings.selectLocationMode == Constant.normalLocationMode)
|
|
|
) {
|
|
|
} else {
|
|
|
stateService.clearEventName();
|
|
@@ -1281,7 +1474,10 @@ export default class Layer {
|
|
|
|
|
|
stopAddVector() {
|
|
|
let eventName = stateService.getEventName();
|
|
|
- if (eventName != LayerEvents.AddingRoad && eventName != LayerEvents.AddingLine) {
|
|
|
+ if (
|
|
|
+ eventName != LayerEvents.AddingRoad &&
|
|
|
+ eventName != LayerEvents.AddingLine
|
|
|
+ ) {
|
|
|
stateService.clearEventName();
|
|
|
} else if (eventName == LayerEvents.AddingRoad) {
|
|
|
stateService.setEventName(LayerEvents.AddRoad);
|
|
@@ -1419,23 +1615,57 @@ export default class Layer {
|
|
|
let otherPoint1 = null;
|
|
|
let otherPoint2 = null;
|
|
|
if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedRoadPointIdX) {
|
|
|
- otherPoint1 = dataService.getRoadPoint(listenLayer.modifyPoint.linkedRoadPointIdX);
|
|
|
- } else if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedCurveRoadPointIdX) {
|
|
|
- otherPoint1 = dataService.getCurveRoadPoint(listenLayer.modifyPoint.linkedCurvePointIdX);
|
|
|
- } else if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedPointIdX) {
|
|
|
- otherPoint1 = dataService.getPoint(listenLayer.modifyPoint.linkedPointIdX);
|
|
|
- } else if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedCurvePointIdX) {
|
|
|
- otherPoint1 = dataService.getCurvePoint(listenLayer.modifyPoint.linkedCurvePointIdX);
|
|
|
+ otherPoint1 = dataService.getRoadPoint(
|
|
|
+ listenLayer.modifyPoint.linkedRoadPointIdX
|
|
|
+ );
|
|
|
+ } else if (
|
|
|
+ listenLayer.modifyPoint &&
|
|
|
+ listenLayer.modifyPoint.linkedCurveRoadPointIdX
|
|
|
+ ) {
|
|
|
+ otherPoint1 = dataService.getCurveRoadPoint(
|
|
|
+ listenLayer.modifyPoint.linkedCurvePointIdX
|
|
|
+ );
|
|
|
+ } else if (
|
|
|
+ listenLayer.modifyPoint &&
|
|
|
+ listenLayer.modifyPoint.linkedPointIdX
|
|
|
+ ) {
|
|
|
+ otherPoint1 = dataService.getPoint(
|
|
|
+ listenLayer.modifyPoint.linkedPointIdX
|
|
|
+ );
|
|
|
+ } else if (
|
|
|
+ listenLayer.modifyPoint &&
|
|
|
+ listenLayer.modifyPoint.linkedCurvePointIdX
|
|
|
+ ) {
|
|
|
+ otherPoint1 = dataService.getCurvePoint(
|
|
|
+ listenLayer.modifyPoint.linkedCurvePointIdX
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedRoadPointIdY) {
|
|
|
- otherPoint2 = dataService.getRoadPoint(listenLayer.modifyPoint.linkedRoadPointIdY);
|
|
|
- } else if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedCurvePointIdY) {
|
|
|
- otherPoint2 = dataService.getCurveRoadPoint(listenLayer.modifyPoint.linkedCurvePointIdY);
|
|
|
- } else if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedPointIdY) {
|
|
|
- otherPoint2 = dataService.getPoint(listenLayer.modifyPoint.linkedPointIdY);
|
|
|
- } else if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedCurvePointIdY) {
|
|
|
- otherPoint2 = dataService.getCurvePoint(listenLayer.modifyPoint.linkedCurvePointIdY);
|
|
|
+ otherPoint2 = dataService.getRoadPoint(
|
|
|
+ listenLayer.modifyPoint.linkedRoadPointIdY
|
|
|
+ );
|
|
|
+ } else if (
|
|
|
+ listenLayer.modifyPoint &&
|
|
|
+ listenLayer.modifyPoint.linkedCurvePointIdY
|
|
|
+ ) {
|
|
|
+ otherPoint2 = dataService.getCurveRoadPoint(
|
|
|
+ listenLayer.modifyPoint.linkedCurvePointIdY
|
|
|
+ );
|
|
|
+ } else if (
|
|
|
+ listenLayer.modifyPoint &&
|
|
|
+ listenLayer.modifyPoint.linkedPointIdY
|
|
|
+ ) {
|
|
|
+ otherPoint2 = dataService.getPoint(
|
|
|
+ listenLayer.modifyPoint.linkedPointIdY
|
|
|
+ );
|
|
|
+ } else if (
|
|
|
+ listenLayer.modifyPoint &&
|
|
|
+ listenLayer.modifyPoint.linkedCurvePointIdY
|
|
|
+ ) {
|
|
|
+ otherPoint2 = dataService.getCurvePoint(
|
|
|
+ listenLayer.modifyPoint.linkedCurvePointIdY
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
let otherPoint = {};
|
|
@@ -1445,7 +1675,7 @@ export default class Layer {
|
|
|
}
|
|
|
if (otherPoint2) {
|
|
|
otherPoint.y = otherPoint2.y;
|
|
|
- if (!otherPoint.hasOwnProperty('x')) {
|
|
|
+ if (!otherPoint.hasOwnProperty("x")) {
|
|
|
otherPoint.x = otherPoint2.x;
|
|
|
}
|
|
|
}
|