if(!view->Topview->is_top_fisheye)
drawTopViewGraph(view->g[view->activeGraph]); //view->Topview style dots and straight lines
else {
-// drawtopologicalfisheye(view->Topview);
- drawtopologicalfisheye2(view->Topview);
+ drawtopologicalfisheye(view->Topview);
}
glCompSetDraw(view->Topview->topviewmenu);
}
#include <gtk/gtkgl.h>
#include <glade/glade.h>
#include "callbacks.h"
-#include "cgraph.h"
+#include "agraph.h"
buf = agget(view->g[view->activeGraph], "defaultnodeshape");
if (!buf)
buf = agget(view->default_attributes, "defaultnodeshape");
- if (buf) {
- /*select the right item in combo box */
- gtk_combo_box_set_active((GtkComboBox *)
+ if (buf)
+ {
+ /*select the right item in combo box */
+ gtk_combo_box_set_active((GtkComboBox *)
glade_xml_get_widget(xml,
"settingscombobox1"),
atoi(buf));
- }
+
+ }
+
+ /*Node Shape Combo, 0:opengl dots, 1:circle ,2:box */
+ buf = agget(view->g[view->activeGraph], "defaultselectionmethod");
+ if (!buf)
+ buf = agget(view->default_attributes, "defaultselectionmethod");
+ if (buf)
+ {
+ /*select the right item in combo box */
+ gtk_combo_box_set_active((GtkComboBox *)
+ glade_xml_get_widget(xml,
+ "settingscombobox1"),
+ atoi(buf));
+
+ }
+
return 1;
}
"settingsscale2", g);
get_combobox_widget_to_attribute("defaultnodeshape","settingscombobox1", g) ;
+ get_combobox_widget_to_attribute("defaultselectionmethod","settingscombobox2", g) ;
return 1;
}
#endif
#include <gtk/gtk.h>
-#include "cgraph.h"
+#include "agraph.h"
#include <GL/gl.h>
#include <GL/glu.h>
#include <gtk/gtkgl.h>
typedef struct _selection {
int Active; //0 there is no selection need to be applied
char Type; //0 single selection , 1 rectangle , 2 rectangleX
- float X, Y, W, H; //selection boundries
+ int PickingType; //0 normal, union,2 subtract 3 intersection
+ float X, Y, W, H; //selection boundries
int Anti; //subtract selections if 1
int AlreadySelected; //for single selections to avoid selecting more than one object
RGBColor SelectionColor;
#include "assert.h"
#include "hier.h"
+int get_temp_coords(topview* t,int level,int v,double* coord_x,double* coord_y,float *R,float *G,float *B);
static double dist(double x1, double y1, double x2, double y2)
{
return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
v_data *graph = makeGraph(t, &ne);
// t->animate=1; //turn the animation on
- for (i = 0, np = t->Nodes; i < t->Nodecount; i++, np++) {
- x_coords[i] = np->x;
- y_coords[i] = np->y;
+ for (i = 0, np = t->Nodes; i < t->Nodecount; i++, np++)
+ {
+ x_coords[i] = np->x;
+ y_coords[i] = np->y;
}
hp = t->h =
- makeHier(t->Nodecount, ne, graph, x_coords, y_coords, &(t->parms.hier));
+ makeHier(t->Nodecount, ne, graph, x_coords, y_coords, &(t->parms.hier));
freeGraph(graph);
free(x_coords);
free(y_coords);
draws all level 0 nodes and edges, during animation
*/
-int drawtopologicalfisheye2(topview * t)
+void drawtopologicalfisheye2(topview * t)
{
int level, v, i, n;
Hierarchy *hp = t->h;
for (v = 0; v < hp->nvtxs[level]; v++)
{
{
- /* ex_vtx_data *gg = hp->geom_graphs[level]; */
+ ex_vtx_data *gg = hp->geom_graphs[level];
double x0,y0;
if(get_temp_coords(t,level,v,&x0,&y0,&R,&G,&B))
{
glColor3f((GLfloat)R,(GLfloat)G,(GLfloat)B);
-// glColor3f((GLfloat) (hp->nlevels - level) /(GLfloat) hp->nlevels,(GLfloat) level / (GLfloat) hp->nlevels, 0);
-
glVertex3f((GLfloat) x0, (GLfloat) y0, (GLfloat) 0);
}
}
//draw edges
- glLineWidth(2);
glBegin(GL_LINES);
for (level = 0; level < hp->nlevels; level++)
{
for (i = 1; i < g[v].nedges; i++)
{
double x, y;
- float RR,GG,BB;
- RR=0;GG=0;BB=0;
n = g[v].edges[i];
-
- if(get_temp_coords(t,level,n,&x,&y,&RR,&GG,&BB))
+ if(get_temp_coords(t,level,n,&x,&y,&R,&G,&B))
{
if (((x0==0)||(x==0) || (y0==0) || (y==0)) &&(debug_mode))
{
+ /*printf ("(%f,%f)->(%f,%f)\n",x0,y0,x,y);*/
}
else
{
glColor3f((GLfloat)R,(GLfloat)G,(GLfloat)B);
-// glColor3f(0,1,0);
-
+// glColor3f((GLfloat) (hp->nlevels - level) / (GLfloat) hp->nlevels,(GLfloat) level / (GLfloat) hp->nlevels, 0);
glVertex3f((GLfloat) x0, (GLfloat) y0,(GLfloat) 0);
glVertex3f((GLfloat) x, (GLfloat) y,(GLfloat) 0);
}
}
}
- glEnd();
- return 1;
+ glEnd();
}
int get_temp_coords(topview* t,int level,int v,double* coord_x,double* coord_y,float *R,float *G,float *B)
{
- Hierarchy *hp = t->h;
+ static int recorded =0;
+ Hierarchy *hp = t->h;
ex_vtx_data *gg = hp->geom_graphs[level];
- /* v_data *g = hp->graphs[level]; */
+ v_data *g = hp->graphs[level];
int OAL,AL;
- double x0,y0,x1,y1;
- float R0,R1,G0,G1,B0,B1;
-
OAL=gg[v].old_active_level;
AL=gg[v].active_level;
/*if ((OAL > level) && (AL>level))
return 0;*/
+
if ((OAL < level) && (AL<level))
return 0;
- /*if (!t->animate)
+ if (!t->animate)
{
if (AL == level)
{
return 0;
}
else
- {*/
+ {
+ double x0,y0,x1,y1;
x0=0;
y0=0;
x1=0;
y1=0;
- R0=1;R1=0;
- G0=0;G1=1;
- B0=0;B1=0;
-
+
get_active_frame(t);
if ((OAL == level) && (AL==level))
{
y0=(double)gg[v].old_physical_y_coord;
x1=(double)gg[v].physical_x_coord;
y1=(double)gg[v].physical_y_coord;
- R0=1;R1=1;
- G0=0;G1=0;
- B0=0;B1=0;
+ *G=0;
+ *R=1;
}
if ((OAL == level) && (AL>level))
y0=(double)gg[v].old_physical_y_coord;
find_physical_coords(t->h,level,v,&x1,&y1);
*G=view->active_frame/view->total_frames;
- R0=1;R1=0;
- G0=0;G1=1;
- B0=0;B1=0;
+ *R=0;
+
}
if ((OAL > level) && (AL==level))
y1=(double)gg[v].physical_y_coord;
*R=view->active_frame/view->total_frames;
*G=1/(view->active_frame/view->total_frames+0.0000001);
- R0=1;R1=1;
- G0=0;G1=0;
- B0=0;B1=0;
-
}
if ((OAL > level) && (AL>level))
{
find_old_physical_coords(t->h,level,v,&x0,&y0);
find_physical_coords(t->h,level,v,&x1,&y1);
- R0=0;R1=0;
- G0=1;G1=1;
- B0=0;B1=0;
+ *G=1;
+ *R=0;
}
- *R=R0+(R1-R0)/(double)view->total_frames*(double)(view->active_frame+1);
- *G= G0+(G1-G0)/(double)view->total_frames*(double)(view->active_frame+1);
- *B= B0+(B1-B0)/(double)view->total_frames*(double)(view->active_frame+1);
get_interpolated_coords(x0,y0,x1,y1,view->active_frame,view->total_frames,coord_x,coord_y);
-
- //}
- return 1;
-}
+ if (recorded < 100)
+ {
+ printf ("OAL AL (x0,y0)-(x1,y1) current \n");
+ printf ("%i %i (%f,%f)-(%f,%f) (%f,%f)\n",OAL,AL,x0,y0,x1,y1,coord_x,coord_y);
+ recorded ++;
+ }
+ return 1;
+ }
+ return 0;
+}
-void drawtopologicalfisheye(topview * t)
-{
- int level, v, i, n;
- float R,G,B;
- Hierarchy *hp = t->h;
- //draw only nodes and super nodes
- glPointSize(5);
- glBegin(GL_POINTS);
- for (level = 0; level < hp->nlevels; level++)
- {
- for (v = 0; v < hp->nvtxs[level]; v++)
- {
- ex_vtx_data *gg = hp->geom_graphs[level];
- if (gg[v].active_level == level)
- {
- double x0,y0;
- t->animate=0;
- get_temp_coords(t,level,v,&x0,&y0,&R,&G,&B);
- glColor3f((GLfloat) (hp->nlevels - level) /
- (GLfloat) hp->nlevels,
- (GLfloat) level / (GLfloat) hp->nlevels, 0);
- glVertex3f((GLfloat) x0, (GLfloat) y0, (GLfloat) 0);
- t->animate=1;
- }
- }
- }
- glEnd();
- //draw edges
- glBegin(GL_LINES);
- for (level = 0; level < hp->nlevels; level++)
- {
- for (v = 0; v < hp->nvtxs[level]; v++)
- {
- ex_vtx_data *gg = hp->geom_graphs[level];
- v_data *g = hp->graphs[level];
- if (gg[v].active_level == level)
- {
- double x0,y0;
- get_temp_coords(t,level,v,&x0,&y0,&R,&G,&B);
- for (i = 1; i < g[v].nedges; i++)
- {
- double x, y;
- n = g[v].edges[i];
- glColor3f((GLfloat) (hp->nlevels - level) /
- (GLfloat) hp->nlevels,
- (GLfloat) level / (GLfloat) hp->nlevels, 0);
- if (gg[n].active_level == level)
- {
- if (v < n)
- {
- get_temp_coords(t,level,n,&x,&y,&R,&G,&B);
- glVertex3f((GLfloat) x0, (GLfloat) y0,(GLfloat) 0);
- glVertex3f((GLfloat) x, (GLfloat) y,(GLfloat) 0);
- }
- }
- else if (gg[n].active_level > level)
- {
- find_physical_coords(hp, level, n, &x, &y);
- glVertex3f((GLfloat) x0, (GLfloat) y0,(GLfloat) 0);
- glVertex3f((GLfloat) x, (GLfloat) y, (GLfloat) 0);
- }
- }
- }
- }
- }
- glEnd();
-}
+`2
/* In loop,
* update fs.
* For example, if user clicks mouse at (p.x,p.y) to pick a single new focus,
for (v = 0; v < hp->nvtxs[level]; v++)
{
ex_vtx_data *gg = hp->geom_graphs[level];
- /* v_data *g = hp->graphs[level]; */
- /* double x0,y0; */
+ v_data *g = hp->graphs[level];
+ double x0,y0;
gg[v].old_physical_x_coord=gg[v].physical_x_coord;
gg[v].old_physical_y_coord=gg[v].physical_y_coord;
gg[v].old_active_level=gg[v].active_level;
}
void get_interpolated_coords(double x0,double y0,double x1,double y1,int fr,int total_fr, double* x,double* y)
{
- if (view->Topview->animate)
- {
- *x=x0+(x1-x0)/(double)total_fr*(double)(fr+1);
- *y= y0+(y1-y0)/(double)total_fr*(double)(fr+1);
- }
- else
- {
- *x=x1;
- *y= y1;
- }
-
-
+ *x=x0+(x1-x0)/(double)total_fr*(double)(fr+1);
+ *y= y0+(y1-y0)/(double)total_fr*(double)(fr+1);
}
int get_active_frame(topview* t)
{
else
{
g_timer_stop(view->timer);
- view->Topview->animate=0;
+// view->Topview->animate=0;
return 0;
}
topview * t);
void prepare_topological_fisheye(topview*);
void drawtopologicalfisheye(topview * t);
-int drawtopologicalfisheye2(topview * t);
+void drawtopologicalfisheye2(topview * t);
void changetopfishfocus(topview * t, float *x, float *y,
float *z, int num_foci);
void refresh_old_values(topview* t);
/* FIX
* Why is Selected being set to 1 in both cases?
*/
- if (OD_Selected(n->Node) == 0) {
- OD_Selected(n->Node) = 1;
- select_object(view->g[view->activeGraph], n->Node);
+ if (OD_Selected(n->Node) == 0)
+ {
+ OD_Selected(n->Node) = 1;
+ select_object(view->g[view->activeGraph], n->Node);
} else {
- OD_Selected(n->Node) = 1;
- deselect_object(view->g[view->activeGraph], n->Node);
+ OD_Selected(n->Node) = 1;
+ deselect_object(view->g[view->activeGraph], n->Node);
}
break;
+/*
+ int Active; //0 there is no selection need to be applied
+ char Type; //0 single selection , 1 rectangle , 2 rectangleX
+ float X, Y, W, H; //selection boundries
+ int Anti; //subtract selections if 1
+ int AlreadySelected; //for single selections to avoid selecting more than one object
+ RGBColor SelectionColor;
+*/
+
+
case 1:
case 2:
if (view->Selection.Anti == 0) {
#define TOPVIEWDATA_H
#include <gtk/gtk.h>
-#include "cgraph.h"
+#include "agraph.h"
#include "smyrnadefs.h"
#include "tvnodes.h"
g));
view->defaultnodeshape=atoi(buf=get_attribute_value("defaultnodeshape", view,g));
+ view->Selection.PickingType=atoi(buf=get_attribute_value("defaultselectionmethod", view,g));
+
view->gridVisible = atoi(get_attribute_value("gridvisible", view, g));
#include "smyrnadefs.h"
#include <gtk/gtk.h>
#include "xdot.h"
-#include "cgraph.h"
+#include "agraph.h"
void init_viewport(ViewInfo * view);
void set_viewport_settings_from_template(ViewInfo * view, Agraph_t *);
* AT&T Research, Florham Park NJ *
**********************************************************/
+#define WITH_CGRAPH 1
+#ifdef WITH_CGRAPH
+#include <cgraph.h>
+#else
#include <agraph.h>
+#endif
+#undef WITH_CGRAPH
+
#include <agutil.h>
#include <stdlib.h>
* AT&T Research, Florham Park NJ *
**********************************************************/
+
+#define WITH_CGRAPH 1
+#ifdef WITH_CGRAPH
+#include <cgraph.h>
+#else
#include <agraph.h>
+#endif
+#undef WITH_CGRAPH
+
#include <agutil.h>
/* node Nqueue maintenance */
#include "config.h"
#endif
-#include <cgraph.h>
+#include <agraph.h>
#include <ctype.h>
}
}
+/*
+ cgraph requires
+
+*/
void graph_init(graph_t * g, boolean use_rankdir)
{
char *p;
#include "colorprocs.h" /* must collow color.h (in types.h) */
#include "geomprocs.h" /* must follow geom.h (in types.h) */
#include "agxbuf.h"
-#include "graph.h" /* must follow types.h */
+#ifdef WITH_CGRAPH
+#include <cgraph.h>
+#else
+#include <graph.h>
+#endif
#include "utils.h" /* must follow types.h and agxbuf.h */
#include "gvplugin.h" /* must follow gvcext.h (in types.h) */
#include "gvcjob.h" /* must follow gvcext.h (in types.h) */
typedef int (*bsearch_cmpf) (const void *, const void *);
typedef struct Agraph_t graph_t;
- typedef struct Agnode_t node_t;
+
+#ifdef WITH_CGRAPH
+ typedef struct Agnode_s node_t;
+ typedef struct Agedge_s edge_t;
+#else
+ typedef struct Agnode_t node_t;
typedef struct Agedge_t edge_t;
- typedef struct Agsym_t attrsym_t;
+#endif
+
+ typedef struct Agsym_t attrsym_t;
typedef struct htmllabel_t htmllabel_t;
} Agraphinfo_t;
+#ifdef WITH_CGRAPH
+#include <cgraph.h>
+#define GD_drawing(g) (((Agraphinfo_t*)AGDATA(g))->drawing)
+#define GD_bb(g) (((Agraphinfo_t*)AGDATA(g))->bb)
+#define GD_gvc(g) (((Agraphinfo_t*)AGDATA(g))->gvc)
+#define GD_cleanup(g) (((Agraphinfo_t*)AGDATA(g))->cleanup)
+#define ND_id(n) (((Agnodeinfo_t*)AGDATA(n))->id)
+#define ED_dist(e) (((Agedgeinfo_t*)AGDATA(e))->dist)
+#define GD_dist(g) (((Agraphinfo_t*)AGDATA(e))->dist)
+#define ND_alg(n) (((Agnodeinfo_t*)AGDATA(n))->alg)
+#define ED_weight(e) (((Agedgeinfo_t*)AGDATA(e))->weight)
+//#define ED_weight(e) (e)->u.weight
+#else
+#include <graph.h>
+#endif
+
+
+
+
+
+
+
+
#define GD_alg(g) (g)->u.alg
-#define GD_bb(g) (g)->u.bb
+//#define GD_bb(g) (g)->u.bb
#define GD_border(g) (g)->u.border
#define GD_cl_cnt(g) (g)->u.cl_cnt
-#define GD_cleanup(g) (g)->u.cleanup
+//#define GD_cleanup(g) (g)->u.cleanup
#define GD_clust(g) (g)->u.clust
#define GD_cluster_was_collapsed(g) (g)->u.cluster_was_collapsed
#define GD_comp(g) (g)->u.comp
-#define GD_dist(g) (g)->u.dist
-#define GD_drawing(g) (g)->u.drawing
+//#define GD_dist(g) (g)->u.dist
+//#define GD_drawing(g) (g)->u.drawing
#define GD_exact_ranksep(g) (g)->u.exact_ranksep
#define GD_expanded(g) (g)->u.expanded
#define GD_flags(g) (g)->u.flags
#define GD_gui_state(g) (g)->u.gui_state
-#define GD_gvc(g) (g)->u.gvc
+//#define GD_gvc(g) (g)->u.gvc
#define GD_charset(g) (g)->u.charset
#define GD_has_labels(g) (g)->u.has_labels
#define GD_has_images(g) (g)->u.has_images
#define ND_UF_parent(n) (n)->u.UF_parent
#define ND_UF_size(n) (n)->u.UF_size
-#define ND_alg(n) (n)->u.alg
+//#define ND_alg(n) (n)->u.alg
#define ND_bb(n) (n)->u.bb
#define ND_clust(n) (n)->u.clust
#define ND_coord_i(n) (n)->u.coord
#define ND_height(n) (n)->u.height
#define ND_hops(n) (n)->u.hops
#define ND_ht_i(n) (n)->u.ht
-#define ND_id(n) (n)->u.id
+//#define ND_id(n) (n)->u.id
#define ND_in(n) (n)->u.in
#define ND_inleaf(n) (n)->u.inleaf
#define ND_label(n) (n)->u.label
#define ED_conc_opp_flag(e) (e)->u.conc_opp_flag
#define ED_count(e) (e)->u.count
#define ED_cutvalue(e) (e)->u.cutvalue
-#define ED_dist(e) (e)->u.dist
+//#define ED_dist(e) (e)->u.dist
#define ED_edge_type(e) (e)->u.edge_type
#define ED_adjacent(e) (e)->u.adjacent
#define ED_factor(e) (e)->u.factor
#define ED_to_orig(e) (e)->u.to_orig
#define ED_to_virt(e) (e)->u.to_virt
#define ED_tree_index(e) (e)->u.tree_index
-#define ED_weight(e) (e)->u.weight
+//#define ED_weight(e) (e)->u.weight
#define ED_xpenalty(e) (e)->u.xpenalty
typedef struct {
* Information and Software Systems Research *
* AT&T Research, Florham Park NJ *
**********************************************************/
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "builddate.h"
#include "types.h"
-#include "graph.h"
+/*This code block should be replaced with only one onclude to cgraph*/
+#ifdef WITH_CGRAPH
+#include <cgraph.h>
+#else
+#include <graph.h>
+#endif
+/********************/
+
#include "const.h"
#include "gvplugin.h"
#include "gvcjob.h"
{
GVC_t *gvc;
- aginit();
+// void aginit(Agraph_t * g, int kind, char *rec_name, int rec_size, int move_to_front);
+//#define aginit() aginitlib(sizeof(Agraph_t),sizeof(Agnode_t),sizeof(Agedge_t))
+//void aginit(Agraph_t * g, int kind, char *rec_name, int rec_size, int move_to_front);
+// aginit();
agnodeattr(NULL, "label", NODENAME_ESC);
gvc = gvNEWcontext(LibInfo, gvUsername());
gvconfig(gvc, FALSE); /* configure for available plugins and codegens */
/* set bb attribute for basic layout.
* doesn't yet include margins, scaling or page sizes because
* those depend on the renderer being used. */
- if (GD_drawing(g)->landscape)
+
+ if (GD_drawing(g)->landscape)
sprintf(buf, "%d %d %d %d",
ROUND(GD_bb(g).LL.y), ROUND(GD_bb(g).LL.x),
ROUND(GD_bb(g).UR.y), ROUND(GD_bb(g).UR.x));
{
int rc;
GVJ_t *job;
+#ifdef WITH_CGRAPH
+ g=agroot(g);
+#else
+ g = g->root;
+#endif
+
+
- g = g->root;
/* create a job for the required format */
rc = gvjobs_output_langname(gvc, format);
int rc;
GVJ_t *job;
- g = g->root;
+#ifdef WITH_CGRAPH
+ g=agroot(g);
+#else
+ g = g->root;
+#endif
/* create a job for the required format */
rc = gvjobs_output_langname(gvc, format);
int rc;
GVJ_t *job;
- g = g->root;
+#ifdef WITH_CGRAPH
+ g=agroot(g);
+#else
+ g = g->root;
+#endif
/* create a job for the required format */
rc = gvjobs_output_langname(gvc, format);
#define GVC_H
#include "types.h"
-#include "graph.h"
+#define WITH_CGRAPH 1
+#ifdef WITH_CGRAPH
+#include <cgraph.h>
+#else
+#include <graph.h>
+#endif
+#undef WITH_CGRAPH
#ifdef __cplusplus
extern "C" {
#include "memory.h"
#include "const.h"
#include "types.h"
-#include "graph.h"
+/*This code block should be replaced with only one onclude to cgraph*/
+#ifdef WITH_CGRAPH
+#include <cgraph.h>
+#else
+#include <graph.h>
+#endif
+/********************/
#include "gvplugin.h"
#include "gvcjob.h"
#endif
#include "types.h"
-#include "graph.h"
+/*This code block should be replaced with only one onclude to cgraph*/
+#ifdef WITH_CGRAPH
+#include <cgraph.h>
+#else
+#include <graph.h>
+#endif
+/********************/
#include "gvplugin.h"
#include "gvcjob.h"
#include "gvcint.h"
#include <string.h>
#include "gvplugin_layout.h"
-#include "graph.h"
+
+#ifdef WITH_CGRAPH
+#include <cgraph.h>
+#else
+#include <graph.h>
+#endif
+
#include "gvcint.h"
#include "gvcproc.h"
static void gv_graph_state(GVJ_t *job, graph_t *g)
{
int i, j;
- Agsym_t *a;
+ Agsym_t *a=NULL;
gv_argvlist_t *list;
-
- list = &(job->selected_obj_type_name);
+ list = &(job->selected_obj_type_name);
j = 0;
- if (g == g->root) {
+
+
+#ifdef WITH_CGRAPH
+ if (g == agroot(g)) {
+#else
+ if (g == g->root) {
+#endif
+
+#ifdef WITH_CGRAPH
+ if (AGTYPE(g) && agisdirected(g))
+#else
if (g->kind && AGFLAG_DIRECTED)
- gv_argvlist_set_item(list, j++, s_digraph);
+#endif
+
+
+ gv_argvlist_set_item(list, j++, s_digraph);
else
gv_argvlist_set_item(list, j++, s_graph);
}
else {
gv_argvlist_set_item(list, j++, s_subgraph);
}
- gv_argvlist_set_item(list, j++, g->name);
+
+#ifdef WITH_CGRAPH
+ gv_argvlist_set_item(list, j++, agname(g));
+#else
+ gv_argvlist_set_item(list, j++, g->name);
+#endif
+
list->argc = j;
list = &(job->selected_obj_attributes);
- for (i = 0, j = 0; i < dtsize(g->univ->globattr->dict); i++) {
+
+
+#ifdef WITH_CGRAPH
+ j=0;
+ while (a = agnxtattr(g, AGRAPH, a)) {
+ gv_argvlist_set_item(list, j++, a->name);
+ gv_argvlist_set_item(list, j++, a->defval); /* For graphs, defval and the graph's value are the same */
+ gv_argvlist_set_item(list, j++, (char*)GVATTR_STRING);
+ }
+#else
+ for (i = 0, j = 0; i < dtsize(g->univ->globattr->dict); i++) {
a = g->univ->globattr->list[i];
gv_argvlist_set_item(list, j++, a->name);
gv_argvlist_set_item(list, j++, agxget(g, a->index));
gv_argvlist_set_item(list, j++, (char*)GVATTR_STRING);
}
- list->argc = j;
+#endif
+
+ list->argc = j;
+
+
+#ifdef WITH_CGRAPH
+ a = agfindattr(agroot(g), s_href);
+ if (!a)
+ a = agfindattr(agroot(g), s_URL);
- a = agfindattr(g->root, s_href);
+#else
+ a = agfindattr(g->root, s_href);
if (!a)
a = agfindattr(g->root, s_URL);
+#endif
+
+
if (a)
- job->selected_href = strdup_and_subst_obj(agxget(g, a->index), (void*)g);
+
+#ifdef WITH_CGRAPH
+ job->selected_href = strdup_and_subst_obj(agxget(g, a), (void*)g);
+#else
+ job->selected_href = strdup_and_subst_obj(agxget(g, a->index), (void*)g);
+#endif
+
+
}
+/*
+ * Summary :
+ * Parameters: *GVJ_s,*Agnode_s
+ * Return : no return value
+ */
static void gv_node_state(GVJ_t *job, node_t *n)
{
int i, j;
list = &(job->selected_obj_type_name);
j = 0;
gv_argvlist_set_item(list, j++, s_node);
- gv_argvlist_set_item(list, j++, n->name);
+
+#ifdef WITH_CGRAPH
+ gv_argvlist_set_item(list, j++, agnameof(n));
+ list->argc = j;
+ list = &(job->selected_obj_attributes);
+
+ g= agroot(agraphof(n));
+ j=0;
+ while (a = agnxtattr(g, AGNODE, a)) {
+ gv_argvlist_set_item(list, j++, a->name);
+ gv_argvlist_set_item(list, j++, a->defval); /* For graphs, defval and the graph's value are the same */
+ gv_argvlist_set_item(list, j++, (char*)GVATTR_STRING);
+ }
list->argc = j;
+ /*ASK ERG!!!!!!!!!!!!!!!!!!!!!!
+ /*Agproto_t *proto;
+ a = agfindattr(agraphof(n)->proto->n, s_href);
+ if (!a)
+ a = agfindattr(n->graph->proto->n, s_URL);
+ if (a)
+ job->selected_href = strdup_and_subst_obj(agxget(n, a), (void*)n);*/
+#else
+ gv_argvlist_set_item(list, j++, n->name);
+ list->argc = j;
list = &(job->selected_obj_attributes);
g = n -> graph -> root;
for (i = 0, j = 0; i < dtsize(g->univ->nodeattr->dict); i++) {
a = agfindattr(n->graph->proto->n, s_URL);
if (a)
job->selected_href = strdup_and_subst_obj(agxget(n, a->index), (void*)n);
+
+#endif
+
}
static void gv_edge_state(GVJ_t *job, edge_t *e)
{
- int i, j;
+#ifdef WITH_CGRAPH
+ int i, j;
+ Agsym_t *a;
+ Agraph_t *g;
+ gv_argvlist_t *nlist, *alist;
+
+ nlist = &(job->selected_obj_type_name);
+
+ /* only tail, head, and key are strictly identifying properties,
+ * but we commonly alse use edge kind (e.g. "->") and tailport,headport
+ * in edge names */
+ j = 0;
+ gv_argvlist_set_item(nlist, j++, s_edge);
+ gv_argvlist_set_item(nlist, j++, e->tail->name);
+ j++; /* skip tailport slot for now */
+ gv_argvlist_set_item(nlist, j++, (e->tail->graph->kind && AGFLAG_DIRECTED)?"->":"--");
+ gv_argvlist_set_item(nlist, j++, e->head->name);
+ j++; /* skip headport slot for now */
+ j++; /* skip key slot for now */
+ nlist->argc = j;
+
+ alist = &(job->selected_obj_attributes);
+ g = e -> head -> graph -> root;
+ for (i = 0, j = 0; i < dtsize(g->univ->edgeattr->dict); i++) {
+ a = g->univ->edgeattr->list[i];
+
+ /* tailport and headport can be shown as part of the name, but they
+ * are not identifying properties of the edge so we
+ * also list them as modifyable attributes. */
+ if (strcmp(a->name,s_tailport) == 0)
+ gv_argvlist_set_item(nlist, 2, agxget(e, a->index));
+ else if (strcmp(a->name,s_headport) == 0)
+ gv_argvlist_set_item(nlist, 5, agxget(e, a->index));
+
+ /* key is strictly an identifying property to distinguish multiple
+ * edges between the same node pair. Its non-writable, so
+ * no need to list it as an attribute as well. */
+ else if (strcmp(a->name,s_key) == 0) {
+ gv_argvlist_set_item(nlist, 6, agxget(e, a->index));
+ continue;
+ }
+
+ gv_argvlist_set_item(alist, j++, a->name);
+ gv_argvlist_set_item(alist, j++, agxget(e, a->index));
+ }
+ alist->argc = j;
+
+ a = agfindattr(e->head->graph->proto->e, s_href);
+ if (!a)
+ a = agfindattr(e->head->graph->proto->e, s_URL);
+ if (a)
+ job->selected_href = strdup_and_subst_obj(agxget(e, a->index), (void*)e);
+
+#else
+ int i, j;
Agsym_t *a;
Agraph_t *g;
gv_argvlist_t *nlist, *alist;
a = agfindattr(e->head->graph->proto->e, s_URL);
if (a)
job->selected_href = strdup_and_subst_obj(agxget(e, a->index), (void*)e);
+#endif
}
static void gvevent_refresh(GVJ_t * job)
#include "const.h"
#include "gvplugin_layout.h"
#include "gvcint.h"
-#include "graph.h"
+
+#ifdef WITH_CGRAPH
+#include <cgraph.h>
+#else
+#include <graph.h>
+#endif
+
#include "gvcproc.h"
extern void graph_init(graph_t *g, boolean use_rankdir);
return -1;
GD_gvc(g) = gvc;
- if (g != g->root) GD_gvc(g->root) = gvc;
+ if (g != agroot(g)) GD_gvc(agroot(g)) = gvc;
graph_init(g, gvc->layout.features->flags & LAYOUT_USES_RANKDIR);
- GD_drawing(g->root) = GD_drawing(g);
+ GD_drawing(agroot(g)) = GD_drawing(g);
if (gvle && gvle->layout) {
gvle->layout(g);
if (gvle->cleanup)
if (GD_drawing(g)) {
graph_cleanup(g);
GD_drawing(g) = NULL;
- GD_drawing(g->root) = NULL;
+ GD_drawing(agroot(g)) = NULL;
}
return 0;
}
#include "gvcproc.h"
/* for agerr() */
-#include "graph.h"
+#define WITH_CGRAPH 1
+#ifdef WITH_CGRAPH
+#include <cgraph.h>
+#else
+#include <graph.h>
+#endif
+#undef WITH_CGRAPH
static int gvloadimage_select(GVJ_t * job, char *str)
{
#include "memory.h"
#include "types.h"
-#include "graph.h"
+
+#ifdef WITH_CGRAPH
+#include <cgraph.h>
+#else
+#include <graph.h>
+#endif
+
#include "gvplugin.h"
#include "gvcjob.h"
#include "gvcint.h"
#include "macros.h"
#include "colorprocs.h"
#include "gvplugin_render.h"
-#include "graph.h"
+
+#define WITH_CGRAPH 1
+#ifdef WITH_CGRAPH
+#include <cgraph.h>
+#else
+#include <graph.h>
+#endif
+#undef WITH_CGRAPH
+
+
#include "gvcint.h"
#include "geom.h"
#include "geomprocs.h"
#include "types.h"
#include "logic.h"
#include "memory.h"
-#include "graph.h"
+
+#define WITH_CGRAPH 1
+#ifdef WITH_CGRAPH
+#include <cgraph.h>
+#else
+#include <graph.h>
+#endif
+#undef WITH_CGRAPH
+
#include "agxbuf.h"
#include "utils.h"