From 393f822611fceffdad66ee56c6c31f9c6a22bd24 Mon Sep 17 00:00:00 2001 From: arif Date: Tue, 16 Jun 2009 14:45:50 +0000 Subject: [PATCH] smyrna changes to improve font size calculation and to fix edge color bug --- cmd/smyrna/main.c | 55 ++++++++++++++++++++++++++ cmd/smyrna/smyrnadefs.h | 1 + cmd/smyrna/topview.c | 7 +++- cmd/smyrna/viewport.c | 2 + graphviz.sln | 12 +++--- plugin/gdiplus/gvplugin_gdiplus.vcproj | 4 ++ 6 files changed, 73 insertions(+), 8 deletions(-) diff --git a/cmd/smyrna/main.c b/cmd/smyrna/main.c index 985130d05..7513f997d 100755 --- a/cmd/smyrna/main.c +++ b/cmd/smyrna/main.c @@ -53,6 +53,61 @@ static char* smyrnaDir; /* path to directory containin smyrna data files */ char* smyrnaGlade; unsigned char SmyrnaVerbose; +infixtoposfic(char* infix,char* posfix,int bfsize) +{ + char a=NULL; + int ind=0; + int ind2=0; /*points to empty cell*/ + int st[512]; + int ptr=0; + for (ind=0;ind < strlen(infix); ind ++) + { + printf ("stack:%s\n",st); + printf ("posix:%s\n",posfix); + a=infix[ind]; + if ((a != '(') && (a != ')') &&(a != '+') && (a != '-') && (a != '/') &&(a != '*')) + { + posfix[ind2]=a; + ind2++; + continue; + } + if(a=='(') + { + st[ptr]=a; + ptr++; + continue; + } + if((a == '+') || (a == '-') || (a == '/') ||(a == '*')) + { + ptr --; + while ((st[ptr]=='+') || (st[ptr]=='-')|| (st[ptr]=='/')|| (st[ptr]=='*')) + { + posfix[ind2]=st[ptr]; + ind2++; + ptr --; + } + ptr++; + st[ptr]=a; + ptr++; + continue; + } + if(a==')') + { + while ((st[ptr]!= '(') ) + { + posfix[ind2]=st[ptr]; + ind2++; + ptr --; + } + ptr--; + } + } + posfix[ind2]='\0'; +} + + + + /* smyrnaPath: * Construct pathname for smyrna data file. * Base file name is given as suffix. diff --git a/cmd/smyrna/smyrnadefs.h b/cmd/smyrna/smyrnadefs.h index 6109a4281..3c8dff5e2 100644 --- a/cmd/smyrna/smyrnadefs.h +++ b/cmd/smyrna/smyrnadefs.h @@ -316,6 +316,7 @@ typedef struct { int maxnodedegree; float maxedgelen; float minedgelen; + float avgedgelength; float init_node_size; //raster size of node float init_zoom; float fitin_zoom; diff --git a/cmd/smyrna/topview.c b/cmd/smyrna/topview.c index 58e571f38..272529150 100755 --- a/cmd/smyrna/topview.c +++ b/cmd/smyrna/topview.c @@ -151,9 +151,10 @@ static void setRGBcolor(RGBColor* c,char* colorstr) void settvposinfo(Agraph_t* g,topview* t) { int ind; - float maxedgelen,len,minedgelen; + float maxedgelen,len,minedgelen,totallen; maxedgelen=0; minedgelen=MAXFLOAT; + totallen=0; /*loop nodes*/ for (ind=0;ind < t->Nodecount ; ind ++) { @@ -170,6 +171,7 @@ void settvposinfo(Agraph_t* g,topview* t) setpositioninfo(&t->Edges[ind].x1,&t->Edges[ind].y1,&t->Edges[ind].z1,agget(t->Edges[ind].Node1->Node, "pos")); setpositioninfo(&t->Edges[ind].x2,&t->Edges[ind].y2,&t->Edges[ind].z2,agget(t->Edges[ind].Node2->Node, "pos")); len=(float)pow(pow((t->Edges[ind].x2-t->Edges[ind].x1),2)+pow((t->Edges[ind].y2-t->Edges[ind].y1),2),0.5); + totallen = totallen + len; if (len > maxedgelen) maxedgelen=len; if(len < minedgelen) @@ -178,6 +180,7 @@ void settvposinfo(Agraph_t* g,topview* t) } t->maxedgelen=maxedgelen; t->minedgelen=minedgelen; + t->avgedgelength=totallen / (float) t->Edgecount; } /*if object has attribute returns its value, else returns 0*/ @@ -226,7 +229,7 @@ void settvcolorinfo(Agraph_t* g,topview* t) t->Edges[ind].data.Visible=boolAttr("visible",t->Edges[ind].Edge,1); } /*update node size values in case node size is changed*/ - t->init_node_size=t->minedgelen*10/GetOGLDistance(10)*atoi(agget(view->g[view->activeGraph],"nodesize"))/100.0*5.00; + t->init_node_size=t->avgedgelength*2/GetOGLDistance(2)*atoi(agget(view->g[view->activeGraph],"nodesize"))/100.0*5.00; t->init_zoom=view->zoom; } diff --git a/cmd/smyrna/viewport.c b/cmd/smyrna/viewport.c index 2e4a01dc3..58e121e1f 100755 --- a/cmd/smyrna/viewport.c +++ b/cmd/smyrna/viewport.c @@ -996,12 +996,14 @@ void getcolorfromschema(colorschemaset* sc,float l,float maxl,RGBColor* c) 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; } } static void set_color_theme_color(colorschemaset* sc,char** colorstr,int colorcnt,int smooth) diff --git a/graphviz.sln b/graphviz.sln index 507369cf3..e83ce6584 100644 --- a/graphviz.sln +++ b/graphviz.sln @@ -189,8 +189,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gvplugin_gdiplus", "plugin\ {8E82D6BD-74D0-48C3-887A-1754EA71DA5A} = {8E82D6BD-74D0-48C3-887A-1754EA71DA5A} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "otk", "lib\otk_lib\otk.vcproj", "{343EB043-1F93-4F40-989D-FA309E4668AF}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "regex_win32", "lib\regex_win32\regex_win32.vcproj", "{1DE8628B-271E-49B3-A9B7-A53519E1CA65}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gvtest", "cmd\tester\gvtest.vcproj", "{C2AA7FA3-9BB5-4319-A01D-37439E0E6830}" @@ -199,6 +197,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "osage", "lib\osage\osage.vc EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gvprlib", "cmd\gvprlib\gvprlib.vcproj", "{1068DA13-0BB3-43A7-8776-6F519003EEBD}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sfdp", "lib\sfdpgen\sfdp.vcproj", "{443EB1A7-C634-4292-9F2D-C752BB2BF40F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -409,10 +409,6 @@ Global {0F4D5D8F-F4D6-4A5D-97E0-9B482257F493}.Debug|Win32.Build.0 = Debug|Win32 {0F4D5D8F-F4D6-4A5D-97E0-9B482257F493}.Release|Win32.ActiveCfg = Release|Win32 {0F4D5D8F-F4D6-4A5D-97E0-9B482257F493}.Release|Win32.Build.0 = Release|Win32 - {343EB043-1F93-4F40-989D-FA309E4668AF}.Debug|Win32.ActiveCfg = Debug|Win32 - {343EB043-1F93-4F40-989D-FA309E4668AF}.Debug|Win32.Build.0 = Debug|Win32 - {343EB043-1F93-4F40-989D-FA309E4668AF}.Release|Win32.ActiveCfg = Release|Win32 - {343EB043-1F93-4F40-989D-FA309E4668AF}.Release|Win32.Build.0 = Release|Win32 {1DE8628B-271E-49B3-A9B7-A53519E1CA65}.Debug|Win32.ActiveCfg = Debug|Win32 {1DE8628B-271E-49B3-A9B7-A53519E1CA65}.Debug|Win32.Build.0 = Debug|Win32 {1DE8628B-271E-49B3-A9B7-A53519E1CA65}.Release|Win32.ActiveCfg = Release|Win32 @@ -429,6 +425,10 @@ Global {1068DA13-0BB3-43A7-8776-6F519003EEBD}.Debug|Win32.Build.0 = Debug|Win32 {1068DA13-0BB3-43A7-8776-6F519003EEBD}.Release|Win32.ActiveCfg = Release|Win32 {1068DA13-0BB3-43A7-8776-6F519003EEBD}.Release|Win32.Build.0 = Release|Win32 + {443EB1A7-C634-4292-9F2D-C752BB2BF40F}.Debug|Win32.ActiveCfg = Debug|Win32 + {443EB1A7-C634-4292-9F2D-C752BB2BF40F}.Debug|Win32.Build.0 = Debug|Win32 + {443EB1A7-C634-4292-9F2D-C752BB2BF40F}.Release|Win32.ActiveCfg = Release|Win32 + {443EB1A7-C634-4292-9F2D-C752BB2BF40F}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/plugin/gdiplus/gvplugin_gdiplus.vcproj b/plugin/gdiplus/gvplugin_gdiplus.vcproj index ed3e9b7ac..0ac08750a 100644 --- a/plugin/gdiplus/gvplugin_gdiplus.vcproj +++ b/plugin/gdiplus/gvplugin_gdiplus.vcproj @@ -228,6 +228,10 @@ RelativePath=".\gvrender_gdiplus.cpp" > + + -- 2.40.0