]> granicus.if.org Git - graphviz/commitdiff
smyrna changes to improve font size calculation and to fix edge color bug
authorarif <devnull@localhost>
Tue, 16 Jun 2009 14:45:50 +0000 (14:45 +0000)
committerarif <devnull@localhost>
Tue, 16 Jun 2009 14:45:50 +0000 (14:45 +0000)
cmd/smyrna/main.c
cmd/smyrna/smyrnadefs.h
cmd/smyrna/topview.c
cmd/smyrna/viewport.c
graphviz.sln
plugin/gdiplus/gvplugin_gdiplus.vcproj

index 985130d0560d90cc8edc94f51dae36b3f9a7189f..7513f997dcf49fda8a15b4929061439a30346b8d 100755 (executable)
@@ -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.
index 6109a4281a35fa6f37d5c023afe69003a57506df..3c8dff5e2ac7c689fb8bee02d5b54c5b6a120df7 100644 (file)
@@ -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;
index 58e571f388ac9daf89f18366faf09f9b9539d012..272529150274941684b9c6f5ad5dc6db0256e4a2 100755 (executable)
@@ -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;
 
 }
index 2e4a01dc32775999fe09b8d76d13f35a28534f28..58e121e1fe2abea961df735cc75e12c227707d4b 100755 (executable)
@@ -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)
index 507369cf3b85dd36ecadd2d3e1ccc810854c09cd..e83ce65844db229d3dad764e58abf7fc695310bf 100644 (file)
@@ -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
index ed3e9b7ac093190561c100fb527c03e66dbc844e..0ac08750aa6570e6c65a0b21a2af13b3742df645 100644 (file)
                                RelativePath=".\gvrender_gdiplus.cpp"
                                >
                        </File>
+                       <File
+                               RelativePath=".\gvtextlayout_gdiplus.cpp"
+                               >
+                       </File>
                </Filter>
        </Files>
        <Globals>