From d214e8aabee4798f5746ee8ab40b16a4f70b1728 Mon Sep 17 00:00:00 2001 From: arif Date: Mon, 1 Feb 2010 19:18:14 +0000 Subject: [PATCH] smyrna non convax polygon support --- cmd/smyrna/Makefile.am | 4 +- cmd/smyrna/draw.c | 17 +- cmd/smyrna/glexpose.c | 6 +- cmd/smyrna/gui/appmouse.c | 2 +- cmd/smyrna/gui/glcompui.c | 13 +- cmd/smyrna/hotkeymap.c | 2 +- cmd/smyrna/polytess.c | 262 ++++++++++++++++++++ cmd/smyrna/polytess.h | 33 +++ cmd/smyrna/smyrna.vcproj | 12 + cmd/smyrna/smyrna.vcproj.RESEARCH.arif.user | 65 +++++ cmd/smyrna/smyrna_utils.c | 154 ++++++++++++ cmd/smyrna/smyrna_utils.h | 16 ++ cmd/smyrna/smyrnadefs.h | 20 +- cmd/smyrna/topfisheyeview.c | 132 +++++----- cmd/smyrna/topview.c | 177 ++++++++++++- cmd/smyrna/viewport.c | 29 +-- 16 files changed, 828 insertions(+), 116 deletions(-) create mode 100644 cmd/smyrna/polytess.c create mode 100644 cmd/smyrna/polytess.h create mode 100644 cmd/smyrna/smyrna.vcproj.RESEARCH.arif.user create mode 100644 cmd/smyrna/smyrna_utils.c create mode 100644 cmd/smyrna/smyrna_utils.h diff --git a/cmd/smyrna/Makefile.am b/cmd/smyrna/Makefile.am index 2dcaef3c4..fabf4abeb 100644 --- a/cmd/smyrna/Makefile.am +++ b/cmd/smyrna/Makefile.am @@ -41,7 +41,7 @@ noinst_HEADERS = btree.h draw.h filter.h glexpose.h glmotion.h gltemplate.h \ topfisheyeview.h viewportcamera.h gvprpipe.h md5.h drawxdot.h arcball.h \ gui/beacon.h gui/callbacks.h gui/datalistcallbacks.h gui/filterscallbacks.h \ gui/frmobjectui.h gui/glcompui.h gui/gui.h gui/menucallbacks.h \ - gui/toolboxcallbacks.h gui/topviewsettings.h gui/appmouse.h + gui/toolboxcallbacks.h gui/topviewsettings.h gui/appmouse.h polytess.h smyrna_utils.h smyrna_SOURCES = btree.c draw.c filter.c glexpose.c glmotion.c gltemplate.c \ hier.c main.c selection.c support.c template.c topview.c topviewdata.c \ @@ -49,7 +49,7 @@ smyrna_SOURCES = btree.c draw.c filter.c glexpose.c glmotion.c gltemplate.c \ gvprpipe.c md5.c drawxdot.c arcball.c hotkeymap.c \ gui/beacon.c gui/callbacks.c gui/datalistcallbacks.c gui/filterscallbacks.c \ gui/frmobjectui.c gui/glcompui.c gui/gui.c gui/menucallbacks.c \ - gui/toolboxcallbacks.c gui/topviewsettings.c gui/appmouse.c + gui/toolboxcallbacks.c gui/topviewsettings.c gui/appmouse.c polytess.c smyrna_utils.c smyrna_LDADD = $(top_builddir)/lib/cgraph/libcgraph_C.la \ $(top_builddir)/lib/cdt/libcdt_C.la \ diff --git a/cmd/smyrna/draw.c b/cmd/smyrna/draw.c index 5fb6fa2ee..06b7910f1 100755 --- a/cmd/smyrna/draw.c +++ b/cmd/smyrna/draw.c @@ -30,6 +30,7 @@ XDOT DRAWING FUNCTIONS, maybe need to move them somewhere else #include "topfisheyeview.h" #include "appmouse.h" #include "hotkeymap.h" +#include "polytess.h" //delta values static float dx = 0.0; @@ -331,6 +332,8 @@ extern void DrawPolygon(sdot_op * o, int param) } glLineWidth(view->LineWidth); + drawTessPolygon(o); +/* if (!filled) glBegin(GL_LINE_STRIP); else @@ -341,9 +344,21 @@ extern void DrawPolygon(sdot_op * o, int param) (GLfloat) op->u.polygon.pts[i].z + view->Topview->global_z); } glVertex3f((GLfloat) op->u.polygon.pts[0].x - dx, (GLfloat) op->u.polygon.pts[0].y - dy, (GLfloat) op->u.polygon.pts[0].z + view->Topview->global_z); //close the polygon - glEnd(); + glEnd();*/ +} + + +extern void DrawPolygon2(sdot_op * o, int param) + +{ + drawTessPolygon(o); } + + + + + void DrawPolyline(sdot_op* o, int param) { int i = 0; diff --git a/cmd/smyrna/glexpose.c b/cmd/smyrna/glexpose.c index 26ee1916f..dca3792d5 100644 --- a/cmd/smyrna/glexpose.c +++ b/cmd/smyrna/glexpose.c @@ -23,6 +23,7 @@ #include "gui/toolboxcallbacks.h" #include "arcball.h" #include "hotkeymap.h" +#include "polytess.h" void drawRotatingAxis(void); void draw_cube() @@ -182,9 +183,6 @@ int glexpose_main(ViewInfo * view) drawRotatingAxis(); // draw_stuff(); // test_color_pallete(); - - - // drawtestpoly(); /*DEBUG*/ /* if (view->mouse.mouse_mode == MM_PAN) @@ -263,7 +261,7 @@ int glexpose_drawgraph(ViewInfo * view) if (view->activeGraph > -1) { // if (GD_TopView(view->g[view->activeGraph])) // { - if (!view->Topview->is_top_fisheye) + if (!view->Topview->fisheyeParams.active) drawTopViewGraph(view->g[view->activeGraph]); //view->Topview style dots and straight lines else { drawtopologicalfisheye(view->Topview); diff --git a/cmd/smyrna/gui/appmouse.c b/cmd/smyrna/gui/appmouse.c index 909fe1887..cfcf6f846 100644 --- a/cmd/smyrna/gui/appmouse.c +++ b/cmd/smyrna/gui/appmouse.c @@ -64,7 +64,7 @@ static void apply_actions(ViewInfo* v,int x,int y) if (view->activeGraph >= 0) { - if (view->Topview->is_top_fisheye) + if (view->Topview->fisheyeParams.active) changetopfishfocus(view->Topview,&view->mouse.GLpos.x,&view->mouse.GLpos.y, 0, 1); else //single right click // pick_node_from_coords(view->mouse.GLpos.x, view->mouse.GLpos.y,view->mouse.GLpos.z); diff --git a/cmd/smyrna/gui/glcompui.c b/cmd/smyrna/gui/glcompui.c index 6dfda0a10..c78db4a7c 100644 --- a/cmd/smyrna/gui/glcompui.c +++ b/cmd/smyrna/gui/glcompui.c @@ -71,19 +71,20 @@ static void menu_click_zoom_plus(glCompObj *obj, GLfloat x, GLfloat y, static void menu_switch_to_fisheye(glCompObj *obj, GLfloat x, GLfloat y, glMouseButtonType t) { - if (!view->Topview->is_top_fisheye == 1) { - if (!view->Topview->h) { + if (!view->Topview->fisheyeParams.active) + { + if (!view->Topview->fisheyeParams.h) { prepare_topological_fisheye(view->Topview); g_timer_start(view->timer); } - view->Topview->is_top_fisheye = 1; + view->Topview->fisheyeParams.active = 1; glCompButtonShow(toNormal); glCompButtonHide(toFisheye); imgFisheye->common.visible = 1; } else { - view->Topview->is_top_fisheye = 0; + view->Topview->fisheyeParams.active = 0; g_timer_stop(view->timer); glCompButtonHide(toNormal); glCompButtonShow(toFisheye); @@ -331,8 +332,8 @@ glCompSet *glcreate_gl_topview_menu(void) glCompImageLoadPng(i, smyrnaPath("mod_3D.png")); img3D = i; i->common.visible = 0; - l=glCompLabelNew((glCompObj *)s,100,5,view->Topview->Graphdata.GraphFileName); - glCompLabelSetFontSize(l,24); +/* l=glCompLabelNew((glCompObj *)s,100,5,view->Topview->Graphdata.GraphFileName); + glCompLabelSetFontSize(l,24);*/ return s; diff --git a/cmd/smyrna/hotkeymap.c b/cmd/smyrna/hotkeymap.c index 61e56d4b1..9605e3ca0 100644 --- a/cmd/smyrna/hotkeymap.c +++ b/cmd/smyrna/hotkeymap.c @@ -230,7 +230,7 @@ int get_mode(ViewInfo* v) view_mode=smyrna_2D; if (v->active_camera >= 0 ) view_mode=smyrna_3D; - if(v->Topview->is_top_fisheye) + if(v->Topview->fisheyeParams.active) view_mode=smyrna_fisheye; diff --git a/cmd/smyrna/polytess.c b/cmd/smyrna/polytess.c new file mode 100644 index 000000000..dea06f518 --- /dev/null +++ b/cmd/smyrna/polytess.c @@ -0,0 +1,262 @@ +#include "polytess.h" +#include "xdot.h" +tessPoly TP; + +GLdouble star[5][3] = { 0.6f, -0.1f, 0.0f, + 1.35f, 1.4f, 0.0f, + 2.1f, -0.1f, 0.0f, + 0.6f, 0.9f, 0.0f, + 2.1f, 0.9f, 0.0f,}; + + +//second polygon: a quad-4 vertices; first contour + +GLdouble s1[3][3] = { 0.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f,}; +GLdouble s2[4][3] = { 0.0f, 1.0f, 0.0f, + 0.3f, 0.3f, 0.0f, + 0.7f, 0.3f, 0.0f, + 0.5f, 0.7f, 0.0f,}; + + + + + + +GLdouble quad2[9][3] = { 0.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, + 1.0f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, + 0.3f, 0.3f, 0.0f, + 0.7f, 0.3f, 0.0f, + 0.5f, 0.7f, 0.0f, + 0.3f, 0.3f, 0.0f}; + + + +GLdouble quad[5][3] = { 0.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, + 1.0f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f}; + +//second polygon: a triangle-3 vertices; second contour +GLdouble tri[3][3] = { 0.3f, 0.3f, 0.0f, + 0.7f, 0.3f, 0.0f, + 0.5f, 0.7f, 0.0f}; + +GLdouble complex[25][3] = { 0.0f, 0.0f, 0.0f, + 2.0f, 1.0f, 0.0f, + 2.0f, 2.0f, 0.0f, + 1.0f, 3.0f, 0.0f, + 3.0f, 3.0f, 0.0f, + 3.0f, 5.0f, 0.0f, + 0.0f, 5.0f, 0.0f, + 1.0f, 6.0f, 0.0f, + 0.0f, 7.0f, 0.0f, + 3.0f, 7.0f, 0.0f, + 5.0f, 5.0f, 0.0f, + 6.0f, 7.0f, 0.0f, + 7.0f, 7.0f, 0.0f, + 6.0f, 4.0f, 0.0f, + 5.0f, 4.0f, 0.0f, + 5.0f, 3.0f, 0.0f, + 4.0f, 3.0f, 0.0f, + 4.0f, 2.0f, 0.0f, + 7.0f, 2.0f, 0.0f, + 4.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, + 2.5f, 0.5f, 0.0f, + 3.5f, 1.0f, 0.0f, + 3.5f, 0.5f, 0.0f, + 2.5f, 0.5f, 0.0f}; + + + +void CALLBACK combineCallback(GLdouble coords[3], GLdouble *vertex_data[4],GLfloat weight[4], GLdouble **dataOut) +{ + GLdouble *vertex; + int i; + vertex = (GLdouble *) malloc(6 * sizeof(GLdouble)); + vertex[0] = coords[0]; + vertex[1] = coords[1]; + vertex[2] = coords[2]; + for (i = 3; i < 6; i++) + { +/* vertex[i] = weight[0] * vertex_data[0][i] + + weight[1] * vertex_data[1][i] + + weight[2] * vertex_data[2][i] + + weight[3] * vertex_data[3][i];*/ + vertex[i] = 0; + + } + *dataOut = vertex; +} + +void CALLBACK vertexCallback(GLvoid *vertex) +{ + GLdouble *ptr; + ptr = (GLdouble *) vertex; + glVertex3dv((GLdouble *) ptr); + +} + + + +static GLUtesselator* Init() +{ + // Create a new tessellation object + GLUtesselator* tobj = gluNewTess(); + // Set callback functions + gluTessCallback(tobj, GLU_TESS_VERTEX, &vertexCallback); + gluTessCallback(tobj, GLU_TESS_BEGIN, &glBegin); + gluTessCallback(tobj, GLU_TESS_END, &glEnd); + gluTessCallback(tobj, GLU_TESS_COMBINE,&combineCallback); + return tobj; +} + + + +static int Set_Winding_Rule(GLUtesselator *tobj,GLenum winding_rule) +{ + +// Set the winding rule + gluTessProperty(tobj, GLU_TESS_WINDING_RULE, winding_rule); + return 1 ; +} + +static int Render_Contour2(GLUtesselator *tobj,sdot_op* p) +{ + GLdouble** d; + int x=0; + int y=0; + + d=(GLdouble**) malloc(sizeof(GLdouble)* p->op.u.polygon.cnt); + for (x=0;x < p->op.u.polygon.cnt; x++) + { + GLdouble temp; + d[x]=(GLdouble*)(malloc(sizeof(GLdouble)*3)); + d[x][0]=p->op.u.polygon.pts[x].x; + d[x][1]=p->op.u.polygon.pts[x].y; + d[x][2]=p->op.u.polygon.pts[x].z; + } + for (x = 0; x < p->op.u.polygon.cnt; x++) //loop through the vertices + { + gluTessVertex(tobj, d[x],d[x]); //store the vertex + } + + +/* for (x = 0; x < p->op.u.polygon.cnt; x++) //loop through the vertices + { + d[0]=p->op.u.polygon.pts[x].x; + d[1]=p->op.u.polygon.pts[x].y; + d[2]=p->op.u.polygon.pts[x].z; +// gluTessVertex(tobj, obj_data[x], obj_data[x]); //store the vertex + gluTessVertex(tobj, d,d); //store the vertex + }*/ + return(1); + +} +static int Render_Contour(GLUtesselator *tobj, GLdouble obj_data[][3],int cnt) +{ + + + +// GLdouble d[1][3]; + static GLdouble**d; + int x=0; + int y=0; + if (!d) + { + d=(GLdouble**) malloc(sizeof(GLdouble)* cnt); + for (x=0;x < cnt; x++) + { + GLdouble temp; + d[x]=(GLdouble*)(malloc(sizeof(GLdouble)*3)); + d[x][0]=obj_data[x][0]; + d[x][1]=obj_data[x][1]; + d[x][2]=obj_data[x][2]; + } + } + + + + + for (x = 0; x < cnt; x++) //loop through the vertices + { +/* d[0][0]=obj_data[x][0]; + d[0][1]=obj_data[x][1]; + d[0][2]=obj_data[x][2];*/ + + + +/*void APIENTRY gluTessVertex( + GLUtesselator *tess, + GLdouble coords[3], + void *data );*/ + + gluTessVertex(tobj, d[x], d[x]); //store the vertex +// gluTessVertex(tobj, obj_data[x], obj_data[x]); //store the vertex +// gluTessVertex(tobj, d[0],d[0]); //store the vertex +// gluTessVertex(tobj, g,g); //store the vertex + + } + + return(1); + +} + + + + + + +static int Begin_Polygon(GLUtesselator *tobj) +{ + gluTessBeginPolygon(tobj, NULL); + return(1); +} +static int End_Polygon(GLUtesselator *tobj) +{ + gluTessEndPolygon(tobj); + return(1); + +} +static int Begin_Contour(GLUtesselator *tobj) +{ + gluTessBeginContour(tobj); + return(1); + +} +static int End_Contour(GLUtesselator *tobj) +{ + gluTessEndContour(tobj); + return(1); + +} + +static int freeTes(GLUtesselator *tobj) +{ + gluDeleteTess(tobj); + return(1); + +} +int drawTessPolygon(sdot_op* p) +{ + if (!TP.tobj) + { + TP.tobj=Init(); + TP.windingRule=GLU_TESS_WINDING_ODD; + } + Set_Winding_Rule(TP.tobj,TP.windingRule); + Begin_Polygon(TP.tobj); + Begin_Contour(TP.tobj); + Render_Contour2(TP.tobj,p); +// Render_Contour(TP.tobj,complex,25); + End_Contour(TP.tobj); + End_Polygon(TP.tobj); + return 1; +} + diff --git a/cmd/smyrna/polytess.h b/cmd/smyrna/polytess.h new file mode 100644 index 000000000..d9ac6ad24 --- /dev/null +++ b/cmd/smyrna/polytess.h @@ -0,0 +1,33 @@ +/* $Id$ $Revision$ */ +/* vim:set shiftwidth=4 ts=8: */ + +/********************************************************** +* This software is part of the graphviz package * +* http://www.graphviz.org/ * +* * +* Copyright (c) 1994-2004 AT&T Corp. * +* and is licensed under the * +* Common Public License, Version 1.0 * +* by AT&T Corp. * +* * +* Information and Software Systems Research * +* AT&T Research, Florham Park NJ * +**********************************************************/ + +#ifndef POLYTESS_H +#define POLYTESS_H +#include "smyrnadefs.h" + +#ifdef __cplusplus +extern "C" { +#endif + typedef struct { + GLUtesselator *tobj; + GLenum windingRule; + }tessPoly; + extern int drawTessPolygon(sdot_op* p); + extern int testDraw(); +#ifdef __cplusplus +} /* end extern "C" */ +#endif +#endif diff --git a/cmd/smyrna/smyrna.vcproj b/cmd/smyrna/smyrna.vcproj index c4c019507..b98cd27ec 100644 --- a/cmd/smyrna/smyrna.vcproj +++ b/cmd/smyrna/smyrna.vcproj @@ -433,10 +433,18 @@ RelativePath=".\gui\menucallbacks.c" > + + + + @@ -457,6 +465,10 @@ RelativePath=".\topviewdata.c" > + + diff --git a/cmd/smyrna/smyrna.vcproj.RESEARCH.arif.user b/cmd/smyrna/smyrna.vcproj.RESEARCH.arif.user new file mode 100644 index 000000000..c1742dcfa --- /dev/null +++ b/cmd/smyrna/smyrna.vcproj.RESEARCH.arif.user @@ -0,0 +1,65 @@ + + + + + + + + + + + diff --git a/cmd/smyrna/smyrna_utils.c b/cmd/smyrna/smyrna_utils.c new file mode 100644 index 000000000..349e0895a --- /dev/null +++ b/cmd/smyrna/smyrna_utils.c @@ -0,0 +1,154 @@ +#include "smyrna_utils.h" +static boolean mapbool(char *p) +{ + if (p == NULL) + return FALSE; + if (!strcasecmp(p, "false")) + return FALSE; + if (!strcasecmp(p, "no")) + return FALSE; + if (!strcasecmp(p, "true")) + return TRUE; + if (!strcasecmp(p, "yes")) + return TRUE; + return atoi(p); +} + +static int late_int(void *obj,Agsym_t* attr, int def, int low) +{ + char *p; + int rv; + if (attr == NULL) + return def; + p = agxget(obj, attr); + if (!p || p[0] == '\0') + return def; + if ((rv = atoi(p)) < low) + rv = low; + return rv; +} + +static double late_double(void *obj, Agsym_t* attr, double def, double low) +{ + char *p; + double rv; + + if (!attr || !obj) + return def; + p = agxget(obj, attr); + if (!p || p[0] == '\0') + return def; + if ((rv = atof(p)) < low) + rv = low; + return rv; +} + +static char* late_string(void *obj, Agsym_t * attr, char *def) +{ + if (!attr || !obj) + return def; + return agxget(obj, attr); +} + +static char *late_nnstring(void *obj, Agsym_t * attr, char *def) +{ + char *rv = late_string(obj, attr, def); + if (!rv || (rv[0] == '\0')) + rv = def; + return rv; +} + +static boolean late_bool(void *obj, Agsym_t * attr, int def) +{ + if (attr == NULL) + return def; + return mapbool(agxget(obj, attr)); +} + +int l_int(void *obj, Agsym_t * attr, int def) +{ + char *p; + if (attr == NULL) + return def; + p = agxget(obj, attr); + if (!p || p[0] == '\0') + return def; + return atoi(p); +} + +float l_float(void *obj, Agsym_t * attr, float def) +{ + char *p; + if (!attr || !obj) + return def; + p = agxget(obj, attr); + if (!p || p[0] == '\0') + return def; + return atof(p); +} +int getAttrBool(Agraph_t* g,void* obj,char* attr_name,int def) +{ + Agsym_t* attr; + attr = agattr(g, AGTYPE(obj), attr_name,0); + return late_bool(obj, attr,def); +} +int getAttrInt(Agraph_t* g,void* obj,char* attr_name,int def) +{ + Agsym_t* attr; + attr = agattr(g, AGTYPE(obj), attr_name,0); + return l_int(obj,attr,def); +} +float getAttrFloat(Agraph_t* g,void* obj,char* attr_name,float def) +{ + Agsym_t* attr; + attr = agattr(g, AGTYPE(obj), attr_name,0); + return l_float(obj,attr,def); +} +char* getAttrStr(Agraph_t* g,void* obj,char* attr_name,char* def) +{ + Agsym_t* attr; + attr = agattr(g, AGTYPE(obj), attr_name,0); + return late_string(obj, attr,def); +} + + +void setColor(glCompColor* c,GLfloat R,GLfloat G,GLfloat B,GLfloat A) +{ + c->R=R; + c->G=G; + c->B=B; + c->A=A; +} +static float interpol(float minv, float maxv, float minc, float maxc, float x) +{ + return ((x - minv) * (maxc - minc) / (maxv - minv) + minc); +} + + +/*void getcolorfromschema(colorschemaset * sc, float l, float maxl,glCompColor * c) +{ + int ind; + float percl = l / maxl * 100.00; + for (ind = 0; ind < sc->schemacount; ind++) { + if (percl < sc->s[ind].perc) + break; + } + + if (sc->s[ind].smooth) { + c->R = + interpol(sc->s[ind - 1].perc, sc->s[ind].perc, + sc->s[ind - 1].c.R, sc->s[ind].c.R, percl); + c->G = + interpol(sc->s[ind - 1].perc, sc->s[ind].perc, + sc->s[ind - 1].c.G, sc->s[ind].c.G, percl); + c->B = + interpol(sc->s[ind - 1].perc, sc->s[ind].perc, + sc->s[ind - 1].c.B, sc->s[ind].c.B, percl); + c->A = 1; + } else { + c->R = sc->s[ind].c.R; + c->G = sc->s[ind].c.G; + c->B = sc->s[ind].c.B; + c->A = 1; + } +}*/ diff --git a/cmd/smyrna/smyrna_utils.h b/cmd/smyrna/smyrna_utils.h new file mode 100644 index 000000000..5f69e2ec0 --- /dev/null +++ b/cmd/smyrna/smyrna_utils.h @@ -0,0 +1,16 @@ +#ifndef SMYRNA_UTILS_H +#define SMYRNA_UTILS_H + +#include "smyrnadefs.h" +#include "cgraph.h" + +extern int l_int(void *obj, Agsym_t * attr, int def); +extern float l_float(void *obj, Agsym_t * attr, float def); +extern int getAttrBool(Agraph_t* g,void* obj,char* attr_name,int def); +extern int getAttrInt(Agraph_t* g,void* obj,char* attr_name,int def); +extern float getAttrFloat(Agraph_t* g,void* obj,char* attr_name,float def); +extern char* getAttrStr(Agraph_t* g,void* obj,char* attr_name,char* def); +extern void setColor(glCompColor* c,GLfloat R,GLfloat G,GLfloat B,GLfloat A); +extern void getcolorfromschema(colorschemaset * sc, float l, float maxl,glCompColor * c); + +#endif diff --git a/cmd/smyrna/smyrnadefs.h b/cmd/smyrna/smyrnadefs.h index a790263f3..0f23b300a 100644 --- a/cmd/smyrna/smyrnadefs.h +++ b/cmd/smyrna/smyrnadefs.h @@ -42,6 +42,8 @@ extern "C" { #endif +#define WITH_CGRAPH 1 + #ifdef WIN32 //this is needed on WIN32 to get libglade see the callback #define _BB __declspec(dllexport) @@ -151,6 +153,7 @@ typedef struct glCompFont* font; int size; int layer; + int listId;/*opengl list id*/ } sdot_op; @@ -387,20 +390,20 @@ typedef struct topview_edge *Edges; int Nodecount; int Edgecount; - int limits[4]; topviewdata *TopviewData; void *customptr; - Hierarchy *h; - glCompColor srcColor; //fine node colors of topfisheye - glCompColor tarColor; //supernode colors of fisheye - int is_top_fisheye; //1 draw hierarchy 0 draw regular topview - focus_t *fs; struct { + int active; //1 draw hierarchy 0 draw regular topview reposition_t repos; levelparms_t level; hierparms_t hier; - } parms; - int animate; + Hierarchy *h; + int animate; + glCompColor srcColor; //fine node colors of topfisheye + glCompColor tarColor; //supernode colors of fisheye + focus_t *fs; + } fisheyeParams; + topview_node **picked_nodes; int picked_node_count; topview_edge **picked_edges; @@ -418,6 +421,7 @@ typedef struct float global_z; attr_list* attributes;/*attribute list*/ attr_list* filtered_attr_list; + int xdotId; } topview; diff --git a/cmd/smyrna/topfisheyeview.c b/cmd/smyrna/topfisheyeview.c index 53ab826d9..2beeca95a 100644 --- a/cmd/smyrna/topfisheyeview.c +++ b/cmd/smyrna/topfisheyeview.c @@ -258,19 +258,19 @@ void prepare_topological_fisheye(topview * t) v_data *graph = makeGraph(t, &ne); -// t->animate=1; //turn the animation on +// t->fisheyeParams.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; } - hp = t->h = + hp = t->fisheyeParams.h = makeHier(t->Nodecount, ne, graph, x_coords, y_coords, - &(t->parms.hier)); + &(t->fisheyeParams.hier)); freeGraph(graph); free(x_coords); free(y_coords); - fs = t->fs = initFocus(t->Nodecount); // create focus set + fs = t->fisheyeParams.fs = initFocus(t->Nodecount); // create focus set gg = hp->geom_graphs[0]; closest_fine_node = 0; /* first node */ @@ -279,47 +279,47 @@ void prepare_topological_fisheye(topview * t) fs->x_foci[0] = hp->geom_graphs[cur_level][closest_fine_node].x_coord; fs->y_foci[0] = hp->geom_graphs[cur_level][closest_fine_node].y_coord; - view->Topview->parms.repos.width = + view->Topview->fisheyeParams.repos.width = (int) (view->bdxRight - view->bdxLeft); - view->Topview->parms.repos.height = + view->Topview->fisheyeParams.repos.height = (int) (view->bdyTop - view->bdyBottom); - view->Topview->parms.repos.rescale = Polar; + view->Topview->fisheyeParams.repos.rescale = Polar; //topological fisheye colorxlate(get_attribute_value ("topologicalfisheyefinestcolor", view, view->g[view->activeGraph]), &cl, RGBA_DOUBLE); - view->Topview->srcColor.R = (float) cl.u.RGBA[0]; - view->Topview->srcColor.G = (float) cl.u.RGBA[1]; - view->Topview->srcColor.B = (float) cl.u.RGBA[2]; + view->Topview->fisheyeParams.srcColor.R = (float) cl.u.RGBA[0]; + view->Topview->fisheyeParams.srcColor.G = (float) cl.u.RGBA[1]; + view->Topview->fisheyeParams.srcColor.B = (float) cl.u.RGBA[2]; colorxlate(get_attribute_value ("topologicalfisheyecoarsestcolor", view, view->g[view->activeGraph]), &cl, RGBA_DOUBLE); - view->Topview->tarColor.R = (float) cl.u.RGBA[0]; - view->Topview->tarColor.G = (float) cl.u.RGBA[1]; - view->Topview->tarColor.B = (float) cl.u.RGBA[2]; + view->Topview->fisheyeParams.tarColor.R = (float) cl.u.RGBA[0]; + view->Topview->fisheyeParams.tarColor.G = (float) cl.u.RGBA[1]; + view->Topview->fisheyeParams.tarColor.B = (float) cl.u.RGBA[2]; sscanf(agget (view->g[view->activeGraph], "topologicalfisheyedistortionfactor"), "%lf", - &view->Topview->parms.repos.distortion); + &view->Topview->fisheyeParams.repos.distortion); sscanf(agget (view->g[view->activeGraph], "topologicalfisheyefinenodes"), - "%d", &view->Topview->parms.level.num_fine_nodes); + "%d", &view->Topview->fisheyeParams.level.num_fine_nodes); sscanf(agget (view->g[view->activeGraph], "topologicalfisheyecoarseningfactor"), "%lf", - &view->Topview->parms.level.coarsening_rate); + &view->Topview->fisheyeParams.level.coarsening_rate); sscanf(agget (view->g[view->activeGraph], "topologicalfisheyedist2limit"), - "%d", &view->Topview->parms.hier.dist2_limit); + "%d", &view->Topview->fisheyeParams.hier.dist2_limit); sscanf(agget(view->g[view->activeGraph], "topologicalfisheyeanimate"), - "%d", &view->Topview->animate); + "%d", &view->Topview->fisheyeParams.animate); - set_active_levels(hp, fs->foci_nodes, fs->num_foci, &(t->parms.level)); - positionAllItems(hp, fs, &(t->parms.repos)); + set_active_levels(hp, fs->foci_nodes, fs->num_foci, &(t->fisheyeParams.level)); + positionAllItems(hp, fs, &(t->fisheyeParams.repos)); refresh_old_values(t); /* fprintf (stderr, "No. of active nodes = %d\n", count_active_nodes(hp)); */ @@ -332,7 +332,7 @@ void prepare_topological_fisheye(topview * t) void printalllevels(topview * t) { int level, v; - Hierarchy *hp = t->h; + Hierarchy *hp = t->fisheyeParams.h; glPointSize(5); glBegin(GL_POINTS); for (level = 0; level < hp->nlevels; level++) { @@ -357,20 +357,20 @@ void drawtopfishnodes(topview * t) glCompColor tarColor; glCompColor color; int level, v; - Hierarchy *hp = t->h; + Hierarchy *hp = t->fisheyeParams.h; static int max_visible_level = 0; - srcColor.R = view->Topview->srcColor.R; - srcColor.G = view->Topview->srcColor.G; - srcColor.B = view->Topview->srcColor.B; - tarColor.R = view->Topview->tarColor.R; - tarColor.G = view->Topview->tarColor.G; - tarColor.B = view->Topview->tarColor.B; + srcColor.R = view->Topview->fisheyeParams.srcColor.R; + srcColor.G = view->Topview->fisheyeParams.srcColor.G; + srcColor.B = view->Topview->fisheyeParams.srcColor.B; + tarColor.R = view->Topview->fisheyeParams.tarColor.R; + tarColor.G = view->Topview->fisheyeParams.tarColor.G; + tarColor.B = view->Topview->fisheyeParams.tarColor.B; glEnable(GL_POINT_SMOOTH); /*turn this off to make points look square */ //draw focused node little bigger than others /* ex_vtx_data *gg = hp->geom_graphs[0]; - if ((gg[v].active_level == 0) &&(v==t->fs->foci_nodes[0]))*/ + if ((gg[v].active_level == 0) &&(v==t->fisheyeParams.fs->foci_nodes[0]))*/ //drawing nodes @@ -418,7 +418,7 @@ void drawtopfishnodelabels(topview * t) int v, finenodes, focusnodes; char buf[512]; char *str; - Hierarchy *hp = t->h; + Hierarchy *hp = t->fisheyeParams.h; finenodes = focusnodes = 0; str = agget(view->g[view->activeGraph], @@ -440,7 +440,7 @@ void drawtopfishnodelabels(topview * t) else sprintf(buf, "%d", v); - if ((v == t->fs->foci_nodes[0]) && (focusnodes)) { + if ((v == t->fisheyeParams.fs->foci_nodes[0]) && (focusnodes)) { glColor4f((float) 0, (float) 0, (float) 1, (float) 1); glprintfglut(GLUT_BITMAP_HELVETICA_18, gg[v].physical_x_coord, @@ -464,14 +464,14 @@ void drawtopfishedges(topview * t) glCompColor color; int level, v, i, n; - Hierarchy *hp = t->h; + Hierarchy *hp = t->fisheyeParams.h; static int max_visible_level = 0; - srcColor.R = view->Topview->srcColor.R; - srcColor.G = view->Topview->srcColor.G; - srcColor.B = view->Topview->srcColor.B; - tarColor.R = view->Topview->tarColor.R; - tarColor.G = view->Topview->tarColor.G; - tarColor.B = view->Topview->tarColor.B; + srcColor.R = view->Topview->fisheyeParams.srcColor.R; + srcColor.G = view->Topview->fisheyeParams.srcColor.G; + srcColor.B = view->Topview->fisheyeParams.srcColor.B; + tarColor.R = view->Topview->fisheyeParams.tarColor.R; + tarColor.G = view->Topview->fisheyeParams.tarColor.G; + tarColor.B = view->Topview->fisheyeParams.tarColor.B; //and edges glBegin(GL_LINES); @@ -538,7 +538,7 @@ void drawtopologicalfisheye(topview * t) get_active_frame(t); drawtopfishnodes(t); drawtopfishedges(t); - if (!t->animate) + if (!t->fisheyeParams.animate) drawtopfishnodelabels(t); } @@ -547,11 +547,11 @@ void drawtopologicalfisheye(topview * t) int get_temp_coords(topview * t, int level, int v, double *coord_x, double *coord_y) { - Hierarchy *hp = t->h; + Hierarchy *hp = t->fisheyeParams.h; ex_vtx_data *gg = hp->geom_graphs[level]; /* v_data *g = hp->graphs[level]; */ - if (!t->animate) { + if (!t->fisheyeParams.animate) { if (gg[v].active_level != level) return 0; @@ -583,13 +583,13 @@ int get_temp_coords(topview * t, int level, int v, double *coord_x, } if ((OAL > level) && (AL == level)) //draw as from ancs to new) { - find_old_physical_coords(t->h, level, v, &x0, &y0); + find_old_physical_coords(t->fisheyeParams.h, level, v, &x0, &y0); x1 = (double) gg[v].physical_x_coord; y1 = (double) gg[v].physical_y_coord; } if ((OAL == level) && (AL > level)) //draw as from ancs to new) { - find_physical_coords(t->h, level, v, &x1, &y1); + find_physical_coords(t->fisheyeParams.h, level, v, &x1, &y1); x0 = (double) gg[v].old_physical_x_coord; y0 = (double) gg[v].old_physical_y_coord; } @@ -621,7 +621,7 @@ int get_temp_coords(topview * t, int level, int v, double *coord_x, void infotopfisheye(topview * t, float *x, float *y, float *z) { - Hierarchy *hp = t->h; + Hierarchy *hp = t->fisheyeParams.h; int closest_fine_node; find_closest_active_node(hp, *x, *y, &closest_fine_node); @@ -640,12 +640,12 @@ void changetopfishfocus(topview * t, float *x, float *y, { gvcolor_t cl; - focus_t *fs = t->fs; + focus_t *fs = t->fisheyeParams.fs; int i; int closest_fine_node; int cur_level = 0; - Hierarchy *hp = t->h; + Hierarchy *hp = t->fisheyeParams.h; refresh_old_values(t); fs->num_foci = num_foci; for (i = 0; i < num_foci; i++) { @@ -658,54 +658,54 @@ void changetopfishfocus(topview * t, float *x, float *y, } - view->Topview->parms.repos.width = + view->Topview->fisheyeParams.repos.width = (int) (view->bdxRight - view->bdxLeft); - view->Topview->parms.repos.height = + view->Topview->fisheyeParams.repos.height = (int) (view->bdyTop - view->bdyBottom); colorxlate(get_attribute_value ("topologicalfisheyefinestcolor", view, view->g[view->activeGraph]), &cl, RGBA_DOUBLE); - view->Topview->srcColor.R = (float) cl.u.RGBA[0]; - view->Topview->srcColor.G = (float) cl.u.RGBA[1]; - view->Topview->srcColor.B = (float) cl.u.RGBA[2]; + view->Topview->fisheyeParams.srcColor.R = (float) cl.u.RGBA[0]; + view->Topview->fisheyeParams.srcColor.G = (float) cl.u.RGBA[1]; + view->Topview->fisheyeParams.srcColor.B = (float) cl.u.RGBA[2]; colorxlate(get_attribute_value ("topologicalfisheyecoarsestcolor", view, view->g[view->activeGraph]), &cl, RGBA_DOUBLE); - view->Topview->tarColor.R = (float) cl.u.RGBA[0]; - view->Topview->tarColor.G = (float) cl.u.RGBA[1]; - view->Topview->tarColor.B = (float) cl.u.RGBA[2]; + view->Topview->fisheyeParams.tarColor.R = (float) cl.u.RGBA[0]; + view->Topview->fisheyeParams.tarColor.G = (float) cl.u.RGBA[1]; + view->Topview->fisheyeParams.tarColor.B = (float) cl.u.RGBA[2]; sscanf(agget (view->g[view->activeGraph], "topologicalfisheyedistortionfactor"), "%lf", - &view->Topview->parms.repos.distortion); + &view->Topview->fisheyeParams.repos.distortion); sscanf(agget (view->g[view->activeGraph], "topologicalfisheyefinenodes"), - "%d", &view->Topview->parms.level.num_fine_nodes); + "%d", &view->Topview->fisheyeParams.level.num_fine_nodes); sscanf(agget (view->g[view->activeGraph], "topologicalfisheyecoarseningfactor"), "%lf", - &view->Topview->parms.level.coarsening_rate); + &view->Topview->fisheyeParams.level.coarsening_rate); sscanf(agget (view->g[view->activeGraph], "topologicalfisheyedist2limit"), - "%d", &view->Topview->parms.hier.dist2_limit); + "%d", &view->Topview->fisheyeParams.hier.dist2_limit); sscanf(agget(view->g[view->activeGraph], "topologicalfisheyeanimate"), - "%d", &view->Topview->animate); + "%d", &view->Topview->fisheyeParams.animate); - set_active_levels(hp, fs->foci_nodes, fs->num_foci, &(t->parms.level)); + set_active_levels(hp, fs->foci_nodes, fs->num_foci, &(t->fisheyeParams.level)); - positionAllItems(hp, fs, &(t->parms.repos)); + positionAllItems(hp, fs, &(t->fisheyeParams.repos)); - view->Topview->animate = 1; + view->Topview->fisheyeParams.animate = 1; - if (t->animate) { + if (t->fisheyeParams.animate) { view->active_frame = 0; g_timer_start(view->timer); } @@ -714,7 +714,7 @@ void changetopfishfocus(topview * t, float *x, float *y, void refresh_old_values(topview * t) { int level, v; - Hierarchy *hp = t->h; + Hierarchy *hp = t->fisheyeParams.h; for (level = 0; level < hp->nlevels; level++) { for (v = 0; v < hp->nvtxs[level]; v++) { ex_vtx_data *gg = hp->geom_graphs[level]; @@ -751,7 +751,7 @@ int get_active_frame(topview * t) } } else { g_timer_stop(view->timer); - view->Topview->animate = 0; + view->Topview->fisheyeParams.animate = 0; return 0; } @@ -762,7 +762,7 @@ int get_active_frame(topview * t) void drawtopologicalfisheyestatic(topview * t) { int level, v; - Hierarchy *hp = t->h; + Hierarchy *hp = t->fisheyeParams.h; glPointSize(15); glBegin(GL_POINTS); diff --git a/cmd/smyrna/topview.c b/cmd/smyrna/topview.c index 714b17a9e..9495dccdb 100755 --- a/cmd/smyrna/topview.c +++ b/cmd/smyrna/topview.c @@ -52,6 +52,9 @@ static int node_visible(topview_node * n); static int get_color_from_edge(topview_edge * e); static void draw_tv_xdot(topview* t); static void draw_xdot(xdot* x,float base_z); +static int drawtopviewnodes(Agraph_t * g); +static void drawtopviewedges(Agraph_t * g); +void tesstest(); @@ -319,8 +322,9 @@ static xdot* parseXdotwithattrs(void *e) void settvxdot(Agraph_t * g, topview * t) { - /*look for xdot attributes and parse them if there is any */ - + /* + look for xdot attributes and parse them if there is any + */ topview_node *np; topview_edge *ep; int ind; @@ -383,11 +387,30 @@ static void reset_refresh(ViewInfo* v) v->refresh.visibility=0; } + + +static create_DL() +{ + Agraph_t* g=view->g[view->activeGraph]; + glNewList(1,GL_COMPILE); + drawtopviewnodes(g); + drawtopviewlabels(g); + drawtopviewedges(g); + drawtopviewedgelabels(g); +/* renderNodes(g); + renderEdges(g);*/ + glEndList(); + +} + void update_topview(Agraph_t * g, topview * t, int init) { if (init) + { preparetopview(g, t); + t->xdotId=-1; + } settvcolorinfo(g, t); set_boundaries(t); settvxdot(view->g[view->activeGraph], view->Topview); @@ -428,6 +451,8 @@ void update_topview(Agraph_t * g, topview * t, int init) if (view->SignalBlock) btnToolZoomFit_clicked(NULL, NULL); +// create_DL(); + } @@ -510,11 +535,11 @@ void preparetopview(Agraph_t * g, topview * t) /*for grouped data , group data viewing buttons extension */ // load_host_buttons(t, g, view->widgets); /*set topologilca fisheye to NULL */ - t->h = '\0'; + t->fisheyeParams.h = '\0'; if (view->dfltViewType == VT_TOPFISH) - t->is_top_fisheye = 1; + t->fisheyeParams.active = 1; else - t->is_top_fisheye = 0; + t->fisheyeParams.active = 0; /*reset picked nodes */ t->picked_node_count = 0; @@ -674,11 +699,13 @@ static int drawtopviewnodes(Agraph_t * g) view->visiblenodecount = 0; for (ind = 0; ind < view->Topview->Nodecount; ind++) { v = view->Topview->Nodes + ind; - if (((-v->distorted_x / view->zoom >= view->clipX1) +/* if (((-v->distorted_x / view->zoom >= view->clipX1) && (-v->distorted_x / view->zoom <= view->clipX2) && (-v->distorted_y / view->zoom >= view->clipY1) && (-v->distorted_y / view->zoom <= view->clipY2)) - || (view->active_camera >= 0)) { + || (view->active_camera >= 0))*/ + if(1) + { float zdepth; view->visiblenodecount = view->visiblenodecount + 1; if (!view->drawnodes || !node_visible(v)) @@ -733,6 +760,7 @@ static int edgevisible(topview_edge* e) static glCompPoint b; static glCompPoint c; static glCompPoint d; + return 1; x1=e->x1/ view->zoom * -1; x2=e->y1/ view->zoom * -1; @@ -909,13 +937,15 @@ void drawTopViewGraph(Agraph_t * g) glDisable(GL_DEPTH_TEST);*/ // glDisable(GL_DEPTH_TEST); +// glCallList (1); drawtopviewnodes(g); drawtopviewlabels(g); drawtopviewedges(g); drawtopviewedgelabels(g); enddrawcycle(g); draw_tv_xdot(view->Topview); - draw_node_hint_boxes(); + // draw_node_hint_boxes(); +// tesstest(); // glEnable(GL_DEPTH_TEST); @@ -1382,15 +1412,59 @@ static void draw_xdot(xdot* x,float base_z) static void draw_tv_xdot(topview* t) { + +/* glNewList(1,GL_COMPILE); + drawtopviewnodes(g); + drawtopviewlabels(g); + drawtopviewedges(g); + drawtopviewedgelabels(g); + renderNodes(g); + renderEdges(g);*/ + int j; float basez=0; + + if(t->xdotId==-1) + { + t->xdotId=glGenLists(1); + glNewList(1,GL_COMPILE); + glNewList(t->xdotId,GL_COMPILE); + draw_xdot(t->xDot,basez); + basez= basez+0.01; + for (j=0; j < t->Nodecount; j++) + { + draw_xdot(t->Nodes[j].xDot,basez); + basez = basez+0.001; + } + for (j=0; j < t->Edgecount; j++) + { + draw_xdot(t->Edges[j].xDot,basez); + + } + glEndList(); + } + else + glCallList(t->xdotId); + +/* if((t->xDot)&&(t->xDot->ops->kind ==xd_font)) + { draw_xdot(t->xDot,basez); basez= basez+0.01; - for (j=0; j < t->Nodecount; j++) - draw_xdot(t->Nodes[j].xDot,basez); - basez = basez+0.001; - for (j=0; j < t->Edgecount; j++) - draw_xdot(t->Edges[j].xDot,basez); + } + for (j=0; j < t->Nodecount; j++) + { + if(t->Nodes[j].xDot->ops->kind==xd_font) + { + draw_xdot(t->Nodes[j].xDot,basez); + basez = basez+0.001; + } + } + for (j=0; j < t->Edgecount; j++) + { + if(t->Edges[j].xDot->ops->kind==xd_font) + draw_xdot(t->Edges[j].xDot,basez); + }*/ + } void setMultiedges(Agraph_t * g, char *attrname) @@ -1424,3 +1498,80 @@ void setMultiedges(Agraph_t * g, char *attrname) } freePM(map); } +void CALLBACK tessBeginCB(GLenum which) +{ + glBegin(which); +} + + + +void CALLBACK tessEndCB() +{ + glEnd(); +} +void errorCallback(GLenum errorCode) +{ + const GLubyte *estring; + + estring = gluErrorString(errorCode); + fprintf (stderr, "Tessellation Error: %s\n", estring); + exit (0); +} + +void tesstest() +{ + + static GLUtesselator *tobj; + + + GLdouble rect[4][3] = {0.0, 0.0, 0.0, + 200.0, 50.0, 0.0, + 200.0, 200.0, 0.0, + 0, 0, 0.0}; + GLdouble tri[3][3] = {0.0, 0.0, 0.0, + 125.0, 175.0, 0.0, + 175.0, 0.0, 0.0}; + GLdouble star[5][6] = {250.0, 50.0, 0.0, 1.0, 0.0, 1.0, + 325.0, 200.0, 0.0, 1.0, 1.0, 0.0, + 400.0, 50.0, 0.0, 0.0, 1.0, 1.0, + 250.0, 150.0, 0.0, 1.0, 0.0, 0.0, + 400.0, 150.0, 0.0, 0.0, 1.0, 0.0}; + + if(!tobj) + tobj=gluNewTess(); // create a tessellator + if(!tobj) return; // failed to create tessellation object, return 0 + +// gluTessCallback(tobj, GLU_TESS_VERTEX,(GLvoid (*) ()) &glVertex3dv); + + gluTessCallback(tobj, GLU_TESS_BEGIN, (void (CALLBACK *)())tessBeginCB); + gluTessCallback(tobj, GLU_TESS_END, (void (CALLBACK *)())tessEndCB); + + + glShadeModel(GL_FLAT); + gluTessBeginPolygon(tobj, NULL); + gluTessBeginContour(tobj); + gluTessVertex(tobj, rect[0], rect[0]); + gluTessVertex(tobj, rect[1], rect[1]); + gluTessVertex(tobj, rect[2], rect[2]); + gluTessVertex(tobj, rect[3], rect[3]); + gluTessEndContour(tobj); + gluTessBeginContour(tobj); + gluTessVertex(tobj, tri[0], tri[0]); + gluTessVertex(tobj, tri[1], tri[1]); + gluTessVertex(tobj, tri[2], tri[2]); + gluTessEndContour(tobj); + gluTessEndPolygon(tobj); + + glShadeModel(GL_SMOOTH); + gluTessProperty(tobj, GLU_TESS_WINDING_RULE, + GLU_TESS_WINDING_POSITIVE); + gluTessBeginPolygon(tobj, NULL); + gluTessBeginContour(tobj); + gluTessVertex(tobj, star[0], star[0]); + gluTessVertex(tobj, star[1], star[1]); + gluTessVertex(tobj, star[2], star[2]); + gluTessVertex(tobj, star[3], star[3]); + gluTessVertex(tobj, star[4], star[4]); + gluTessEndContour(tobj); + gluTessEndPolygon(tobj); +} \ No newline at end of file diff --git a/cmd/smyrna/viewport.c b/cmd/smyrna/viewport.c index 98e5a5a9a..9b586c340 100755 --- a/cmd/smyrna/viewport.c +++ b/cmd/smyrna/viewport.c @@ -326,7 +326,7 @@ void set_viewport_settings_from_template(ViewInfo * view, Agraph_t * g) static gboolean gl_main_expose(gpointer data) { if (view->activeGraph >= 0) { - if (view->Topview->animate == 1) + if (view->Topview->fisheyeParams.animate == 1) expose_event(view->drawing_area, NULL, NULL); return 1; } @@ -464,22 +464,22 @@ void init_viewport(ViewInfo * view) view->Selection.SelectionColor.A = 1; view->Selection.Anti = 0; view->Topview = GNEW(topview); - view->Topview->fs = 0; + view->Topview->fisheyeParams.fs = 0; view->Topview->xDot=NULL; /* init topfish parameters */ - view->Topview->parms.level.num_fine_nodes = 10; - view->Topview->parms.level.coarsening_rate = 2.5; - view->Topview->parms.hier.dist2_limit = 1; - view->Topview->parms.hier.min_nvtxs = 20; - view->Topview->parms.repos.rescale = Polar; - view->Topview->parms.repos.width = + view->Topview->fisheyeParams.level.num_fine_nodes = 10; + view->Topview->fisheyeParams.level.coarsening_rate = 2.5; + view->Topview->fisheyeParams.hier.dist2_limit = 1; + view->Topview->fisheyeParams.hier.min_nvtxs = 20; + view->Topview->fisheyeParams.repos.rescale = Polar; + view->Topview->fisheyeParams.repos.width = (int) (view->bdxRight - view->bdxLeft); - view->Topview->parms.repos.height = + view->Topview->fisheyeParams.repos.height = (int) (view->bdyTop - view->bdyBottom); - view->Topview->parms.repos.margin = 0; - view->Topview->parms.repos.graphSize = 100; - view->Topview->parms.repos.distortion = 1.0; + view->Topview->fisheyeParams.repos.margin = 0; + view->Topview->fisheyeParams.repos.graphSize = 100; + view->Topview->fisheyeParams.repos.distortion = 1.0; /*create timer */ view->timer = g_timer_new(); view->timer2 = g_timer_new(); @@ -767,7 +767,8 @@ int save_graph_with_file_name(Agraph_t * graph, char *fileName) int save_graph(void) { //check if there is an active graph - if (view->activeGraph > -1) { + if (view->activeGraph > -1) + { //check if active graph has a file name if (view->Topview->Graphdata.GraphFileName) { return save_graph_with_file_name(view->g[view->activeGraph], @@ -775,8 +776,8 @@ int save_graph(void) GraphFileName); } else return save_as_graph(); + fill_key(view->orig_key, get_md5_key(view->g[view->activeGraph])); } - fill_key(view->orig_key, get_md5_key(view->g[view->activeGraph])); return 1; } -- 2.40.0