# HG changeset patch
# User alpar
# Date 1138257839 0
# Node ID 9f9eeb4d5c691057761365e4e2922ee80507141e
# Parent  7fa90b66ca9e84ddc41f033a283b74193c07983f
MALE and FEMALE node shape added.

diff -r 7fa90b66ca9e -r 9f9eeb4d5c69 doc/images/nodeshape_3.eps
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/images/nodeshape_3.eps	Thu Jan 26 06:43:59 2006 +0000
@@ -0,0 +1,77 @@
+%!PS-Adobe-2.0 EPSF-2.0
+%%Title: LEMON GraphToEps figure
+%%Creator: LEMON GraphToEps function
+%%BoundingBox: 0 0 256 372
+%%EndComments
+/lb { setlinewidth setrgbcolor newpath moveto
+      4 2 roll 1 index 1 index curveto stroke } bind def
+/l { setlinewidth setrgbcolor newpath moveto lineto stroke } bind def
+/c { newpath dup 3 index add 2 index moveto 0 360 arc closepath } bind def
+/sq { newpath 2 index 1 index add 2 index 2 index add moveto
+      2 index 1 index sub 2 index 2 index add lineto
+      2 index 1 index sub 2 index 2 index sub lineto
+      2 index 1 index add 2 index 2 index sub lineto
+      closepath pop pop pop} bind def
+/di { newpath 2 index 1 index add 2 index moveto
+      2 index             2 index 2 index add lineto
+      2 index 1 index sub 2 index             lineto
+      2 index             2 index 2 index sub lineto
+      closepath pop pop pop} bind def
+/nc { 0 0 0 setrgbcolor 5 index 5 index 5 index c fill
+     setrgbcolor 1.1 div c fill
+   } bind def
+/nsq { 0 0 0 setrgbcolor 5 index 5 index 5 index sq fill
+     setrgbcolor 1.1 div sq fill
+   } bind def
+/ndi { 0 0 0 setrgbcolor 5 index 5 index 5 index di fill
+     setrgbcolor 1.1 div di fill
+   } bind def
+/nfemale { 0 0 0 setrgbcolor 3 index 0.0909091 1.5 mul mul setlinewidth
+  newpath 5 index 5 index moveto 5 index 5 index 5 index 3.01 mul sub
+  lineto 5 index 4 index .7 mul sub 5 index 5 index 2.2 mul sub moveto
+  5 index 4 index .7 mul add 5 index 5 index 2.2 mul sub lineto stroke
+  5 index 5 index 5 index c fill
+  setrgbcolor 1.1 div c fill
+  } bind def
+/nmale {
+  0 0 0 setrgbcolor 3 index 0.0909091 1.5 mul mul setlinewidth
+  newpath 5 index 5 index moveto
+  5 index 4 index 1 mul 1.5 mul add
+  5 index 5 index 3 sqrt 1.5 mul mul add
+  1 index 1 index lineto
+  1 index 1 index 7 index sub moveto
+  1 index 1 index lineto
+  exch 5 index 3 sqrt .5 mul mul sub exch 5 index .5 mul sub lineto
+  stroke
+  5 index 5 index 5 index c fill
+  setrgbcolor 1.1 div c fill
+  } bind def
+/arrl 1 def
+/arrw 0.3 def
+/lrl { 2 index mul exch 2 index mul exch rlineto pop} bind def
+/arr { setrgbcolor /y1 exch def /x1 exch def /dy exch def /dx exch def
+       /w exch def /len exch def
+       newpath x1 dy w 2 div mul add y1 dx w 2 div mul sub moveto
+       len w sub arrl sub dx dy lrl
+       arrw dy dx neg lrl
+       dx arrl w add mul dy w 2 div arrw add mul sub
+       dy arrl w add mul dx w 2 div arrw add mul add rlineto
+       dx arrl w add mul neg dy w 2 div arrw add mul sub
+       dy arrl w add mul neg dx w 2 div arrw add mul add rlineto
+       arrw dy dx neg lrl
+       len w sub arrl sub neg dx dy lrl
+       closepath fill } bind def
+/cshow { 2 index 2 index moveto dup stringwidth pop
+         neg 2 div fosi .35 mul neg rmoveto show pop pop} def
+
+gsave
+100 dup scale
+%Edges:
+gsave
+grestore
+%Nodes:
+gsave
+1 1 1 0.2 1 0.2 nmale
+grestore
+grestore
+showpage
diff -r 7fa90b66ca9e -r 9f9eeb4d5c69 doc/images/nodeshape_3.png
Binary file doc/images/nodeshape_3.png has changed
diff -r 7fa90b66ca9e -r 9f9eeb4d5c69 doc/images/nodeshape_4.eps
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/images/nodeshape_4.eps	Thu Jan 26 06:43:59 2006 +0000
@@ -0,0 +1,77 @@
+%!PS-Adobe-2.0 EPSF-2.0
+%%Title: LEMON GraphToEps figure
+%%Creator: LEMON GraphToEps function
+%%BoundingBox: 0 -199 200 200
+%%EndComments
+/lb { setlinewidth setrgbcolor newpath moveto
+      4 2 roll 1 index 1 index curveto stroke } bind def
+/l { setlinewidth setrgbcolor newpath moveto lineto stroke } bind def
+/c { newpath dup 3 index add 2 index moveto 0 360 arc closepath } bind def
+/sq { newpath 2 index 1 index add 2 index 2 index add moveto
+      2 index 1 index sub 2 index 2 index add lineto
+      2 index 1 index sub 2 index 2 index sub lineto
+      2 index 1 index add 2 index 2 index sub lineto
+      closepath pop pop pop} bind def
+/di { newpath 2 index 1 index add 2 index moveto
+      2 index             2 index 2 index add lineto
+      2 index 1 index sub 2 index             lineto
+      2 index             2 index 2 index sub lineto
+      closepath pop pop pop} bind def
+/nc { 0 0 0 setrgbcolor 5 index 5 index 5 index c fill
+     setrgbcolor 1.1 div c fill
+   } bind def
+/nsq { 0 0 0 setrgbcolor 5 index 5 index 5 index sq fill
+     setrgbcolor 1.1 div sq fill
+   } bind def
+/ndi { 0 0 0 setrgbcolor 5 index 5 index 5 index di fill
+     setrgbcolor 1.1 div di fill
+   } bind def
+/nfemale { 0 0 0 setrgbcolor 3 index 0.0909091 1.5 mul mul setlinewidth
+  newpath 5 index 5 index moveto 5 index 5 index 5 index 3.01 mul sub
+  lineto 5 index 4 index .7 mul sub 5 index 5 index 2.2 mul sub moveto
+  5 index 4 index .7 mul add 5 index 5 index 2.2 mul sub lineto stroke
+  5 index 5 index 5 index c fill
+  setrgbcolor 1.1 div c fill
+  } bind def
+/nmale {
+  0 0 0 setrgbcolor 3 index 0.0909091 1.5 mul mul setlinewidth
+  newpath 5 index 5 index moveto
+  5 index 4 index 1 mul 1.5 mul add
+  5 index 5 index 3 sqrt 1.5 mul mul add
+  1 index 1 index lineto
+  1 index 1 index 7 index sub moveto
+  1 index 1 index lineto
+  exch 5 index 3 sqrt .5 mul mul sub exch 5 index .5 mul sub lineto
+  stroke
+  5 index 5 index 5 index c fill
+  setrgbcolor 1.1 div c fill
+  } bind def
+/arrl 1 def
+/arrw 0.3 def
+/lrl { 2 index mul exch 2 index mul exch rlineto pop} bind def
+/arr { setrgbcolor /y1 exch def /x1 exch def /dy exch def /dx exch def
+       /w exch def /len exch def
+       newpath x1 dy w 2 div mul add y1 dx w 2 div mul sub moveto
+       len w sub arrl sub dx dy lrl
+       arrw dy dx neg lrl
+       dx arrl w add mul dy w 2 div arrw add mul sub
+       dy arrl w add mul dx w 2 div arrw add mul add rlineto
+       dx arrl w add mul neg dy w 2 div arrw add mul sub
+       dy arrl w add mul neg dx w 2 div arrw add mul add rlineto
+       arrw dy dx neg lrl
+       len w sub arrl sub neg dx dy lrl
+       closepath fill } bind def
+/cshow { 2 index 2 index moveto dup stringwidth pop
+         neg 2 div fosi .35 mul neg rmoveto show pop pop} def
+
+gsave
+100 dup scale
+%Edges:
+gsave
+grestore
+%Nodes:
+gsave
+1 1 1 0.2 1 0.2 nfemale
+grestore
+grestore
+showpage
diff -r 7fa90b66ca9e -r 9f9eeb4d5c69 doc/images/nodeshape_4.png
Binary file doc/images/nodeshape_4.png has changed
diff -r 7fa90b66ca9e -r 9f9eeb4d5c69 lemon/graph_to_eps.h
--- a/lemon/graph_to_eps.h	Wed Jan 25 16:44:19 2006 +0000
+++ b/lemon/graph_to_eps.h	Thu Jan 26 06:43:59 2006 +0000
@@ -385,7 +385,17 @@
     ///\image html nodeshape_2.png
     ///\image latex nodeshape_2.eps "DIAMOND shape (2)" width=2cm
     ///
