feat(workbench): stabilize junction tools workspace
This commit is contained in:
1 parent
e6b822416d
commit
f10a5da325
22 files changed
+1078
-53
No files matched your search
@@ -961,7 +961,12 @@ function makeJunctionHandles(model, junctionData, constraints) {
|
||||
const road = match.road;
|
||||
const line = approach.endpoint.side === 'start' ? road.centerline : [...road.centerline].reverse();
|
||||
const tangent = tangentAzimuth(line, Math.min(0.95, approach.cutback / approach.length));
|
||||
const placementAzimuth = tangent;
|
||||
// `line` is oriented from the junction outward. Native control geometry
|
||||
// follows the road centerline orientation, which is outward for a `start`
|
||||
// endpoint and inward for an `end` endpoint. Derive this per approach;
|
||||
// assuming every arm has the same endpoint side reverses half the handles.
|
||||
const approachAzimuth = approach.endpoint.side === 'start' ? tangent : (tangent + 180) % 360;
|
||||
const placementAzimuth = approachAzimuth;
|
||||
const anchorBase = {
|
||||
type: 'junction-crossing',
|
||||
crossingId: String(crossing.id),
|
||||
@@ -990,7 +995,8 @@ function makeJunctionHandles(model, junctionData, constraints) {
|
||||
// along the approach, not a reliable screen station from the junction;
|
||||
// deriving the point from junction distance put the knob off the zebra.
|
||||
position: offsetCoordinate(crossing.coordinate, placementAzimuth, insetApplied),
|
||||
axisAzimuth: (tangent + 180) % 360,
|
||||
// Increasing inset moves the crossing toward the junction.
|
||||
axisAzimuth: approachAzimuth,
|
||||
value: { current: insetValue, min: 0, max: insetMax, unit: 'meter' },
|
||||
...(insetConstraint ? { constraintId: insetConstraint.id } : {}),
|
||||
affects: [`crosswalk:node/${crossing.id}`],
|
||||
@@ -1010,8 +1016,9 @@ function makeJunctionHandles(model, junctionData, constraints) {
|
||||
-stopValue,
|
||||
),
|
||||
// The compiled stop line applies `-offset` along the approach axis, so
|
||||
// this tangent is the positive drag direction for increasing offset.
|
||||
axisAzimuth: tangent,
|
||||
// Increasing the offset moves away from the junction, opposite to the
|
||||
// approach axis used by the compiled stop-line geometry.
|
||||
axisAzimuth: (approachAzimuth + 180) % 360,
|
||||
value: {
|
||||
current: stopValue,
|
||||
min: MIN_STOP_LINE_OFFSET_METERS,
|
||||
|
||||
@@ -894,10 +894,12 @@ function applyDirectJunctionPlans(plans, directEdit) {
|
||||
if (requestedRadii.length) changed = true;
|
||||
if (!changed) continue;
|
||||
const referenceWidth = Math.max(...plan.approaches.map((approach) => approach.widthMeters), 1);
|
||||
const cornerRadiusMultiplier = requestedRadii.length
|
||||
? Math.max(0.1, Math.min(3, requestedRadii[0] / referenceWidth))
|
||||
: 1;
|
||||
const boundary = junctionBoundary(plan.approaches, plan.node, plan.cutbackMeters, cornerRadiusMultiplier, 1);
|
||||
const cornerRadiusMultipliers = Object.fromEntries(
|
||||
Object.entries(directPlan.corners || {})
|
||||
.filter(([, radius]) => Number.isFinite(radius))
|
||||
.map(([key, radius]) => [key, Math.max(0.1, Math.min(3, radius / referenceWidth))]),
|
||||
);
|
||||
const boundary = junctionBoundary(plan.approaches, plan.node, plan.cutbackMeters, cornerRadiusMultipliers, 1);
|
||||
plan.boundary = boundary.points;
|
||||
plan.boundaryMode = boundary.mode;
|
||||
plan.boundaryFallbacks = boundary.fallbacks;
|
||||
@@ -2892,13 +2894,18 @@ function junctionBoundary(approaches, node, cutbackMeters, cornerRadiusMultiplie
|
||||
// bends the far side of a T junction and exposes junction asphalt beyond
|
||||
// the pedestrian strip.
|
||||
if (first.segmentId === second.segmentId || isStraightJunctionEdge(first, second)) continue;
|
||||
const cornerKey = `${first.segmentId}->${second.segmentId}`;
|
||||
const multiplier =
|
||||
cornerRadiusMultiplier && typeof cornerRadiusMultiplier === 'object'
|
||||
? (cornerRadiusMultiplier[cornerKey] ?? 1)
|
||||
: cornerRadiusMultiplier;
|
||||
const curve = roundedCorner(
|
||||
node,
|
||||
first.point,
|
||||
second.point,
|
||||
first.outwardHeading,
|
||||
second.outwardHeading,
|
||||
cornerRadiusMultiplier,
|
||||
multiplier,
|
||||
);
|
||||
if (!curve) {
|
||||
fallbacks += 1;
|
||||
|
||||
Reference in new issue
Block a user