|
@@ -0,0 +1,101 @@
|
|
|
|
+import { mathUtil } from "../Util/MathUtil";
|
|
|
|
+import { circleService } from "../Service/CircleService";
|
|
|
|
+import { listenLayer } from "../ListenLayer";
|
|
|
|
+import { roadPointService } from "../Service/RoadPointService";
|
|
|
|
+import { roadService } from "../Service/RoadService";
|
|
|
|
+import { edgeService } from "../Service/EdgeService";
|
|
|
|
+
|
|
|
|
+export default class AddCrossRoad {
|
|
|
|
+ constructor() {}
|
|
|
|
+
|
|
|
|
+ build(position, count) {}
|
|
|
|
+
|
|
|
|
+ //三岔口
|
|
|
|
+ buildThree(position) {
|
|
|
|
+ const len = 300;
|
|
|
|
+ let start = roadPointService.create(position);
|
|
|
|
+ let end1 = roadPointService.create({
|
|
|
|
+ x: start.x,
|
|
|
|
+ y: start.y + len,
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ let end2 = roadPointService.create({
|
|
|
|
+ x: start.x + len,
|
|
|
|
+ y: start.y,
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ let end3 = roadPointService.create({
|
|
|
|
+ x: start.x - len,
|
|
|
|
+ y: start.y,
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ //需要设置公路的车道数,是否双向等等
|
|
|
|
+ // this.leftDrivewayCount = Setting.roadLeftDrivewayCount;
|
|
|
|
+ // this.rightDrivewayCount = Setting.roadRightDrivewayCount;
|
|
|
|
+ // this.singleRoadDrivewayCount = Setting.singleRoadDrivewayCount;
|
|
|
|
+ // this.way = Setting.wayType;
|
|
|
|
+
|
|
|
|
+ roadService.create(start.vectorId, end1.vectorId);
|
|
|
|
+ roadService.create(start.vectorId, end2.vectorId);
|
|
|
|
+ roadService.create(start.vectorId, end3.vectorId);
|
|
|
|
+ edgeService.updateEdgeForMulRoad(start.vectorId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //四岔口
|
|
|
|
+ buildFour(position) {
|
|
|
|
+ const len = 300;
|
|
|
|
+ let start = roadPointService.create(position);
|
|
|
|
+ let end1 = roadPointService.create({
|
|
|
|
+ x: start.x,
|
|
|
|
+ y: start.y + len,
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ let end2 = roadPointService.create({
|
|
|
|
+ x: start.x,
|
|
|
|
+ y: start.y - len,
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ let end3 = roadPointService.create({
|
|
|
|
+ x: start.x + len,
|
|
|
|
+ y: start.y,
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ let end4 = roadPointService.create({
|
|
|
|
+ x: start.x - len,
|
|
|
|
+ y: start.y,
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ //需要设置公路的车道数,是否双向等等
|
|
|
|
+ // this.leftDrivewayCount = Setting.roadLeftDrivewayCount;
|
|
|
|
+ // this.rightDrivewayCount = Setting.roadRightDrivewayCount;
|
|
|
|
+ // this.singleRoadDrivewayCount = Setting.singleRoadDrivewayCount;
|
|
|
|
+ // this.way = Setting.wayType;
|
|
|
|
+
|
|
|
|
+ roadService.create(start.vectorId, end1.vectorId);
|
|
|
|
+ roadService.create(start.vectorId, end2.vectorId);
|
|
|
|
+ roadService.create(start.vectorId, end3.vectorId);
|
|
|
|
+ roadService.create(start.vectorId, end4.vectorId);
|
|
|
|
+ edgeService.updateEdgeForMulRoad(start.vectorId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //五岔口
|
|
|
|
+ buildFive(position) {
|
|
|
|
+ const len = 300;
|
|
|
|
+ const points = mathUtil.createFivePointedStar(position, len);
|
|
|
|
+ let start = roadPointService.create(position);
|
|
|
|
+ let end1 = roadPointService.create(points[0]);
|
|
|
|
+ let end2 = roadPointService.create(points[1]);
|
|
|
|
+ let end3 = roadPointService.create(points[2]);
|
|
|
|
+ let end4 = roadPointService.create(points[3]);
|
|
|
|
+ let end5 = roadPointService.create(points[4]);
|
|
|
|
+ roadService.create(start.vectorId, end1.vectorId);
|
|
|
|
+ roadService.create(start.vectorId, end2.vectorId);
|
|
|
|
+ roadService.create(start.vectorId, end3.vectorId);
|
|
|
|
+ roadService.create(start.vectorId, end4.vectorId);
|
|
|
|
+ roadService.create(start.vectorId, end5.vectorId);
|
|
|
|
+ edgeService.updateEdgeForMulRoad(start.vectorId);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+const addCrossRoad = new AddCrossRoad();
|
|
|
|
+export { addCrossRoad };
|