fix: preserve approach lane separators near junction controls
This commit is contained in:
1 parent
ad0f55e79d
commit
062f20f34c
3 files changed
+57
-4
No files matched your search
@@ -1139,7 +1139,11 @@ function compileComplexLaneSeparators(features, controls = []) {
|
||||
(point[0] + right[pointIndex][0]) / 2,
|
||||
(point[1] + right[pointIndex][1]) / 2,
|
||||
]);
|
||||
const visibleLine = trimLineBeforeFirstControl(line, controls, 0.12);
|
||||
// A control on a crossing arm must not trim this arm's separator. In
|
||||
// oblique and multi-node clusters their envelopes can otherwise overlap
|
||||
// near the core and make the separator disappear entirely.
|
||||
const roadControls = controls.filter((control) => String(control.properties?.road_id || '') === String(roadId));
|
||||
const visibleLine = trimLineBeforeFirstControl(line, roadControls, 0.12);
|
||||
const ring = visibleLine ? roadRing(visibleLine, 0.12) : null;
|
||||
if (!ring) continue;
|
||||
result.push({
|
||||
@@ -1675,6 +1679,9 @@ function compileLaneMarkings(model, overrides, lanes, diagnostics, junctionPlans
|
||||
const cluster = clusterForRoad(road, options);
|
||||
const internalCluster = cluster && roadInternalToCluster(road, cluster);
|
||||
const roadLanes = (lanes.markingByRoadId || lanes.byRoadId).get(road.id) || [];
|
||||
const roadControls = controlFeatures.filter(
|
||||
(control) => String(control.properties?.road_id || '') === String(road.id),
|
||||
);
|
||||
for (let index = 1; index < roadLanes.length; index += 1) {
|
||||
const left = roadLanes[index - 1].coordinates;
|
||||
const right = roadLanes[index].coordinates;
|
||||
@@ -1698,7 +1705,7 @@ function compileLaneMarkings(model, overrides, lanes, diagnostics, junctionPlans
|
||||
provenance: 'native-road-lane-separator/v1',
|
||||
};
|
||||
if (style.pattern === 'solid') {
|
||||
const visibleLine = trimLineBeforeFirstControl(centerline, controlFeatures, 0.12);
|
||||
const visibleLine = trimLineBeforeFirstControl(centerline, roadControls, 0.12);
|
||||
const ring = visibleLine ? roadRing(visibleLine, 0.12) : null;
|
||||
if (ring)
|
||||
separators.push({
|
||||
@@ -1707,7 +1714,7 @@ function compileLaneMarkings(model, overrides, lanes, diagnostics, junctionPlans
|
||||
geometry: { type: 'Polygon', coordinates: [ring] },
|
||||
});
|
||||
} else {
|
||||
const visibleLine = trimLineBeforeFirstControl(centerline, controlFeatures, 0.12);
|
||||
const visibleLine = trimLineBeforeFirstControl(centerline, roadControls, 0.12);
|
||||
const visibleLength = visibleLine ? lineLengthMeters(visibleLine) : 0;
|
||||
for (let distance = 1, part = 1; visibleLine && distance + 1 <= visibleLength; distance += 4, part += 1) {
|
||||
const placement = pointAndAxisAlongLine(visibleLine, distance);
|
||||
|
||||
Reference in new issue
Block a user