summaryrefslogtreecommitdiff
path: root/src/gtkext/graph/edge.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2015-05-04 21:58:09 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2015-05-04 21:58:09 (GMT)
commit4d0451c1153eb572f5ab0833c0c0911dfdc5f11a (patch)
tree6fb1690ded59d323bb21ac200dabb69dca528f2d /src/gtkext/graph/edge.c
parent08adf78fbff30d213891a533fbf43d91816b166a (diff)
Reordered slot indexes in order to avoid edges crossings.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@525 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/gtkext/graph/edge.c')
-rw-r--r--src/gtkext/graph/edge.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/gtkext/graph/edge.c b/src/gtkext/graph/edge.c
index acd164c..5750198 100644
--- a/src/gtkext/graph/edge.c
+++ b/src/gtkext/graph/edge.c
@@ -212,6 +212,56 @@ GGraphEdge *g_graph_edge_new(GFlowNode *src_node, node_slot_t *src_slot, GFlowNo
/******************************************************************************
* *
+* Paramètres : a = premier lien à considérer. *
+* b = second lien à considérer. *
+* *
+* Description : Etablit la comparaison entre deux liens graphiques. *
+* *
+* Retour : Bilan de la comparaison : -1, 0 ou 1. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+int g_graph_edge_compare(const GGraphEdge **a, const GGraphEdge **b)
+{
+ int result; /* Bilan à retourner */
+ const GGraphEdge *_a; /* Commodité d'accès #1 */
+ const GGraphEdge *_b; /* Commodité d'accès #2 */
+ GdkPoint start_a; /* Point de départ A */
+ GdkPoint start_b; /* Point de départ B */
+
+ _a = *a;
+ _b = *b;
+
+ /**
+ * La comparaison s'établit sur le noeud d'arrivée.
+ */
+
+ if (_a->dest_node < _b->dest_node)
+ result = -1;
+
+ else if (_a->dest_node > _b->dest_node)
+ result = 1;
+
+ else
+ {
+ start_a = g_flow_node_get_point_from_slot(_a->src_node, false, _a->src_slot);
+ start_b = g_flow_node_get_point_from_slot(_b->src_node, false, _b->src_slot);
+
+ result = g_flow_node_compare_slots_for_edges(_a->dest_node,
+ _a->dest_slot, start_a.x,
+ _b->dest_slot, start_b.x);
+
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : edge = ligne de rendu à mettre à jour. *
* nodes = noeud au sommet de la hiérarchie. *
* ranks = classement global dans lequel s'intégrer. *