garage44.eu/jeroen/cartopolis

logclone: git clone https://garage44.eu/jeroen/cartopolis.git

.. /crates/geo/src/lib.rs

raw

//! Bevy-free map geodata: MVT decode and rasterisation, road classification, tree
//! scattering, and the routing graph.
//!
//! Everything here is a pure function over bytes and geometry. That is the crate's
//! whole contract — see `Cargo.toml` for why it is enforced by a crate boundary
//! rather than a convention.
//!
//! `cartopolis` re-exports these four modules from `systems`, so client code still
//! writes `systems::vector_tiles` and does not name this crate directly.

// The crop grown on each registered agricultural field (the RVO's BRP). Split
// from `paving` — the other surveyed polygon layer — because the two answer
// different questions and share only the triangulation, which is `flat_fill`.
// Measured Dutch ground. Here rather than in the client so the harness can ask
// for it too — it cannot depend on `cartopolis`, and looking at the real ground
// is the thing it exists for.
pub mod ahn;
// The moving traffic's models — car bodies and an articulated walker — shared
// once by the whole pool, unlike the parked cars' merged furniture boxes.
pub mod agent_models;
pub mod building_design;
pub mod crops;
// The installations standing on ProRail's registered level crossings. Split from
// `furniture` on the same terms `nav_marks` is: a different source, fetched
// rather than read out of the tile this cell is already made of, and a different
// claim. It borrows `furniture`'s mesh buffer and its way index, so a boom and a
// bench end up in one group, one material and one draw call.
pub mod crossings;
// A bridge deck's height along its length, from the surface-model samples over it.
pub mod deck_profile;
// The triangulation both surveyed polygon layers use: rings in, byte-bounded
// merged meshes out, with the per-polygon tone in the vertex colours.
mod flat_fill;
// The per-cell JSON files atlas's pipelines write and the client's streamers
// read, as one set of serde types both ends use — so a renamed key is a compile
// error on both sides rather than a layer that silently draws nothing. Also the
// one `CACHE_ZOOM` every one of those trees is binned at.
pub mod formats;
pub mod furniture;
// The tiling roughness map the flat ground groups sample, so paving and built
// land stop being one perfectly uniform sheet beside a textured road.
// **The** order of everything drawn flat on the ground: one ordered list, from
// which both the depth bias and the millimetre height are derived. Every
// recurring z-fight in this tree was two statements of that order disagreeing, so
// there is now only one.
pub mod ground_stack;
pub mod ground_texture;
pub mod render_revision;
// One LoD2.2 building cell as plain data, and its compact binary encoding. Here
// so atlas (which writes it) and the client (which reads it) share one
// definition of the format rather than two that must agree.
pub mod lod22_cell;
pub mod mip;
pub mod texcomp;
// The `sites` layer's car parks and cycle parking, filled with vehicles. Split
// from `furniture` rather than folded into it because the claim is different: a
// bench is surveyed and a parked car is inferred from the area it stands on. It
// borrows `furniture`'s forms and mesh builder, which is the whole reason the two
// end up in one group and one material.
// Boats moored along the canal banks. Split from `parking` for the same reason
// that is split from `furniture`: a different source (the water polygons' own
// boundary) and a different rule for deciding there is anything there at all.
pub mod moorings;
// The buoys and beacons on the national waterways (Rijkswaterstaat's
// vaarwegmarkeringen). Split from `furniture` for the same reason `moorings` is:
// a different source and a different claim — a bench is read out of the tile
// this cell is already made of, and a mark is surveyed by somebody else and
// fetched. It borrows `furniture`'s mesh buffer so the two end up in one group,
// one material and one draw call.
pub mod nav_marks;
pub mod parking;
// Curve order for what is cut into upload-sized pieces, so each piece is one patch
// of ground the culling can take out of view.
pub mod patches;
pub mod paving;
pub mod paving_edges;
// Allocation budgets. `cfg(test)` on purpose: the counting allocator must not
// exist in a shipped build, and nothing outside the suite reads it.
#[cfg(any(test, feature = "perf"))]
pub mod perf;
#[cfg(test)]
mod perf_budgets;

