Expand description
The TopoJSON-style shared-arc topology builder. Shared borders are cut into arcs at junctions, each arc is stored ONCE as i24 delta+varint, and every ring is a list of signed arc references. Optional topology-aware Ramer–Douglas–Peucker (RDP) line simplification runs on each arc a single time (endpoints fixed), so neighbouring polygons stay stitched. Other open-polyline simplifiers could slot into the same per-arc pass.
Structs§
- TopoOut
- A serialized topology plus the counts and reconstructed geometry the measurement tools report on.
- Topology
- The shared-arc topology itself, before any serialization: this is what the container encoder (encode.rs) consumes. Arc coords are f64 and already RDP-simplified.
Enums§
- Simplify
- The algorithm choice and its parameter, for callers that thread the choice through knobs.
Functions§
- build_
topology - Builds the topology: vertices are deduped, shared arcs are cut at junctions, and topology-aware RDP runs on each arc exactly once with endpoints fixed.
- build_
topology_ algorithm - This is
build_topology()with the simplification algorithm as a knob (theutz_simplifymenu: RDP, Visvalingam–Whyatt, Imai–Iri, or None). - build_
topology_ weighted - This is
build_topology_algorithm()with spatially varying tolerance:edge_weight(a, b)returns the tolerance multiplier for one arc edge (in practiceDensityWeight::weight(DensityGrid::max_along(a, b))), and each vertex simplifies under the smallest multiplier of its incident edges, so a long edge crossing a dense area pins both flanking vertices. Weights are a pure function of arc geometry and every shared arc is simplified exactly once, so neighbouring zones stay stitched by construction. - encode_
topology - Builds and serializes the shared-arc topology at the default i24
quantization:
build_topology()runs first, followed by arc-store serialization. - encode_
topology_ q qbitsselects the absolute grid: 16 gives i16 (~611 m lon), 24 gives i24 (~2.4 m), and 32 gives cm precision.- encode_
topology_ qm abs_fixedstores arc vertices as fixed-width absolute ints (random-access) instead of the default delta + zigzag-varint stream.- put_
varint - Appends
valueas a varint, low 7 bits per byte with the high bit as continuation; the reader’s inverse isutz::format::read_varint(). - simplify
- Dispatches on
Simplify. - zigzag
- Zigzag-encodes a signed delta for
put_varint(); the reader’s inverse isutz::format::unzigzag().
Type Aliases§
- Edge
Weight Fn - The tolerance multiplier for the edge
a–b(seebuild_topology_weighted()).