feat(viz): graph_labels render con LabelPolicy + ImDrawList (issue 0049j)

graph_labels_draw pinta etiquetas de nodos sobre el FBO del graph_renderer
via ImDrawList. Politica configurable: always-on para selected/hovered/
pinned, top-N por size*(degree+1), culling por viewport AABB y
min_node_pixel_size. Cap duro = max_visible + |always_*|.

API:
- graph_labels_draw(graph, viewport_state, policy, cb, user)
- graph_labels_draw_at(...)  — variante con rect explicito
- graph_labels_select(...)   — helper puro testeable
- graph_compute_degrees(...) — O(E)

Splitting en dos TUs:
- graph_labels.cpp          — funciones draw (depende de ImGui)
- graph_labels_select.cpp   — helpers puros para tests sin ImGui

12 tests en test_graph_labels (culling, max_visible cap, min_pixel_size,
always_* gating por viewport, top-N por score, edge cases). Todos verdes.

Integrado en demos_graph con UI: toggle Labels, sliders Max visible /
Font / Min px, checkboxes Selected/Hovered/Pinned. Golden de
graph_viewport regenerado.

Cierra issue 0049j.
This commit is contained in:
2026-04-29 23:53:32 +02:00
parent 000e9f2ea5
commit 4b28ef6774
11 changed files with 750 additions and 1 deletions
+5
View File
@@ -86,6 +86,11 @@ add_fn_test(test_graph_layouts test_graph_layouts.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../functions/viz/graph_layouts.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../functions/viz/graph_types.cpp)
# --- Issue 0049j — graph_labels (LabelPolicy + select pure logic) ---------
add_fn_test(test_graph_labels test_graph_labels.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../functions/viz/graph_labels_select.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../functions/viz/graph_types.cpp)
# --- Issue 0049i — graph_viewport selection helpers (logica pura sin GL) ---
# Solo cubre graph_viewport_selection.cpp; el widget completo se prueba en
# primitives_gallery + golden image diff. graph_viewport.h incluye ImVec2,