/// The recorded tiles the suite measures against. See the module docs for why
/// they are embedded in one place rather than eleven.
#[cfg(test)]
pub(crate) mod testdata;

// Two readers of the tile's `pois` layer, kept separate on purpose: `places`
// answers "what can the avatar walk up to" (proximity prompts, house numbers,
// street furniture as colliders), `pois` answers "what stands on the map"
// (the data-layer markers that used to come from Overpass). See the note.
pub mod places;
pub mod pois;
// The sea coloured by its depth on the painted map, from an embedded world image.
pub mod ocean_depth;
// The countries the globe names, with their populations, from an embedded table.
pub mod countries;
// Human labels for OSM tags, imported from iD's tagging schema. The table is
// generated by `tools/id_presets.py`; `presets` is the lookup over it.
mod preset_table;
pub mod presets;
// Cutting the road ribbons against each other so that no two of them cover the
// same ground — which is what stops a junction deciding, per pixel and per frame,
// which of two coplanar surfaces is on top.
//
// Public for one item, `cut_under_roads`: the same machinery run over a *finished*
// sheet, which is how the surveyed pavements and the landuse fills are taken out
// from under the carriageways. Everything else in it stays crate-private — a
// `Ribbon` is a stage in a cut, not a thing a caller holds.
pub mod gap_fill;
pub mod road_stitch;
// Flattening the height survey along the roads, so a carriageway is graded rather
// than draped over every bump. The other half of the ground-tearing story: the cut
// above removes the overlaps it can reach, and this removes the curvature that made
// an overlap visible at all.
pub mod road_grade;
// How high every road stands, solved on the network: one height per node, so
// two roads that meet cannot disagree there, and bridges and tunnels are one
// operation at two levels.
pub mod road_levels;
pub mod road_texture;
pub mod routing;
pub mod scatter;
// What a tree's species says about its shape, and the crown each shape is built
// from — read by atlas from a city's register and by the client from OSM tags.
pub mod tree_form;
// The tall-structure lane's z11 cell and Overpass query, shared by the client and
// the atlas dataset that pre-cuts the same query into static files.
pub mod tall;
// The pure half of the near-field grass layer: where a blade may stand, and the
// one lattice mesh every patch of them draws. Split from `scatter` rather than
// folded into it because the two share no machinery beyond the keep-out masks —
// a tree is scattered here and uploaded, a blade of grass is generated in the
// vertex shader and never exists on this side at all. Named for the ground
// rather than the plant so it can pair with the client's `systems::grass` the
// way `scatter` pairs with `systems::vegetation`.
// The drivable network behind ambient traffic, off the same `streets` layer the
// roads and the routing graph are built from.
pub mod traffic;
// Roads that run under the ground. Split from `vector_tiles` rather than folded
// into `tessellate_roads` because a bore is not on the road sheet: it has its own
// depth, its own walls and roof, and a hole it needs cut in the ground.
// Giving a flat mesh vertices to be bent onto terrain by. Here rather than in the
// client so the harness refines exactly as the client does — it cannot depend on
// `cartopolis`, and bending unrefined triangles drew cracks that were the
// instrument, not the map.
pub mod terrain_refine;
// Carve, fill and grade measured ground. Here so atlas grades its tiles with the
// code the client grades its field with.
pub mod terrain_grade;
pub mod terrain_tile;
// The surveyed inputs of a ground cell, and the cell's flat sheets built from
// them. Here so atlas can pre-cut the sheets with the client's own code.
pub mod ground_sheets;
pub mod surveyed_ground;
pub mod tunnels;
pub mod turf;
pub mod vector_tiles;

// The counting allocator that `perf::Cost::measure` reads. A `#[global_allocator]`
// is per-binary and must live at the crate root; under `cfg(test)` it is installed
// only in the test binary, so a shipped build allocates through the system
// allocator with no counters and no branch.
#[cfg(test)]
#[global_allocator]
static COUNTING_ALLOC: perf::Counting = perf::Counting;