merge: quick/shape-circle-energy-cap — circulos por defecto + tapa energia

This commit is contained in:
2026-04-30 23:53:21 +02:00
5 changed files with 50 additions and 25 deletions
+14 -11
View File
@@ -1,60 +1,58 @@
# Ejemplo OSINT — tipos comunes en investigacion de entidades.
# Color como "#RRGGBB" (con o sin alpha "#RRGGBBAA").
# Shapes: circle | square | diamond | hex | triangle | rounded_square
# Shapes: el campo `shape` se ignora — todos los nodos son circulo, salvo
# el tipo "Table" que es cuadrado (regla de forma aplicada en
# types_registry.cpp::apply_types_yaml).
# Iconos: nombres ti-* mapeados en types_registry.cpp::tabler_codepoint_by_name
# Estilos de relacion: solid | dashed | dotted
entities:
- name: Person
color: "#5B8DEF"
shape: circle
icon: ti-user
- name: Email
color: "#58CA8C"
shape: square
icon: ti-mail
- name: Domain
color: "#F4B860"
shape: diamond
icon: ti-world
- name: Phone
color: "#E36AC0"
shape: hex
icon: ti-phone
- name: Org
color: "#C780E8"
shape: triangle
icon: ti-building
- name: IBAN
color: "#52CDF2"
shape: rounded_square
icon: ti-building-bank
- name: Account
color: "#7FD3A0"
shape: rounded_square
icon: ti-id
- name: Document
color: "#C9C9C9"
shape: square
icon: ti-file
- name: Address
color: "#FFB870"
shape: diamond
icon: ti-map-pin
- name: Url
color: "#89E0FC"
shape: hex
icon: ti-link
# Nodo tabla — cuadrado (regla de forma). Issue 0010: contenedor con
# filas que son nodos del grafo.
- name: Table
color: "#0EA5E9"
icon: ti-database
relations:
- name: owns
color: "#888888"
@@ -75,3 +73,8 @@ relations:
- name: member_of
color: "#C780E8"
style: dashed
# Pertenencia de fila a tabla (issue 0010).
- name: CONTAINS_ROW
color: "#0EA5E9"
style: dotted
+10 -4
View File
@@ -251,10 +251,16 @@ static void run_force_step() {
if (g_app.layout_mode != 0) return; // force solo en mode 0
ForceLayoutConfig cfg;
cfg.repulsion = g_app.repulsion;
cfg.attraction = g_app.attraction;
cfg.gravity = g_app.gravity;
cfg.iterations = 1;
cfg.repulsion = g_app.repulsion;
cfg.attraction = g_app.attraction;
cfg.gravity = g_app.gravity;
cfg.iterations = 1;
// Tapa de energia: damping mas agresivo + max_velocity bajo evita que el
// grafo "explote" al cargar (nodos que arrancan cerca del origen y se
// dispersan con repulsion alta). Valores tuneados para sentir movimiento
// suave sin saltos visibles entre frames.
cfg.damping = 0.7f;
cfg.max_velocity = 8.0f;
if (g_app.use_gpu) {
if (!g_gpu_ctx) {
+10 -8
View File
@@ -125,42 +125,40 @@ CREATE TABLE IF NOT EXISTS logs (
// Semilla types.yaml minima si examples/types.yaml no se encuentra.
static const char* k_seed_types_yaml = R"YAML(# types.yaml — generado al crear el proyecto. Editable desde el Type Editor.
# Color como "#RRGGBB" (con o sin alpha "#RRGGBBAA").
# Shapes: circle | square | diamond | hex | triangle | rounded_square
# Todos los nodos son circulo, salvo "Table" que es cuadrado.
# Iconos: nombres ti-* mapeados en types_registry.cpp
# Estilos de relacion: solid | dashed | dotted
entities:
- name: Person
color: "#5B8DEF"
shape: circle
icon: ti-user
- name: Email
color: "#58CA8C"
shape: square
icon: ti-mail
- name: Domain
color: "#F4B860"
shape: diamond
icon: ti-world
- name: Phone
color: "#E36AC0"
shape: hex
icon: ti-phone
- name: Org
color: "#C780E8"
shape: triangle
icon: ti-building
- name: Document
color: "#C9C9C9"
shape: square
icon: ti-file
# Nodo tabla — cuadrado (issue 0010).
- name: Table
color: "#0EA5E9"
icon: ti-database
relations:
- name: owns
color: "#888888"
@@ -173,6 +171,10 @@ relations:
- name: located_in
color: "#FFB870"
style: dashed
- name: CONTAINS_ROW
color: "#0EA5E9"
style: dotted
)YAML";
// ----------------------------------------------------------------------------
+11
View File
@@ -320,6 +320,17 @@ std::vector<uint16_t> apply_types_yaml(GraphData& graph, const ParsedTypes& type
}
}
// Regla de forma: todo nodo es circulo EXCEPTO el tipo "Table" (issue
// 0010 — nodo tabla rectangular contenedor). Sobreescribe lo que diga el
// yaml: se aplica en cada reload, por lo que ediciones futuras desde el
// Type Editor no rompen la convencion.
for (int i = 0; i < graph.type_count; ++i) {
EntityType& et = graph.types[i];
bool is_table = et.name && (eq_ci(et.name, std::string("Table"))
|| eq_ci(et.name, std::string("table")));
et.shape = is_table ? SHAPE_SQUARE : SHAPE_CIRCLE;
}
for (int i = 0; i < graph.rel_type_count; ++i) {
RelationType& rt = graph.rel_types[i];
for (const auto& spec : types.relations) {
+5 -2
View File
@@ -21,8 +21,11 @@ struct AppState {
int apply_layout_tick = 0; // se incrementa cuando hay que reaplicar layout
bool want_unpin_all = false; // Reset layout: limpia NF_PINNED y reaplica
// Force layout — config + GPU toggle
float repulsion = 1500.0f;
// Force layout — config + GPU toggle. Repulsion bajada de 1500→800
// (issue 0006 follow-up) para evitar movimiento excesivo al cargar
// grafos pequenos. Combinado con damping=0.7 y max_velocity=8 en
// run_force_step.
float repulsion = 800.0f;
float attraction = 0.04f;
float gravity = 0.005f;
bool use_gpu = false;