COIN-OR::LEMON - Graph Library

Changeset 1907:9f9eeb4d5c69 in lemon-0.x


Ignore:
Timestamp:
01/26/06 07:43:59 (18 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2482
Message:

MALE and FEMALE node shape added.

Files:
4 added
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/graph_to_eps.h

    r1875 r1907  
    386386    ///\image latex nodeshape_2.eps "DIAMOND shape (2)" width=2cm
    387387    ///
    388     DIAMOND=2
     388    DIAMOND=2,
     389    /// = 3
     390    ///\image html nodeshape_3.png
     391    ///\image latex nodeshape_2.eps "MALE shape (4)" width=2cm
     392    ///
     393    MALE=3,
     394    /// = 4
     395    ///\image html nodeshape_4.png
     396    ///\image latex nodeshape_2.eps "FEMALE shape (4)" width=2cm
     397    ///
     398    FEMALE=4
    389399  };
    390400
     
    751761    switch(t) {
    752762    case CIRCLE:
     763    case MALE:
     764    case FEMALE:
    753765      return p.normSquare()<=r*r;
    754766    case SQUARE:
     
    814826      double ns=_nodeSizes[n]*_nodeScale;
    815827      xy<double> p(ns,ns);
    816       bb.add(p+mycoords[n]);
    817       bb.add(-p+mycoords[n]);
     828      switch(_nodeShapes[n]) {
     829      case CIRCLE:
     830      case SQUARE:
     831      case DIAMOND:
     832        bb.add(p+mycoords[n]);
     833        bb.add(-p+mycoords[n]);
     834        break;
     835      case MALE:
     836        bb.add(-p+mycoords[n]);
     837        bb.add(xy<double>(1.5*ns,1.5*sqrt(3)*ns)+mycoords[n]);
     838        break;
     839      case FEMALE:
     840        bb.add(p+mycoords[n]);
     841        bb.add(xy<double>(-ns,-3.01*ns)+mycoords[n]);
     842        break;
     843      }
    818844    }
    819845    if (bb.empty()) {
     
    859885       << "     setrgbcolor " << 1+_nodeBorderQuotient << " div di fill\n"
    860886       << "   } bind def\n";
     887    os << "/nfemale { 0 0 0 setrgbcolor 3 index "
     888       << _nodeBorderQuotient/(1+_nodeBorderQuotient)
     889       << " 1.5 mul mul setlinewidth\n"
     890       << "  newpath 5 index 5 index moveto "
     891       << "5 index 5 index 5 index 3.01 mul sub\n"
     892       << "  lineto 5 index 4 index .7 mul sub 5 index 5 index 2.2 mul sub moveto\n"
     893       << "  5 index 4 index .7 mul add 5 index 5 index 2.2 mul sub lineto stroke\n"
     894       << "  5 index 5 index 5 index c fill\n"
     895       << "  setrgbcolor " << 1+_nodeBorderQuotient << " div c fill\n"
     896       << "  } bind def\n";
     897    os << "/nmale {\n"
     898       << "  0 0 0 setrgbcolor 3 index "
     899       << _nodeBorderQuotient/(1+_nodeBorderQuotient)
     900       <<" 1.5 mul mul setlinewidth\n"
     901       << "  newpath 5 index 5 index moveto\n"
     902       << "  5 index 4 index 1 mul 1.5 mul add\n"
     903       << "  5 index 5 index 3 sqrt 1.5 mul mul add\n"
     904       << "  1 index 1 index lineto\n"
     905       << "  1 index 1 index 7 index sub moveto\n"
     906       << "  1 index 1 index lineto\n"
     907       << "  exch 5 index 3 sqrt .5 mul mul sub exch 5 index .5 mul sub lineto\n"
     908       << "  stroke\n"
     909       << "  5 index 5 index 5 index c fill\n"
     910       << "  setrgbcolor " << 1+_nodeBorderQuotient << " div c fill\n"
     911       << "  } bind def\n";
     912   
     913
    861914    os << "/arrl " << _arrowLength << " def\n";
    862915    os << "/arrw " << _arrowWidth << " def\n";
     
    10401093        case DIAMOND:
    10411094          os<< "ndi";break;
     1095        case MALE:
     1096          os<< "nmale";break;
     1097        case FEMALE:
     1098          os<< "nfemale";break;
    10421099        }
    10431100        os<<'\n';
Note: See TracChangeset for help on using the changeset viewer.