fix: close divided two-node T junction pavement
This commit is contained in:
1 parent
fda733ce72
commit
f122e8236a
3 files changed
+49
-5
No files matched your search
@@ -116,6 +116,8 @@ function resolveJunctionBuildPlan(model, cluster, helpers) {
|
||||
.map((id) => helpers.junctionPlans.get(id)?.node)
|
||||
.filter(Boolean);
|
||||
const carriageways = [];
|
||||
const internalRoadIds = new Set();
|
||||
const internalLinkLengths = [];
|
||||
for (const [nodeId, plan] of helpers.junctionPlans) {
|
||||
if (!nodeIds.has(String(nodeId))) continue;
|
||||
for (const approach of plan.approaches || []) {
|
||||
@@ -126,7 +128,12 @@ function resolveJunctionBuildPlan(model, cluster, helpers) {
|
||||
(road) => nodeIds.has(String(road.sourceNodeIds[0])) && nodeIds.has(String(road.sourceNodeIds.at(-1))),
|
||||
)
|
||||
: nodes.some((node) => node !== plan.node && helpers.distanceMeters(approach.line.at(-1), node) < 4);
|
||||
if (internal) continue;
|
||||
if (internal) {
|
||||
roads.forEach((road) => internalRoadIds.add(String(road.id)));
|
||||
if (Number.isFinite(helpers.lineLengthMeters(approach.line)))
|
||||
internalLinkLengths.push(helpers.lineLengthMeters(approach.line));
|
||||
continue;
|
||||
}
|
||||
carriageways.push({
|
||||
nodeId: String(nodeId),
|
||||
approach,
|
||||
@@ -179,7 +186,15 @@ function resolveJunctionBuildPlan(model, cluster, helpers) {
|
||||
}
|
||||
for (let index = 0; index < arms.length; index += 1)
|
||||
arms[index].cornerKey = `corner:${arms[index].key}>${arms[(index + 1) % arms.length].key}`;
|
||||
return { schema: 'junction-build-plan/v1', cluster, nodeIds: [...nodeIds].sort(), carriageways, arms };
|
||||
return {
|
||||
schema: 'junction-build-plan/v1',
|
||||
cluster,
|
||||
nodeIds: [...nodeIds].sort(),
|
||||
internalRoadIds: [...internalRoadIds].sort(),
|
||||
internalLinkLengths,
|
||||
carriageways,
|
||||
arms,
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = { MIN_ENTRY_SECTION_METERS, resolveJunctionBuildPlan, stationAtDistanceFrom };
|
||||
Reference in new issue
Block a user