diff options
Diffstat (limited to 'src/graph/dot.c')
-rw-r--r-- | src/graph/dot.c | 90 |
1 files changed, 88 insertions, 2 deletions
diff --git a/src/graph/dot.c b/src/graph/dot.c index dc1c9a9..e4ee38c 100644 --- a/src/graph/dot.c +++ b/src/graph/dot.c @@ -71,16 +71,26 @@ graph_layout *create_graph_layout(char *cmds) printf("ret = %d\n", ret); - + /* + ret = gvLayoutJobs(result->context, result->graph); + printf("ret = %d\n", ret); + ret = gvRenderJobs(result->context, result->graph); + printf("ret = %d\n", ret); + */ ret = gvRender(result->context, result->graph, "dot", NULL); + + + ret = gvRender(result->context, result->graph, "plain", NULL); + printf("ret = %d\n", ret); + return result; cdl_error: @@ -136,13 +146,89 @@ void delete_graph_layout(graph_layout *layout) void place_nodes_of_graph_layout(const graph_layout *layout, GtkFixed *fixed, GGraphNode **nodes, size_t count) { + int height; /* Hauteur du graphique */ node_t *iter; /* Boucle de parcours */ GGraphNode *node; /* Intermédiaire concerné */ + height = GD_bb(layout->graph).UR.y; + for (iter = agfstnode(layout->graph); iter != NULL; iter = agnxtnode(layout->graph, iter)) { + + printf(" pos :: (%d ; %d)\n", iter->u.coord.x, height - iter->u.coord.y); + node = find_graph_node_by_name(nodes, count, iter->name); - g_graph_node_place(node, fixed, (double)iter->u.coord.x, (double)iter->u.coord.y); + g_graph_node_place(node, fixed, iter->u.coord.x, height - iter->u.coord.y); } } + + +/****************************************************************************** +* * +* Paramètres : layout = graphique à supprimer de la mémoire. * +* count = nombre d'éléments mis en place. * +* * +* Description : Charge la définition de tous les liens graphiques. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +GtkLinkRenderer **create_links_from_graph_layout(const graph_layout *layout, size_t *count) +{ + GtkLinkRenderer **result; /* Liste à retourner */ + int height; /* Hauteur du graphique */ + node_t *niter; /* Boucle de parcours #1 */ + edge_t *eiter; /* Boucle de parcours #2 */ + splines *lines; /* Lignes déjà tracées */ + int i; /* Boucle de parcours #3 */ + int k; /* Boucle de parcours #4 */ + GdkPoint *points; /* Points de ligne relus */ + size_t points_count; /* Nombre de ces points */ + + result = NULL; + *count = 0; + + height = GD_bb(layout->graph).UR.y; + + for (niter = agfstnode(layout->graph); niter != NULL; niter = agnxtnode(layout->graph, niter)) + for (eiter = agfstout(layout->graph, niter); eiter != NULL; eiter = agnxtout(layout->graph, eiter)) + { + lines = ED_spl(eiter); + + printf("edge == %p\n", eiter); + + points = NULL; + points_count = 0; + + for (i = 0; i < lines->size; i++) + { + points = (GdkPoint *)realloc(points, (points_count + lines->list[i].size) * sizeof(GdkPoint)); + + for (k = 0; k < lines->list[i].size; k++) + { + points[points_count + k].x = lines->list[i].list[k].x; + points[points_count + k].y = height - lines->list[i].list[k].y; + + printf(" ... ( %d ; %d)\n", + lines->list[i].list[k].x, height - lines->list[i].list[k].y); + + } + + points_count += lines->list[i].size; + + printf(" ...\n"); + + } + + result = (GtkLinkRenderer **)realloc(result, ++(*count) * sizeof(GtkLinkRenderer *)); + result[*count - 1] = gtk_link_renderer_new(points, points_count); + + } + + return result; + +} |