[Lemon-commits] [lemon_svn] alpar: r1484 - in hugo/trunk/src: demo lemon

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:45:48 CET 2006


Author: alpar
Date: Wed Jan 19 13:17:11 2005
New Revision: 1484

Modified:
   hugo/trunk/src/demo/graph_to_eps_demo.cc
   hugo/trunk/src/lemon/graph_to_eps.h

Log:
One more node-shape added.

Modified: hugo/trunk/src/demo/graph_to_eps_demo.cc
==============================================================================
--- hugo/trunk/src/demo/graph_to_eps_demo.cc	(original)
+++ hugo/trunk/src/demo/graph_to_eps_demo.cc	Wed Jan 19 13:17:11 2005
@@ -72,10 +72,10 @@
   ListGraph::EdgeMap<int> 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;
 

Modified: hugo/trunk/src/lemon/graph_to_eps.h
==============================================================================
--- hugo/trunk/src/lemon/graph_to_eps.h	(original)
+++ hugo/trunk/src/lemon/graph_to_eps.h	Wed Jan 19 13:17:11 2005
@@ -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';
       }



More information about the Lemon-commits mailing list