|
@@ -109,7 +109,7 @@ export default class ListenLayer {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
const curvePoint = dataService.getCurvePoint(curvePointId);
|
|
const curvePoint = dataService.getCurvePoint(curvePointId);
|
|
- const distance = mathUtil.getDistance(position, curvePoint);
|
|
|
|
|
|
+ const distance = this.getDistance(position, curvePoint);
|
|
if (distance < Constant.minAdsorbPix) {
|
|
if (distance < Constant.minAdsorbPix) {
|
|
if (curvePointInfo.curvePointId == null) {
|
|
if (curvePointInfo.curvePointId == null) {
|
|
curvePointInfo = {
|
|
curvePointInfo = {
|
|
@@ -189,7 +189,7 @@ export default class ListenLayer {
|
|
let endPoint = dataService.getCurvePoint(curveLine.endId);
|
|
let endPoint = dataService.getCurvePoint(curveLine.endId);
|
|
const comLine = mathUtil.createLine1(startPoint, endPoint);
|
|
const comLine = mathUtil.createLine1(startPoint, endPoint);
|
|
const join = mathUtil.getJoinLinePoint(position, comLine);
|
|
const join = mathUtil.getJoinLinePoint(position, comLine);
|
|
- const distance = mathUtil.getDistance(position, join);
|
|
|
|
|
|
+ const distance = this.getDistance(position, join);
|
|
if (!mathUtil.isContainForSegment(join, startPoint, endPoint)) {
|
|
if (!mathUtil.isContainForSegment(join, startPoint, endPoint)) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
@@ -232,7 +232,7 @@ export default class ListenLayer {
|
|
if (point.getCategory() == VectorCategory.Point.TestBasePoint) {
|
|
if (point.getCategory() == VectorCategory.Point.TestBasePoint) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- const distance = mathUtil.getDistance(position, point);
|
|
|
|
|
|
+ const distance = this.getDistance(position, point);
|
|
if (distance < Constant.minAdsorbPix) {
|
|
if (distance < Constant.minAdsorbPix) {
|
|
if (pointInfo.pointId == null) {
|
|
if (pointInfo.pointId == null) {
|
|
pointInfo = {
|
|
pointInfo = {
|
|
@@ -307,7 +307,7 @@ export default class ListenLayer {
|
|
let endPoint = dataService.getPoint(line.endId);
|
|
let endPoint = dataService.getPoint(line.endId);
|
|
const comLine = mathUtil.createLine1(startPoint, endPoint);
|
|
const comLine = mathUtil.createLine1(startPoint, endPoint);
|
|
const join = mathUtil.getJoinLinePoint(position, comLine);
|
|
const join = mathUtil.getJoinLinePoint(position, comLine);
|
|
- const distance = mathUtil.getDistance(position, join);
|
|
|
|
|
|
+ const distance = this.getDistance(position, join);
|
|
if (!mathUtil.isContainForSegment(join, startPoint, endPoint)) {
|
|
if (!mathUtil.isContainForSegment(join, startPoint, endPoint)) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
@@ -347,7 +347,7 @@ export default class ListenLayer {
|
|
}
|
|
}
|
|
const circle = dataService.getCircle(circleId);
|
|
const circle = dataService.getCircle(circleId);
|
|
for (let i = 0; i < circle.points.length; ++i) {
|
|
for (let i = 0; i < circle.points.length; ++i) {
|
|
- distance = mathUtil.getDistance(position, circle.points[i]);
|
|
|
|
|
|
+ distance = this.getDistance(position, circle.points[i]);
|
|
if (distance < Constant.minAdsorbPix) {
|
|
if (distance < Constant.minAdsorbPix) {
|
|
circleInfo = {
|
|
circleInfo = {
|
|
circleId: circleId,
|
|
circleId: circleId,
|
|
@@ -360,7 +360,7 @@ export default class ListenLayer {
|
|
return circleInfo;
|
|
return circleInfo;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- distance = mathUtil.getDistance(position, circle.center);
|
|
|
|
|
|
+ distance = this.getDistance(position, circle.center);
|
|
if (distance < circle.radius) {
|
|
if (distance < circle.radius) {
|
|
if (circleInfo.circleId == null || distance < circleInfo.distance) {
|
|
if (circleInfo.circleId == null || distance < circleInfo.distance) {
|
|
circleInfo = {
|
|
circleInfo = {
|
|
@@ -508,7 +508,7 @@ export default class ListenLayer {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
const roadPoint = dataService.getRoadPoint(roadPointId);
|
|
const roadPoint = dataService.getRoadPoint(roadPointId);
|
|
- const distance = mathUtil.getDistance(position, roadPoint);
|
|
|
|
|
|
+ const distance = this.getDistance(position, roadPoint);
|
|
if (distance < Constant.minAdsorbPix) {
|
|
if (distance < Constant.minAdsorbPix) {
|
|
if (roadPointInfo.roadPointId == null) {
|
|
if (roadPointInfo.roadPointId == null) {
|
|
roadPointInfo = {
|
|
roadPointInfo = {
|
|
@@ -583,7 +583,7 @@ export default class ListenLayer {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
const curveRoadPoint = dataService.getCurveRoadPoint(curveRoadPointId);
|
|
const curveRoadPoint = dataService.getCurveRoadPoint(curveRoadPointId);
|
|
- const distance = mathUtil.getDistance(position, curveRoadPoint);
|
|
|
|
|
|
+ const distance = this.getDistance(position, curveRoadPoint);
|
|
if (distance < Constant.minAdsorbPix) {
|
|
if (distance < Constant.minAdsorbPix) {
|
|
if (curveRoadPointInfo.curveRoadPointId == null) {
|
|
if (curveRoadPointInfo.curveRoadPointId == null) {
|
|
curveRoadPointInfo = {
|
|
curveRoadPointInfo = {
|
|
@@ -671,7 +671,7 @@ export default class ListenLayer {
|
|
const rightEdge = dataService.getRoadEdge(road.rightEdgeId);
|
|
const rightEdge = dataService.getRoadEdge(road.rightEdgeId);
|
|
const roadLine = roadService.getMidLine(road);
|
|
const roadLine = roadService.getMidLine(road);
|
|
let join = mathUtil.getJoinLinePoint(position, roadLine);
|
|
let join = mathUtil.getJoinLinePoint(position, roadLine);
|
|
- let distance = mathUtil.getDistance(position, join);
|
|
|
|
|
|
+ let distance = this.getDistance(position, join);
|
|
if (
|
|
if (
|
|
mathUtil.isContainForSegment(join, startPoint, endPoint) &&
|
|
mathUtil.isContainForSegment(join, startPoint, endPoint) &&
|
|
distance < Constant.minAdsorbPix
|
|
distance < Constant.minAdsorbPix
|
|
@@ -688,7 +688,7 @@ export default class ListenLayer {
|
|
//检查edge
|
|
//检查edge
|
|
let leftLine = mathUtil.createLine1(leftEdge.start, leftEdge.end);
|
|
let leftLine = mathUtil.createLine1(leftEdge.start, leftEdge.end);
|
|
join = mathUtil.getJoinLinePoint(position, leftLine);
|
|
join = mathUtil.getJoinLinePoint(position, leftLine);
|
|
- distance = mathUtil.getDistance(position, join);
|
|
|
|
|
|
+ distance = this.getDistance(position, join);
|
|
if (
|
|
if (
|
|
mathUtil.isContainForSegment(join, leftEdge.start, leftEdge.end) &&
|
|
mathUtil.isContainForSegment(join, leftEdge.start, leftEdge.end) &&
|
|
distance < Constant.minAdsorbPix
|
|
distance < Constant.minAdsorbPix
|
|
@@ -705,7 +705,7 @@ export default class ListenLayer {
|
|
|
|
|
|
let rightLine = mathUtil.createLine1(rightEdge.start, rightEdge.end);
|
|
let rightLine = mathUtil.createLine1(rightEdge.start, rightEdge.end);
|
|
join = mathUtil.getJoinLinePoint(position, rightLine);
|
|
join = mathUtil.getJoinLinePoint(position, rightLine);
|
|
- distance = mathUtil.getDistance(position, join);
|
|
|
|
|
|
+ distance = this.getDistance(position, join);
|
|
if (
|
|
if (
|
|
mathUtil.isContainForSegment(join, rightEdge.start, rightEdge.end) &&
|
|
mathUtil.isContainForSegment(join, rightEdge.start, rightEdge.end) &&
|
|
distance < Constant.minAdsorbPix
|
|
distance < Constant.minAdsorbPix
|
|
@@ -862,7 +862,7 @@ export default class ListenLayer {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
const crossPoint = dataService.getCrossPoint2(crossPointId);
|
|
const crossPoint = dataService.getCrossPoint2(crossPointId);
|
|
- const distance = mathUtil.getDistance(position, crossPoint.extremePoint);
|
|
|
|
|
|
+ const distance = this.getDistance(position, crossPoint.extremePoint);
|
|
if (distance < Constant.minAdsorbPix) {
|
|
if (distance < Constant.minAdsorbPix) {
|
|
crossCrossPointInfo = {
|
|
crossCrossPointInfo = {
|
|
crossCrossPointId: crossPointId,
|
|
crossCrossPointId: crossPointId,
|
|
@@ -889,7 +889,13 @@ export default class ListenLayer {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
const text = dataService.getText(textId);
|
|
const text = dataService.getText(textId);
|
|
- const distance = mathUtil.getDistance(position, text.center);
|
|
|
|
|
|
+ const distance = this.getDistance(position, text.center);
|
|
|
|
+ console.log(
|
|
|
|
+ "isSelectText-distance:" +
|
|
|
|
+ distance +
|
|
|
|
+ ",minAdsorbPix:" +
|
|
|
|
+ Constant.minAdsorbPix
|
|
|
|
+ );
|
|
if (distance < Constant.minAdsorbPix) {
|
|
if (distance < Constant.minAdsorbPix) {
|
|
textInfo = {
|
|
textInfo = {
|
|
textId: textId,
|
|
textId: textId,
|
|
@@ -916,7 +922,7 @@ export default class ListenLayer {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
const magnifier = dataService.getMagnifier(magnifierId);
|
|
const magnifier = dataService.getMagnifier(magnifierId);
|
|
- const distance = mathUtil.getDistance(position, magnifier.position);
|
|
|
|
|
|
+ const distance = this.getDistance(position, magnifier.position);
|
|
if (distance < Constant.minAdsorbPix) {
|
|
if (distance < Constant.minAdsorbPix) {
|
|
magnifierInfo = {
|
|
magnifierInfo = {
|
|
magnifierId: magnifierId,
|
|
magnifierId: magnifierId,
|
|
@@ -1278,6 +1284,13 @@ export default class ListenLayer {
|
|
return flag;
|
|
return flag;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ getDistance(start, end) {
|
|
|
|
+ return (
|
|
|
|
+ (mathUtil.getDistance(start, end) * coordinate.zoom) /
|
|
|
|
+ coordinate.defaultZoom
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
clear() {
|
|
clear() {
|
|
this.modifyPoint = null;
|
|
this.modifyPoint = null;
|
|
}
|
|
}
|