src/lemon/graph_to_eps.h
changeset 1088 358526a620f8
parent 1087 d496d1d5a5e7
child 1089 c0f4ebdc0034
     1.1 --- a/src/lemon/graph_to_eps.h	Tue Jan 18 12:23:09 2005 +0000
     1.2 +++ b/src/lemon/graph_to_eps.h	Wed Jan 19 12:17:11 2005 +0000
     1.3 @@ -157,7 +157,7 @@
     1.4  
     1.5    bool dontPrint;
     1.6  
     1.7 -  enum NodeShapes { CIRCLE=0, SQUARE=1 };
     1.8 +  enum NodeShapes { CIRCLE=0, SQUARE=1, DIAMOND=2 };
     1.9  		   
    1.10    class edgeLess {
    1.11      const Graph &g;
    1.12 @@ -414,6 +414,8 @@
    1.13        return p.normSquare()<=r*r;
    1.14      case SQUARE:
    1.15        return p.x<=r&&p.x>=-r&&p.y<=r&&p.y>=-r;
    1.16 +    case DIAMOND:
    1.17 +      return p.x+p.y<=r && p.x-p.y<=r && -p.x+p.y<=r && -p.x-p.y<=r;
    1.18      }
    1.19      return false;
    1.20    }
    1.21 @@ -449,6 +451,12 @@
    1.22         << "      2 index 1 index sub 2 index 2 index sub lineto\n"
    1.23         << "      2 index 1 index add 2 index 2 index sub lineto\n"
    1.24         << "      closepath pop pop pop} bind def\n";
    1.25 +    //x y r
    1.26 +    os << "/di { newpath 2 index 1 index add 2 index moveto\n"
    1.27 +       << "      2 index             2 index 2 index add lineto\n"
    1.28 +       << "      2 index 1 index sub 2 index             lineto\n"
    1.29 +       << "      2 index             2 index 2 index sub lineto\n"
    1.30 +       << "      closepath pop pop pop} bind def\n";
    1.31      // x y r cr cg cb
    1.32      os << "/nc { setrgbcolor 2 index 2 index 2 index c fill\n"
    1.33         << "     0 0 0 setrgbcolor dup "
    1.34 @@ -460,6 +468,11 @@
    1.35         << _nodeBorderQuotient << " mul setlinewidth "
    1.36         << 1+_nodeBorderQuotient/2 << " div sq stroke\n"
    1.37         << "   } bind def\n";
    1.38 +    os << "/ndi { setrgbcolor 2 index 2 index 2 index di fill\n"
    1.39 +       << "     0 0 0 setrgbcolor dup "
    1.40 +       << _nodeBorderQuotient << " mul setlinewidth "
    1.41 +       << 1+_nodeBorderQuotient/2 << " div di stroke\n"
    1.42 +       << "   } bind def\n";
    1.43      os << "/arrl " << _arrowLength << " def\n";
    1.44      os << "/arrw " << _arrowWidth << " def\n";
    1.45      // l dx_norm dy_norm
    1.46 @@ -619,6 +632,8 @@
    1.47  	  os<< "nc";break;
    1.48  	case SQUARE:
    1.49  	  os<< "nsq";break;
    1.50 +	case DIAMOND:
    1.51 +	  os<< "ndi";break;
    1.52  	}
    1.53  	os<<'\n';
    1.54        }