|
@@ -149,8 +149,7 @@ export const help = {
|
|
|
return (
|
|
|
Math.round(
|
|
|
(mathUtil.getDistance(p1, p2) * coordinate.res * 100) / coordinate.ratio
|
|
|
- )
|
|
|
- / 100
|
|
|
+ ) / 100
|
|
|
);
|
|
|
},
|
|
|
getPerpendicularPoint(p1, p2, p3, d) {
|
|
@@ -232,12 +231,11 @@ export const help = {
|
|
|
VectorStyle.PointDrawLine,
|
|
|
VectorStyle.SingleDashedLine,
|
|
|
VectorStyle.SingleSolidLine,
|
|
|
- ]
|
|
|
+ ];
|
|
|
if (typeof line === "function" && !funStyle.includes(style)) {
|
|
|
- style = VectorStyle.SingleSolidLine
|
|
|
+ style = VectorStyle.SingleSolidLine;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
switch (style) {
|
|
|
case VectorStyle.PointDrawLine:
|
|
|
case VectorStyle.SingleDashedLine:
|
|
@@ -253,8 +251,8 @@ export const help = {
|
|
|
]);
|
|
|
}
|
|
|
|
|
|
- if (typeof line === 'function') {
|
|
|
- line()
|
|
|
+ if (typeof line === "function") {
|
|
|
+ line();
|
|
|
} else {
|
|
|
ctx.moveTo(line[0].x, line[0].y);
|
|
|
ctx.lineTo(line[1].x, line[1].y);
|
|
@@ -426,9 +424,9 @@ export default class Draw {
|
|
|
const center = coordinate.getScreenXY(vector.center);
|
|
|
this.context.save();
|
|
|
if (vector.scale) {
|
|
|
- this.context.translate(center.x, center.y)
|
|
|
- this.context.scale(vector.scale, vector.scale)
|
|
|
- this.context.translate(-center.x, -center.y)
|
|
|
+ this.context.translate(center.x, center.y);
|
|
|
+ this.context.scale(vector.scale, vector.scale);
|
|
|
+ this.context.translate(-center.x, -center.y);
|
|
|
}
|
|
|
this.context.drawImage(
|
|
|
img,
|
|
@@ -489,13 +487,13 @@ export default class Draw {
|
|
|
};
|
|
|
|
|
|
ctx.save();
|
|
|
- help.setStyle(ctx, styles)
|
|
|
+ help.setStyle(ctx, styles);
|
|
|
vector.midDivide.leftMidDivide && draw(vector.midDivide.leftMidDivide);
|
|
|
vector.midDivide.rightMidDivide && draw(vector.midDivide.rightMidDivide);
|
|
|
|
|
|
ctx.restore();
|
|
|
}
|
|
|
- console.log(styles, label, vector)
|
|
|
+ console.log(styles, label, vector);
|
|
|
|
|
|
if (import.meta.env.DEV && !isTemp) {
|
|
|
const startReal = isTemp
|
|
@@ -511,9 +509,12 @@ export default class Draw {
|
|
|
}
|
|
|
|
|
|
this.drawRoadEdge(vector, isTemp);
|
|
|
- vector.leftLanes && vector.leftLanes.forEach((g) => this.drawLan(g, !!label));
|
|
|
- vector.rightLanes && vector.rightLanes.forEach((g) => this.drawLan(g, !!label));
|
|
|
- vector.singleLanes && vector.singleLanes.forEach((g) => this.drawLan(g, !!label));
|
|
|
+ vector.leftLanes &&
|
|
|
+ vector.leftLanes.forEach((g) => this.drawLan(g, !!label));
|
|
|
+ vector.rightLanes &&
|
|
|
+ vector.rightLanes.forEach((g) => this.drawLan(g, !!label));
|
|
|
+ vector.singleLanes &&
|
|
|
+ vector.singleLanes.forEach((g) => this.drawLan(g, !!label));
|
|
|
}
|
|
|
|
|
|
drawLan(lan, focus) {
|
|
@@ -523,9 +524,9 @@ export default class Draw {
|
|
|
ctx.save();
|
|
|
ctx.beginPath();
|
|
|
help.setVectorStyle(ctx, null, "Lane");
|
|
|
- console.log(focus)
|
|
|
+ console.log(focus);
|
|
|
if (focus) {
|
|
|
- ctx.strokeStyle = 'rgba(255, 143, 40, 1)'
|
|
|
+ ctx.strokeStyle = "rgba(255, 143, 40, 1)";
|
|
|
}
|
|
|
ctx.lineWidth *= Settings.lineWidth;
|
|
|
ctx.setLineDash(Style.Lane.dash);
|
|
@@ -656,14 +657,16 @@ export default class Draw {
|
|
|
ctx.save();
|
|
|
help.setVectorStyle(ctx, vector);
|
|
|
ctx.beginPath();
|
|
|
- ctx.arc(
|
|
|
- extremePoint.x,
|
|
|
- extremePoint.y,
|
|
|
- Style.CrossPoint.radius * coordinate.ratio,
|
|
|
- 0,
|
|
|
- Math.PI * 2,
|
|
|
- true
|
|
|
- );
|
|
|
+ if (!Settings.screenMode) {
|
|
|
+ ctx.arc(
|
|
|
+ extremePoint.x,
|
|
|
+ extremePoint.y,
|
|
|
+ Style.CrossPoint.radius * coordinate.ratio,
|
|
|
+ 0,
|
|
|
+ Math.PI * 2,
|
|
|
+ true
|
|
|
+ );
|
|
|
+ }
|
|
|
ctx.stroke();
|
|
|
ctx.fill();
|
|
|
ctx.restore();
|
|
@@ -690,13 +693,12 @@ export default class Draw {
|
|
|
vector.midDivide.leftMidDivideCurves,
|
|
|
// vector.midDivide.rightMidDivideCurves,
|
|
|
]);
|
|
|
- ctx.setLineDash([8 * coordinate.ratio, 8 * coordinate.ratio])
|
|
|
- ctx.lineWidth *= Settings.lineWidth
|
|
|
+ ctx.setLineDash([8 * coordinate.ratio, 8 * coordinate.ratio]);
|
|
|
+ ctx.lineWidth *= Settings.lineWidth;
|
|
|
for (let coves of midCovesArray) {
|
|
|
help.drawCoves(ctx, coves);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// midCovesArray = help.transformCoves([
|
|
|
// vector.curves,
|
|
|
// ]);
|
|
@@ -704,7 +706,6 @@ export default class Draw {
|
|
|
// for (let coves of midCovesArray) {
|
|
|
// help.drawCoves(ctx, coves);
|
|
|
// }
|
|
|
-
|
|
|
}
|
|
|
ctx.restore();
|
|
|
|
|
@@ -717,9 +718,9 @@ export default class Draw {
|
|
|
vector
|
|
|
);
|
|
|
vector.leftLanesCurves &&
|
|
|
- vector.leftLanesCurves.forEach(this.drawCurveLan.bind(this));
|
|
|
+ vector.leftLanesCurves.forEach((data) => this.drawCurveLan(data, foo));
|
|
|
vector.rightLanesCurves &&
|
|
|
- vector.rightLanesCurves.forEach(this.drawCurveLan.bind(this));
|
|
|
+ vector.rightLanesCurves.forEach((data) => this.drawCurveLan(data, foo));
|
|
|
|
|
|
if (foo) {
|
|
|
const leftEdge = dataService.getCurveRoadEdge(vector.leftEdgeId);
|
|
@@ -780,9 +781,14 @@ export default class Draw {
|
|
|
select && help.setStyle(ctx, style);
|
|
|
// ctx.lineWidth *= Settings.lineWidth;
|
|
|
|
|
|
- help.drawStyleLine(this.context, () => {
|
|
|
- help.drawCoves(ctx, coves);
|
|
|
- }, vector.style, vector.weight);
|
|
|
+ help.drawStyleLine(
|
|
|
+ this.context,
|
|
|
+ () => {
|
|
|
+ help.drawCoves(ctx, coves);
|
|
|
+ },
|
|
|
+ vector.style,
|
|
|
+ vector.weight
|
|
|
+ );
|
|
|
|
|
|
// help.drawCoves(ctx, coves);
|
|
|
ctx.restore();
|
|
@@ -792,13 +798,17 @@ export default class Draw {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- drawCurveLan(lines) {
|
|
|
+ drawCurveLan(lines, focus) {
|
|
|
const [coves] = help.transformCoves([lines]);
|
|
|
const ctx = this.context;
|
|
|
ctx.save();
|
|
|
|
|
|
help.setVectorStyle(ctx, null, "CurveLan");
|
|
|
ctx.lineWidth *= Settings.lineWidth;
|
|
|
+ if (focus) {
|
|
|
+ ctx.strokeStyle = "rgba(255, 153, 0, 1)";
|
|
|
+ ctx.lineWidth *= 2;
|
|
|
+ }
|
|
|
ctx.setLineDash(Style.Lane.dash);
|
|
|
help.drawCoves(ctx, coves);
|
|
|
ctx.restore();
|
|
@@ -1015,6 +1025,15 @@ export default class Draw {
|
|
|
...style,
|
|
|
...stylea,
|
|
|
};
|
|
|
+ } else if (vector.category === VectorCategory.Point.FixPoint) {
|
|
|
+ const text = dataService.getText(vector?.linkedTextId);
|
|
|
+ if (text) {
|
|
|
+ style = {
|
|
|
+ ...style,
|
|
|
+ fillStyle: text.color,
|
|
|
+ strokeStyle: text.color,
|
|
|
+ };
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (vector.color) {
|
|
@@ -1040,6 +1059,7 @@ export default class Draw {
|
|
|
ctx.fill();
|
|
|
ctx.restore();
|
|
|
};
|
|
|
+
|
|
|
if (Settings.selectBasePointId === vector.vectorId) {
|
|
|
style = {
|
|
|
...style,
|
|
@@ -1130,7 +1150,6 @@ export default class Draw {
|
|
|
vector.displayPoint &&
|
|
|
this.drawPoint({ ...vector.center, color: vector.color }, true);
|
|
|
|
|
|
-
|
|
|
// vector.getBound(this.context).forEach(this.drawPoint.bind(this))
|
|
|
}
|
|
|
|
|
@@ -1149,9 +1168,13 @@ export default class Draw {
|
|
|
this.context.scale(width / svgWidth, height / svgHidth);
|
|
|
const [style, label] = help.getVectorStyle(vector);
|
|
|
this.context.lineWidth = style.lineWidth / (width / svgWidth);
|
|
|
- this.context.fillStyle = 'rgba(0,0,0,0)'
|
|
|
- this.context.strokeStyle = 'rgba(0,0,0,0)'
|
|
|
- SVGIcons[vector.type].draw(this.context, style.fillStyle || 'rgba(0,0,0,0)', style.strokeStyle || 'rgba(0,0,0,0)');
|
|
|
+ this.context.fillStyle = "rgba(0,0,0,0)";
|
|
|
+ this.context.strokeStyle = "rgba(0,0,0,0)";
|
|
|
+ SVGIcons[vector.type].draw(
|
|
|
+ this.context,
|
|
|
+ style.fillStyle || "rgba(0,0,0,0)",
|
|
|
+ style.strokeStyle || "rgba(0,0,0,0)"
|
|
|
+ );
|
|
|
this.context.restore();
|
|
|
|
|
|
if (label) {
|
|
@@ -1162,15 +1185,20 @@ export default class Draw {
|
|
|
this.context.lineTo(points[2].x, points[2].y);
|
|
|
this.context.lineTo(points[3].x, points[3].y);
|
|
|
this.context.strokeStyle = style.strokeStyle;
|
|
|
- this.context.fillStyle = 'rgba(255, 153, 0, 0.30)';
|
|
|
+ this.context.fillStyle = "rgba(255, 153, 0, 0.30)";
|
|
|
this.context.lineWidth = 2 * coordinate.ratio;
|
|
|
this.context.setLineDash([6 * coordinate.ratio, 2 * coordinate.ratio]);
|
|
|
this.context.closePath();
|
|
|
this.context.stroke();
|
|
|
- this.context.fill()
|
|
|
+ this.context.fill();
|
|
|
this.context.restore();
|
|
|
vector.points.forEach((point) =>
|
|
|
- this.drawPoint({ ...point, fillColor: '#fff', color: style.strokeStyle, radius: 5 })
|
|
|
+ this.drawPoint({
|
|
|
+ ...point,
|
|
|
+ fillColor: "#fff",
|
|
|
+ color: style.strokeStyle,
|
|
|
+ radius: 5,
|
|
|
+ })
|
|
|
);
|
|
|
}
|
|
|
}
|
|
@@ -1245,15 +1273,20 @@ export default class Draw {
|
|
|
ctx.save();
|
|
|
help.setVectorStyle(ctx, vector);
|
|
|
|
|
|
- help.drawStyleLine(this.context, () => {
|
|
|
- help.transformCoves([vector.curves]).forEach((coves) => {
|
|
|
- help.drawCoves(ctx, coves);
|
|
|
- });
|
|
|
- }, vector.style, vector.weight);
|
|
|
+ help.drawStyleLine(
|
|
|
+ this.context,
|
|
|
+ () => {
|
|
|
+ help.transformCoves([vector.curves]).forEach((coves) => {
|
|
|
+ help.drawCoves(ctx, coves);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ vector.style,
|
|
|
+ vector.weight
|
|
|
+ );
|
|
|
ctx.restore();
|
|
|
|
|
|
// if (import.meta.env.DEV) {
|
|
|
- vector.points.forEach(this.drawPoint.bind(this));
|
|
|
+ vector.points.forEach(this.drawPoint.bind(this));
|
|
|
// }
|
|
|
}
|
|
|
|