feat(junction): taper complex carriageway edits
This commit is contained in:
1 parent
d353b48a0b
commit
280b726c6f
4 files changed
+31
-6
No files matched your search
@@ -507,8 +507,11 @@ function buildComplexJunctionGeometry(model, cluster, helpers) {
|
|||||||
0,
|
0,
|
||||||
),
|
),
|
||||||
width_m: item.approach.widthMeters,
|
width_m: item.approach.widthMeters,
|
||||||
|
outer_width_m: section.outerWidthMeters,
|
||||||
|
inner_width_m: section.innerWidthMeters,
|
||||||
|
transition_length_m: Math.round((section.outer.stationMeters - section.inner.stationMeters) * 10) / 10,
|
||||||
boundary_refs: section.edgeRefs,
|
boundary_refs: section.edgeRefs,
|
||||||
provenance: 'native-road-complex-junction/v5',
|
provenance: 'native-road-complex-junction/v6-shared-transition-sections',
|
||||||
},
|
},
|
||||||
geometry: { type: 'Polygon', coordinates: [ring] },
|
geometry: { type: 'Polygon', coordinates: [ring] },
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -39,11 +39,11 @@ function offsetCoordinate(point, heading, meters) {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
function sectionAt(item, radius, center, helpers) {
|
function sectionAt(item, radius, center, widthMeters, helpers) {
|
||||||
const station = Math.min(item.length, stationAtDistanceFrom(item.approach.line, center, radius, helpers));
|
const station = Math.min(item.length, stationAtDistanceFrom(item.approach.line, center, radius, helpers));
|
||||||
const point = pointAtStation(item.approach.line, station, helpers);
|
const point = pointAtStation(item.approach.line, station, helpers);
|
||||||
const tangent = tangentAtStation(item.approach.line, station, helpers);
|
const tangent = tangentAtStation(item.approach.line, station, helpers);
|
||||||
const halfWidth = Math.max(0, Number(item.approach.widthMeters) || 0) / 2;
|
const halfWidth = Math.max(0, Number(widthMeters) || 0) / 2;
|
||||||
return {
|
return {
|
||||||
stationMeters: station,
|
stationMeters: station,
|
||||||
point,
|
point,
|
||||||
@@ -60,13 +60,17 @@ function buildJunctionBoundaryGraph(topology, center, radii, helpers, exclusionR
|
|||||||
const sections = topology.carriageways.map((item) => {
|
const sections = topology.carriageways.map((item) => {
|
||||||
const outerRadius = radii.outerRadiusFor(item);
|
const outerRadius = radii.outerRadiusFor(item);
|
||||||
const innerRadius = radii.innerRadiusFor(item);
|
const innerRadius = radii.innerRadiusFor(item);
|
||||||
const outer = sectionAt(item, outerRadius, center, helpers);
|
const outerWidthMeters = Number(item.approach.sourceWidthMeters) || item.approach.widthMeters;
|
||||||
const inner = sectionAt(item, innerRadius, center, helpers);
|
const innerWidthMeters = item.approach.widthMeters;
|
||||||
|
const outer = sectionAt(item, outerRadius, center, outerWidthMeters, helpers);
|
||||||
|
const inner = sectionAt(item, innerRadius, center, innerWidthMeters, helpers);
|
||||||
const key = `boundary:${item.key}`;
|
const key = `boundary:${item.key}`;
|
||||||
return {
|
return {
|
||||||
key,
|
key,
|
||||||
carriagewayKey: item.key,
|
carriagewayKey: item.key,
|
||||||
armKey: item.armKey,
|
armKey: item.armKey,
|
||||||
|
outerWidthMeters,
|
||||||
|
innerWidthMeters,
|
||||||
outer,
|
outer,
|
||||||
inner,
|
inner,
|
||||||
edgeRefs: {
|
edgeRefs: {
|
||||||
|
|||||||
@@ -988,7 +988,13 @@ function applyDirectClusterPlans(model, junctionPlans, directEdit, clusters) {
|
|||||||
});
|
});
|
||||||
for (const item of topology.carriageways) {
|
for (const item of topology.carriageways) {
|
||||||
const width = widths.get(item.key);
|
const width = widths.get(item.key);
|
||||||
if (Number.isFinite(width)) item.approach.widthMeters = width;
|
if (Number.isFinite(width)) {
|
||||||
|
// The outer section stays attached to the untouched source road. The
|
||||||
|
// complex approach then tapers from that fixed width to this local
|
||||||
|
// correction instead of opening a seam at the cluster boundary.
|
||||||
|
item.approach.sourceWidthMeters ??= item.approach.widthMeters;
|
||||||
|
item.approach.widthMeters = width;
|
||||||
|
}
|
||||||
const cutback = cutbacks.get(item.key);
|
const cutback = cutbacks.get(item.key);
|
||||||
if (Number.isFinite(cutback)) item.approach.cutback = cutback;
|
if (Number.isFinite(cutback)) item.approach.cutback = cutback;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -328,6 +328,18 @@ assert.notDeepEqual(
|
|||||||
complexSurface(clusterPreview).geometry,
|
complexSurface(clusterPreview).geometry,
|
||||||
'a cluster carriageway constraint must change compiled complex geometry',
|
'a cluster carriageway constraint must change compiled complex geometry',
|
||||||
);
|
);
|
||||||
|
const baselineApproachRing = complexSurface(clusterPreview).geometry.coordinates[0];
|
||||||
|
const widenedApproachRing = complexSurface(widenedClusterPreview).geometry.coordinates[0];
|
||||||
|
assert.deepEqual(
|
||||||
|
[widenedApproachRing[0], widenedApproachRing[3]],
|
||||||
|
[baselineApproachRing[0], baselineApproachRing[3]],
|
||||||
|
'a local width correction must preserve the source-road outer seam',
|
||||||
|
);
|
||||||
|
assert.notDeepEqual(
|
||||||
|
[widenedApproachRing[1], widenedApproachRing[2]],
|
||||||
|
[baselineApproachRing[1], baselineApproachRing[2]],
|
||||||
|
'a local width correction must taper into the edited inner section',
|
||||||
|
);
|
||||||
const complexCrossingHandle = clusterState.handles.handles.find((handle) => handle.kind === 'cluster-crossing-inset');
|
const complexCrossingHandle = clusterState.handles.handles.find((handle) => handle.kind === 'cluster-crossing-inset');
|
||||||
assert.ok(complexCrossingHandle, 'the complex fixture must publish grouped crossing handles');
|
assert.ok(complexCrossingHandle, 'the complex fixture must publish grouped crossing handles');
|
||||||
const renderedComplexCrosswalk = clusterPreview.layers.crosswalks.features.find(
|
const renderedComplexCrosswalk = clusterPreview.layers.crosswalks.features.find(
|
||||||
|
|||||||
Reference in new issue
Block a user