feat: insert direct edit constraint solver stage
Adds resolveDirectEditConstraints between compileRoadModel and compileGeometry, per the parent design's data flow. The stage is an identity transform until the individual constraint kinds land: it returns empty road profiles, junction plans and handle manifest, so compileGeometry's geometry code is untouched and output stays byte-identical. Constraint planning is separated from solving up front. Only `exact` and `recheck` constraints may reach the solver; `disabled`, `pending`, `conflicted` and `stale` are reported as unapplied with a reason. SOLVED_KINDS starts empty and grows one entry per kind, so a partially delivered solver reports what it skipped instead of publishing half-solved geometry. diagnostic() moves to src/compile/diagnostics.js so the solver can share the compiler's diagnostic shape without depending on fs, which would break the pure-function boundary that lets preview, the full compile and the CLI export share one implementation. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
c5e762e1a9
commit
3297d0c97a
9 files changed
+274
-14
No files matched your search
@@ -4,6 +4,7 @@ const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { arrowRingsAt, normalizeManeuver } = require('./turn-lane-arrows');
|
||||
const { buildComplexJunctionGeometry, complexJunctionMetrics } = require('./complex-junction');
|
||||
const { diagnostic } = require('./diagnostics');
|
||||
|
||||
const OVERRIDE_SCHEMA = 'native-road-overrides/v1';
|
||||
const MOTOR_HIGHWAYS = new Set([
|
||||
@@ -3089,17 +3090,6 @@ function unproject(point, origin) {
|
||||
const scale = 111320;
|
||||
return [point[0] / (scale * Math.cos((origin[1] * Math.PI) / 180)) + origin[0], point[1] / scale + origin[1]];
|
||||
}
|
||||
function diagnostic(severity, subjectId, sourceIds, rule, message, coordinate) {
|
||||
return {
|
||||
id: `diagnostic:${rule}:${subjectId}`,
|
||||
severity,
|
||||
subjectId,
|
||||
sourceIds,
|
||||
rule,
|
||||
message,
|
||||
geometry: coordinate ? { type: 'Point', coordinates: coordinate } : null,
|
||||
};
|
||||
}
|
||||
function xmlAttrs(text) {
|
||||
const attrs = {};
|
||||
for (const match of text.matchAll(/([:\w-]+)\s*=\s*(?:"([^"]*)"|'([^']*)')/g)) attrs[match[1]] = match[2] ?? match[3];
|
||||
|
||||
Reference in new issue
Block a user