feat(junction): expose stage1 structure and standards panel
This commit is contained in:
1 parent
0f804b71d1
commit
fc7fe81eff
15 files changed
+434
-17
No files matched your search
+48
-16
@@ -23,6 +23,7 @@ const {
|
||||
} = require('../src/compile/road-revisions');
|
||||
const { GEOMETRY_VERSION, resolveDirectEditConstraints } = require('../src/compile/direct-edit-solver');
|
||||
const { loadEditDocument, saveEditDocument, validateEditDocument } = require('../src/compile/native-road-edits');
|
||||
const { projectJunctionStructure, standardsDiagnostics } = require('../src/compile/junction-projection');
|
||||
|
||||
function startWorkbench({
|
||||
area = null,
|
||||
@@ -245,6 +246,8 @@ function state(area, junctionReference = null, debug = false) {
|
||||
};
|
||||
const trafficRuntime = runtime(trafficSignals);
|
||||
const compiled = readCompiled(area);
|
||||
const layers = readWorkbenchLayers(nativeDir, osm2streetsRoadSurface);
|
||||
const junctionStructure = projectJunctionStructure({ model: compiled.model, layers, trafficSignals });
|
||||
const junctionShapes = debug
|
||||
? (readLayer(path.join(nativeDir, 'layers', 'road_surface.geojson')).features || [])
|
||||
.filter((feature) => feature.properties?.kind === 'complex-core' && feature.properties?.cluster_id)
|
||||
@@ -273,27 +276,34 @@ function state(area, junctionReference = null, debug = false) {
|
||||
}
|
||||
: null,
|
||||
compiled,
|
||||
junctionStructure,
|
||||
standardsProfile: { id: 'cn-urban-default', label: '中国城市道路(项目默认)' },
|
||||
standardsDiagnostics: standardsDiagnostics(junctionStructure),
|
||||
overrides: loadOverrides(area.outputs.nativeRoadOverrides),
|
||||
trafficSignals,
|
||||
trafficRuntime,
|
||||
comparison: readJson(path.join(nativeDir, 'comparison.json')),
|
||||
junctionReference,
|
||||
layers: {
|
||||
nativeRoadSurface: readLayer(path.join(nativeDir, 'layers', 'road_surface.geojson')),
|
||||
edgeLines: readLayer(path.join(nativeDir, 'layers', 'edge_lines.geojson')),
|
||||
nativeSidewalkSurface: readLayer(path.join(nativeDir, 'layers', 'sidewalk_surface.geojson')),
|
||||
nativeIntersectionSurface: readLayer(path.join(nativeDir, 'layers', 'intersection_surface.geojson')),
|
||||
laneCenterlines: readLayer(path.join(nativeDir, 'layers', 'lane_centerlines.geojson')),
|
||||
laneSeparators: readLayer(path.join(nativeDir, 'layers', 'lane_separators.geojson')),
|
||||
centerLines: readLayer(path.join(nativeDir, 'layers', 'center_lines.geojson')),
|
||||
directionArrows: readLayer(path.join(nativeDir, 'layers', 'direction_arrows.geojson')),
|
||||
turnArrows: readLayer(path.join(nativeDir, 'layers', 'turn_arrows.geojson')),
|
||||
crosswalks: readLayer(path.join(nativeDir, 'layers', 'crosswalks.geojson')),
|
||||
vehicleStopLines: readLayer(path.join(nativeDir, 'layers', 'vehicle_stop_lines.geojson')),
|
||||
connectors: readLayer(path.join(nativeDir, 'layers', 'connectors.geojson')),
|
||||
osm2streetsRoadSurface:
|
||||
osm2streetsRoadSurface && fs.existsSync(osm2streetsRoadSurface) ? readLayer(osm2streetsRoadSurface) : null,
|
||||
},
|
||||
layers,
|
||||
};
|
||||
}
|
||||
|
||||
function readWorkbenchLayers(nativeDir, osm2streetsRoadSurface) {
|
||||
return {
|
||||
nativeRoadSurface: readLayer(path.join(nativeDir, 'layers', 'road_surface.geojson')),
|
||||
edgeLines: readLayer(path.join(nativeDir, 'layers', 'edge_lines.geojson')),
|
||||
nativeSidewalkSurface: readLayer(path.join(nativeDir, 'layers', 'sidewalk_surface.geojson')),
|
||||
nativeIntersectionSurface: readLayer(path.join(nativeDir, 'layers', 'intersection_surface.geojson')),
|
||||
laneCenterlines: readLayer(path.join(nativeDir, 'layers', 'lane_centerlines.geojson')),
|
||||
laneSeparators: readLayer(path.join(nativeDir, 'layers', 'lane_separators.geojson')),
|
||||
centerLines: readLayer(path.join(nativeDir, 'layers', 'center_lines.geojson')),
|
||||
directionArrows: readLayer(path.join(nativeDir, 'layers', 'direction_arrows.geojson')),
|
||||
turnArrows: readLayer(path.join(nativeDir, 'layers', 'turn_arrows.geojson')),
|
||||
crosswalks: readLayer(path.join(nativeDir, 'layers', 'crosswalks.geojson')),
|
||||
vehicleStopLines: readLayer(path.join(nativeDir, 'layers', 'vehicle_stop_lines.geojson')),
|
||||
connectors: readLayer(path.join(nativeDir, 'layers', 'connectors.geojson')),
|
||||
osm2streetsRoadSurface:
|
||||
osm2streetsRoadSurface && fs.existsSync(osm2streetsRoadSurface) ? readLayer(osm2streetsRoadSurface) : null,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -325,6 +335,13 @@ function editState(area, selection = null) {
|
||||
compilerGeometryVersion: GEOMETRY_VERSION,
|
||||
selection,
|
||||
});
|
||||
const compiled = readCompiled(area);
|
||||
const layers = readWorkbenchLayers(area.outputs.nativeRoadDir, null);
|
||||
const junctionStructure = projectJunctionStructure({
|
||||
model: compiled.model,
|
||||
layers,
|
||||
trafficSignals: readJson(area.outputs.nativeTrafficSignals),
|
||||
});
|
||||
return {
|
||||
active: true,
|
||||
areaId: area.id,
|
||||
@@ -334,6 +351,9 @@ function editState(area, selection = null) {
|
||||
constraintStates: resolution.constraintStates,
|
||||
diagnostics: resolution.diagnostics,
|
||||
handles: resolution.handles,
|
||||
junctionStructure,
|
||||
standardsProfile: { id: 'cn-urban-default', label: '中国城市道路(项目默认)' },
|
||||
standardsDiagnostics: standardsDiagnostics(junctionStructure),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -368,6 +388,15 @@ function editPreview(area, body = {}) {
|
||||
directEdit: resolution,
|
||||
});
|
||||
const diagnostics = [...compiled.diagnostics, ...resolution.diagnostics];
|
||||
const junctionStructure = projectJunctionStructure({
|
||||
model,
|
||||
layers: {
|
||||
crosswalks: compiled.crosswalks,
|
||||
vehicleStopLines: compiled.vehicleStopLines,
|
||||
intersectionSurface: compiled.intersectionSurface,
|
||||
},
|
||||
trafficSignals: readJson(area.outputs.nativeTrafficSignals),
|
||||
});
|
||||
const degraded = Date.now() - startedAt > 300;
|
||||
return {
|
||||
ok: true,
|
||||
@@ -378,6 +407,9 @@ function editPreview(area, body = {}) {
|
||||
constraintStates: resolution.constraintStates,
|
||||
diagnostics,
|
||||
handles: resolution.handles,
|
||||
junctionStructure,
|
||||
standardsProfile: { id: 'cn-urban-default', label: '中国城市道路(项目默认)' },
|
||||
standardsDiagnostics: standardsDiagnostics(junctionStructure),
|
||||
layers: {
|
||||
roadSurface: compiled.roadSurface,
|
||||
edgeLines: compiled.edgeLines,
|
||||
|
||||
Reference in new issue
Block a user