Skip to main content

Module auto_route

Module auto_route 

Source

Re-exports§

pub use crate::presentation::Crossing;
pub use crate::presentation::RouteGeometry;

Structs§

CrossingSite 🔒
Every route order (store index) passing through one crossing point on each axis. The set sizes both count the routes at the point and identify them, so a 1/1 site is a lone H×V pair and anything busier is a multi-crossing.
HEdge
A horizontal route segment, tagged with the store-order index of the route that owns it. Used only by compute_crossings.
VEdge
A vertical route segment, tagged with the store-order index of the route that owns it. Used only by compute_crossings.
Wire
A wire as the layers below the document read it: the authored route with the labels hanging off it, which are entities of their own — the bundling twin of BlockShape’s pins. Resolved once per borrow, so a renderer, a hit test, and a relayout cannot disagree about which labels a wire carries.

Functions§

compute_crossings
Pure geometry core of crossing detection (no Block/Store dependency so it can be unit-tested directly). Returns, per route store-order index, the hops that route should draw. A hop is recorded only for a strict interior crossing of a horizontal and a vertical segment (so shared endpoints, corners and T-junctions never hop).
geometry_from_points
Solve the router’s point list into edge geometry: axis-aligned edges merged while collinear within one segment (two edges from different waypoint legs never merge, even collinear), endpoints from the first and last point.
hit_text_anchor
The label whose drawn box contains hover_pos. name is the wire’s own name — an unnamed wire measures its faint placeholder instead, so the prompt stays clickable (matching what the renderer draws there).
hit_waypoint
Which corner of a route sits within tolerance of pos — the grab a route edit starts from. Waypoints are positional, so the answer is the ordinal the edit session and the emitters both speak.
label_anchors
Each label’s current world position, captured before a relayout so reanchored can put it back where it was instead of letting it slide with the arc length.
reanchored
Each captured anchor re-projected onto the current geometry — the arc lengths a route edit commits. Re-projecting the same screen point keeps a horizontal label at the same X and a vertical one at the same Y (the perpendicular foot shares that coordinate).
reroute_preview_closed
Non-destructive drag preview: reroute as if every stored waypoint were shifted by waypoint_delta grid cells, WITHOUT mutating the stored waypoints (the group drag is uncommitted). Only geometry’s edges and endpoints are rewritten, and the authored route is untouched. Routes on a frozen ClosedRouter.
reroute_preview_excluding
Non-destructive closed-router reroute: route through the stored waypoint skeleton minus excluded (a trim or prune the preview previews without applying — see PreviewExclusions in the routing module), additionally skipping inaccessible and position-duplicated corners on a working copy. The authored route is never touched (locks included: they only matter to commit-time trims, never to routing). Replaces geometry wholesale and applies the new edges’ occupancy to the router in place.
route_hops
The hops each of routes draws, in the order given. Each crossing point resolves to a single orientation and every route crossing it in that orientation gets a matching hop (see compute_crossings).
route_labels
A wire’s name labels as the geometry layer reads them: the entity to write back to, and the arc length along the solved polyline it sits at. Resolved through the route index in the document’s one draw order, so hit-testing, rendering, and re-anchoring all walk the same list.
text_anchors
Where each label sits on the wire — the diamonds a selected route draws.