|
@@ -20,7 +20,7 @@ export default class CurveRoadEdge extends Geometry {
|
|
this.weight = VectorWight.Thinning;
|
|
this.weight = VectorWight.Thinning;
|
|
this.points = points || [];
|
|
this.points = points || [];
|
|
this.curves = [];
|
|
this.curves = [];
|
|
- this.curveRoadSide = null;
|
|
|
|
|
|
+ this.roadSide = null;
|
|
this.geoType = VectorType.CurveRoadEdge;
|
|
this.geoType = VectorType.CurveRoadEdge;
|
|
this.setId(vectorId);
|
|
this.setId(vectorId);
|
|
this.setPositions(start, end);
|
|
this.setPositions(start, end);
|
|
@@ -53,26 +53,26 @@ export default class CurveRoadEdge extends Geometry {
|
|
}
|
|
}
|
|
|
|
|
|
initCurveRoadSide() {
|
|
initCurveRoadSide() {
|
|
- if (!this.curveRoadSide) {
|
|
|
|
- this.curveRoadSide = {};
|
|
|
|
- this.curveRoadSide["width"] = Constant.roadSideWidth;
|
|
|
|
|
|
+ if (!this.roadSide) {
|
|
|
|
+ this.roadSide = {};
|
|
|
|
+ this.roadSide["width"] = Constant.roadSideWidth;
|
|
}
|
|
}
|
|
|
|
|
|
let startPoint = this.start;
|
|
let startPoint = this.start;
|
|
let curveRoad = dataService.getCurveRoad(this.parent);
|
|
let curveRoad = dataService.getCurveRoad(this.parent);
|
|
|
|
|
|
let endPoint = this.end;
|
|
let endPoint = this.end;
|
|
- // this.setStyle("curveRoadSide");
|
|
|
|
- let curveRoadSidePoints = mathUtil.RectangleVertex(startPoint, endPoint, (this.curveRoadSide.width * 2 * window.devicePixelRatio) / coordinate.res);
|
|
|
|
|
|
+ // this.setStyle("roadSide");
|
|
|
|
+ let curveRoadSidePoints = mathUtil.RectangleVertex(startPoint, endPoint, (this.roadSide.width * 2 * window.devicePixelRatio) / coordinate.res);
|
|
|
|
|
|
for (let key in curveRoad) {
|
|
for (let key in curveRoad) {
|
|
if (this.vectorId == curveRoad[key]) {
|
|
if (this.vectorId == curveRoad[key]) {
|
|
- this.curveRoadSide.points = [];
|
|
|
|
|
|
+ this.roadSide.points = [];
|
|
if (key == "rightEdgeId") {
|
|
if (key == "rightEdgeId") {
|
|
- this.curveRoadSide["start"] = curveRoadSidePoints.rightEdgeStart;
|
|
|
|
- this.curveRoadSide["end"] = curveRoadSidePoints.rightEdgeEnd;
|
|
|
|
- this.curveRoadSide.points.push(curveRoadSidePoints.rightEdgeStart);
|
|
|
|
- this.curveRoadSide.points.push(curveRoadSidePoints.rightEdgeEnd);
|
|
|
|
|
|
+ this.roadSide["start"] = curveRoadSidePoints.rightEdgeStart;
|
|
|
|
+ this.roadSide["end"] = curveRoadSidePoints.rightEdgeEnd;
|
|
|
|
+ this.roadSide.points.push(curveRoadSidePoints.rightEdgeStart);
|
|
|
|
+ this.roadSide.points.push(curveRoadSidePoints.rightEdgeEnd);
|
|
|
|
|
|
const midPoint = {
|
|
const midPoint = {
|
|
x: (curveRoadSidePoints.rightEdgeStart.x + curveRoadSidePoints.rightEdgeEnd.x) / 2,
|
|
x: (curveRoadSidePoints.rightEdgeStart.x + curveRoadSidePoints.rightEdgeEnd.x) / 2,
|
|
@@ -83,12 +83,12 @@ export default class CurveRoadEdge extends Geometry {
|
|
const join = mathUtil.getJoinLinePoint(midPoint, parallelLines.line1);
|
|
const join = mathUtil.getJoinLinePoint(midPoint, parallelLines.line1);
|
|
// let point = curveRoadPointService.create(join);
|
|
// let point = curveRoadPointService.create(join);
|
|
// let curveRoadSideMidPoint = { x: point.x, y: point.y };
|
|
// let curveRoadSideMidPoint = { x: point.x, y: point.y };
|
|
- this.curveRoadSide.points.splice(1, 0, join);
|
|
|
|
|
|
+ this.roadSide.points.splice(1, 0, join);
|
|
} else if (key == "leftEdgeId") {
|
|
} else if (key == "leftEdgeId") {
|
|
- this.curveRoadSide["start"] = curveRoadSidePoints.leftEdgeStart;
|
|
|
|
- this.curveRoadSide["end"] = curveRoadSidePoints.leftEdgeEnd;
|
|
|
|
- this.curveRoadSide.points.push(curveRoadSidePoints.leftEdgeStart);
|
|
|
|
- this.curveRoadSide.points.push(curveRoadSidePoints.leftEdgeEnd);
|
|
|
|
|
|
+ this.roadSide["start"] = curveRoadSidePoints.leftEdgeStart;
|
|
|
|
+ this.roadSide["end"] = curveRoadSidePoints.leftEdgeEnd;
|
|
|
|
+ this.roadSide.points.push(curveRoadSidePoints.leftEdgeStart);
|
|
|
|
+ this.roadSide.points.push(curveRoadSidePoints.leftEdgeEnd);
|
|
const midPoint = {
|
|
const midPoint = {
|
|
x: (curveRoadSidePoints.leftEdgeStart.x + curveRoadSidePoints.leftEdgeEnd.x) / 2,
|
|
x: (curveRoadSidePoints.leftEdgeStart.x + curveRoadSidePoints.leftEdgeEnd.x) / 2,
|
|
y: (curveRoadSidePoints.leftEdgeStart.y + curveRoadSidePoints.leftEdgeEnd.y) / 2,
|
|
y: (curveRoadSidePoints.leftEdgeStart.y + curveRoadSidePoints.leftEdgeEnd.y) / 2,
|
|
@@ -101,13 +101,12 @@ export default class CurveRoadEdge extends Geometry {
|
|
// console.error(join)
|
|
// console.error(join)
|
|
// console.error(point)
|
|
// console.error(point)
|
|
// let curveRoadSideMidPoint = { x: point.x, y: point.y };
|
|
// let curveRoadSideMidPoint = { x: point.x, y: point.y };
|
|
- this.curveRoadSide.points.splice(1, 0, join);
|
|
|
|
|
|
+ this.roadSide.points.splice(1, 0, join);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- let curves = mathUtil.getCurvesByPoints(this.curveRoadSide.points);
|
|
|
|
- this.curveRoadSide.curves = curves;
|
|
|
|
- // console.error(this.curveRoadSide);
|
|
|
|
|
|
+ let curves = mathUtil.getCurvesByPoints(this.roadSide.points);
|
|
|
|
+ this.roadSide.curves = curves;
|
|
// const midPoint = {
|
|
// const midPoint = {
|
|
// x: (startPoint.x + endPoint.x) / 2,
|
|
// x: (startPoint.x + endPoint.x) / 2,
|
|
// y: (startPoint.y + endPoint.y) / 2,
|
|
// y: (startPoint.y + endPoint.y) / 2,
|
|
@@ -118,27 +117,30 @@ export default class CurveRoadEdge extends Geometry {
|
|
|
|
|
|
// this.addCPoint(curveRoad, join, 1);
|
|
// this.addCPoint(curveRoad, join, 1);
|
|
|
|
|
|
- // if (this.curveRoadSide.width) {
|
|
|
|
|
|
+ // if (this.roadSide.width) {
|
|
// let curveRoad = dataService.getCurveRoad(this.parent);
|
|
// let curveRoad = dataService.getCurveRoad(this.parent);
|
|
- // this.curveRoadSide.points = [];
|
|
|
|
- // this.curveRoadSide.curves = [];
|
|
|
|
|
|
+ // this.roadSide.points = [];
|
|
|
|
+ // this.roadSide.curves = [];
|
|
// for (let i = 0; i < curveRoad.points.length; ++i) {
|
|
// for (let i = 0; i < curveRoad.points.length; ++i) {
|
|
- // this.curveRoadSide.points[i] = mathUtil.getLineEndPointPos(
|
|
|
|
|
|
+ // this.roadSide.points[i] = mathUtil.getLineEndPointPos(
|
|
// curveRoad.points[i],
|
|
// curveRoad.points[i],
|
|
// this.points[i],
|
|
// this.points[i],
|
|
- // this.curveRoadSide.width
|
|
|
|
|
|
+ // this.roadSide.width
|
|
// );
|
|
// );
|
|
// }
|
|
// }
|
|
- // this.curveRoadSide.curves = mathUtil.getCurvesByPoints(
|
|
|
|
- // this.curveRoadSide.points
|
|
|
|
|
|
+ // this.roadSide.curves = mathUtil.getCurvesByPoints(
|
|
|
|
+ // this.roadSide.points
|
|
// );
|
|
// );
|
|
// }
|
|
// }
|
|
}
|
|
}
|
|
setCurveRoadSideWidth(width) {
|
|
setCurveRoadSideWidth(width) {
|
|
- this.curveRoadSide.width = width;
|
|
|
|
|
|
+ this.roadSide.width = width;
|
|
this.initCurveRoadSide();
|
|
this.initCurveRoadSide();
|
|
}
|
|
}
|
|
|
|
+ setCurveRoadSide(roadSide) {
|
|
|
|
+ this.roadSide =JSON.parse(JSON.stringify(roadSide))
|
|
|
|
+ }
|
|
removeCurveRoadSide() {
|
|
removeCurveRoadSide() {
|
|
- this.curveRoadSide = null;
|
|
|
|
|
|
+ this.roadSide = null;
|
|
}
|
|
}
|
|
}
|
|
}
|