|
@@ -13,6 +13,7 @@ import { addRoad } from "./Controls/AddRoad";
|
|
import { addLine } from "./Controls/AddLine";
|
|
import { addLine } from "./Controls/AddLine";
|
|
import { addPoint } from "./Controls/AddPoint";
|
|
import { addPoint } from "./Controls/AddPoint";
|
|
import { addCircle } from "./Controls/AddCircle";
|
|
import { addCircle } from "./Controls/AddCircle";
|
|
|
|
+import { addElliptic } from "./Controls/AddElliptic";
|
|
import { addText } from "./Controls/AddText";
|
|
import { addText } from "./Controls/AddText";
|
|
import { addMagnifier } from "./Controls/AddMagnifier";
|
|
import { addMagnifier } from "./Controls/AddMagnifier";
|
|
import { addSVG } from "./Controls/AddSVG";
|
|
import { addSVG } from "./Controls/AddSVG";
|
|
@@ -20,6 +21,7 @@ import { moveRoad } from "./Controls/MoveRoad";
|
|
import { moveLine } from "./Controls/MoveLine";
|
|
import { moveLine } from "./Controls/MoveLine";
|
|
import { movePoint } from "./Controls/MovePoint";
|
|
import { movePoint } from "./Controls/MovePoint";
|
|
import { moveCircle } from "./Controls/MoveCircle";
|
|
import { moveCircle } from "./Controls/MoveCircle";
|
|
|
|
+import { moveElliptic } from "./Controls/MoveElliptic";
|
|
import { coordinate } from "./Coordinate";
|
|
import { coordinate } from "./Coordinate";
|
|
import Render from "./Renderer/Render";
|
|
import Render from "./Renderer/Render";
|
|
import { draw } from "./Renderer/Draw";
|
|
import { draw } from "./Renderer/Draw";
|
|
@@ -40,6 +42,7 @@ import Settings from "./Settings";
|
|
import Constant from "./Constant";
|
|
import Constant from "./Constant";
|
|
import { uiService } from "./Service/UIService";
|
|
import { uiService } from "./Service/UIService";
|
|
import { imageService } from "./Service/ImageService";
|
|
import { imageService } from "./Service/ImageService";
|
|
|
|
+import VectorEvents from "./enum/VectorEvents";
|
|
|
|
|
|
const minDragDis = 10;
|
|
const minDragDis = 10;
|
|
const minZoom = 20;
|
|
const minZoom = 20;
|
|
@@ -125,6 +128,8 @@ export default class Layer {
|
|
this.dragging = false;
|
|
this.dragging = false;
|
|
//用于支持平板电脑
|
|
//用于支持平板电脑
|
|
listenLayer.start(position);
|
|
listenLayer.start(position);
|
|
|
|
+ let selectItem = stateService.getSelectItem();
|
|
|
|
+ let focusItem = stateService.getFocusItem();
|
|
this.setEventName("mouseDown");
|
|
this.setEventName("mouseDown");
|
|
const eventName = stateService.getEventName();
|
|
const eventName = stateService.getEventName();
|
|
switch (eventName) {
|
|
switch (eventName) {
|
|
@@ -161,6 +166,10 @@ export default class Layer {
|
|
stateService.setEventName(LayerEvents.AddingCircle);
|
|
stateService.setEventName(LayerEvents.AddingCircle);
|
|
addCircle.setCenter(position);
|
|
addCircle.setCenter(position);
|
|
break;
|
|
break;
|
|
|
|
+ case LayerEvents.AddElliptic:
|
|
|
|
+ stateService.setEventName(LayerEvents.AddingElliptic);
|
|
|
|
+ addElliptic.setCenter(position);
|
|
|
|
+ break;
|
|
case LayerEvents.AddText:
|
|
case LayerEvents.AddText:
|
|
stateService.setEventName(LayerEvents.MoveText);
|
|
stateService.setEventName(LayerEvents.MoveText);
|
|
addText.buildText(position);
|
|
addText.buildText(position);
|
|
@@ -174,6 +183,8 @@ export default class Layer {
|
|
case LayerEvents.AddSVG:
|
|
case LayerEvents.AddSVG:
|
|
stateService.setEventName(LayerEvents.MoveSVG);
|
|
stateService.setEventName(LayerEvents.MoveSVG);
|
|
addSVG.buildSVG(position);
|
|
addSVG.buildSVG(position);
|
|
|
|
+ addSVG.newSVG.setType(Settings.selectSVGType);
|
|
|
|
+
|
|
stateService.setSelectItem(addSVG.newSVG.vectorId, VectorType.SVG, -1);
|
|
stateService.setSelectItem(addSVG.newSVG.vectorId, VectorType.SVG, -1);
|
|
addSVG.clear();
|
|
addSVG.clear();
|
|
break;
|
|
break;
|
|
@@ -187,8 +198,128 @@ export default class Layer {
|
|
);
|
|
);
|
|
addMagnifier.clear();
|
|
addMagnifier.clear();
|
|
break;
|
|
break;
|
|
|
|
+ case VectorEvents.AddLane:
|
|
|
|
+ if (selectItem && selectItem.dir && selectItem.vectorId) {
|
|
|
|
+ let road = dataService.getRoad(selectItem.vectorId);
|
|
|
|
+ if (road) {
|
|
|
|
+ if (selectItem.dir == "left") {
|
|
|
|
+ roadService.updateForAddSubtractLanesCount(
|
|
|
|
+ road.vectorId,
|
|
|
|
+ road.leftDrivewayCount + 1,
|
|
|
|
+ selectItem.dir
|
|
|
|
+ );
|
|
|
|
+ } else {
|
|
|
|
+ roadService.updateForAddSubtractLanesCount(
|
|
|
|
+ road.vectorId,
|
|
|
|
+ road.rightDrivewayCount + 1,
|
|
|
|
+ selectItem.dir
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ road = dataService.getCurveRoad(selectItem.vectorId);
|
|
|
|
+ if (selectItem.dir == "left") {
|
|
|
|
+ curveRoadService.updateForAddSubtractLanesCount(
|
|
|
|
+ road.vectorId,
|
|
|
|
+ road.leftDrivewayCount + 1,
|
|
|
|
+ selectItem.dir
|
|
|
|
+ );
|
|
|
|
+ } else {
|
|
|
|
+ curveRoadService.updateForAddSubtractLanesCount(
|
|
|
|
+ road.vectorId,
|
|
|
|
+ road.rightDrivewayCount + 1,
|
|
|
|
+ selectItem.dir
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ stateService.clearEventName();
|
|
|
|
+ this.history.save();
|
|
|
|
+ this.renderer.autoRedraw();
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case VectorEvents.DelLane:
|
|
|
|
+ if (selectItem && selectItem.dir && selectItem.vectorId) {
|
|
|
|
+ let road = dataService.getRoad(selectItem.vectorId);
|
|
|
|
+ if (road) {
|
|
|
|
+ if (selectItem.dir == "left") {
|
|
|
|
+ roadService.updateForAddSubtractLanesCount(
|
|
|
|
+ road.vectorId,
|
|
|
|
+ road.leftDrivewayCount - 1,
|
|
|
|
+ selectItem.dir
|
|
|
|
+ );
|
|
|
|
+ } else {
|
|
|
|
+ roadService.updateForAddSubtractLanesCount(
|
|
|
|
+ road.vectorId,
|
|
|
|
+ road.rightDrivewayCount - 1,
|
|
|
|
+ selectItem.dir
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ road = dataService.getCurveRoad(selectItem.vectorId);
|
|
|
|
+ if (selectItem.dir == "left") {
|
|
|
|
+ curveRoadService.updateForAddSubtractLanesCount(
|
|
|
|
+ road.vectorId,
|
|
|
|
+ road.leftDrivewayCount - 1,
|
|
|
|
+ selectItem.dir
|
|
|
|
+ );
|
|
|
|
+ } else {
|
|
|
|
+ curveRoadService.updateForAddSubtractLanesCount(
|
|
|
|
+ road.vectorId,
|
|
|
|
+ road.rightDrivewayCount - 1,
|
|
|
|
+ selectItem.dir
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ stateService.clearEventName();
|
|
|
|
+ this.history.save();
|
|
|
|
+ this.renderer.autoRedraw();
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case VectorEvents.AddCrossPoint:
|
|
|
|
+ if (focusItem && focusItem.vectorId) {
|
|
|
|
+ const curveRoad = dataService.getCurveRoad(focusItem.vectorId);
|
|
|
|
+ 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
|
|
|
|
+ );
|
|
|
|
+ if (dis1 > dis2) {
|
|
|
|
+ curveRoadService.addCPoint(
|
|
|
|
+ curveRoad,
|
|
|
|
+ position,
|
|
|
|
+ curveRoad.points.length - 2
|
|
|
|
+ );
|
|
|
|
+ } else {
|
|
|
|
+ curveRoadService.addCPoint(curveRoad, position, 1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ curveRoadService.setLanes(curveRoad.vectorId);
|
|
|
|
+ stateService.clearEventName();
|
|
|
|
+ this.history.save();
|
|
|
|
+ this.renderer.autoRedraw();
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case VectorEvents.MinusCrossPoint:
|
|
|
|
+ if (selectItem && selectItem.vectorId) {
|
|
|
|
+ const curvePoint = dataService.getCurveRoadPoint(selectItem.vectorId);
|
|
|
|
+ const curveRoad = dataService.getCurveRoad(curvePoint.parent);
|
|
|
|
+ if (curveRoad.points.length > 3) {
|
|
|
|
+ curveRoadService.subCPoint(curveRoad, curvePoint.getIndex());
|
|
|
|
+ curveRoadService.setLanes(curveRoad.vectorId);
|
|
|
|
+ stateService.clearEventName();
|
|
|
|
+ }
|
|
|
|
+ this.history.save();
|
|
|
|
+ this.renderer.autoRedraw();
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
- const selectItem = stateService.getSelectItem();
|
|
|
|
|
|
+ selectItem = stateService.getSelectItem();
|
|
stateService.setDraggingItem(selectItem);
|
|
stateService.setDraggingItem(selectItem);
|
|
// 清除上一个状态
|
|
// 清除上一个状态
|
|
// 设置当前事件名称
|
|
// 设置当前事件名称
|
|
@@ -316,7 +447,7 @@ export default class Layer {
|
|
//鼠标样式
|
|
//鼠标样式
|
|
elementService.setPoint(position);
|
|
elementService.setPoint(position);
|
|
elementService.showPoint();
|
|
elementService.showPoint();
|
|
- this.showElementLine(position);
|
|
|
|
|
|
+ this.showElementLine(position, eventName);
|
|
break;
|
|
break;
|
|
case LayerEvents.AddLine:
|
|
case LayerEvents.AddLine:
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
@@ -330,7 +461,7 @@ export default class Layer {
|
|
elementService.hideAll();
|
|
elementService.hideAll();
|
|
elementService.setPoint(position);
|
|
elementService.setPoint(position);
|
|
elementService.showPoint();
|
|
elementService.showPoint();
|
|
- this.showElementLine(position);
|
|
|
|
|
|
+ this.showElementLine(position, eventName);
|
|
break;
|
|
break;
|
|
case LayerEvents.AddCurveLine:
|
|
case LayerEvents.AddCurveLine:
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
@@ -344,7 +475,7 @@ export default class Layer {
|
|
elementService.hideAll();
|
|
elementService.hideAll();
|
|
elementService.setPoint(position);
|
|
elementService.setPoint(position);
|
|
elementService.showPoint();
|
|
elementService.showPoint();
|
|
- this.showElementLine(position);
|
|
|
|
|
|
+ this.showElementLine(position, eventName);
|
|
break;
|
|
break;
|
|
case LayerEvents.AddCircle:
|
|
case LayerEvents.AddCircle:
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
@@ -360,14 +491,39 @@ export default class Layer {
|
|
elementService.showPoint();
|
|
elementService.showPoint();
|
|
this.showElementLine(position);
|
|
this.showElementLine(position);
|
|
break;
|
|
break;
|
|
|
|
+ case LayerEvents.AddElliptic:
|
|
|
|
+ needAutoRedraw = true;
|
|
|
|
+ listenLayer.start(position);
|
|
|
|
+ if (listenLayer.modifyPoint) {
|
|
|
|
+ position = {
|
|
|
|
+ x: listenLayer.modifyPoint.x,
|
|
|
|
+ y: listenLayer.modifyPoint.y,
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+ elementService.hideAll();
|
|
|
|
+ elementService.setPoint(position);
|
|
|
|
+ elementService.showPoint();
|
|
|
|
+ this.showElementLine(position);
|
|
|
|
+ break;
|
|
case LayerEvents.AddingRoad:
|
|
case LayerEvents.AddingRoad:
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
listenLayer.start(position);
|
|
listenLayer.start(position);
|
|
|
|
+
|
|
|
|
+ // listenLayer.start(position, {
|
|
|
|
+ // exceptLineId: exceptLineId,
|
|
|
|
+ // exceptPointId: exceptPointId,
|
|
|
|
+ // addRoad.startInfo.linkedRoadId
|
|
|
|
+ // addRoad.startInfo.linkedRoadPointId
|
|
|
|
+ // });
|
|
|
|
+
|
|
if (listenLayer.modifyPoint) {
|
|
if (listenLayer.modifyPoint) {
|
|
position = {
|
|
position = {
|
|
x: listenLayer.modifyPoint.x,
|
|
x: listenLayer.modifyPoint.x,
|
|
y: listenLayer.modifyPoint.y,
|
|
y: listenLayer.modifyPoint.y,
|
|
};
|
|
};
|
|
|
|
+ // console.log(
|
|
|
|
+ // "LayerEvents.AddingRoad:" + JSON.stringify(listenLayer.modifyPoint)
|
|
|
|
+ // );
|
|
}
|
|
}
|
|
|
|
|
|
elementService.execute(addRoad.startInfo.position, position);
|
|
elementService.execute(addRoad.startInfo.position, position);
|
|
@@ -383,7 +539,7 @@ export default class Layer {
|
|
elementService.setNewRoadState("normal");
|
|
elementService.setNewRoadState("normal");
|
|
}
|
|
}
|
|
elementService.showPoint();
|
|
elementService.showPoint();
|
|
- this.showElementLine(position);
|
|
|
|
|
|
+ this.showElementLine(position, eventName);
|
|
break;
|
|
break;
|
|
case LayerEvents.AddingLine:
|
|
case LayerEvents.AddingLine:
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
@@ -413,7 +569,7 @@ export default class Layer {
|
|
elementService.hideAll();
|
|
elementService.hideAll();
|
|
elementService.setPoint(position);
|
|
elementService.setPoint(position);
|
|
elementService.showPoint();
|
|
elementService.showPoint();
|
|
- this.showElementLine(position);
|
|
|
|
|
|
+ this.showElementLine(position, eventName);
|
|
break;
|
|
break;
|
|
case LayerEvents.AddingCurveLine:
|
|
case LayerEvents.AddingCurveLine:
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
@@ -443,7 +599,7 @@ export default class Layer {
|
|
elementService.hideAll();
|
|
elementService.hideAll();
|
|
elementService.setPoint(position);
|
|
elementService.setPoint(position);
|
|
elementService.showPoint();
|
|
elementService.showPoint();
|
|
- this.showElementLine(position);
|
|
|
|
|
|
+ this.showElementLine(position, eventName);
|
|
break;
|
|
break;
|
|
case LayerEvents.AddingCircle:
|
|
case LayerEvents.AddingCircle:
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
@@ -458,8 +614,6 @@ export default class Layer {
|
|
y: listenLayer.modifyPoint.y,
|
|
y: listenLayer.modifyPoint.y,
|
|
};
|
|
};
|
|
}
|
|
}
|
|
- // elementService.execute(addCircle.center, position);
|
|
|
|
- // elementService.setPoint(position);
|
|
|
|
if (addCircle.newCircle == null) {
|
|
if (addCircle.newCircle == null) {
|
|
addCircle.buildCircle(position);
|
|
addCircle.buildCircle(position);
|
|
} else {
|
|
} else {
|
|
@@ -470,6 +624,29 @@ export default class Layer {
|
|
elementService.showPoint();
|
|
elementService.showPoint();
|
|
this.showElementLine(position);
|
|
this.showElementLine(position);
|
|
break;
|
|
break;
|
|
|
|
+ case LayerEvents.AddingElliptic:
|
|
|
|
+ needAutoRedraw = true;
|
|
|
|
+ let exceptEllipticId = null;
|
|
|
|
+ if (addElliptic.newElliptic != null) {
|
|
|
|
+ exceptEllipticId = addElliptic.newElliptic.vectorId;
|
|
|
|
+ }
|
|
|
|
+ listenLayer.start(position, { exceptEllipticId: exceptEllipticId });
|
|
|
|
+ if (listenLayer.modifyPoint) {
|
|
|
|
+ position = {
|
|
|
|
+ x: listenLayer.modifyPoint.x,
|
|
|
|
+ y: listenLayer.modifyPoint.y,
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+ if (addElliptic.newElliptic == null) {
|
|
|
|
+ addElliptic.buildElliptic(position);
|
|
|
|
+ } else {
|
|
|
|
+ addElliptic.updateElliptic(position);
|
|
|
|
+ }
|
|
|
|
+ elementService.hideAll();
|
|
|
|
+ elementService.setPoint(position);
|
|
|
|
+ elementService.showPoint();
|
|
|
|
+ this.showElementLine(position);
|
|
|
|
+ break;
|
|
case LayerEvents.MoveRoad:
|
|
case LayerEvents.MoveRoad:
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
//只允许拖拽一条公路
|
|
//只允许拖拽一条公路
|
|
@@ -494,11 +671,19 @@ export default class Layer {
|
|
exceptRoadPointId: draggingItem.vectorId,
|
|
exceptRoadPointId: draggingItem.vectorId,
|
|
exceptRoadIds: point.parent,
|
|
exceptRoadIds: point.parent,
|
|
});
|
|
});
|
|
- if (listenLayer.modifyPoint) {
|
|
|
|
|
|
+ if (
|
|
|
|
+ listenLayer.modifyPoint &&
|
|
|
|
+ (listenLayer.modifyPoint.linkedRoadPointId ||
|
|
|
|
+ listenLayer.modifyPoint.linkedRoadId ||
|
|
|
|
+ listenLayer.modifyPoint.linkedRoadPointIdX ||
|
|
|
|
+ listenLayer.modifyPoint.linkedRoadPointIdY)
|
|
|
|
+ ) {
|
|
position = {
|
|
position = {
|
|
x: listenLayer.modifyPoint.x,
|
|
x: listenLayer.modifyPoint.x,
|
|
y: listenLayer.modifyPoint.y,
|
|
y: listenLayer.modifyPoint.y,
|
|
};
|
|
};
|
|
|
|
+ } else {
|
|
|
|
+ listenLayer.modifyPoint = null;
|
|
}
|
|
}
|
|
|
|
|
|
let flag = moveRoad.moveingRoadPoint(
|
|
let flag = moveRoad.moveingRoadPoint(
|
|
@@ -509,7 +694,7 @@ export default class Layer {
|
|
if (!flag) {
|
|
if (!flag) {
|
|
elementService.hideAll();
|
|
elementService.hideAll();
|
|
} else {
|
|
} else {
|
|
- this.showElementLine(point);
|
|
|
|
|
|
+ this.showElementLine(point, eventName);
|
|
}
|
|
}
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
break;
|
|
break;
|
|
@@ -525,7 +710,7 @@ export default class Layer {
|
|
elementService.hideAll();
|
|
elementService.hideAll();
|
|
elementService.setPoint(position);
|
|
elementService.setPoint(position);
|
|
elementService.showPoint();
|
|
elementService.showPoint();
|
|
- this.showElementLine(position);
|
|
|
|
|
|
+ this.showElementLine(position, eventName);
|
|
break;
|
|
break;
|
|
case LayerEvents.AddingCurveRoad:
|
|
case LayerEvents.AddingCurveRoad:
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
@@ -550,7 +735,7 @@ export default class Layer {
|
|
elementService.setNewRoadState("normal");
|
|
elementService.setNewRoadState("normal");
|
|
}
|
|
}
|
|
elementService.showPoint();
|
|
elementService.showPoint();
|
|
- this.showElementLine(position);
|
|
|
|
|
|
+ this.showElementLine(position, eventName);
|
|
break;
|
|
break;
|
|
case LayerEvents.MoveCurveRoad:
|
|
case LayerEvents.MoveCurveRoad:
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
@@ -569,14 +754,23 @@ export default class Layer {
|
|
exceptRoadPointId: draggingItem.vectorId,
|
|
exceptRoadPointId: draggingItem.vectorId,
|
|
exceptCurveRoadId: point.parent, //不会融合,所以parent只有一个
|
|
exceptCurveRoadId: point.parent, //不会融合,所以parent只有一个
|
|
});
|
|
});
|
|
- if (listenLayer.modifyPoint) {
|
|
|
|
|
|
+ if (
|
|
|
|
+ listenLayer.modifyPoint &&
|
|
|
|
+ (listenLayer.modifyPoint.linkedRoadPointId ||
|
|
|
|
+ listenLayer.modifyPoint.linkedRoadId ||
|
|
|
|
+ listenLayer.modifyPoint.linkedRoadPointIdX ||
|
|
|
|
+ listenLayer.modifyPoint.linkedRoadPointIdY ||
|
|
|
|
+ listenLayer.modifyPoint.linkedCurvePointIdX ||
|
|
|
|
+ listenLayer.modifyPoint.linkedCurvePointIdY ||
|
|
|
|
+ listenLayer.modifyPoint.linkedCurveRoadPointIdX)
|
|
|
|
+ ) {
|
|
position = {
|
|
position = {
|
|
x: listenLayer.modifyPoint.x,
|
|
x: listenLayer.modifyPoint.x,
|
|
y: listenLayer.modifyPoint.y,
|
|
y: listenLayer.modifyPoint.y,
|
|
};
|
|
};
|
|
}
|
|
}
|
|
moveRoad.moveCurveRoadPoint(draggingItem.vectorId, position);
|
|
moveRoad.moveCurveRoadPoint(draggingItem.vectorId, position);
|
|
- this.showElementLine(point);
|
|
|
|
|
|
+ this.showElementLine(point, eventName);
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
break;
|
|
break;
|
|
case LayerEvents.MoveCrossPoint:
|
|
case LayerEvents.MoveCrossPoint:
|
|
@@ -624,7 +818,7 @@ export default class Layer {
|
|
};
|
|
};
|
|
}
|
|
}
|
|
movePoint.movePoint(position, draggingItem.vectorId);
|
|
movePoint.movePoint(position, draggingItem.vectorId);
|
|
- this.showElementLine(point);
|
|
|
|
|
|
+ this.showElementLine(point, eventName);
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
@@ -642,7 +836,7 @@ export default class Layer {
|
|
};
|
|
};
|
|
}
|
|
}
|
|
movePoint.moveCurvePoint(position, draggingItem.vectorId);
|
|
movePoint.moveCurvePoint(position, draggingItem.vectorId);
|
|
- this.showElementLine(curvePoint);
|
|
|
|
|
|
+ this.showElementLine(curvePoint, eventName);
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
@@ -681,6 +875,31 @@ export default class Layer {
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
+ case LayerEvents.MoveElliptic:
|
|
|
|
+ if (draggingItem != null) {
|
|
|
|
+ if (draggingItem.state == -1) {
|
|
|
|
+ moveElliptic.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
|
|
|
|
+ ) {
|
|
|
|
+ moveElliptic.movePoint(
|
|
|
|
+ position,
|
|
|
|
+ draggingItem.vectorId,
|
|
|
|
+ draggingItem.state
|
|
|
|
+ );
|
|
|
|
+ } else {
|
|
|
|
+ debugger;
|
|
|
|
+ }
|
|
|
|
+ needAutoRedraw = true;
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
case LayerEvents.MoveText:
|
|
case LayerEvents.MoveText:
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
if (draggingItem != null) {
|
|
if (draggingItem != null) {
|
|
@@ -745,6 +964,7 @@ export default class Layer {
|
|
vectorId: selectItem.vectorId,
|
|
vectorId: selectItem.vectorId,
|
|
type: selectItem.type,
|
|
type: selectItem.type,
|
|
cursor: { x: this.lastX, y: this.lastY },
|
|
cursor: { x: this.lastX, y: this.lastY },
|
|
|
|
+ dir: selectItem.dir,
|
|
};
|
|
};
|
|
stateService.setFocusItem(focusItem);
|
|
stateService.setFocusItem(focusItem);
|
|
this.uiControl.focusVector = focusItem;
|
|
this.uiControl.focusVector = focusItem;
|
|
@@ -857,6 +1077,13 @@ export default class Layer {
|
|
this.history.save();
|
|
this.history.save();
|
|
elementService.hideAll();
|
|
elementService.hideAll();
|
|
break;
|
|
break;
|
|
|
|
+ case LayerEvents.AddingElliptic:
|
|
|
|
+ needAutoRedraw = true;
|
|
|
|
+ addElliptic.finish(position);
|
|
|
|
+ addElliptic.clear();
|
|
|
|
+ this.history.save();
|
|
|
|
+ elementService.hideAll();
|
|
|
|
+ break;
|
|
case LayerEvents.MoveText:
|
|
case LayerEvents.MoveText:
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
this.history.save();
|
|
this.history.save();
|
|
@@ -933,6 +1160,10 @@ export default class Layer {
|
|
needAutoRedraw = true;
|
|
needAutoRedraw = true;
|
|
this.history.save();
|
|
this.history.save();
|
|
break;
|
|
break;
|
|
|
|
+ case LayerEvents.MoveElliptic:
|
|
|
|
+ needAutoRedraw = true;
|
|
|
|
+ this.history.save();
|
|
|
|
+ break;
|
|
case LayerEvents.AddPoint:
|
|
case LayerEvents.AddPoint:
|
|
if (
|
|
if (
|
|
Settings.selectBasePointId != null &&
|
|
Settings.selectBasePointId != null &&
|
|
@@ -1199,6 +1430,8 @@ export default class Layer {
|
|
stateService.setEventName(LayerEvents.MoveCurveLine);
|
|
stateService.setEventName(LayerEvents.MoveCurveLine);
|
|
} else if (selectItem.type == VectorType.Circle) {
|
|
} else if (selectItem.type == VectorType.Circle) {
|
|
stateService.setEventName(LayerEvents.MoveCircle);
|
|
stateService.setEventName(LayerEvents.MoveCircle);
|
|
|
|
+ } else if (selectItem.type == VectorType.Elliptic) {
|
|
|
|
+ stateService.setEventName(LayerEvents.MoveElliptic);
|
|
} else if (selectItem.type == VectorType.Text) {
|
|
} else if (selectItem.type == VectorType.Text) {
|
|
stateService.setEventName(LayerEvents.MoveText);
|
|
stateService.setEventName(LayerEvents.MoveText);
|
|
} else if (selectItem.type == VectorType.Magnifier) {
|
|
} else if (selectItem.type == VectorType.Magnifier) {
|
|
@@ -1289,6 +1522,104 @@ export default class Layer {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // showElementLine(point, eventName) {
|
|
|
|
+ // let otherPoint1 = null;
|
|
|
|
+ // let otherPoint2 = null;
|
|
|
|
+ // if (
|
|
|
|
+ // listenLayer.modifyPoint &&
|
|
|
|
+ // listenLayer.modifyPoint.linkedRoadPointIdX &&
|
|
|
|
+ // (eventName == LayerEvents.AddingRoad ||
|
|
|
|
+ // eventName == LayerEvents.MoveRoadPoint ||
|
|
|
|
+ // eventName == LayerEvents.AddRoad)
|
|
|
|
+ // ) {
|
|
|
|
+ // otherPoint1 = dataService.getRoadPoint(
|
|
|
|
+ // listenLayer.modifyPoint.linkedRoadPointIdX
|
|
|
|
+ // );
|
|
|
|
+ // } else if (
|
|
|
|
+ // listenLayer.modifyPoint &&
|
|
|
|
+ // listenLayer.modifyPoint.linkedCurveRoadPointIdX &&
|
|
|
|
+ // (eventName == LayerEvents.AddingCurveRoad ||
|
|
|
|
+ // eventName == LayerEvents.MoveCurveRoadPoint ||
|
|
|
|
+ // eventName == LayerEvents.AddCurveRoad)
|
|
|
|
+ // ) {
|
|
|
|
+ // otherPoint1 = dataService.getCurveRoadPoint(
|
|
|
|
+ // listenLayer.modifyPoint.linkedCurvePointIdX
|
|
|
|
+ // );
|
|
|
|
+ // } else if (
|
|
|
|
+ // listenLayer.modifyPoint &&
|
|
|
|
+ // listenLayer.modifyPoint.linkedPointIdX &&
|
|
|
|
+ // (eventName == LayerEvents.AddLine || eventName == LayerEvents.MovePoint)
|
|
|
|
+ // ) {
|
|
|
|
+ // otherPoint1 = dataService.getPoint(
|
|
|
|
+ // listenLayer.modifyPoint.linkedPointIdX
|
|
|
|
+ // );
|
|
|
|
+ // } else if (
|
|
|
|
+ // listenLayer.modifyPoint &&
|
|
|
|
+ // listenLayer.modifyPoint.linkedCurvePointIdX &&
|
|
|
|
+ // (eventName == LayerEvents.AddCurveLine ||
|
|
|
|
+ // eventName == LayerEvents.MoveCurvePoint)
|
|
|
|
+ // ) {
|
|
|
|
+ // otherPoint1 = dataService.getCurvePoint(
|
|
|
|
+ // listenLayer.modifyPoint.linkedCurvePointIdX
|
|
|
|
+ // );
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // if (
|
|
|
|
+ // listenLayer.modifyPoint &&
|
|
|
|
+ // listenLayer.modifyPoint.linkedRoadPointIdY &&
|
|
|
|
+ // (eventName == LayerEvents.AddingRoad ||
|
|
|
|
+ // eventName == LayerEvents.MoveRoadPoint ||
|
|
|
|
+ // eventName == LayerEvents.AddRoad)
|
|
|
|
+ // ) {
|
|
|
|
+ // otherPoint2 = dataService.getRoadPoint(
|
|
|
|
+ // listenLayer.modifyPoint.linkedRoadPointIdY
|
|
|
|
+ // );
|
|
|
|
+ // } else if (
|
|
|
|
+ // listenLayer.modifyPoint &&
|
|
|
|
+ // listenLayer.modifyPoint.linkedCurvePointIdY &&
|
|
|
|
+ // (eventName == LayerEvents.AddingCurveRoad ||
|
|
|
|
+ // eventName == LayerEvents.MoveCurveRoadPoint ||
|
|
|
|
+ // eventName == LayerEvents.AddCurveRoad)
|
|
|
|
+ // ) {
|
|
|
|
+ // otherPoint2 = dataService.getCurveRoadPoint(
|
|
|
|
+ // listenLayer.modifyPoint.linkedCurvePointIdY
|
|
|
|
+ // );
|
|
|
|
+ // } else if (
|
|
|
|
+ // listenLayer.modifyPoint &&
|
|
|
|
+ // listenLayer.modifyPoint.linkedPointIdY &&
|
|
|
|
+ // (eventName == LayerEvents.AddLine || eventName == LayerEvents.MovePoint)
|
|
|
|
+ // ) {
|
|
|
|
+ // otherPoint2 = dataService.getPoint(
|
|
|
|
+ // listenLayer.modifyPoint.linkedPointIdY
|
|
|
|
+ // );
|
|
|
|
+ // } else if (
|
|
|
|
+ // listenLayer.modifyPoint &&
|
|
|
|
+ // listenLayer.modifyPoint.linkedCurvePointIdY &&
|
|
|
|
+ // (eventName == LayerEvents.AddCurveLine ||
|
|
|
|
+ // eventName == LayerEvents.MoveCurvePoint)
|
|
|
|
+ // ) {
|
|
|
|
+ // otherPoint2 = dataService.getCurvePoint(
|
|
|
|
+ // listenLayer.modifyPoint.linkedCurvePointIdY
|
|
|
|
+ // );
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // let otherPoint = {};
|
|
|
|
+ // if (otherPoint1) {
|
|
|
|
+ // otherPoint.x = otherPoint1.x;
|
|
|
|
+ // otherPoint.y = otherPoint1.y;
|
|
|
|
+ // }
|
|
|
|
+ // if (otherPoint2) {
|
|
|
|
+ // otherPoint.y = otherPoint2.y;
|
|
|
|
+ // if (!otherPoint.hasOwnProperty("x")) {
|
|
|
|
+ // otherPoint.x = otherPoint2.x;
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // if (otherPoint.hasOwnProperty("x") && otherPoint.hasOwnProperty("y")) {
|
|
|
|
+ // elementService.execute(otherPoint, point);
|
|
|
|
+ // } else {
|
|
|
|
+ // elementService.hideAll();
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
showElementLine(point) {
|
|
showElementLine(point) {
|
|
let otherPoint1 = null;
|
|
let otherPoint1 = null;
|
|
let otherPoint2 = null;
|
|
let otherPoint2 = null;
|
|
@@ -1298,7 +1629,7 @@ export default class Layer {
|
|
);
|
|
);
|
|
} else if (
|
|
} else if (
|
|
listenLayer.modifyPoint &&
|
|
listenLayer.modifyPoint &&
|
|
- listenLayer.modifyPoint.linkedCurvePointIdX
|
|
|
|
|
|
+ listenLayer.modifyPoint.linkedCurveRoadPointIdX
|
|
) {
|
|
) {
|
|
otherPoint1 = dataService.getCurveRoadPoint(
|
|
otherPoint1 = dataService.getCurveRoadPoint(
|
|
listenLayer.modifyPoint.linkedCurvePointIdX
|
|
listenLayer.modifyPoint.linkedCurvePointIdX
|
|
@@ -1357,7 +1688,6 @@ export default class Layer {
|
|
otherPoint.x = otherPoint2.x;
|
|
otherPoint.x = otherPoint2.x;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
elementService.execute(otherPoint, point);
|
|
elementService.execute(otherPoint, point);
|
|
}
|
|
}
|
|
}
|
|
}
|