COIN-OR::LEMON - Graph Library

Changeset 1088:358526a620f8 in lemon-0.x for src


Ignore:
Timestamp:
01/19/05 13:17:11 (20 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1484
Message:

One more node-shape added.

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/demo/graph_to_eps_demo.cc

    r1086 r1088  
    7373 
    7474  coords[n1]=Xy(50,50);  sizes[n1]=1; colors[n1]=1; shapes[n1]=0;
    75   coords[n2]=Xy(50,70);  sizes[n2]=2; colors[n2]=2; shapes[n2]=0;
     75  coords[n2]=Xy(50,70);  sizes[n2]=2; colors[n2]=2; shapes[n2]=2;
    7676  coords[n3]=Xy(70,70);  sizes[n3]=1; colors[n3]=3; shapes[n3]=0;
    7777  coords[n4]=Xy(70,50);  sizes[n4]=2; colors[n4]=4; shapes[n4]=1;
    78   coords[n5]=Xy(85,60);  sizes[n5]=3; colors[n5]=5; shapes[n5]=0;
     78  coords[n5]=Xy(85,60);  sizes[n5]=3; colors[n5]=5; shapes[n5]=2;
    7979 
    8080  Edge e;
  • src/lemon/graph_to_eps.h

    r1087 r1088  
    158158  bool dontPrint;
    159159
    160   enum NodeShapes { CIRCLE=0, SQUARE=1 };
     160  enum NodeShapes { CIRCLE=0, SQUARE=1, DIAMOND=2 };
    161161                   
    162162  class edgeLess {
     
    415415    case SQUARE:
    416416      return p.x<=r&&p.x>=-r&&p.y<=r&&p.y>=-r;
     417    case DIAMOND:
     418      return p.x+p.y<=r && p.x-p.y<=r && -p.x+p.y<=r && -p.x-p.y<=r;
    417419    }
    418420    return false;
     
    450452       << "      2 index 1 index add 2 index 2 index sub lineto\n"
    451453       << "      closepath pop pop pop} bind def\n";
     454    //x y r
     455    os << "/di { newpath 2 index 1 index add 2 index moveto\n"
     456       << "      2 index             2 index 2 index add lineto\n"
     457       << "      2 index 1 index sub 2 index             lineto\n"
     458       << "      2 index             2 index 2 index sub lineto\n"
     459       << "      closepath pop pop pop} bind def\n";
    452460    // x y r cr cg cb
    453461    os << "/nc { setrgbcolor 2 index 2 index 2 index c fill\n"
     
    460468       << _nodeBorderQuotient << " mul setlinewidth "
    461469       << 1+_nodeBorderQuotient/2 << " div sq stroke\n"
     470       << "   } bind def\n";
     471    os << "/ndi { setrgbcolor 2 index 2 index 2 index di fill\n"
     472       << "     0 0 0 setrgbcolor dup "
     473       << _nodeBorderQuotient << " mul setlinewidth "
     474       << 1+_nodeBorderQuotient/2 << " div di stroke\n"
    462475       << "   } bind def\n";
    463476    os << "/arrl " << _arrowLength << " def\n";
     
    620633        case SQUARE:
    621634          os<< "nsq";break;
     635        case DIAMOND:
     636          os<< "ndi";break;
    622637        }
    623638        os<<'\n';
Note: See TracChangeset for help on using the changeset viewer.