demo/graph_to_eps_demo.cc
changeset 1875 98698b69a902
parent 1802 fdfa3aa18607
child 1930 92b70deed0c5
equal deleted inserted replaced
5:039511a290d6 6:406c31860413
     1 /* -*- C++ -*-
     1 /* -*- C++ -*-
     2  * demo/graph_to_eps.cc - Part of LEMON, a generic C++ optimization library
     2  * demo/graph_to_eps.cc - Part of LEMON, a generic C++ optimization library
     3  *
     3  *
     4  * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     4  * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     5  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     5  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     6  *
     6  *
     7  * Permission to use, modify and distribute this software is granted
     7  * Permission to use, modify and distribute this software is granted
     8  * provided that this copyright notice appears in all copies. For
     8  * provided that this copyright notice appears in all copies. For
     9  * precise terms see the accompanying LICENSE file.
     9  * precise terms see the accompanying LICENSE file.
    79   IdMap<ListGraph,Node> id(g);
    79   IdMap<ListGraph,Node> id(g);
    80 
    80 
    81   cout << "Create 'graph_to_eps_demo_out.eps'" << endl;
    81   cout << "Create 'graph_to_eps_demo_out.eps'" << endl;
    82   graphToEps(g,"graph_to_eps_demo_out.eps").scale(10).coords(coords).
    82   graphToEps(g,"graph_to_eps_demo_out.eps").scale(10).coords(coords).
    83     title("Sample .eps figure").
    83     title("Sample .eps figure").
    84     copyright("(C) 2005 LEMON Project").
    84     copyright("(C) 2006 LEMON Project").
    85     nodeScale(2).nodeSizes(sizes).
    85     nodeScale(2).nodeSizes(sizes).
    86     nodeShapes(shapes).
    86     nodeShapes(shapes).
    87     nodeColors(composeMap(colorSet,colors)).
    87     nodeColors(composeMap(colorSet,colors)).
    88     edgeColors(composeMap(colorSet,ecolors)).
    88     edgeColors(composeMap(colorSet,ecolors)).
    89     edgeWidthScale(.4).edgeWidths(widths).
    89     edgeWidthScale(.4).edgeWidths(widths).
    92 
    92 
    93 
    93 
    94   cout << "Create 'graph_to_eps_demo_out_arr.eps'" << endl;
    94   cout << "Create 'graph_to_eps_demo_out_arr.eps'" << endl;
    95   graphToEps(g,"graph_to_eps_demo_out_arr.eps").scale(10).
    95   graphToEps(g,"graph_to_eps_demo_out_arr.eps").scale(10).
    96     title("Sample .eps figure (with arrowheads)").
    96     title("Sample .eps figure (with arrowheads)").
    97     copyright("(C) 2005 LEMON Project").
    97     copyright("(C) 2006 LEMON Project").
    98     nodeColors(composeMap(colorSet,colors)).
    98     nodeColors(composeMap(colorSet,colors)).
    99     coords(coords).
    99     coords(coords).
   100     nodeScale(2).nodeSizes(sizes).
   100     nodeScale(2).nodeSizes(sizes).
   101     nodeShapes(shapes).
   101     nodeShapes(shapes).
   102     edgeColors(composeMap(colorSet,ecolors)).
   102     edgeColors(composeMap(colorSet,ecolors)).
   117   e=g.addEdge(n1,n2); ecolors[e]=7; widths[e]=1;
   117   e=g.addEdge(n1,n2); ecolors[e]=7; widths[e]=1;
   118 
   118 
   119   cout << "Create 'graph_to_eps_demo_out_par.eps'" << endl;
   119   cout << "Create 'graph_to_eps_demo_out_par.eps'" << endl;
   120   graphToEps(g,"graph_to_eps_demo_out_par.eps").scale(10).
   120   graphToEps(g,"graph_to_eps_demo_out_par.eps").scale(10).
   121     title("Sample .eps figure (parallel edges)").
   121     title("Sample .eps figure (parallel edges)").
   122     copyright("(C) 2005 LEMON Project").
   122     copyright("(C) 2006 LEMON Project").
   123     nodeShapes(shapes).
   123     nodeShapes(shapes).
   124     coords(coords).
   124     coords(coords).
   125     nodeScale(2).nodeSizes(sizes).
   125     nodeScale(2).nodeSizes(sizes).
   126     nodeColors(composeMap(colorSet,colors)).
   126     nodeColors(composeMap(colorSet,colors)).
   127     edgeColors(composeMap(colorSet,ecolors)).
   127     edgeColors(composeMap(colorSet,ecolors)).
   131     run();
   131     run();
   132   
   132   
   133   cout << "Create 'graph_to_eps_demo_out_par_arr.eps'" << endl;
   133   cout << "Create 'graph_to_eps_demo_out_par_arr.eps'" << endl;
   134   graphToEps(g,"graph_to_eps_demo_out_par_arr.eps").scale(10).
   134   graphToEps(g,"graph_to_eps_demo_out_par_arr.eps").scale(10).
   135     title("Sample .eps figure (parallel edges and arrowheads)").
   135     title("Sample .eps figure (parallel edges and arrowheads)").
   136     copyright("(C) 2005 LEMON Project").
   136     copyright("(C) 2006 LEMON Project").
   137     nodeScale(2).nodeSizes(sizes).
   137     nodeScale(2).nodeSizes(sizes).
   138     coords(coords).
   138     coords(coords).
   139     nodeShapes(shapes).
   139     nodeShapes(shapes).
   140     nodeColors(composeMap(colorSet,colors)).
   140     nodeColors(composeMap(colorSet,colors)).
   141     edgeColors(composeMap(colorSet,ecolors)).
   141     edgeColors(composeMap(colorSet,ecolors)).
   146     run();
   146     run();
   147 
   147 
   148   cout << "Create 'graph_to_eps_demo_out_a4.eps'" << endl;
   148   cout << "Create 'graph_to_eps_demo_out_a4.eps'" << endl;
   149   graphToEps(g,"graph_to_eps_demo_out_a4.eps").scaleToA4().
   149   graphToEps(g,"graph_to_eps_demo_out_a4.eps").scaleToA4().
   150     title("Sample .eps figure (fits to A4)").
   150     title("Sample .eps figure (fits to A4)").
   151     copyright("(C) 2005 LEMON Project").
   151     copyright("(C) 2006 LEMON Project").
   152     nodeScale(2).nodeSizes(sizes).
   152     nodeScale(2).nodeSizes(sizes).
   153     coords(coords).
   153     coords(coords).
   154     nodeShapes(shapes).
   154     nodeShapes(shapes).
   155     nodeColors(composeMap(colorSet,colors)).
   155     nodeColors(composeMap(colorSet,colors)).
   156     edgeColors(composeMap(colorSet,ecolors)).
   156     edgeColors(composeMap(colorSet,ecolors)).
   172   }
   172   }
   173   
   173   
   174   cout << "Create 'graph_to_eps_demo_out_colors.eps'" << endl;
   174   cout << "Create 'graph_to_eps_demo_out_colors.eps'" << endl;
   175   graphToEps(h,"graph_to_eps_demo_out_colors.eps").scale(60).
   175   graphToEps(h,"graph_to_eps_demo_out_colors.eps").scale(60).
   176     title("Sample .eps figure (ColorSet demo)").
   176     title("Sample .eps figure (ColorSet demo)").
   177     copyright("(C) 2005 LEMON Project").
   177     copyright("(C) 2006 LEMON Project").
   178     coords(hcoords).
   178     coords(hcoords).
   179     nodeScale(.45).
   179     nodeScale(.45).
   180     distantColorNodeTexts().
   180     distantColorNodeTexts().
   181     //    distantBWNodeTexts().
   181     //    distantBWNodeTexts().
   182     nodeTexts(hcolors).nodeTextSize(.6).
   182     nodeTexts(hcolors).nodeTextSize(.6).