# HG changeset patch # User alpar # Date 1106137031 0 # Node ID 358526a620f89a9dea0569a0a90ffe5280bf650b # Parent d496d1d5a5e748f548e5b85a8ec27320eb7b2ce5 One more node-shape added. diff -r d496d1d5a5e7 -r 358526a620f8 src/demo/graph_to_eps_demo.cc --- a/src/demo/graph_to_eps_demo.cc Tue Jan 18 12:23:09 2005 +0000 +++ b/src/demo/graph_to_eps_demo.cc Wed Jan 19 12:17:11 2005 +0000 @@ -72,10 +72,10 @@ ListGraph::EdgeMap widths(g); coords[n1]=Xy(50,50); sizes[n1]=1; colors[n1]=1; shapes[n1]=0; - coords[n2]=Xy(50,70); sizes[n2]=2; colors[n2]=2; shapes[n2]=0; + coords[n2]=Xy(50,70); sizes[n2]=2; colors[n2]=2; shapes[n2]=2; coords[n3]=Xy(70,70); sizes[n3]=1; colors[n3]=3; shapes[n3]=0; coords[n4]=Xy(70,50); sizes[n4]=2; colors[n4]=4; shapes[n4]=1; - coords[n5]=Xy(85,60); sizes[n5]=3; colors[n5]=5; shapes[n5]=0; + coords[n5]=Xy(85,60); sizes[n5]=3; colors[n5]=5; shapes[n5]=2; Edge e; diff -r d496d1d5a5e7 -r 358526a620f8 src/lemon/graph_to_eps.h --- a/src/lemon/graph_to_eps.h Tue Jan 18 12:23:09 2005 +0000 +++ b/src/lemon/graph_to_eps.h Wed Jan 19 12:17:11 2005 +0000 @@ -157,7 +157,7 @@ bool dontPrint; - enum NodeShapes { CIRCLE=0, SQUARE=1 }; + enum NodeShapes { CIRCLE=0, SQUARE=1, DIAMOND=2 }; class edgeLess { const Graph &g; @@ -414,6 +414,8 @@ return p.normSquare()<=r*r; case SQUARE: return p.x<=r&&p.x>=-r&&p.y<=r&&p.y>=-r; + case DIAMOND: + return p.x+p.y<=r && p.x-p.y<=r && -p.x+p.y<=r && -p.x-p.y<=r; } return false; } @@ -449,6 +451,12 @@ << " 2 index 1 index sub 2 index 2 index sub lineto\n" << " 2 index 1 index add 2 index 2 index sub lineto\n" << " closepath pop pop pop} bind def\n"; + //x y r + os << "/di { newpath 2 index 1 index add 2 index moveto\n" + << " 2 index 2 index 2 index add lineto\n" + << " 2 index 1 index sub 2 index lineto\n" + << " 2 index 2 index 2 index sub lineto\n" + << " closepath pop pop pop} bind def\n"; // x y r cr cg cb os << "/nc { setrgbcolor 2 index 2 index 2 index c fill\n" << " 0 0 0 setrgbcolor dup " @@ -460,6 +468,11 @@ << _nodeBorderQuotient << " mul setlinewidth " << 1+_nodeBorderQuotient/2 << " div sq stroke\n" << " } bind def\n"; + os << "/ndi { setrgbcolor 2 index 2 index 2 index di fill\n" + << " 0 0 0 setrgbcolor dup " + << _nodeBorderQuotient << " mul setlinewidth " + << 1+_nodeBorderQuotient/2 << " div di stroke\n" + << " } bind def\n"; os << "/arrl " << _arrowLength << " def\n"; os << "/arrw " << _arrowWidth << " def\n"; // l dx_norm dy_norm @@ -619,6 +632,8 @@ os<< "nc";break; case SQUARE: os<< "nsq";break; + case DIAMOND: + os<< "ndi";break; } os<<'\n'; }