|
@@ -13,11 +13,6 @@ import { coordinate } from "../Coordinate.js";
|
|
export class ElementService {
|
|
export class ElementService {
|
|
constructor() {
|
|
constructor() {
|
|
this.point = null;
|
|
this.point = null;
|
|
-
|
|
|
|
- this.newLine = null;
|
|
|
|
- this.newLineStart = null;
|
|
|
|
- this.newLineEnd = null;
|
|
|
|
-
|
|
|
|
this.newRoad = null;
|
|
this.newRoad = null;
|
|
|
|
|
|
this.checkLinesXStart = null;
|
|
this.checkLinesXStart = null;
|
|
@@ -47,15 +42,6 @@ export class ElementService {
|
|
this.newRoad = this.createTempRoad();
|
|
this.newRoad = this.createTempRoad();
|
|
this.newRoad.name = ElementEvents.NewRoad;
|
|
this.newRoad.name = ElementEvents.NewRoad;
|
|
|
|
|
|
- this.newLineStart = new Point({ x: 0, y: 0 });
|
|
|
|
- this.newLineEnd = new Point({ x: 1, y: 1 });
|
|
|
|
- this.newLine = new Line(
|
|
|
|
- this.newLineStart.vectorId,
|
|
|
|
- this.newLineEnd.vectorId
|
|
|
|
- );
|
|
|
|
- this.newLine.setCategory(VectorCategory.Line.NormalLine);
|
|
|
|
- this.newLine.name = ElementEvents.NewLine;
|
|
|
|
-
|
|
|
|
this.checkLinesXStart = new Point({ x: 0, y: 0 });
|
|
this.checkLinesXStart = new Point({ x: 0, y: 0 });
|
|
this.checkLinesXEnd = new Point({ x: 1, y: 1 });
|
|
this.checkLinesXEnd = new Point({ x: 1, y: 1 });
|
|
this.checkLines.X = new Line(
|
|
this.checkLines.X = new Line(
|
|
@@ -96,11 +82,7 @@ export class ElementService {
|
|
}
|
|
}
|
|
|
|
|
|
getPoint(vectorId) {
|
|
getPoint(vectorId) {
|
|
- if (this.newLineStart.vectorId == vectorId) {
|
|
|
|
- return this.newLineStart;
|
|
|
|
- } else if (this.newLineEnd.vectorId == vectorId) {
|
|
|
|
- return this.newLineEnd;
|
|
|
|
- } else if (this.checkLinesXStart.vectorId == vectorId) {
|
|
|
|
|
|
+ if (this.checkLinesXStart.vectorId == vectorId) {
|
|
return this.checkLinesXStart;
|
|
return this.checkLinesXStart;
|
|
} else if (this.checkLinesXEnd.vectorId == vectorId) {
|
|
} else if (this.checkLinesXEnd.vectorId == vectorId) {
|
|
return this.checkLinesXEnd;
|
|
return this.checkLinesXEnd;
|
|
@@ -166,10 +148,6 @@ export class ElementService {
|
|
return this.newRoad;
|
|
return this.newRoad;
|
|
}
|
|
}
|
|
|
|
|
|
- setNewLineCategory(value) {
|
|
|
|
- this.newLine.setCategory(value);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
showPoint() {
|
|
showPoint() {
|
|
this.point.display = true;
|
|
this.point.display = true;
|
|
}
|
|
}
|
|
@@ -211,19 +189,6 @@ export class ElementService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- setNewLine(point1, point2) {
|
|
|
|
- this.newLineStart.setPosition(point1);
|
|
|
|
- this.newLineEnd.setPosition(point2);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- showNewLine() {
|
|
|
|
- this.newLine.display = true;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- hideNewLine() {
|
|
|
|
- this.newLine.display = false;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
setNewRoadState(state) {
|
|
setNewRoadState(state) {
|
|
this.newRoad.state = state;
|
|
this.newRoad.state = state;
|
|
}
|
|
}
|
|
@@ -285,7 +250,6 @@ export class ElementService {
|
|
this.hideCheckLinesY();
|
|
this.hideCheckLinesY();
|
|
this.hidePoint();
|
|
this.hidePoint();
|
|
this.hideNewRoad();
|
|
this.hideNewRoad();
|
|
- this.hideNewLine();
|
|
|
|
this.hideVCheckLinesX();
|
|
this.hideVCheckLinesX();
|
|
this.hideVCheckLinesY();
|
|
this.hideVCheckLinesY();
|
|
}
|
|
}
|
|
@@ -374,42 +338,6 @@ export class ElementService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- // //pointId是角度的顶点
|
|
|
|
- // //exceptPointId表示position对应的pointId(如果有的话)
|
|
|
|
- // checkAngle(position, pointId, exceptPointId) {
|
|
|
|
- // //type:1表示90°,2表示180°
|
|
|
|
- // function ajust(position, point1, point2, type) {
|
|
|
|
- // let line = mathUtil.createLine1(point1, point2);
|
|
|
|
- // let join = null;
|
|
|
|
- // if (type == 1) {
|
|
|
|
- // let vLine = mathUtil.getVerticalLine(line, point1);
|
|
|
|
- // join = mathUtil.getJoinLinePoint(position, vLine);
|
|
|
|
- // } else if (type == 2) {
|
|
|
|
- // join = mathUtil.getJoinLinePoint(position, line);
|
|
|
|
- // }
|
|
|
|
- // return join;
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
- // let points = roadService.getNeighPoints(pointId, exceptPointId);
|
|
|
|
- // let point = dataService.getRoadPoint(pointId);
|
|
|
|
- // let newPosition = null;
|
|
|
|
- // for (let i = 0; i < points.length; ++i) {
|
|
|
|
- // let angle = mathUtil.Angle(point, position, points[i]);
|
|
|
|
- // if (Math.abs((angle - 90) < 5) {
|
|
|
|
- // newPosition = ajust(position, point, points[i], 1);
|
|
|
|
- // } else if (
|
|
|
|
- // Math.abs(angle < 5 ||
|
|
|
|
- // Math.abs(angle - 180) < 5
|
|
|
|
- // ) {
|
|
|
|
- // newPosition = ajust(position, point, points[i], 2);
|
|
|
|
- // }
|
|
|
|
- // if (newPosition != null) {
|
|
|
|
- // return newPosition;
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // return newPosition;
|
|
|
|
- // }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
const elementService = new ElementService();
|
|
const elementService = new ElementService();
|