|
@@ -52,23 +52,49 @@ export default class CurveRoadEdge extends Geometry {
|
|
|
}
|
|
|
|
|
|
initCurveRoadSide() {
|
|
|
- if (this.curveRoadSide.width) {
|
|
|
- let curveRoad = dataService.getCurveRoad(this.parent);
|
|
|
- this.curveRoadSide.points = [];
|
|
|
- this.curveRoadSide.curves = [];
|
|
|
- for (let i = 0; i < curveRoad.points.length; ++i) {
|
|
|
- this.curveRoadSide.points[i] = mathUtil.getLineEndPointPos(
|
|
|
- curveRoad.points[i],
|
|
|
- this.points[i],
|
|
|
- this.curveRoadSide.width
|
|
|
- );
|
|
|
+ if (!this.curveRoadSide) {
|
|
|
+ this.curveRoadSide = {};
|
|
|
+ this.curveRoadSide["width"] = Constant.roadSideWidth;
|
|
|
+ }
|
|
|
+
|
|
|
+ let startPoint = this.start;
|
|
|
+ let curveRoad = dataService.getCurveRoad(this.parent);
|
|
|
+
|
|
|
+ let endPoint = this.end;
|
|
|
+
|
|
|
+ let curveRoadSidePoints = mathUtil.RectangleVertex(startPoint, endPoint, (this.curveRoadSide.width * 100 * window.devicePixelRatio) / 5);
|
|
|
+ for (let key in curveRoad) {
|
|
|
+ if (this.vectorId == curveRoad[key]) {
|
|
|
+ if (key == "rightEdgeId") {
|
|
|
+ this.curveRoadSide["start"] = curveRoadSidePoints.rightEdgeStart;
|
|
|
+ this.curveRoadSide["end"] = curveRoadSidePoints.rightEdgeEnd;
|
|
|
+ } else if (key == "leftEdgeId") {
|
|
|
+ this.curveRoadSide["start"] = curveRoadSidePoints.leftEdgeStart;
|
|
|
+ this.curveRoadSide["end"] = curveRoadSidePoints.leftEdgeEnd;
|
|
|
+ }
|
|
|
}
|
|
|
- this.curveRoadSide.curves = mathUtil.getCurvesByPoints(
|
|
|
- this.curveRoadSide.points
|
|
|
- );
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
+ // if (this.curveRoadSide.width) {
|
|
|
+ // let curveRoad = dataService.getCurveRoad(this.parent);
|
|
|
+ // this.curveRoadSide.points = [];
|
|
|
+ // this.curveRoadSide.curves = [];
|
|
|
+ // for (let i = 0; i < curveRoad.points.length; ++i) {
|
|
|
+ // this.curveRoadSide.points[i] = mathUtil.getLineEndPointPos(
|
|
|
+ // curveRoad.points[i],
|
|
|
+ // this.points[i],
|
|
|
+ // this.curveRoadSide.width
|
|
|
+ // );
|
|
|
+ // }
|
|
|
+ // this.curveRoadSide.curves = mathUtil.getCurvesByPoints(
|
|
|
+ // this.curveRoadSide.points
|
|
|
+ // );
|
|
|
+ // }
|
|
|
+ }
|
|
|
+ setRoadSideWidth(width) {
|
|
|
+ this.curveRoadSide.width = width;
|
|
|
+ this.initCurveRoadSide();
|
|
|
+ }
|
|
|
removeCurveRoadSide() {
|
|
|
this.curveRoadSide = null;
|
|
|
}
|