Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions builder/wasm/wasm_size_guard.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
# Measured in CI on the build with the outline's turns, the levels that the tiles carry, the faces' tile-line
# vertices, the decks' ceilings and end faces, the shared water level and curve of the feature bake, line water
# and its culverts with their mouths, the classifier's ford rule, and the storeys over the ground with their open
# junction ends, their ends on the stubs' points, what each deck is made of and the junctions that lie on the
# ground (the crate's feature `storeys` on, stable 1.100.0).
# junction ends, their ends on the stubs' points, what each deck is made of, the junctions that lie on the
# ground, and a building passage of an older bake on the ground (the crate's feature `storeys` on, stable 1.100.0).
# The owner allows about 60 kB of code growth for the crossing block, stated in its pull request and recorded here.
GROUND_PLAN_MEASURED = {"gzipped": 806_847, "raw_wasm": 2_087_262}
GROUND_PLAN_MEASURED = {"gzipped": 808_271, "raw_wasm": 2_090_936}
# The owner's margin: compiler and dependency updates move the size by a few kilobytes and must not fail
# unrelated pull requests; real growth past the margin still fails. Raw gets the same fraction as gzipped.
# A pull request that changes the bridge's code records its own CI size here; the margin is only for toolchain
Expand Down
8 changes: 8 additions & 0 deletions builder/web/src/lib/trailview/terrain/bins.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,14 @@ describe('the ends of bridges and tunnels', () => {
], { level: 14, x: 8574, y: 5778 });
expect(lines.filter(line => line.kind === BRIDGE || line.kind === TUNNEL).map(line => line.abut)).toEqual([[true, true], [true, false], [false, false]]);
});

it('take a passage through a building of kind `tunnel` as a way of its class, and a tunnel as a bore', () => {
const way = (tunnel: string) =>
({ kind: 'tunnel', tags: { highway: 'residential', tunnel }, geometry: 'line' as const, parts: [{ outer: false, xy: Int32Array.from([1000, 4000, 2000, 4000]), z: Float32Array.from([500, 500]) }] });
const kinds = (tunnel: string) => features([way(tunnel)], { level: 14, x: 8574, y: 5778 }).lines.map(line => line.kind);
expect(kinds('building_passage')).toEqual([ROAD]);
expect(kinds('yes')).toEqual([TUNNEL]);
});
});

describe('a waterway', () => {
Expand Down
6 changes: 4 additions & 2 deletions builder/web/src/lib/trailview/terrain/bins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,10 @@ type Frame = ReturnType<typeof frameOf>;
function lineType(kind: string, tags: Record<string, string>): number | undefined {
const river = kind === 'river' || kind === 'stream';
if (!river && !['main-road', 'road', 'path', 'railway', 'tunnel', 'gallery'].includes(kind)) return undefined;
const bridge = !river && kind !== 'tunnel' && !GROUND.includes(tags.bridge ?? 'no');
return kind === 'river' ? RIVER : kind === 'stream' ? STREAM : bridge ? BRIDGE : kind === 'tunnel' ? TUNNEL : kind === 'railway' ? RAIL : kind === 'path' || Object.hasOwn(PATH_HALF, tags.highway) ? PATH : ROAD;
// Tiles of an older bake hold a passage through a building as a tunnel: it is a way, the building stands over it.
const bore = kind === 'tunnel' && tags.tunnel !== 'building_passage';
const bridge = !river && !bore && !GROUND.includes(tags.bridge ?? 'no');
return kind === 'river' ? RIVER : kind === 'stream' ? STREAM : bridge ? BRIDGE : bore ? TUNNEL : kind === 'railway' ? RAIL : kind === 'path' || Object.hasOwn(PATH_HALF, tags.highway) ? PATH : ROAD;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion host/obc-ground-plan/src/graph/parts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ pub(crate) fn classify<'a>(feature: &Feature, sections: &'a Sections) -> Option<
} else {
Family::Road
};
let level = if kind == "tunnel" {
// Tiles of an older bake hold a passage through a building as a tunnel: it is a way, the building stands over it.
let level = if kind == "tunnel" && tag("tunnel") != Some("building_passage") {
Level::Tunnel
} else if tag("deck").is_some() {
Level::Deck
Expand Down
10 changes: 10 additions & 0 deletions host/obc-ground-plan/src/graph/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -910,3 +910,13 @@ fn the_room_reads_each_way_on_its_own_curve() {
}
assert!(g.crossings.iter().any(|c| c.ladder.is_some()));
}

#[test]
fn a_passage_through_a_building_of_kind_tunnel_lies_on_the_ground_and_a_tunnel_does_not() {
let level = |tunnel: &'static str| {
let l = line("tunnel", &[("highway", "residential"), ("tunnel", tunnel)], &[[-20.0, 0.0], [20.0, 0.0]], 500.0);
parts::classify(&feature(&l, cell().feature_tiles()[0], 0), Sections::embedded()).map(|c| c.2)
};
assert_eq!(level("building_passage"), Some(Level::Ground));
assert_eq!(level("yes"), Some(Level::Tunnel));
}
Loading