CurveRoadService.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. import { dataService } from "./DataService";
  2. import { curvePointService } from "./CurvePointService";
  3. import { curveEdgeService } from "./CurveEdgeService";
  4. import { mathUtil } from "../Util/MathUtil.js";
  5. import CurveRoad from "../Geometry/CurveRoad.js";
  6. import VectorType from "../enum/VectorType";
  7. import Constant from "../Constant";
  8. import RoadService from "./RoadService";
  9. export default class CurveRoadService extends RoadService {
  10. constructor() {
  11. super();
  12. }
  13. create(startId, endId, vectorId) {
  14. let curveRoad = new CurveRoad(startId, endId, vectorId);
  15. dataService.addCurveRoad(curveRoad);
  16. let startPoint = dataService.getCurvePoint(startId);
  17. startPoint.setPointParent(curveRoad.vectorId);
  18. startPoint.setIndex(0);
  19. let endPoint = dataService.getCurvePoint(endId);
  20. endPoint.setPointParent(curveRoad.vectorId);
  21. endPoint.setIndex(2);
  22. let edgePoints = mathUtil.RectangleVertex(
  23. startPoint,
  24. endPoint,
  25. curveRoad.width
  26. );
  27. let leftEdge = curveEdgeService.create(
  28. edgePoints.leftEdgeStart,
  29. edgePoints.leftEdgeEnd,
  30. null,
  31. vectorId
  32. );
  33. let rightEdge = curveEdgeService.create(
  34. edgePoints.rightEdgeStart,
  35. edgePoints.rightEdgeEnd,
  36. null,
  37. vectorId
  38. );
  39. curveRoad.setLeftEdge(leftEdge.vectorId);
  40. curveRoad.setRightEdge(rightEdge.vectorId);
  41. if (!vectorId) {
  42. leftEdge.setEdgeParent(curveRoad.vectorId);
  43. rightEdge.setEdgeParent(curveRoad.vectorId);
  44. }
  45. curveRoad.points.push(startPoint);
  46. curveRoad.points.push(endPoint);
  47. leftEdge.points.push(edgePoints.leftEdgeStart);
  48. leftEdge.points.push(edgePoints.leftEdgeEnd);
  49. rightEdge.points.push(edgePoints.rightEdgeStart);
  50. rightEdge.points.push(edgePoints.rightEdgeEnd);
  51. this.setLanes(curveRoad);
  52. this.addCPoint(
  53. curveRoad,
  54. {
  55. x: (startPoint.x + endPoint.x) / 2,
  56. y: (startPoint.y + endPoint.y) / 2,
  57. },
  58. 0
  59. );
  60. return curveRoad;
  61. }
  62. //不能加首尾,只能加中间
  63. addCPoint(curveRoad, position, startIndex) {
  64. let point = curvePointService.create(position);
  65. curveRoad.points.splice(startIndex + 1, 0, point);
  66. point.setPointParent(curveRoad.vectorId, startIndex);
  67. point.setIndex(startIndex + 1);
  68. for (let i = startIndex + 2; i < curveRoad.points.length; ++i) {
  69. curveRoad.points[i].setIndex(i);
  70. }
  71. let leftCount = curveRoad.leftDrivewayCount;
  72. let rightCount = curveRoad.rightDrivewayCount;
  73. let leftJoin = null;
  74. let rightJoin = null;
  75. const leftCurveEdge = dataService.getCurveEdge(curveRoad.leftEdgeId);
  76. const rightCurveEdge = dataService.getCurveEdge(curveRoad.rightEdgeId);
  77. let line1 = mathUtil.createLine1(
  78. curveRoad.points[startIndex],
  79. curveRoad.points[startIndex + 1]
  80. );
  81. let line2 = mathUtil.createLine1(
  82. curveRoad.points[startIndex + 1],
  83. curveRoad.points[startIndex + 2]
  84. );
  85. const leftLine = mathUtil.createLine1(
  86. leftCurveEdge.points[startIndex],
  87. leftCurveEdge.points[startIndex + 1]
  88. );
  89. let leftLine1 = mathUtil.createLine3(
  90. line1,
  91. leftCurveEdge.points[startIndex]
  92. );
  93. let leftLine2 = mathUtil.createLine3(
  94. line2,
  95. leftCurveEdge.points[startIndex + 1]
  96. );
  97. const rightLine = mathUtil.createLine1(
  98. rightCurveEdge.points[startIndex],
  99. rightCurveEdge.points[startIndex + 1]
  100. );
  101. let rightLine1 = mathUtil.createLine3(
  102. line1,
  103. rightCurveEdge.points[startIndex]
  104. );
  105. let rightLine2 = mathUtil.createLine3(
  106. line2,
  107. rightCurveEdge.points[startIndex + 1]
  108. );
  109. if (
  110. mathUtil.Angle(
  111. curveRoad.points[startIndex + 1],
  112. curveRoad.points[startIndex],
  113. curveRoad.points[startIndex + 2]
  114. ) > Constant.maxAngle
  115. ) {
  116. leftJoin = mathUtil.getJoinLinePoint(position, leftLine);
  117. leftCurveEdge.points.splice(startIndex + 1, 0, leftJoin);
  118. curveEdgeService.setCurves(leftCurveEdge);
  119. rightJoin = mathUtil.getJoinLinePoint(position, rightLine);
  120. rightCurveEdge.points.splice(startIndex + 1, 0, rightJoin);
  121. curveEdgeService.setCurves(rightCurveEdge);
  122. for (let i = 0; i < leftCount - 1; ++i) {
  123. const leftLaneLine = mathUtil.createLine1(
  124. curveRoad.leftLanes[i][startIndex],
  125. curveRoad.leftLanes[i][startIndex + 1]
  126. );
  127. leftJoin = mathUtil.getJoinLinePoint(position, leftLaneLine);
  128. curveRoad.leftLanes[i].splice(startIndex + 1, 0, leftJoin);
  129. curveRoad.leftLanesCurves[i] = mathUtil.getCurvesByPoints(
  130. curveRoad.leftLanes[i]
  131. );
  132. }
  133. for (let i = 0; i < rightCount - 1; ++i) {
  134. const rightLaneLine = mathUtil.createLine1(
  135. curveRoad.rightLanes[i][startIndex],
  136. curveRoad.rightLanes[i][startIndex + 1]
  137. );
  138. rightJoin = mathUtil.getJoinLinePoint(position, rightLaneLine);
  139. curveRoad.rightLanes[i].splice(startIndex + 1, 0, rightJoin);
  140. curveRoad.rightLanesCurves[i] = mathUtil.getCurvesByPoints(
  141. curveRoad.rightLanes[i]
  142. );
  143. }
  144. } else {
  145. leftJoin = mathUtil.getIntersectionPoint(leftLine1, leftLine2);
  146. leftCurveEdge.points.splice(startIndex + 1, 0, leftJoin);
  147. curveEdgeService.setCurves(leftCurveEdge);
  148. for (let i = 0; i < leftCount - 1; ++i) {
  149. leftLine1 = mathUtil.createLine3(
  150. line1,
  151. curveRoad.leftLanes[i][startIndex]
  152. );
  153. leftLine2 = mathUtil.createLine3(
  154. line2,
  155. curveRoad.leftLanes[i][startIndex + 1]
  156. );
  157. leftJoin = mathUtil.getIntersectionPoint(leftLine1, leftLine2);
  158. curveRoad.leftLanes[i].splice(startIndex + 1, 0, leftJoin);
  159. curveRoad.leftLanesCurves[i] = mathUtil.getCurvesByPoints(
  160. curveRoad.leftLanes[i]
  161. );
  162. }
  163. rightJoin = mathUtil.getIntersectionPoint(rightLine1, rightLine2);
  164. rightCurveEdge.points.splice(startIndex + 1, 0, rightJoin);
  165. curveEdgeService.setCurves(rightCurveEdge);
  166. for (let i = 0; i < rightCount - 1; ++i) {
  167. rightLine1 = mathUtil.createLine3(
  168. line1,
  169. curveRoad.rightLanes[i][startIndex]
  170. );
  171. rightLine2 = mathUtil.createLine3(
  172. line2,
  173. curveRoad.rightLanes[i][startIndex + 1]
  174. );
  175. rightJoin = mathUtil.getIntersectionPoint(rightLine1, rightLine2);
  176. curveRoad.rightLanes[i].splice(startIndex + 1, 0, rightJoin);
  177. curveRoad.rightLanesCurves[i] = mathUtil.getCurvesByPoints(
  178. curveRoad.rightLanes[i]
  179. );
  180. }
  181. }
  182. this.setCurves(curveRoad);
  183. }
  184. subCPoint(curveRoad, index) {
  185. dataService.deleteCurvePoint(curveRoad.points[index].vectorId);
  186. curveRoad.points.splice(index, 1);
  187. for (let i = index; i < curveRoad.points.length; ++i) {
  188. curveRoad.points[i].setIndex(i);
  189. }
  190. this.setCurves(curveRoad);
  191. const leftCurveEdge = dataService.getCurveEdge(curveRoad.leftEdgeId);
  192. leftCurveEdge.points.splice(index, 1);
  193. curveEdgeService.setCurves(leftCurveEdge);
  194. const rightCurveEdge = dataService.getCurveEdge(curveRoad.rightEdgeId);
  195. rightCurveEdge.points.splice(index, 1);
  196. curveEdgeService.setCurves(rightCurveEdge);
  197. this.removeCPointToLanes(curveRoad, index);
  198. }
  199. removeCPointToLanes(curveRoad, index) {
  200. for (let i = 0; i < curveRoad.leftLanes.length; ++i) {
  201. curveRoad.leftLanes[i].splice(index, 1);
  202. curveRoad.leftLanesCurves[i] = mathUtil.getCurvesByPoints(
  203. curveRoad.leftLanes[i]
  204. );
  205. }
  206. for (let i = 0; i < curveRoad.rightLanes.length; ++i) {
  207. curveRoad.rightLanes[i].splice(index, 1);
  208. curveRoad.rightLanesCurves[i] = mathUtil.getCurvesByPoints(
  209. curveRoad.rightLanes[i]
  210. );
  211. }
  212. }
  213. setLanesPoints(curveRoadId) {
  214. let curveRoad = dataService.getCurveRoad(curveRoadId);
  215. let startPoint = dataService.getPoint(curveRoad.startId);
  216. let endPoint = dataService.getPoint(curveRoad.endId);
  217. let midPoint = curvePointService.create({
  218. x: (startPoint.x + endPoint.x) / 2,
  219. y: (startPoint.y + endPoint.y) / 2,
  220. });
  221. curveRoad.points = [];
  222. curveRoad.points.push(startPoint);
  223. curveRoad.points.push(midPoint);
  224. curveRoad.points.push(endPoint);
  225. }
  226. //车道
  227. //points的第一个元素是start,最后一个是end
  228. setLanes(curveRoad, dir) {
  229. let points = curveRoad.points;
  230. const leftEdge = dataService.getCurveEdge(curveRoad.leftEdgeId);
  231. const rightEdge = dataService.getCurveEdge(curveRoad.rightEdgeId);
  232. const leftEdgePoints = leftEdge.points;
  233. const rightEdgePoints = rightEdge.points;
  234. const leftCount = curveRoad.leftDrivewayCount;
  235. const rightCount = curveRoad.rightDrivewayCount;
  236. let leftLanes = [];
  237. let leftLanesCurves = [];
  238. let rightLanes = [];
  239. let rightLanesCurves = [];
  240. if (dir == "left" || !dir) {
  241. for (let i = 0; i < leftCount - 1; ++i) {
  242. for (let j = 0; j < points.length; ++j) {
  243. if (!leftLanes[i]) {
  244. leftLanes[i] = [];
  245. }
  246. const leftdx = (leftEdgePoints[j].x - points[j].x) / leftCount;
  247. const leftdy = (leftEdgePoints[j].y - points[j].y) / leftCount;
  248. leftLanes[i][j] = {};
  249. leftLanes[i][j].x = points[j].x + leftdx * (i + 1);
  250. leftLanes[i][j].y = points[j].y + leftdy * (i + 1);
  251. }
  252. leftLanesCurves[i] = mathUtil.getCurvesByPoints(leftLanes[i]);
  253. }
  254. curveRoad.leftLanes = leftLanes;
  255. curveRoad.leftLanesCurves = leftLanesCurves;
  256. }
  257. if (dir == "right" || !dir) {
  258. for (let i = 0; i < rightCount - 1; ++i) {
  259. for (let j = 0; j < points.length; ++j) {
  260. if (!rightLanes[i]) {
  261. rightLanes[i] = [];
  262. }
  263. const rightdx = (rightEdgePoints[j].x - points[j].x) / rightCount;
  264. const rightdy = (rightEdgePoints[j].y - points[j].y) / rightCount;
  265. rightLanes[i][j] = {};
  266. rightLanes[i][j].x = points[j].x + rightdx * (i + 1);
  267. rightLanes[i][j].y = points[j].y + rightdy * (i + 1);
  268. }
  269. rightLanesCurves[i] = mathUtil.getCurvesByPoints(rightLanes[i]);
  270. }
  271. curveRoad.rightLanes = rightLanes;
  272. curveRoad.rightLanesCurves = rightLanesCurves;
  273. }
  274. }
  275. //删除或者减少车道
  276. updateForAddSubtractLanesCount(curveRoad, newCount, dir) {
  277. let curveEdge, oldCount, lanes;
  278. if (newCount < 0) {
  279. newCount = 0;
  280. }
  281. if (dir == "left") {
  282. curveEdge = dataService.getCurveEdge(curveRoad.leftEdgeId);
  283. oldCount = curveRoad.leftDrivewayCount;
  284. curveRoad.leftDrivewayCount = newCount;
  285. lanes = curveRoad.leftLanes;
  286. } else if (dir == "right") {
  287. curveEdge = dataService.getCurveEdge(curveRoad.rightEdgeId);
  288. oldCount = curveRoad.rightDrivewayCount;
  289. curveRoad.rightDrivewayCount = newCount;
  290. lanes = curveRoad.rightLanes;
  291. }
  292. if (newCount == oldCount) {
  293. return;
  294. } else if (newCount == 0) {
  295. this.mulToSinglelane(curveRoad);
  296. return;
  297. } else if (oldCount == 0) {
  298. this.singleToMullane(curveRoad);
  299. return;
  300. }
  301. for (let i = 0; i < curveRoad.points.length; ++i) {
  302. const dx = (curveEdge.points[i].x - curveRoad.points[i].x) / oldCount;
  303. curveEdge.points[i].x = curveRoad.points[i].x + dx * newCount;
  304. const dy = (curveEdge.points[i].y - curveRoad.points[i].y) / oldCount;
  305. curveEdge.points[i].y = curveRoad.points[i].y + dy * newCount;
  306. }
  307. mathUtil.clonePoint(curveEdge.start, curveEdge.points[0]);
  308. mathUtil.clonePoint(
  309. curveEdge.end,
  310. curveEdge.points[curveEdge.points.length - 1]
  311. );
  312. curveEdgeService.setCurves(curveEdge);
  313. this.setLanes(curveRoad, dir);
  314. const line = mathUtil.createLine1(curveRoad.points[0], curveRoad.points[1]);
  315. const leftCurveEdge = dataService.getCurveEdge(curveRoad.leftEdgeId);
  316. const rightCurveEdge = dataService.getCurveEdge(curveRoad.leftEdgeId);
  317. const leftWidth = mathUtil.getDisForPoinLine(leftCurveEdge.start, line);
  318. const rightWidth = mathUtil.getDisForPoinLine(rightCurveEdge.start, line);
  319. curveRoad.setWidth(leftWidth + rightWidth);
  320. }
  321. //单车道转多车道,默认是转换成左右两边各一个
  322. //不改变路的宽度
  323. singleToMullane(curveRoad) {
  324. curveRoad.leftDrivewayCount = 1;
  325. curveRoad.rightDrivewayCount = 1;
  326. this.setLanes(curveRoad);
  327. }
  328. //多车道转单车道
  329. mulToSinglelane(curveRoad) {
  330. if (curveRoad.leftDrivewayCount > 0) {
  331. this.updateForAddSubtractLanesCount(curveRoad, 1, "left");
  332. }
  333. if (curveRoad.rightDrivewayCount > 0) {
  334. this.updateForAddSubtractLanesCount(curveRoad, 1, "right");
  335. }
  336. curveRoad.leftDrivewayCount = 0;
  337. curveRoad.rightDrivewayCount = 0;
  338. curveRoad.leftLanesCurves = [];
  339. curveRoad.rightLanesCurves = [];
  340. curveRoad.leftLanes = [];
  341. curveRoad.rightLanes = [];
  342. }
  343. updateForMovePoint(pointId, position) {
  344. let curvePoint = dataService.getCurvePoint(pointId);
  345. let curveRoadId = curvePoint.getParent();
  346. let curveRoad = dataService.getCurveRoad(curveRoadId);
  347. let index = curvePoint.getIndex();
  348. let dx = position.x - curvePoint.x;
  349. let dy = position.y - curvePoint.y;
  350. curvePoint.setPosition(position);
  351. let line = null;
  352. let join = null;
  353. let len = curveRoad.points.length;
  354. const leftCurveEdge = dataService.getCurveEdge(curveRoad.leftEdgeId);
  355. leftCurveEdge.points[index].x += dx;
  356. leftCurveEdge.points[index].y += dy;
  357. const rightCurveEdge = dataService.getCurveEdge(curveRoad.rightEdgeId);
  358. rightCurveEdge.points[index].x += dx;
  359. rightCurveEdge.points[index].y += dy;
  360. if (index == 0 || index == 1) {
  361. line = mathUtil.createLine1(curveRoad.points[0], curveRoad.points[1]);
  362. if (
  363. line != null &&
  364. !line.hasOwnProperty("x") &&
  365. !line.hasOwnProperty("y")
  366. ) {
  367. let line1 = mathUtil.createLine3(line, leftCurveEdge.points[index]);
  368. join = mathUtil.getJoinLinePoint(curveRoad.points[0], line1);
  369. leftCurveEdge.points[0].x = join.x;
  370. leftCurveEdge.points[0].y = join.y;
  371. leftCurveEdge.start.x = join.x;
  372. leftCurveEdge.start.y = join.y;
  373. let line2 = mathUtil.createLine3(line, rightCurveEdge.points[index]);
  374. join = mathUtil.getJoinLinePoint(curveRoad.points[0], line2);
  375. rightCurveEdge.points[0].x = join.x;
  376. rightCurveEdge.points[0].y = join.y;
  377. rightCurveEdge.start.x = join.x;
  378. rightCurveEdge.start.y = join.y;
  379. }
  380. }
  381. if (
  382. index == curveRoad.points.length - 1 ||
  383. index == curveRoad.points.length - 2
  384. ) {
  385. line = mathUtil.createLine1(
  386. curveRoad.points[len - 2],
  387. curveRoad.points[len - 1]
  388. );
  389. if (
  390. line != null &&
  391. !line.hasOwnProperty("x") &&
  392. !line.hasOwnProperty("y")
  393. ) {
  394. let line1 = mathUtil.createLine3(line, leftCurveEdge.points[index]);
  395. join = mathUtil.getJoinLinePoint(curveRoad.points[len - 1], line1);
  396. leftCurveEdge.points[len - 1].x = join.x;
  397. leftCurveEdge.points[len - 1].y = join.y;
  398. leftCurveEdge.end.x = join.x;
  399. leftCurveEdge.end.y = join.y;
  400. let line2 = mathUtil.createLine3(line, rightCurveEdge.points[index]);
  401. join = mathUtil.getJoinLinePoint(curveRoad.points[len - 1], line2);
  402. rightCurveEdge.points[len - 1].x = join.x;
  403. rightCurveEdge.points[len - 1].y = join.y;
  404. rightCurveEdge.end.x = join.x;
  405. rightCurveEdge.end.y = join.y;
  406. }
  407. }
  408. for (let i = 0; i < curveRoad.leftLanes.length; ++i) {
  409. curveRoad.leftLanes[i][index].x += dx;
  410. curveRoad.leftLanes[i][index].y += dy;
  411. //需要修改端点
  412. if (
  413. index == 0 ||
  414. index == 1 ||
  415. index == curveRoad.points.length - 1 ||
  416. index == curveRoad.points.length - 2
  417. ) {
  418. if (index == 0 || index == 1) {
  419. line = mathUtil.createLine1(curveRoad.points[0], curveRoad.points[1]);
  420. if (
  421. line != null &&
  422. !line.hasOwnProperty("x") &&
  423. !line.hasOwnProperty("y")
  424. ) {
  425. line = mathUtil.createLine3(line, curveRoad.leftLanes[i][index]);
  426. join = mathUtil.getJoinLinePoint(curveRoad.points[0], line);
  427. curveRoad.leftLanes[i][0].x = join.x;
  428. curveRoad.leftLanes[i][0].y = join.y;
  429. }
  430. }
  431. if (
  432. index == curveRoad.points.length - 1 ||
  433. index == curveRoad.points.length - 2
  434. ) {
  435. line = mathUtil.createLine1(
  436. curveRoad.points[len - 2],
  437. curveRoad.points[len - 1]
  438. );
  439. if (
  440. line != null &&
  441. !line.hasOwnProperty("x") &&
  442. !line.hasOwnProperty("y")
  443. ) {
  444. line = mathUtil.createLine3(line, curveRoad.leftLanes[i][index]);
  445. join = mathUtil.getJoinLinePoint(curveRoad.points[len - 1], line);
  446. curveRoad.leftLanes[i][len - 1].x = join.x;
  447. curveRoad.leftLanes[i][len - 1].y = join.y;
  448. }
  449. }
  450. }
  451. curveRoad.leftLanesCurves[i] = mathUtil.getCurvesByPoints(
  452. curveRoad.leftLanes[i]
  453. );
  454. }
  455. for (let i = 0; i < curveRoad.rightLanes.length; ++i) {
  456. curveRoad.rightLanes[i][index].x += dx;
  457. curveRoad.rightLanes[i][index].y += dy;
  458. //需要修改端点
  459. if (
  460. index == 0 ||
  461. index == 1 ||
  462. index == curveRoad.points.length - 1 ||
  463. index == curveRoad.points.length - 2
  464. ) {
  465. if (index == 0 || index == 1) {
  466. line = mathUtil.createLine1(curveRoad.points[0], curveRoad.points[1]);
  467. if (
  468. line != null &&
  469. !line.hasOwnProperty("x") &&
  470. !line.hasOwnProperty("y")
  471. ) {
  472. line = mathUtil.createLine3(line, curveRoad.rightLanes[i][index]);
  473. join = mathUtil.getJoinLinePoint(curveRoad.points[0], line);
  474. curveRoad.rightLanes[i][0].x = join.x;
  475. curveRoad.rightLanes[i][0].y = join.y;
  476. }
  477. }
  478. if (
  479. index == curveRoad.points.length - 1 ||
  480. index == curveRoad.points.length - 2
  481. ) {
  482. line = mathUtil.createLine1(
  483. curveRoad.points[len - 2],
  484. curveRoad.points[len - 1]
  485. );
  486. if (
  487. line != null &&
  488. !line.hasOwnProperty("x") &&
  489. !line.hasOwnProperty("y")
  490. ) {
  491. line = mathUtil.createLine3(line, curveRoad.rightLanes[i][index]);
  492. join = mathUtil.getJoinLinePoint(curveRoad.points[len - 1], line);
  493. curveRoad.rightLanes[i][len - 1].x = join.x;
  494. curveRoad.rightLanes[i][len - 1].y = join.y;
  495. }
  496. }
  497. }
  498. curveRoad.rightLanesCurves[i] = mathUtil.getCurvesByPoints(
  499. curveRoad.rightLanes[i]
  500. );
  501. }
  502. this.setCurves(curveRoad);
  503. curveEdgeService.setCurves(leftCurveEdge);
  504. curveEdgeService.setCurves(rightCurveEdge);
  505. }
  506. setCurves(curveRoad) {
  507. curveRoad.curves = mathUtil.getCurvesByPoints(curveRoad.points);
  508. }
  509. }
  510. const curveRoadService = new CurveRoadService();
  511. export { curveRoadService };