|
@@ -132,6 +132,9 @@ export default class Layer {
|
|
listenLayer.start(position);
|
|
listenLayer.start(position);
|
|
let selectItem = stateService.getSelectItem();
|
|
let selectItem = stateService.getSelectItem();
|
|
let focusItem = stateService.getFocusItem();
|
|
let focusItem = stateService.getFocusItem();
|
|
|
|
+ if (selectItem && focusItem && selectItem.vectorId != focusItem.vectorId) {
|
|
|
|
+ stateService.clearFocusItem();
|
|
|
|
+ }
|
|
|
|
|
|
this.setEventName("mouseDown");
|
|
this.setEventName("mouseDown");
|
|
const eventName = stateService.getEventName();
|
|
const eventName = stateService.getEventName();
|
|
@@ -161,16 +164,7 @@ export default class Layer {
|
|
VectorType.Point,
|
|
VectorType.Point,
|
|
SelectState.Select
|
|
SelectState.Select
|
|
);
|
|
);
|
|
- this.history.save();
|
|
|
|
this.renderer.autoRedraw();
|
|
this.renderer.autoRedraw();
|
|
- } else {
|
|
|
|
- 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;
|
|
break;
|
|
case LayerEvents.AddCircle:
|
|
case LayerEvents.AddCircle:
|
|
@@ -207,9 +201,11 @@ export default class Layer {
|
|
addMagnifier.clear();
|
|
addMagnifier.clear();
|
|
break;
|
|
break;
|
|
case VectorEvents.AddLane:
|
|
case VectorEvents.AddLane:
|
|
|
|
+ let selectAddLaneFlag = false;
|
|
if (selectItem && selectItem.dir && selectItem.vectorId) {
|
|
if (selectItem && selectItem.dir && selectItem.vectorId) {
|
|
let road = dataService.getRoad(selectItem.vectorId);
|
|
let road = dataService.getRoad(selectItem.vectorId);
|
|
if (road) {
|
|
if (road) {
|
|
|
|
+ selectAddLaneFlag = true;
|
|
let roadLanCount = road.getLanesCount(selectItem.dir);
|
|
let roadLanCount = road.getLanesCount(selectItem.dir);
|
|
if (selectItem.dir == "left") {
|
|
if (selectItem.dir == "left") {
|
|
roadService.updateForAddSubtractLanesCount(
|
|
roadService.updateForAddSubtractLanesCount(
|
|
@@ -226,30 +222,37 @@ export default class Layer {
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
road = dataService.getCurveRoad(selectItem.vectorId);
|
|
road = dataService.getCurveRoad(selectItem.vectorId);
|
|
- let curveRoadLanCount = road.getLanesCount(selectItem.dir);
|
|
|
|
- if (selectItem.dir == "left") {
|
|
|
|
- curveRoadService.updateForAddSubtractLanesCount(
|
|
|
|
- road.vectorId,
|
|
|
|
- curveRoadLanCount + 1,
|
|
|
|
- selectItem.dir
|
|
|
|
- );
|
|
|
|
- } else {
|
|
|
|
- curveRoadService.updateForAddSubtractLanesCount(
|
|
|
|
- road.vectorId,
|
|
|
|
- curveRoadLanCount + 1,
|
|
|
|
- selectItem.dir
|
|
|
|
- );
|
|
|
|
|
|
+ if (road) {
|
|
|
|
+ selectAddLaneFlag = true;
|
|
|
|
+ let curveRoadLanCount = road.getLanesCount(selectItem.dir);
|
|
|
|
+ if (selectItem.dir == "left") {
|
|
|
|
+ curveRoadService.updateForAddSubtractLanesCount(
|
|
|
|
+ road.vectorId,
|
|
|
|
+ curveRoadLanCount + 1,
|
|
|
|
+ selectItem.dir
|
|
|
|
+ );
|
|
|
|
+ } else {
|
|
|
|
+ curveRoadService.updateForAddSubtractLanesCount(
|
|
|
|
+ road.vectorId,
|
|
|
|
+ curveRoadLanCount + 1,
|
|
|
|
+ selectItem.dir
|
|
|
|
+ );
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- stateService.clearEventName();
|
|
|
|
this.history.save();
|
|
this.history.save();
|
|
this.renderer.autoRedraw();
|
|
this.renderer.autoRedraw();
|
|
}
|
|
}
|
|
|
|
+ if (!selectAddLaneFlag) {
|
|
|
|
+ stateService.clearEventName();
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
case VectorEvents.DelLane:
|
|
case VectorEvents.DelLane:
|
|
|
|
+ let selectDelLaneFlag = false;
|
|
if (selectItem && selectItem.dir && selectItem.vectorId) {
|
|
if (selectItem && selectItem.dir && selectItem.vectorId) {
|
|
let road = dataService.getRoad(selectItem.vectorId);
|
|
let road = dataService.getRoad(selectItem.vectorId);
|
|
if (road) {
|
|
if (road) {
|
|
|
|
+ selectDelLaneFlag = true;
|
|
let roadLanCount = road.getLanesCount(selectItem.dir);
|
|
let roadLanCount = road.getLanesCount(selectItem.dir);
|
|
if (selectItem.dir == "left") {
|
|
if (selectItem.dir == "left") {
|
|
roadService.updateForAddSubtractLanesCount(
|
|
roadService.updateForAddSubtractLanesCount(
|
|
@@ -266,25 +269,30 @@ export default class Layer {
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
road = dataService.getCurveRoad(selectItem.vectorId);
|
|
road = dataService.getCurveRoad(selectItem.vectorId);
|
|
- let curveRoadLanCount = road.getLanesCount(selectItem.dir);
|
|
|
|
- if (selectItem.dir == "left") {
|
|
|
|
- curveRoadService.updateForAddSubtractLanesCount(
|
|
|
|
- road.vectorId,
|
|
|
|
- curveRoadLanCount - 1,
|
|
|
|
- selectItem.dir
|
|
|
|
- );
|
|
|
|
- } else {
|
|
|
|
- curveRoadService.updateForAddSubtractLanesCount(
|
|
|
|
- road.vectorId,
|
|
|
|
- curveRoadLanCount - 1,
|
|
|
|
- selectItem.dir
|
|
|
|
- );
|
|
|
|
|
|
+ if (road) {
|
|
|
|
+ selectDelLaneFlag = true;
|
|
|
|
+ let curveRoadLanCount = road.getLanesCount(selectItem.dir);
|
|
|
|
+ if (selectItem.dir == "left") {
|
|
|
|
+ curveRoadService.updateForAddSubtractLanesCount(
|
|
|
|
+ road.vectorId,
|
|
|
|
+ curveRoadLanCount - 1,
|
|
|
|
+ selectItem.dir
|
|
|
|
+ );
|
|
|
|
+ } else {
|
|
|
|
+ curveRoadService.updateForAddSubtractLanesCount(
|
|
|
|
+ road.vectorId,
|
|
|
|
+ curveRoadLanCount - 1,
|
|
|
|
+ selectItem.dir
|
|
|
|
+ );
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- stateService.clearEventName();
|
|
|
|
this.history.save();
|
|
this.history.save();
|
|
this.renderer.autoRedraw();
|
|
this.renderer.autoRedraw();
|
|
}
|
|
}
|
|
|
|
+ if (!selectDelLaneFlag) {
|
|
|
|
+ stateService.clearEventName();
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
case VectorEvents.AddCrossPoint:
|
|
case VectorEvents.AddCrossPoint:
|
|
if (focusItem && focusItem.vectorId) {
|
|
if (focusItem && focusItem.vectorId) {
|
|
@@ -373,7 +381,15 @@ export default class Layer {
|
|
selectItem = stateService.getSelectItem();
|
|
selectItem = stateService.getSelectItem();
|
|
stateService.setDraggingItem(selectItem);
|
|
stateService.setDraggingItem(selectItem);
|
|
stateService.clearFocusItem();
|
|
stateService.clearFocusItem();
|
|
- this.uiControl.focusVector = null;
|
|
|
|
|
|
+ if (
|
|
|
|
+ selectItem &&
|
|
|
|
+ this.uiControl.focusVector &&
|
|
|
|
+ selectItem.vectorId == this.uiControl.focusVector.vectorId
|
|
|
|
+ ) {
|
|
|
|
+ } else {
|
|
|
|
+ this.uiControl.clearFocusVector();
|
|
|
|
+ }
|
|
|
|
+
|
|
// 清除上一个状态
|
|
// 清除上一个状态
|
|
// 设置当前事件名称
|
|
// 设置当前事件名称
|
|
e.preventDefault();
|
|
e.preventDefault();
|
|
@@ -454,7 +470,7 @@ export default class Layer {
|
|
) {
|
|
) {
|
|
} else {
|
|
} else {
|
|
stateService.clearFocusItem();
|
|
stateService.clearFocusItem();
|
|
- this.uiControl.focusVector = null;
|
|
|
|
|
|
+ this.uiControl.clearFocusVector();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -994,7 +1010,7 @@ export default class Layer {
|
|
this.uiControl.focusVector = focusItem;
|
|
this.uiControl.focusVector = focusItem;
|
|
stateService.clearDraggingItem();
|
|
stateService.clearDraggingItem();
|
|
} else {
|
|
} else {
|
|
- this.uiControl.focusVector = null;
|
|
|
|
|
|
+ this.uiControl.clearFocusVector();
|
|
}
|
|
}
|
|
this.dragging = false;
|
|
this.dragging = false;
|
|
let position = coordinate.getXYFromScreen({
|
|
let position = coordinate.getXYFromScreen({
|
|
@@ -1007,16 +1023,16 @@ export default class Layer {
|
|
if (e instanceof TouchEvent) {
|
|
if (e instanceof TouchEvent) {
|
|
stateService.clearSelectItem();
|
|
stateService.clearSelectItem();
|
|
stateService.clearDraggingItem();
|
|
stateService.clearDraggingItem();
|
|
- this.uiControl.focusVector = null;
|
|
|
|
|
|
+ this.uiControl.clearFocusVector();
|
|
this.renderer.autoRedraw();
|
|
this.renderer.autoRedraw();
|
|
}
|
|
}
|
|
return;
|
|
return;
|
|
case LayerEvents.PanBackGround:
|
|
case LayerEvents.PanBackGround:
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
stateService.clearFocusItem();
|
|
stateService.clearFocusItem();
|
|
- this.uiControl.focusVector = null;
|
|
|
|
- this.uiControl.currentUI = null;
|
|
|
|
- Settings.selectBasePointId = null;
|
|
|
|
|
|
+ this.uiControl.clearFocusVector();
|
|
|
|
+ this.uiControl.clearCurrentUI();
|
|
|
|
+ uiService.setSelectBasePointId(null);
|
|
break;
|
|
break;
|
|
case LayerEvents.MoveRoadPoint:
|
|
case LayerEvents.MoveRoadPoint:
|
|
if (!draggingItem || !draggingItem.vectorId) {
|
|
if (!draggingItem || !draggingItem.vectorId) {
|
|
@@ -1082,22 +1098,20 @@ export default class Layer {
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
if (addRoad.canAdd) {
|
|
if (addRoad.canAdd) {
|
|
addRoad.buildRoad();
|
|
addRoad.buildRoad();
|
|
- this.history.save();
|
|
|
|
elementService.hideAll();
|
|
elementService.hideAll();
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
case LayerEvents.AddingLine:
|
|
case LayerEvents.AddingLine:
|
|
- if (Settings.selectLocationMode == Constant.freeLocationMode) {
|
|
|
|
- this.uiControl.showConfirm();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
addLine.finish(position);
|
|
addLine.finish(position);
|
|
this.updateForLocation();
|
|
this.updateForLocation();
|
|
|
|
+ //绘制的是基准线
|
|
|
|
+ if (Settings.baseLineId == addLine.newLine.vectorId) {
|
|
|
|
+ stateService.clearEventName();
|
|
|
|
+ this.history.save();
|
|
|
|
+ }
|
|
addLine.clearVectorData();
|
|
addLine.clearVectorData();
|
|
- this.history.save();
|
|
|
|
elementService.hideAll();
|
|
elementService.hideAll();
|
|
-
|
|
|
|
break;
|
|
break;
|
|
case LayerEvents.AddingCurveLine:
|
|
case LayerEvents.AddingCurveLine:
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
@@ -1147,7 +1161,6 @@ export default class Layer {
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
if (addRoad.canAdd) {
|
|
if (addRoad.canAdd) {
|
|
addRoad.buildCurveRoad();
|
|
addRoad.buildCurveRoad();
|
|
- this.history.save();
|
|
|
|
elementService.hideAll();
|
|
elementService.hideAll();
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
@@ -1207,7 +1220,6 @@ export default class Layer {
|
|
}
|
|
}
|
|
this.history.save();
|
|
this.history.save();
|
|
elementService.hideAll();
|
|
elementService.hideAll();
|
|
-
|
|
|
|
break;
|
|
break;
|
|
case LayerEvents.MoveCurvePoint:
|
|
case LayerEvents.MoveCurvePoint:
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
@@ -1241,17 +1253,15 @@ export default class Layer {
|
|
this.history.save();
|
|
this.history.save();
|
|
break;
|
|
break;
|
|
case LayerEvents.AddPoint:
|
|
case LayerEvents.AddPoint:
|
|
- if (
|
|
|
|
- (Settings.selectBasePointId != null &&
|
|
|
|
- (Settings.selectLocationMode == Constant.angleLocationMode ||
|
|
|
|
- Settings.selectLocationMode == Constant.allLocationMode)) ||
|
|
|
|
- (Settings.baseLineId != null &&
|
|
|
|
- Settings.selectLocationMode == Constant.normalLocationMode)
|
|
|
|
- ) {
|
|
|
|
|
|
+ // 绘制的是基准点
|
|
|
|
+ if (Settings.selectPointCategory == VectorCategory.Point.BasePoint) {
|
|
|
|
+ stateService.clearEventName();
|
|
|
|
+ this.history.save();
|
|
|
|
+ } else {
|
|
this.uiControl.showConfirm();
|
|
this.uiControl.showConfirm();
|
|
- needAutoRedraw = true;
|
|
|
|
- elementService.hideAll();
|
|
|
|
}
|
|
}
|
|
|
|
+ needAutoRedraw = true;
|
|
|
|
+ elementService.hideAll();
|
|
break;
|
|
break;
|
|
case LayerEvents.AddRoadTemplate:
|
|
case LayerEvents.AddRoadTemplate:
|
|
addCrossRoad.build(position);
|
|
addCrossRoad.build(position);
|
|
@@ -1259,9 +1269,9 @@ export default class Layer {
|
|
this.renderer.autoRedraw();
|
|
this.renderer.autoRedraw();
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
-
|
|
|
|
this.setEventName("mouseUp");
|
|
this.setEventName("mouseUp");
|
|
stateService.clearDraggingItem();
|
|
stateService.clearDraggingItem();
|
|
|
|
+ stateService.clearSelectItem();
|
|
if (needAutoRedraw) {
|
|
if (needAutoRedraw) {
|
|
this.renderer.autoRedraw();
|
|
this.renderer.autoRedraw();
|
|
}
|
|
}
|
|
@@ -1350,42 +1360,19 @@ export default class Layer {
|
|
}
|
|
}
|
|
} else if (eventType == "mouseUp") {
|
|
} else if (eventType == "mouseUp") {
|
|
if (eventName == LayerEvents.AddingRoad) {
|
|
if (eventName == LayerEvents.AddingRoad) {
|
|
- if (Settings.isMobile) {
|
|
|
|
- stateService.clearEventName();
|
|
|
|
- this.exit();
|
|
|
|
- } else {
|
|
|
|
- stateService.setEventName(LayerEvents.AddRoad);
|
|
|
|
- }
|
|
|
|
|
|
+ this.uiControl.showConfirm();
|
|
|
|
+ stateService.setEventName(LayerEvents.AddRoad);
|
|
} else if (eventName == LayerEvents.AddingLine) {
|
|
} else if (eventName == LayerEvents.AddingLine) {
|
|
- if (Settings.isMobile) {
|
|
|
|
- if (Settings.selectLocationMode == Constant.freeLocationMode) {
|
|
|
|
- stateService.setEventName(LayerEvents.AddLine);
|
|
|
|
- } else {
|
|
|
|
- stateService.clearEventName();
|
|
|
|
- this.exit();
|
|
|
|
- uiService.setSelectLineCategory(VectorCategory.Line.NormalLine);
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- stateService.setEventName(LayerEvents.AddLine);
|
|
|
|
- }
|
|
|
|
|
|
+ this.uiControl.showConfirm();
|
|
|
|
+ stateService.setEventName(LayerEvents.AddLine);
|
|
} else if (eventName == LayerEvents.AddingCurveRoad) {
|
|
} else if (eventName == LayerEvents.AddingCurveRoad) {
|
|
- if (Settings.isMobile) {
|
|
|
|
- stateService.clearEventName();
|
|
|
|
- this.exit();
|
|
|
|
- } else {
|
|
|
|
- stateService.setEventName(LayerEvents.AddCurveRoad);
|
|
|
|
- }
|
|
|
|
|
|
+ this.uiControl.showConfirm();
|
|
|
|
+ stateService.setEventName(LayerEvents.AddCurveRoad);
|
|
} else if (eventName == LayerEvents.AddLine) {
|
|
} else if (eventName == LayerEvents.AddLine) {
|
|
stateService.setEventName(LayerEvents.AddingLine);
|
|
stateService.setEventName(LayerEvents.AddingLine);
|
|
- } 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)
|
|
|
|
- ) {
|
|
|
|
|
|
+ } else if (eventName == LayerEvents.AddPoint) {
|
|
|
|
+ } else if (eventName == VectorEvents.AddLane) {
|
|
|
|
+ } else if (eventName == VectorEvents.DelLane) {
|
|
} else {
|
|
} else {
|
|
stateService.clearEventName();
|
|
stateService.clearEventName();
|
|
}
|
|
}
|
|
@@ -1395,8 +1382,8 @@ export default class Layer {
|
|
exit() {
|
|
exit() {
|
|
stateService.clear();
|
|
stateService.clear();
|
|
this.uiControl.clearUI();
|
|
this.uiControl.clearUI();
|
|
- this.uiControl.focusVector = null;
|
|
|
|
- this.uiControl.currentUI = null;
|
|
|
|
|
|
+ this.uiControl.clearFocusVector();
|
|
|
|
+ this.uiControl.clearCurrentUI();
|
|
}
|
|
}
|
|
|
|
|
|
stopAddVector() {
|
|
stopAddVector() {
|