|
@@ -57,17 +57,24 @@ export default class ListenLayer {
|
|
|
exceptCurveRoadId
|
|
|
) {
|
|
|
let isSame = false;
|
|
|
- this.modifyPoint = null;
|
|
|
+ this.clear();
|
|
|
let curveRoadInfo = this.isSelectCurveRoad(position, exceptCurveRoadId);
|
|
|
let roadInfo = this.isSelectRoad(position, exceptRoadIds);
|
|
|
let curvePointInfo = this.isSelectCurvePoint(position, exceptCurvePointId);
|
|
|
let pointInfo = this.isSelectPoint(position, exceptPointId);
|
|
|
-
|
|
|
- let flag1 = this.equalAndClone(this.curveRoadInfo, curveRoadInfo);
|
|
|
- let flag2 = this.equalAndClone(this.roadInfo, roadInfo);
|
|
|
- let flag3 = this.equalAndClone(this.curvePointInfo, curvePointInfo);
|
|
|
- let flag4 = this.equalAndClone(this.pointInfo, pointInfo);
|
|
|
- isSame = this.updateSelectItem(flag1, flag2, flag3, flag4);
|
|
|
+ this.setModifyPoint(
|
|
|
+ position,
|
|
|
+ pointInfo,
|
|
|
+ curvePointInfo,
|
|
|
+ roadInfo,
|
|
|
+ curveRoadInfo
|
|
|
+ );
|
|
|
+ // let flag1 = this.equalAndClone(this.curveRoadInfo, curveRoadInfo);
|
|
|
+ // let flag2 = this.equalAndClone(this.roadInfo, roadInfo);
|
|
|
+ // let flag3 = this.equalAndClone(this.curvePointInfo, curvePointInfo);
|
|
|
+ // let flag4 = this.equalAndClone(this.pointInfo, pointInfo);
|
|
|
+ // isSame = this.updateSelectItem(flag1, flag2, flag3, flag4);
|
|
|
+ isSame = this.updateSelectItem();
|
|
|
return !isSame;
|
|
|
}
|
|
|
|
|
@@ -75,7 +82,7 @@ export default class ListenLayer {
|
|
|
let pointInfo = {
|
|
|
pointId: null,
|
|
|
type: null,
|
|
|
- state: null,
|
|
|
+ distance: null,
|
|
|
};
|
|
|
|
|
|
let seqInfo = {};
|
|
@@ -85,50 +92,58 @@ export default class ListenLayer {
|
|
|
continue;
|
|
|
}
|
|
|
const point = dataService.getPoint(pointId);
|
|
|
- if (mathUtil.getDistance(position, point) < Constant.minAdsorbPix) {
|
|
|
+ const distance = mathUtil.getDistance(position, point);
|
|
|
+ if (distance < Constant.minAdsorbPix) {
|
|
|
if (pointInfo.pointId == null) {
|
|
|
pointInfo = {
|
|
|
pointId: pointId,
|
|
|
type: VectorType.Point,
|
|
|
- state: SelectState.Select,
|
|
|
+ distance: distance,
|
|
|
};
|
|
|
} else if (pointInfo.pointId != null) {
|
|
|
- let oldPoint = dataService.getPoint(pointInfo.pointId);
|
|
|
- if (
|
|
|
- mathUtil.getDistance(position, point) <
|
|
|
- mathUtil.getDistance(position, oldPoint)
|
|
|
- ) {
|
|
|
+ if (distance < pointInfo.distance) {
|
|
|
pointInfo = {
|
|
|
pointId: pointId,
|
|
|
type: VectorType.Point,
|
|
|
- state: SelectState.Select,
|
|
|
+ distance: distance,
|
|
|
};
|
|
|
}
|
|
|
}
|
|
|
- } else if (Math.abs(position.x - point.x) < Constant.minAdsorbPix) {
|
|
|
- seqInfo.linkedPointIdX = pointId;
|
|
|
- seqInfo.x = point.x;
|
|
|
- } else if (Math.abs(position.y - point.y) < Constant.minAdsorbPix) {
|
|
|
- seqInfo.linkedPointIdY = pointId;
|
|
|
- seqInfo.y = point.y;
|
|
|
+ } else {
|
|
|
+ if (Math.abs(position.x - point.x) < Constant.minAdsorbPix) {
|
|
|
+ seqInfo.linkedPointIdX = pointId;
|
|
|
+ seqInfo.x = point.x;
|
|
|
+ } else if (Math.abs(position.y - point.y) < Constant.minAdsorbPix) {
|
|
|
+ seqInfo.linkedPointIdY = pointId;
|
|
|
+ seqInfo.y = point.y;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (pointInfo.pointId) {
|
|
|
- this.modifyPoint = {};
|
|
|
- this.modifyPoint.linkedPointId = pointInfo.pointId;
|
|
|
- if (pointInfo.pointId) {
|
|
|
- const linkedPoint = dataService.getPoint(pointInfo.pointId);
|
|
|
- this.modifyPoint.x = linkedPoint.x;
|
|
|
- this.modifyPoint.y = linkedPoint.y;
|
|
|
- } else if (seqInfo.hasOwnProperty("linkedPointIdX")) {
|
|
|
- this.modifyPoint.linkedPointIdX = seqInfo.linkedPointIdX;
|
|
|
- this.modifyPoint.x = seqInfo.x;
|
|
|
- } else if (seqInfo.hasOwnProperty("linkedPointIdY")) {
|
|
|
- this.modifyPoint.linkedPointIdY = seqInfo.linkedPointIdY;
|
|
|
- this.modifyPoint.y = seqInfo.y;
|
|
|
+ const linkedPoint = dataService.getPoint(pointInfo.pointId);
|
|
|
+ pointInfo.x = linkedPoint.x;
|
|
|
+ pointInfo.y = linkedPoint.y;
|
|
|
+ }
|
|
|
+ //因为这种纠正的权限最低
|
|
|
+ else {
|
|
|
+ if (seqInfo.hasOwnProperty("linkedPointIdX")) {
|
|
|
+ pointInfo.linkedPointIdX = seqInfo.linkedPointIdX;
|
|
|
+ pointInfo.x = seqInfo.x;
|
|
|
+ }
|
|
|
+ if (seqInfo.hasOwnProperty("linkedPointIdY")) {
|
|
|
+ pointInfo.linkedPointIdY = seqInfo.linkedPointIdY;
|
|
|
+ pointInfo.y = seqInfo.y;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (pointInfo.hasOwnProperty("y") && !pointInfo.hasOwnProperty("x")) {
|
|
|
+ pointInfo.x = position.x;
|
|
|
+ }
|
|
|
+ if (pointInfo.hasOwnProperty("x") && !pointInfo.hasOwnProperty("y")) {
|
|
|
+ pointInfo.y = position.y;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
return pointInfo;
|
|
|
}
|
|
|
|
|
@@ -136,7 +151,7 @@ export default class ListenLayer {
|
|
|
let curvePointInfo = {
|
|
|
curvePointId: null,
|
|
|
type: null,
|
|
|
- state: null,
|
|
|
+ distance: null,
|
|
|
};
|
|
|
|
|
|
let seqInfo = {};
|
|
@@ -146,52 +161,62 @@ export default class ListenLayer {
|
|
|
continue;
|
|
|
}
|
|
|
const curvePoint = dataService.getCurvePoint(curvePointId);
|
|
|
- if (mathUtil.getDistance(position, curvePoint) < Constant.minAdsorbPix) {
|
|
|
+ const distance = mathUtil.getDistance(position, curvePoint);
|
|
|
+ if (distance < Constant.minAdsorbPix) {
|
|
|
if (curvePointInfo.curvePointId == null) {
|
|
|
curvePointInfo = {
|
|
|
curvePointId: curvePointId,
|
|
|
type: VectorType.CurvePoint,
|
|
|
- state: SelectState.Select,
|
|
|
+ distance: distance,
|
|
|
};
|
|
|
} else if (curvePointInfo.pointId != null) {
|
|
|
- let oldCurvePoint = dataService.getCurvePoint(
|
|
|
- curvePointInfo.curvePointId
|
|
|
- );
|
|
|
- if (
|
|
|
- mathUtil.getDistance(position, curvePoint) <
|
|
|
- mathUtil.getDistance(position, oldCurvePoint)
|
|
|
- ) {
|
|
|
+ if (distance < curvePointInfo.distance) {
|
|
|
curvePointInfo = {
|
|
|
curvePointId: curvePointId,
|
|
|
type: VectorType.CurvePoint,
|
|
|
- state: SelectState.Select,
|
|
|
+ distance: distance,
|
|
|
};
|
|
|
}
|
|
|
}
|
|
|
- } else if (Math.abs(position.x - curvePoint.x) < Constant.minAdsorbPix) {
|
|
|
- seqInfo.linkedPointIdX = curvePointId;
|
|
|
- seqInfo.x = curvePoint.x;
|
|
|
- } else if (Math.abs(position.y - curvePoint.y) < Constant.minAdsorbPix) {
|
|
|
- seqInfo.linkedPointIdY = curvePointId;
|
|
|
- seqInfo.y = curvePoint.y;
|
|
|
+ } else {
|
|
|
+ if (Math.abs(position.x - curvePoint.x) < Constant.minAdsorbPix) {
|
|
|
+ seqInfo.linkedPointIdX = curvePointId;
|
|
|
+ seqInfo.x = curvePoint.x;
|
|
|
+ } else if (
|
|
|
+ Math.abs(position.y - curvePoint.y) < Constant.minAdsorbPix
|
|
|
+ ) {
|
|
|
+ seqInfo.linkedPointIdY = curvePointId;
|
|
|
+ seqInfo.y = curvePoint.y;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (curvePointInfo.curvePointId) {
|
|
|
- this.modifyPoint = {};
|
|
|
- this.modifyPoint.linkedCurvePointId = curvePointInfo.curvePointId;
|
|
|
- if (curvePointInfo.curvePointId) {
|
|
|
- const linkedCurvePoint = dataService.getCurvePoint(
|
|
|
- curvePointInfo.curvePointId
|
|
|
- );
|
|
|
- this.modifyPoint.x = linkedCurvePoint.x;
|
|
|
- this.modifyPoint.y = linkedCurvePoint.y;
|
|
|
- } else if (seqInfo.hasOwnProperty("linkedPointIdX")) {
|
|
|
- this.modifyPoint.linkedPointIdX = seqInfo.linkedPointIdX;
|
|
|
- this.modifyPoint.x = seqInfo.x;
|
|
|
+ curvePointInfo.linkedCurvePointId = curvePointInfo.curvePointId;
|
|
|
+ const linkedCurvePoint = dataService.getCurvePoint(
|
|
|
+ curvePointInfo.curvePointId
|
|
|
+ );
|
|
|
+ curvePointInfo.x = linkedCurvePoint.x;
|
|
|
+ curvePointInfo.y = linkedCurvePoint.y;
|
|
|
+ } else {
|
|
|
+ if (seqInfo.hasOwnProperty("linkedPointIdX")) {
|
|
|
+ curvePointInfo.linkedPointIdX = seqInfo.linkedPointIdX;
|
|
|
+ curvePointInfo.x = seqInfo.x;
|
|
|
} else if (seqInfo.hasOwnProperty("linkedPointIdY")) {
|
|
|
- this.modifyPoint.linkedPointIdY = seqInfo.linkedPointIdY;
|
|
|
- this.modifyPoint.y = seqInfo.y;
|
|
|
+ curvePointInfo.linkedPointIdY = seqInfo.linkedPointIdY;
|
|
|
+ curvePointInfo.y = seqInfo.y;
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ curvePointInfo.hasOwnProperty("y") &&
|
|
|
+ !curvePointInfo.hasOwnProperty("x")
|
|
|
+ ) {
|
|
|
+ curvePointInfo.x = position.x;
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ curvePointInfo.hasOwnProperty("x") &&
|
|
|
+ !curvePointInfo.hasOwnProperty("y")
|
|
|
+ ) {
|
|
|
+ curvePointInfo.y = position.y;
|
|
|
}
|
|
|
}
|
|
|
return curvePointInfo;
|
|
@@ -201,7 +226,7 @@ export default class ListenLayer {
|
|
|
let roadInfo = {
|
|
|
roadId: null,
|
|
|
type: null,
|
|
|
- state: null,
|
|
|
+ distance: null,
|
|
|
};
|
|
|
const roads = dataService.getRoads();
|
|
|
for (const roadId in roads) {
|
|
@@ -209,27 +234,28 @@ export default class ListenLayer {
|
|
|
continue;
|
|
|
}
|
|
|
const road = dataService.getRoad(roadId);
|
|
|
+ let startPoint = dataService.getPoint(road.startId);
|
|
|
+ let endPoint = dataService.getPoint(road.endId);
|
|
|
const roadLine = roadService.getMidLine(road);
|
|
|
- const distance = mathUtil.getDisForPoinLine(position, roadLine);
|
|
|
+ const join = mathUtil.getJoinLinePoint(position, roadLine);
|
|
|
+ const distance = mathUtil.getDistance(position, join);
|
|
|
|
|
|
- if (distance < road.width / 2) {
|
|
|
+ if (
|
|
|
+ distance < road.width / 2 &&
|
|
|
+ mathUtil.isContainForSegment(join, startPoint, endPoint)
|
|
|
+ ) {
|
|
|
if (roadInfo.roadId == null) {
|
|
|
roadInfo = {
|
|
|
roadId: roadId,
|
|
|
type: VectorType.Road,
|
|
|
- state: SelectState.Select,
|
|
|
+ distance: distance,
|
|
|
};
|
|
|
- } else if (roadInfo.pointId != null) {
|
|
|
- let oldRoad = dataService.getRoad(roadInfo.roadId);
|
|
|
- const oldRoadLine = roadService.getMidLine(oldRoad);
|
|
|
- if (
|
|
|
- mathUtil.getDisForPoinLine(position, roadLine) <
|
|
|
- mathUtil.getDisForPoinLine(position, oldRoadLine)
|
|
|
- ) {
|
|
|
+ } else if (roadInfo.roadId != null) {
|
|
|
+ if (distance < roadInfo.distance) {
|
|
|
roadInfo = {
|
|
|
roadId: roadId,
|
|
|
type: VectorType.Road,
|
|
|
- state: SelectState.Select,
|
|
|
+ distance: mathUtil.getDisForPoinLine(position, roadLine),
|
|
|
};
|
|
|
}
|
|
|
}
|
|
@@ -237,16 +263,14 @@ export default class ListenLayer {
|
|
|
}
|
|
|
|
|
|
if (roadInfo.roadId) {
|
|
|
- this.modifyPoint = {};
|
|
|
- this.modifyPoint.linkedRoadId = roadInfo.roadId;
|
|
|
- const linkedRoad = dataService.getRoad(this.modifyPoint.linkedRoadId);
|
|
|
+ const linkedRoad = dataService.getRoad(roadInfo.roadId);
|
|
|
const linkedRoadLine = roadService.getMidLine(linkedRoad);
|
|
|
const linkedPosition = mathUtil.getJoinLinePoint(
|
|
|
position,
|
|
|
linkedRoadLine
|
|
|
);
|
|
|
- this.modifyPoint.x = linkedPosition.x;
|
|
|
- this.modifyPoint.y = linkedPosition.y;
|
|
|
+ roadInfo.x = linkedPosition.x;
|
|
|
+ roadInfo.y = linkedPosition.y;
|
|
|
}
|
|
|
return roadInfo;
|
|
|
}
|
|
@@ -255,7 +279,7 @@ export default class ListenLayer {
|
|
|
let curveRoadInfo = {
|
|
|
curveRoadId: null,
|
|
|
type: null,
|
|
|
- state: null,
|
|
|
+ distance: null,
|
|
|
};
|
|
|
|
|
|
const curveRoads = dataService.getCurveRoads();
|
|
@@ -264,64 +288,177 @@ export default class ListenLayer {
|
|
|
continue;
|
|
|
}
|
|
|
const curveRoad = dataService.getCurveRoad(curveRoadId);
|
|
|
- let flag = this.isHitForBezier(position, curveRoad.curves);
|
|
|
- if (flag) {
|
|
|
+ let joinInfo = this.distanceForBezier(position, curveRoad.curves);
|
|
|
+ if (joinInfo.distance < Constant.minAdsorbPix) {
|
|
|
curveRoadInfo = {
|
|
|
curveRoadId: curveRoadId,
|
|
|
type: VectorType.CurveRoad,
|
|
|
- state: SelectState.Select,
|
|
|
+ distance: joinInfo.distance,
|
|
|
+ x: joinInfo.position.x,
|
|
|
+ y: joinInfo.position.y,
|
|
|
};
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (curveRoadInfo.curveRoadId) {
|
|
|
+ return curveRoadInfo;
|
|
|
+ }
|
|
|
+
|
|
|
+ setModifyPoint(position, pointInfo, curvePointInfo, roadInfo, curveRoadInfo) {
|
|
|
+ //优先级最高
|
|
|
+ if (pointInfo.pointId || curvePointInfo.curvePointId) {
|
|
|
this.modifyPoint = {};
|
|
|
- this.modifyPoint.linkedCurveRoadId = curveRoadInfo.curveRoadId;
|
|
|
+ if (pointInfo.pointId && curvePointInfo.curvePointId) {
|
|
|
+ if (pointInfo.distance < curvePointInfo.distance) {
|
|
|
+ this.modifyPoint.linkedPointId = pointInfo.pointId;
|
|
|
+ this.modifyPoint.x = pointInfo.x;
|
|
|
+ this.modifyPoint.y = pointInfo.y;
|
|
|
+ } else {
|
|
|
+ this.modifyPoint.linkedCurvePointId = curvePointInfo.curvePointId;
|
|
|
+ this.modifyPoint.x = curvePointInfo.x;
|
|
|
+ this.modifyPoint.y = curvePointInfo.y;
|
|
|
+ }
|
|
|
+ } else if (pointInfo.pointId) {
|
|
|
+ this.modifyPoint.linkedPointId = pointInfo.pointId;
|
|
|
+ this.modifyPoint.x = pointInfo.x;
|
|
|
+ this.modifyPoint.y = pointInfo.y;
|
|
|
+ } else if (curvePointInfo.curvePointId) {
|
|
|
+ this.modifyPoint.linkedCurvePointId = curvePointInfo.curvePointId;
|
|
|
+ this.modifyPoint.x = curvePointInfo.x;
|
|
|
+ this.modifyPoint.y = curvePointInfo.y;
|
|
|
+ }
|
|
|
+ } else if (roadInfo.roadId || curveRoadInfo.curveRoadId) {
|
|
|
+ this.modifyPoint = {};
|
|
|
+ if (roadInfo.roadId && curveRoadInfo.curveRoadId) {
|
|
|
+ if (roadInfo.distance < curveRoadInfo.distance) {
|
|
|
+ this.modifyPoint.linkedRoadId = roadInfo.roadId;
|
|
|
+ this.modifyPoint.x = roadInfo.x;
|
|
|
+ this.modifyPoint.y = roadInfo.y;
|
|
|
+ } else {
|
|
|
+ this.modifyPoint.linkedCurveRoadId = curveRoadInfo.curveRoadId;
|
|
|
+ this.modifyPoint.x = curveRoadInfo.x;
|
|
|
+ this.modifyPoint.y = curveRoadInfo.y;
|
|
|
+ }
|
|
|
+ } else if (roadInfo.roadId) {
|
|
|
+ this.modifyPoint.linkedRoadId = roadInfo.roadId;
|
|
|
+ this.modifyPoint.x = roadInfo.x;
|
|
|
+ this.modifyPoint.y = roadInfo.y;
|
|
|
+ } else if (curveRoadInfo.curveRoadId) {
|
|
|
+ this.modifyPoint.linkedCurveRoadId = curveRoadInfo.curveRoadId;
|
|
|
+ this.modifyPoint.x = curveRoadInfo.x;
|
|
|
+ this.modifyPoint.y = curveRoadInfo.y;
|
|
|
+ }
|
|
|
+ } else if (pointInfo.linkedPointIdX) {
|
|
|
+ this.modifyPoint = {};
|
|
|
+ this.modifyPoint.linkedPointIdX = pointInfo.linkedPointIdX;
|
|
|
+ this.modifyPoint.x = pointInfo.x;
|
|
|
+ this.modifyPoint.y = position.y;
|
|
|
+ } else if (pointInfo.linkedPointIdY) {
|
|
|
+ this.modifyPoint = {};
|
|
|
+ this.modifyPoint.linkedPointIdY = pointInfo.linkedPointIdY;
|
|
|
+ this.modifyPoint.y = pointInfo.y;
|
|
|
+ this.modifyPoint.x = position.x;
|
|
|
+ } else if (curvePointInfo.linkedPointIdX) {
|
|
|
+ this.modifyPoint = {};
|
|
|
+ this.modifyPoint.linkedPointIdX = curvePointInfo.linkedPointIdX;
|
|
|
+ this.modifyPoint.x = curvePointInfo.x;
|
|
|
+ this.modifyPoint.y = position.y;
|
|
|
+ } else if (curvePointInfo.linkedPointIdY) {
|
|
|
+ this.modifyPoint = {};
|
|
|
+ this.modifyPoint.linkedPointIdY = curvePointInfo.linkedPointIdY;
|
|
|
+ this.modifyPoint.y = curvePointInfo.y;
|
|
|
+ this.modifyPoint.x = position.x;
|
|
|
+ } else {
|
|
|
+ this.modifyPoint = null;
|
|
|
}
|
|
|
- return curveRoadInfo;
|
|
|
}
|
|
|
|
|
|
- updateSelectItem(flag1, flag2, flag3, flag4) {
|
|
|
- if (!flag1) {
|
|
|
+ updateSelectItem() {
|
|
|
+ let selectItem = stateService.getSelectItem();
|
|
|
+ if (this.modifyPoint == null) {
|
|
|
+ if (selectItem != null) {
|
|
|
+ stateService.clearSelectItem();
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ } else if (this.modifyPoint.linkedPointId) {
|
|
|
stateService.setSelectItem(
|
|
|
- this.curveRoadInfo.curveRoadId,
|
|
|
- this.curveRoadInfo.type,
|
|
|
- this.curveRoadInfo.state
|
|
|
+ this.modifyPoint.linkedPointId,
|
|
|
+ VectorType.Point,
|
|
|
+ SelectState.Select
|
|
|
);
|
|
|
- }
|
|
|
-
|
|
|
- if (!flag2) {
|
|
|
+ } else if (this.modifyPoint.linkedCurvePointId) {
|
|
|
stateService.setSelectItem(
|
|
|
- this.roadInfo.roadId,
|
|
|
- this.roadInfo.type,
|
|
|
- this.roadInfo.state
|
|
|
+ this.modifyPoint.linkedCurvePointId,
|
|
|
+ VectorType.CurvePoint,
|
|
|
+ SelectState.Select
|
|
|
);
|
|
|
- }
|
|
|
-
|
|
|
- if (!flag3) {
|
|
|
+ } else if (this.modifyPoint.linkedRoadId) {
|
|
|
stateService.setSelectItem(
|
|
|
- this.curvePointInfo.curvePointId,
|
|
|
- this.curvePointInfo.type,
|
|
|
- this.curvePointInfo.state
|
|
|
+ this.modifyPoint.linkedRoadId,
|
|
|
+ VectorType.Road,
|
|
|
+ SelectState.Select
|
|
|
);
|
|
|
- }
|
|
|
-
|
|
|
- if (!flag4) {
|
|
|
+ } else if (this.modifyPoint.linkedCurveRoadId) {
|
|
|
stateService.setSelectItem(
|
|
|
- this.pointInfo.pointId,
|
|
|
- this.pointInfo.type,
|
|
|
- this.pointInfo.state
|
|
|
+ this.modifyPoint.linkedCurveRoadId,
|
|
|
+ VectorType.CurveRoad,
|
|
|
+ SelectState.Select
|
|
|
);
|
|
|
}
|
|
|
- let selectItem = stateService.getSelectItem();
|
|
|
- if (selectItem != null) {
|
|
|
- console.log("监听:" + JSON.stringify(selectItem));
|
|
|
- }
|
|
|
|
|
|
- return flag1 && flag2 && flag3 && flag4;
|
|
|
+ let newSelectItem = stateService.getSelectItem();
|
|
|
+ if (selectItem == null && newSelectItem == null) {
|
|
|
+ return false;
|
|
|
+ } else if (selectItem == null && newSelectItem != null) {
|
|
|
+ return true;
|
|
|
+ } else if (selectItem != null && newSelectItem == null) {
|
|
|
+ return true;
|
|
|
+ } else if (selectItem.vectorId == newSelectItem.vectorId) {
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ // if (!flag1) {
|
|
|
+ // stateService.setSelectItem(
|
|
|
+ // this.curveRoadInfo.curveRoadId,
|
|
|
+ // this.curveRoadInfo.type,
|
|
|
+ // this.curveRoadInfo.state
|
|
|
+ // );
|
|
|
+ // }
|
|
|
+ // if (!flag2) {
|
|
|
+ // stateService.setSelectItem(
|
|
|
+ // this.roadInfo.roadId,
|
|
|
+ // this.roadInfo.type,
|
|
|
+ // this.roadInfo.state
|
|
|
+ // );
|
|
|
+ // }
|
|
|
+ // if (!flag3) {
|
|
|
+ // stateService.setSelectItem(
|
|
|
+ // this.curvePointInfo.curvePointId,
|
|
|
+ // this.curvePointInfo.type,
|
|
|
+ // this.curvePointInfo.state
|
|
|
+ // );
|
|
|
+ // }
|
|
|
+ // if (!flag4) {
|
|
|
+ // stateService.setSelectItem(
|
|
|
+ // this.pointInfo.pointId,
|
|
|
+ // this.pointInfo.type,
|
|
|
+ // this.pointInfo.state
|
|
|
+ // );
|
|
|
+ // }
|
|
|
+ // let selectItem = stateService.getSelectItem();
|
|
|
+ // if (selectItem != null) {
|
|
|
+ // console.log("监听:" + JSON.stringify(selectItem));
|
|
|
+ // }
|
|
|
+ // return flag1 && flag2 && flag3 && flag4;
|
|
|
}
|
|
|
|
|
|
- isHitForBezier(position, curves) {
|
|
|
+ distanceForBezier(position, curves) {
|
|
|
+ let joinInfo = {
|
|
|
+ position: null,
|
|
|
+ distance: null,
|
|
|
+ };
|
|
|
for (let i = 0; i < curves.length; ++i) {
|
|
|
const curve = curves[i];
|
|
|
let bezierData = [];
|
|
@@ -333,23 +470,25 @@ export default class ListenLayer {
|
|
|
bezierData.push(curve.end.y);
|
|
|
const { isHit, getInfo } = bezierUtil.measureBezier(...bezierData);
|
|
|
const { point } = getInfo(position);
|
|
|
- // this.testStart = position;
|
|
|
- // this.testEnd = {
|
|
|
- // x: point[0],
|
|
|
- // y: point[1],
|
|
|
- // };
|
|
|
- // this.testHit = false;
|
|
|
|
|
|
if (
|
|
|
+ joinInfo.distance == null ||
|
|
|
mathUtil.getDistance(position, {
|
|
|
x: point[0],
|
|
|
y: point[1],
|
|
|
- }) < Constant.minAdsorbPix
|
|
|
+ }) < joinInfo.distance
|
|
|
) {
|
|
|
- return true;
|
|
|
+ joinInfo.distance = mathUtil.getDistance(position, {
|
|
|
+ x: point[0],
|
|
|
+ y: point[1],
|
|
|
+ });
|
|
|
+ joinInfo.position = {
|
|
|
+ x: point[0],
|
|
|
+ y: point[1],
|
|
|
+ };
|
|
|
}
|
|
|
}
|
|
|
- return false;
|
|
|
+ return joinInfo;
|
|
|
}
|
|
|
|
|
|
equalAndClone(info1, info2) {
|