Repository navigation
feat(labels): try more places inside a polygon whose name fits - #3503
jgregoriorincon merged 4 commits into
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Code reviewReviewed the labels change ( BugsNone found. I checked these paths and they hold:
Confidence: high. SecurityNone found. Performance
Quality
AGENTS.mdNo breaks found. The param help, the tooltip and the guide were updated together. The command surface is unchanged (help text only). No wasm, thread or cancel paths are touched. Change sizeCompared with the base branch (the whole PR, merge base fdf25d1 to head 03d57a0).
Change sizeCompared with the base branch: the whole PR, merge base fdf25d1 to head 03d57a0.
|
📖 Docs preview
GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the |
Summary
With Try other places inside and around the polygon on, a polygon's label whose name fits the box of its polygon on the screen was left out once both places inside (where its shape fits it best, then where it goes without the setting) were taken. It now tries up to 16 more places inside: a text box (plus the class's clearance) away from the first place in eight directions, in the order a point's label tries them (corners first), then two boxes away.
Surfaces: placement is in
rustgis-render, so the CPU and GPU maps, turned and tilted views, the globe, export, the browser and phone builds, and scripts, CLI, Python and plugins that setotherPositionsall get it. Thelabels.placementparameter help, the checkbox's tooltip and the user guide say so. No new setting, command, parameter or project format change; undo is unchanged. The new interface string waits for the release translation pass.Cost: no label thins its rings more than before. A label that fits its box now measures up to 16 distances to those thinned rings, whether or not its first place is free, since the places are listed before placement. The distances are measured on a copy of that one label's thinned rings (at most about 20,000 points), freed with the label: no multiple of the layer. Its candidate holds those places, counted by
Candidate::bytesin the label cache's budget, so a very large polygon layer with the setting on reaches that budget sooner.Not in this PR: fitting a name that doesn't fit inside.
Testing
crates/render/src/polygon_labels_tests.rs, written first and seen failing: order and spacing (north up, turned, tilted), same result twice, setting off, angle expression, a polygon with no room for another place, holes and multipolygons, places off the view, label point out of view, globe, and Lock. One more, added in review, for the class's position and offset.cargo nextest run -p rustgis-render -E 'test(label)': 219 passed.schema --check: green. Workspace tests: 11708 passed, 8 failed, all inrustgis-geolibreandrustgis-ui-egui::smoke line_strokes_editor_edits_one_class, which fail on this machine without this change (run before the last commits, which add that test and change comments only).UI evidence
World countries labelled with the setting on, under heavier city labels (before / after). Poland, Lithuania and Serbia now show:
Tanzania now shows, and takes the room Malawi's label had:
Related issue
Closes #3500. Part of #995.
Summary by CodeRabbit