1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import VectorType from "../enum/VectorType.js";
- import Road from "./Road.js";
- import Settings from "../Settings";
- export default class CurveRoad extends Road {
- constructor(startId, endId, vectorId) {
- super(startId, endId, vectorId);
- this.points = []; //中心线上一系列控制点。数组是从start到end。
- this.leftLanesCurves = []; //左车道曲线
- this.rightLanesCurves = []; //左车道曲线
- this.singleLanesCurves = []; //单向车道
- this.leftDrivewayCount = Settings.curveRoadLeftDrivewayCount; //左边的车道个数
- this.rightDrivewayCount = Settings.curveRoadRightDrivewayCount; //右边的车道个数
- this.leftWidth = Settings.leftCurveRoadWidth;
- this.rightWidth = Settings.rightCurveRoadWidth;
- this.midDivide = {
- leftMidDivide: [],
- leftMidDivideCurves: [],
- rightMidDivide: [],
- rightMidDivideCurves: [],
- midDivideWidth: Settings.curveRoadMidDivideWidth,
- };
- this.curves = [];
- this.singleCurveRoadWidth = Settings.singleCurveRoadWidth;
- this.singleCurveRoadDrivewayCount = Settings.singleCurveRoadDrivewayCount;
- this.geoType = VectorType.CurveRoad;
- this.setId(vectorId);
- }
- getLanesCount(dir) {
- if (this.way == Constant.oneWay) {
- return this.singleCurveRoadDrivewayCount;
- } else if (this.way == Constant.twoWay) {
- if (dir == "left") {
- return this.leftDrivewayCount;
- } else {
- return this.rightDrivewayCount;
- }
- }
- }
- }
|