|
@@ -23,6 +23,8 @@ export default class ListenLayer {
|
|
|
* @param exceptVectorIds:{
|
|
|
exceptPointId,
|
|
|
exceptLineId,
|
|
|
+ exceptCurvePointId,
|
|
|
+ exceptCurveLineId,
|
|
|
exceptRoadPointId,
|
|
|
exceptRoadIds,
|
|
|
exceptCurveRoadPointId,
|
|
@@ -63,8 +65,14 @@ export default class ListenLayer {
|
|
|
position,
|
|
|
exceptVectorIds.exceptLineId
|
|
|
);
|
|
|
- selectInfo.curveLineInfo = {};
|
|
|
- selectInfo.curvePointInfo = {};
|
|
|
+ selectInfo.curvePointInfo = this.isSelectCurvePoint(
|
|
|
+ position,
|
|
|
+ exceptVectorIds.exceptCurvePointId
|
|
|
+ );
|
|
|
+ selectInfo.curveLineInfo = this.isSelectCurveLine(
|
|
|
+ position,
|
|
|
+ exceptVectorIds.exceptCurveLineId
|
|
|
+ );
|
|
|
selectInfo.circleInfo = this.isSelectCircle(
|
|
|
position,
|
|
|
exceptVectorIds.exceptCircleId
|
|
@@ -87,6 +95,126 @@ export default class ListenLayer {
|
|
|
return flag;
|
|
|
}
|
|
|
|
|
|
+ isSelectCurvePoint(position, exceptCurvePointId) {
|
|
|
+ let curvePointInfo = {
|
|
|
+ curvePointId: null,
|
|
|
+ type: null,
|
|
|
+ distance: null,
|
|
|
+ };
|
|
|
+
|
|
|
+ let seqInfo = {};
|
|
|
+ const curvePoints = dataService.getCurvePoints();
|
|
|
+ for (const curvePointId in curvePoints) {
|
|
|
+ if (curvePointId == exceptCurvePointId) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ const curvePoint = dataService.getCurvePoint(curvePointId);
|
|
|
+ const distance = mathUtil.getDistance(position, curvePoint);
|
|
|
+ if (distance < Constant.minAdsorbPix) {
|
|
|
+ if (curvePointInfo.curvePointId == null) {
|
|
|
+ curvePointInfo = {
|
|
|
+ curvePointId: curvePointId,
|
|
|
+ type: VectorType.CurvePoint,
|
|
|
+ distance: distance,
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ if (distance < curvePointInfo.distance) {
|
|
|
+ curvePointInfo = {
|
|
|
+ curvePointId: curvePointId,
|
|
|
+ type: VectorType.CurvePoint,
|
|
|
+ distance: distance,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (Math.abs(position.x - curvePoint.x) < Constant.minAdsorbPix) {
|
|
|
+ seqInfo.linkedCurvePointIdX = curvePointId;
|
|
|
+ seqInfo.x = curvePoint.x;
|
|
|
+ }
|
|
|
+ if (Math.abs(position.y - curvePoint.y) < Constant.minAdsorbPix) {
|
|
|
+ seqInfo.linkedPointIdY = curvePointId;
|
|
|
+ seqInfo.y = curvePoint.y;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (curvePointInfo.curvePointId) {
|
|
|
+ curvePointInfo.linkedCurvePointId = curvePointInfo.curvePointId;
|
|
|
+ const linkedCurvePoint = dataService.getCurvePoint(
|
|
|
+ curvePointInfo.curvePointId
|
|
|
+ );
|
|
|
+ curvePointInfo.x = linkedCurvePoint.x;
|
|
|
+ curvePointInfo.y = linkedCurvePoint.y;
|
|
|
+ } else {
|
|
|
+ if (seqInfo.hasOwnProperty("linkedCurvePointIdX")) {
|
|
|
+ curvePointInfo.linkedCurvePointIdX = seqInfo.linkedCurvePointIdX;
|
|
|
+ curvePointInfo.x = seqInfo.x;
|
|
|
+ }
|
|
|
+ if (seqInfo.hasOwnProperty("linkedCurvePointIdY")) {
|
|
|
+ curvePointInfo.linkedCurvePointIdY = seqInfo.linkedCurvePointIdY;
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+
|
|
|
+ isSelectCurveLine(position, exceptCurveLineIds) {
|
|
|
+ let curveLineInfo = {
|
|
|
+ curveLineId: null,
|
|
|
+ type: null,
|
|
|
+ distance: null,
|
|
|
+ };
|
|
|
+ const curveLines = dataService.getCurveLines();
|
|
|
+ for (const curveLineId in curveLines) {
|
|
|
+ if (
|
|
|
+ exceptCurveLineIds &&
|
|
|
+ exceptCurveLineIds.hasOwnProperty(curveLineId)
|
|
|
+ ) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ const curveLine = dataService.getCurveLine(curveLineId);
|
|
|
+ let startPoint = dataService.getCurvePoint(curveLine.startId);
|
|
|
+ let endPoint = dataService.getCurvePoint(curveLine.endId);
|
|
|
+ const comLine = mathUtil.createLine1(startPoint, endPoint);
|
|
|
+ const join = mathUtil.getJoinLinePoint(position, comLine);
|
|
|
+ const distance = mathUtil.getDistance(position, join);
|
|
|
+ if (!mathUtil.isContainForSegment(join, startPoint, endPoint)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (distance < Constant.minAdsorbPix / 2) {
|
|
|
+ curveLineInfo = {
|
|
|
+ curveLineId: curveLineId,
|
|
|
+ type: VectorType.CurveLine,
|
|
|
+ distance: distance,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (curveLineInfo.curveLineId) {
|
|
|
+ const linkedLine = dataService.getLine(lineInfo.curveLineId);
|
|
|
+ let startPoint = dataService.getCurvePoint(linkedLine.startId);
|
|
|
+ let endPoint = dataService.getCurvePoint(linkedLine.endId);
|
|
|
+ const linkedComLine = mathUtil.createLine1(startPoint, endPoint);
|
|
|
+ const linkedPosition = mathUtil.getJoinLinePoint(position, linkedComLine);
|
|
|
+ curveLineInfo.x = linkedPosition.x;
|
|
|
+ curveLineInfo.y = linkedPosition.y;
|
|
|
+ return curveLineInfo;
|
|
|
+ }
|
|
|
+ return curveLineInfo;
|
|
|
+ }
|
|
|
+
|
|
|
isSelectPoint(position, exceptPointId) {
|
|
|
let pointInfo = {
|
|
|
pointId: null,
|