lemon/graph_to_eps.h
changeset 1907 9f9eeb4d5c69
parent 1875 98698b69a902
child 1909 2d806130e700
     1.1 --- a/lemon/graph_to_eps.h	Wed Jan 25 16:44:19 2006 +0000
     1.2 +++ b/lemon/graph_to_eps.h	Thu Jan 26 06:43:59 2006 +0000
     1.3 @@ -385,7 +385,17 @@
     1.4      ///\image html nodeshape_2.png
     1.5      ///\image latex nodeshape_2.eps "DIAMOND shape (2)" width=2cm
     1.6      ///
     1.7 -    DIAMOND=2
     1.8 +    DIAMOND=2,
     1.9 +    /// = 3
    1.10 +    ///\image html nodeshape_3.png
    1.11 +    ///\image latex nodeshape_2.eps "MALE shape (4)" width=2cm
    1.12 +    ///
    1.13 +    MALE=3,
    1.14 +    /// = 4
    1.15 +    ///\image html nodeshape_4.png
    1.16 +    ///\image latex nodeshape_2.eps "FEMALE shape (4)" width=2cm
    1.17 +    ///
    1.18 +    FEMALE=4
    1.19    };
    1.20  
    1.21  private:
    1.22 @@ -750,6 +760,8 @@
    1.23    {
    1.24      switch(t) {
    1.25      case CIRCLE:
    1.26 +    case MALE:
    1.27 +    case FEMALE:
    1.28        return p.normSquare()<=r*r;
    1.29      case SQUARE:
    1.30        return p.x<=r&&p.x>=-r&&p.y<=r&&p.y>=-r;
    1.31 @@ -813,8 +825,22 @@
    1.32      for(NodeIt n(g);n!=INVALID;++n) {
    1.33        double ns=_nodeSizes[n]*_nodeScale;
    1.34        xy<double> p(ns,ns);
    1.35 -      bb.add(p+mycoords[n]);
    1.36 -      bb.add(-p+mycoords[n]);
    1.37 +      switch(_nodeShapes[n]) {
    1.38 +      case CIRCLE:
    1.39 +      case SQUARE:
    1.40 +      case DIAMOND:
    1.41 +	bb.add(p+mycoords[n]);
    1.42 +	bb.add(-p+mycoords[n]);
    1.43 +	break;
    1.44 +      case MALE:
    1.45 +	bb.add(-p+mycoords[n]);
    1.46 +	bb.add(xy<double>(1.5*ns,1.5*sqrt(3)*ns)+mycoords[n]);
    1.47 +	break;
    1.48 +      case FEMALE:
    1.49 +	bb.add(p+mycoords[n]);
    1.50 +	bb.add(xy<double>(-ns,-3.01*ns)+mycoords[n]);
    1.51 +	break;
    1.52 +      }
    1.53      }
    1.54      if (bb.empty()) {
    1.55        bb = BoundingBox<double>(xy<double>(0,0));
    1.56 @@ -858,6 +884,33 @@
    1.57      os << "/ndi { 0 0 0 setrgbcolor 5 index 5 index 5 index di fill\n"
    1.58         << "     setrgbcolor " << 1+_nodeBorderQuotient << " div di fill\n"
    1.59         << "   } bind def\n";
    1.60 +    os << "/nfemale { 0 0 0 setrgbcolor 3 index "
    1.61 +       << _nodeBorderQuotient/(1+_nodeBorderQuotient)
    1.62 +       << " 1.5 mul mul setlinewidth\n"
    1.63 +       << "  newpath 5 index 5 index moveto "
    1.64 +       << "5 index 5 index 5 index 3.01 mul sub\n"
    1.65 +       << "  lineto 5 index 4 index .7 mul sub 5 index 5 index 2.2 mul sub moveto\n"
    1.66 +       << "  5 index 4 index .7 mul add 5 index 5 index 2.2 mul sub lineto stroke\n"
    1.67 +       << "  5 index 5 index 5 index c fill\n"
    1.68 +       << "  setrgbcolor " << 1+_nodeBorderQuotient << " div c fill\n"
    1.69 +       << "  } bind def\n";
    1.70 +    os << "/nmale {\n"
    1.71 +       << "  0 0 0 setrgbcolor 3 index "
    1.72 +       << _nodeBorderQuotient/(1+_nodeBorderQuotient)
    1.73 +       <<" 1.5 mul mul setlinewidth\n"
    1.74 +       << "  newpath 5 index 5 index moveto\n"
    1.75 +       << "  5 index 4 index 1 mul 1.5 mul add\n"
    1.76 +       << "  5 index 5 index 3 sqrt 1.5 mul mul add\n"
    1.77 +       << "  1 index 1 index lineto\n"
    1.78 +       << "  1 index 1 index 7 index sub moveto\n"
    1.79 +       << "  1 index 1 index lineto\n"
    1.80 +       << "  exch 5 index 3 sqrt .5 mul mul sub exch 5 index .5 mul sub lineto\n"
    1.81 +       << "  stroke\n"
    1.82 +       << "  5 index 5 index 5 index c fill\n"
    1.83 +       << "  setrgbcolor " << 1+_nodeBorderQuotient << " div c fill\n"
    1.84 +       << "  } bind def\n";
    1.85 +    
    1.86 +
    1.87      os << "/arrl " << _arrowLength << " def\n";
    1.88      os << "/arrw " << _arrowWidth << " def\n";
    1.89      // l dx_norm dy_norm
    1.90 @@ -1039,6 +1092,10 @@
    1.91  	  os<< "nsq";break;
    1.92  	case DIAMOND:
    1.93  	  os<< "ndi";break;
    1.94 +	case MALE:
    1.95 +	  os<< "nmale";break;
    1.96 +	case FEMALE:
    1.97 +	  os<< "nfemale";break;
    1.98  	}
    1.99  	os<<'\n';
   1.100        }