-    DIAMOND=2
+    DIAMOND=2,
+    /// = 3
+    ///\image html nodeshape_3.png
+    ///\image latex nodeshape_2.eps "MALE shape (4)" width=2cm
+    ///
+    MALE=3,
+    /// = 4
+    ///\image html nodeshape_4.png
+    ///\image latex nodeshape_2.eps "FEMALE shape (4)" width=2cm
+    ///
+    FEMALE=4
   };
 
 private:
@@ -750,6 +760,8 @@
   {
     switch(t) {
     case CIRCLE:
+    case MALE:
+    case FEMALE:
       return p.normSquare()<=r*r;
     case SQUARE:
       return p.x<=r&&p.x>=-r&&p.y<=r&&p.y>=-r;
@@ -813,8 +825,22 @@
     for(NodeIt n(g);n!=INVALID;++n) {
       double ns=_nodeSizes[n]*_nodeScale;
       xy<double> p(ns,ns);
-      bb.add(p+mycoords[n]);
-      bb.add(-p+mycoords[n]);
+      switch(_nodeShapes[n]) {
+      case CIRCLE:
+      case SQUARE:
+      case DIAMOND:
+	bb.add(p+mycoords[n]);
+	bb.add(-p+mycoords[n]);
+	break;
+      case MALE:
+	bb.add(-p+mycoords[n]);
+	bb.add(xy<double>(1.5*ns,1.5*sqrt(3)*ns)+mycoords[n]);
+	break;
+      case FEMALE:
+	bb.add(p+mycoords[n]);
+	bb.add(xy<double>(-ns,-3.01*ns)+mycoords[n]);
+	break;
+      }
     }
     if (bb.empty()) {
       bb = BoundingBox<double>(xy<double>(0,0));
@@ -858,6 +884,33 @@
     os << "/ndi { 0 0 0 setrgbcolor 5 index 5 index 5 index di fill\n"
        << "     setrgbcolor " << 1+_nodeBorderQuotient << " div di fill\n"
        << "   } bind def\n";
+    os << "/nfemale { 0 0 0 setrgbcolor 3 index "
+       << _nodeBorderQuotient/(1+_nodeBorderQuotient)
+       << " 1.5 mul mul setlinewidth\n"
+       << "  newpath 5 index 5 index moveto "
+       << "5 index 5 index 5 index 3.01 mul sub\n"
+       << "  lineto 5 index 4 index .7 mul sub 5 index 5 index 2.2 mul sub moveto\n"
+       << "  5 index 4 index .7 mul add 5 index 5 index 2.2 mul sub lineto stroke\n"
+       << "  5 index 5 index 5 index c fill\n"
+       << "  setrgbcolor " << 1+_nodeBorderQuotient << " div c fill\n"
+       << "  } bind def\n";
+    os << "/nmale {\n"
+       << "  0 0 0 setrgbcolor 3 index "
+       << _nodeBorderQuotient/(1+_nodeBorderQuotient)
+       <<" 1.5 mul mul setlinewidth\n"
+       << "  newpath 5 index 5 index moveto\n"
+       << "  5 index 4 index 1 mul 1.5 mul add\n"
+       << "  5 index 5 index 3 sqrt 1.5 mul mul add\n"
+       << "  1 index 1 index lineto\n"
+       << "  1 index 1 index 7 index sub moveto\n"
+       << "  1 index 1 index lineto\n"
+       << "  exch 5 index 3 sqrt .5 mul mul sub exch 5 index .5 mul sub lineto\n"
+       << "  stroke\n"
+       << "  5 index 5 index 5 index c fill\n"
+       << "  setrgbcolor " << 1+_nodeBorderQuotient << " div c fill\n"
+       << "  } bind def\n";
+    
+
     os << "/arrl " << _arrowLength << " def\n";
     os << "/arrw " << _arrowWidth << " def\n";
     // l dx_norm dy_norm
@@ -1039,6 +1092,10 @@
 	  os<< "nsq";break;
 	case DIAMOND:
 	  os<< "ndi";break;
+	case MALE:
+	  os<< "nmale";break;
+	case FEMALE:
+	  os<< "nfemale";break;
 	}
 	os<<'\n';
       }