|
@@ -530,49 +530,51 @@ export default {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 2. 设定标准间距:约每 0.0018 度 (约 200 米) 放置一个箭头
|
|
// 2. 设定标准间距:约每 0.0018 度 (约 200 米) 放置一个箭头
|
|
|
- const targetSpacing = 0.0018;
|
|
|
|
|
- let currentTargetDist = targetSpacing / 2; // 第一个箭头放在 1/2 间距处,让分布更美观
|
|
|
|
|
-
|
|
|
|
|
- while (currentTargetDist < totalPathDist) {
|
|
|
|
|
- // 3. 寻找对应 targetDist 的路径位置 (线性插值)
|
|
|
|
|
- let foundIdx = 0;
|
|
|
|
|
- for (let j = 0; j < pathDistances.length - 1; j++) {
|
|
|
|
|
- if (currentTargetDist >= pathDistances[j] && currentTargetDist <= pathDistances[j + 1]) {
|
|
|
|
|
- foundIdx = j;
|
|
|
|
|
- break;
|
|
|
|
|
|
|
+ if (configName !== '干线协调') {
|
|
|
|
|
+ const targetSpacing = 0.0018;
|
|
|
|
|
+ let currentTargetDist = targetSpacing / 2; // 第一个箭头放在 1/2 间距处,让分布更美观
|
|
|
|
|
+
|
|
|
|
|
+ while (currentTargetDist < totalPathDist) {
|
|
|
|
|
+ // 3. 寻找对应 targetDist 的路径位置 (线性插值)
|
|
|
|
|
+ let foundIdx = 0;
|
|
|
|
|
+ for (let j = 0; j < pathDistances.length - 1; j++) {
|
|
|
|
|
+ if (currentTargetDist >= pathDistances[j] && currentTargetDist <= pathDistances[j + 1]) {
|
|
|
|
|
+ foundIdx = j;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- const p1 = segmentPath[foundIdx];
|
|
|
|
|
- const p2 = segmentPath[foundIdx + 1];
|
|
|
|
|
- if (p1 && p2) {
|
|
|
|
|
- // 在 p1 和 p2 之间线性插值
|
|
|
|
|
- const ratio = (currentTargetDist - pathDistances[foundIdx]) / (pathDistances[foundIdx + 1] - pathDistances[foundIdx]);
|
|
|
|
|
- const lng1 = Number(p1[0]);
|
|
|
|
|
- const lat1 = Number(p1[1]);
|
|
|
|
|
- const lng2 = Number(p2[0]);
|
|
|
|
|
- const lat2 = Number(p2[1]);
|
|
|
|
|
-
|
|
|
|
|
- const midLng = lng1 + (lng2 - lng1) * ratio;
|
|
|
|
|
- const midLat = lat1 + (lat2 - lat1) * ratio;
|
|
|
|
|
-
|
|
|
|
|
- const bearing = this.calcBearingDeg(p1, p2);
|
|
|
|
|
- const rotation = bearing - 90;
|
|
|
|
|
-
|
|
|
|
|
- const directionMarker = new this.AMap.Marker({
|
|
|
|
|
- position: [midLng, midLat],
|
|
|
|
|
- content: `
|
|
|
|
|
- <div style="transform: rotate(${rotation}deg); width: 20px; height: 10px; display: flex; align-items: center; pointer-events: none; opacity: 0.85;">
|
|
|
|
|
- <img src="${require('@/assets/map/direction.png')}" style="width: 100%; height: auto;" />
|
|
|
|
|
- </div>
|
|
|
|
|
- `,
|
|
|
|
|
- offset: new this.AMap.Pixel(-10, -5),
|
|
|
|
|
- zIndex: 20,
|
|
|
|
|
- bubble: true
|
|
|
|
|
- });
|
|
|
|
|
- overlays.push(directionMarker);
|
|
|
|
|
|
|
+ const p1 = segmentPath[foundIdx];
|
|
|
|
|
+ const p2 = segmentPath[foundIdx + 1];
|
|
|
|
|
+ if (p1 && p2) {
|
|
|
|
|
+ // 在 p1 和 p2 之间线性插值
|
|
|
|
|
+ const ratio = (currentTargetDist - pathDistances[foundIdx]) / (pathDistances[foundIdx + 1] - pathDistances[foundIdx]);
|
|
|
|
|
+ const lng1 = Number(p1[0]);
|
|
|
|
|
+ const lat1 = Number(p1[1]);
|
|
|
|
|
+ const lng2 = Number(p2[0]);
|
|
|
|
|
+ const lat2 = Number(p2[1]);
|
|
|
|
|
+
|
|
|
|
|
+ const midLng = lng1 + (lng2 - lng1) * ratio;
|
|
|
|
|
+ const midLat = lat1 + (lat2 - lat1) * ratio;
|
|
|
|
|
+
|
|
|
|
|
+ const bearing = this.calcBearingDeg(p1, p2);
|
|
|
|
|
+ const rotation = bearing - 90;
|
|
|
|
|
+
|
|
|
|
|
+ const directionMarker = new this.AMap.Marker({
|
|
|
|
|
+ position: [midLng, midLat],
|
|
|
|
|
+ content: `
|
|
|
|
|
+ <div style="transform: rotate(${rotation}deg); width: 20px; height: 10px; display: flex; align-items: center; pointer-events: none; opacity: 0.85;">
|
|
|
|
|
+ <img src="${require('@/assets/map/direction.png')}" style="width: 100%; height: auto;" />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ `,
|
|
|
|
|
+ offset: new this.AMap.Pixel(-10, -5),
|
|
|
|
|
+ zIndex: 20,
|
|
|
|
|
+ bubble: true
|
|
|
|
|
+ });
|
|
|
|
|
+ overlays.push(directionMarker);
|
|
|
|
|
+ }
|
|
|
|
|
+ currentTargetDist += targetSpacing;
|
|
|
}
|
|
}
|
|
|
- currentTargetDist += targetSpacing;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 为圆点保留原来的分布 logic (不受箭头影响)
|
|
// 为圆点保留原来的分布 logic (不受箭头影响)
|