feat(junction): enable complex carriageway width editing
This commit is contained in:
1 parent
56647fcdaa
commit
c4bcbe8ff9
22 files changed
+449
-52
No files matched your search
@@ -3,7 +3,11 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { arrowRingsAt, normalizeManeuver } = require('./turn-lane-arrows');
|
||||
const { buildComplexJunctionGeometry, complexJunctionMetrics } = require('./complex-junction');
|
||||
const {
|
||||
buildComplexJunctionGeometry,
|
||||
complexJunctionMetrics,
|
||||
resolveComplexJunctionTopology,
|
||||
} = require('./complex-junction');
|
||||
const { diagnostic } = require('./diagnostics');
|
||||
// Default marking placement lives with the constraint bounds in the solver, which
|
||||
// is the IO-free module; importing the other way would drag fs into it.
|
||||
@@ -624,6 +628,7 @@ function compileGeometry(model, overrides = { overrides: [] }, options = {}) {
|
||||
const diagnostics = [...model.diagnostics];
|
||||
const junctionPlans = compileJunctionPlans(model, options, diagnostics);
|
||||
applyDirectJunctionPlans(junctionPlans, options.directEdit);
|
||||
applyDirectClusterPlans(model, junctionPlans, options.directEdit, options.junctionTemplates?.clusters || []);
|
||||
detectComplexJunctionCandidates(model, junctionPlans, options, diagnostics);
|
||||
const features = [];
|
||||
const activeClusters = options.junctionTemplates?.enabled ? options.junctionTemplates.clusters || [] : [];
|
||||
@@ -906,6 +911,24 @@ function applyDirectJunctionPlans(plans, directEdit) {
|
||||
}
|
||||
}
|
||||
|
||||
function applyDirectClusterPlans(model, junctionPlans, directEdit, clusters) {
|
||||
if (!directEdit?.clusterPlans?.size) return;
|
||||
for (const [clusterId, widths] of directEdit.clusterPlans) {
|
||||
const cluster = clusters.find((item) => String(item.id) === String(clusterId));
|
||||
if (!cluster || cluster.template !== 'complex-junction-v1') continue;
|
||||
const topology = resolveComplexJunctionTopology(model, cluster, {
|
||||
junctionPlans,
|
||||
distanceMeters,
|
||||
lineLengthMeters,
|
||||
headingAtEndpoint,
|
||||
});
|
||||
for (const item of topology.carriageways) {
|
||||
const width = widths.get(item.key);
|
||||
if (Number.isFinite(width)) item.approach.widthMeters = width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function compileComplexPreviewArrows(features, stopLines) {
|
||||
const result = [];
|
||||
for (const feature of features) {
|
||||
|
||||
Reference in new issue
Block a user