- graph_to_eps_demo.cc is rightly documented
authoralpar
Wed, 20 Jul 2005 08:06:32 +0000
changeset 1573b76a0af36f44
parent 1572 ce52ee162ec0
child 1574 697ed4dd309a
- graph_to_eps_demo.cc is rightly documented
- Fix/improve documentation of graphToEps()
- Missing const added to ColorSet::size();
demo/graph_to_eps_demo.cc
lemon/graph_to_eps.h
     1.1 --- a/demo/graph_to_eps_demo.cc	Wed Jul 20 08:03:15 2005 +0000
     1.2 +++ b/demo/graph_to_eps_demo.cc	Wed Jul 20 08:06:32 2005 +0000
     1.3 @@ -14,13 +14,21 @@
     1.4   *
     1.5   */
     1.6  
     1.7 -#include<lemon/graph_to_eps.h>
     1.8 -#include<lemon/maps.h>
     1.9 -#include<lemon/list_graph.h>
    1.10 -#include<lemon/graph_utils.h>
    1.11 +/// \ingroup demos
    1.12 +/// \file
    1.13 +/// \brief Demo of the graph grawing function \ref graphToEps()
    1.14 +///
    1.15 +/// This demo program shows examples how to  use the function \ref
    1.16 +/// graphToEps(). It takes no input but simply creates  six
    1.17 +/// <tt>.eps</tt> files demonstrating how to draw directed/undirected
    1.18 +/// graphs, how to handle parallel egdes, how to change the properties
    1.19 +/// (like color, shape, size, title etc.) of nodes and edges
    1.20 +/// individually using appropriate \ref maps-page "graphmaps".
    1.21  
    1.22  #include <cmath>
    1.23  
    1.24 +#include<lemon/graph_to_eps.h>
    1.25 +#include<lemon/list_graph.h>
    1.26  
    1.27  using namespace std;
    1.28  using namespace lemon;
    1.29 @@ -66,6 +74,7 @@
    1.30    
    1.31    IdMap<ListGraph,Node> id(g);
    1.32  
    1.33 +  cout << "Create 'graph_to_eps_demo_out.eps'" << endl;
    1.34    graphToEps(g,"graph_to_eps_demo_out.eps").scale(10).coords(coords).
    1.35      title("Sample .eps figure").
    1.36      copyright("(C) 2005 LEMON Project").
    1.37 @@ -77,6 +86,8 @@
    1.38      nodeTexts(id).nodeTextSize(3).
    1.39      run();
    1.40  
    1.41 +
    1.42 +  cout << "Create 'graph_to_eps_demo_out_arr.eps'" << endl;
    1.43    graphToEps(g,"graph_to_eps_demo_out_arr.eps").scale(10).
    1.44      title("Sample .eps figure (with arrowheads)").
    1.45      copyright("(C) 2005 LEMON Project").
    1.46 @@ -101,6 +112,7 @@
    1.47    e=g.addEdge(n1,n2); ecolors[e]=6; widths[e]=1;
    1.48    e=g.addEdge(n1,n2); ecolors[e]=7; widths[e]=1;
    1.49  
    1.50 +  cout << "Create 'graph_to_eps_demo_out_par.eps'" << endl;
    1.51    graphToEps(g,"graph_to_eps_demo_out_par.eps").scale(10).
    1.52      title("Sample .eps figure (parallel edges)").
    1.53      copyright("(C) 2005 LEMON Project").
    1.54 @@ -114,6 +126,7 @@
    1.55      enableParallel().parEdgeDist(1.5).
    1.56      run();
    1.57    
    1.58 +  cout << "Create 'graph_to_eps_demo_out_par_arr.eps'" << endl;
    1.59    graphToEps(g,"graph_to_eps_demo_out_par_arr.eps").scale(10).
    1.60      title("Sample .eps figure (parallel edges and arrowheads)").
    1.61      copyright("(C) 2005 LEMON Project").
    1.62 @@ -128,6 +141,7 @@
    1.63      drawArrows().arrowWidth(1).arrowLength(1).
    1.64      run();
    1.65  
    1.66 +  cout << "Create 'graph_to_eps_demo_out_a4.eps'" << endl;
    1.67    graphToEps(g,"graph_to_eps_demo_out_a4.eps").scaleToA4().
    1.68      title("Sample .eps figure (fits to A4)").
    1.69      copyright("(C) 2005 LEMON Project").
    1.70 @@ -153,8 +167,9 @@
    1.71      hcolors[n]=i;
    1.72    }
    1.73    
    1.74 +  cout << "Create 'graph_to_eps_demo_out_colors.eps'" << endl;
    1.75    graphToEps(h,"graph_to_eps_demo_out_colors.eps").scale(60).
    1.76 -    title("Sample .eps figure (parallel edges and arrowheads)").
    1.77 +    title("Sample .eps figure (ColorSet demo)").
    1.78      copyright("(C) 2005 LEMON Project").
    1.79      coords(hcoords).
    1.80      nodeScale(.45).
     2.1 --- a/lemon/graph_to_eps.h	Wed Jul 20 08:03:15 2005 +0000
     2.2 +++ b/lemon/graph_to_eps.h	Wed Jul 20 08:06:32 2005 +0000
     2.3 @@ -68,7 +68,7 @@
     2.4  
     2.5  ///Maps <tt>int</tt>s to different \ref Color "Color"s
     2.6  
     2.7 -///This map assing one of the predefined \ref Color "Color"s
     2.8 +///This map assigns one of the predefined \ref Color "Color"s
     2.9  ///to each <tt>int</tt>. It is possible to change the colors as well as their
    2.10  ///number. The integer range is cyclically mapped to the provided set of colors.
    2.11  ///
    2.12 @@ -145,7 +145,7 @@
    2.13    ///Sets the number of the exiting colors.
    2.14    void resize(int s) { colors.resize(s);}
    2.15    ///Returns the munber of the existing colors.
    2.16 -  std::size_t size() { return colors.size();}
    2.17 +  std::size_t size() const { return colors.size();}
    2.18  };
    2.19  
    2.20  ///Returns a visible distinct \ref Color
    2.21 @@ -466,7 +466,7 @@
    2.22    ///The PS current point will be moved to the centre of the node before
    2.23    ///the PostScript block inserted.
    2.24    ///
    2.25 -  ///Before and after the block a newline character is inserted to you
    2.26 +  ///Before and after the block a newline character is inserted so you
    2.27    ///don't have to bother with the separators.
    2.28    ///
    2.29    ///\param x must be a node map with type that can be pushed to a standard
    2.30 @@ -502,7 +502,9 @@
    2.31    ///Sets the map of the node colors
    2.32  
    2.33    ///Sets the map of the node colors
    2.34 -  ///\param x must be a node map with \ref Color values. 
    2.35 +  ///\param x must be a node map with \ref Color values.
    2.36 +  ///
    2.37 +  ///\sa ColorSet
    2.38    template<class X> GraphToEps<NodeColorsTraits<X> >
    2.39    nodeColors(const X &x)
    2.40    {
    2.41 @@ -517,6 +519,8 @@
    2.42  
    2.43    ///Sets the map of the node text colors
    2.44    ///\param x must be a node map with \ref Color values. 
    2.45 +  ///
    2.46 +  ///\sa ColorSet
    2.47    template<class X> GraphToEps<NodeTextColorsTraits<X> >
    2.48    nodeTextColors(const X &x)
    2.49    {
    2.50 @@ -533,6 +537,8 @@
    2.51  
    2.52    ///Sets the map of the edge colors
    2.53    ///\param x must be a edge map with \ref Color values. 
    2.54 +  ///
    2.55 +  ///\sa ColorSet
    2.56    template<class X> GraphToEps<EdgeColorsTraits<X> >
    2.57    edgeColors(const X &x)
    2.58    {
    2.59 @@ -621,7 +627,7 @@
    2.60  
    2.61    ///Sets the color of the node texts to be as different from the node color
    2.62    ///as it is possible
    2.63 -    ///
    2.64 +  ///
    2.65    GraphToEps<T> &distantColorNodeTexts()
    2.66    {_nodeTextColorType=DIST_COL;return *this;}
    2.67    ///Sets the color of the node texts to be black or white and always visible.
    2.68 @@ -1008,7 +1014,7 @@
    2.69  ///\warning Don't forget to put the \ref GraphToEps::run() "run()"
    2.70  ///to the end of the parameter list.
    2.71  ///\sa GraphToEps
    2.72 -///\sa graphToEps(G &g, char *file_name)
    2.73 +///\sa graphToEps(G &g, const char *file_name)
    2.74  template<class G>
    2.75  GraphToEps<DefaultGraphToEpsTraits<G> > 
    2.76  graphToEps(G &g, std::ostream& os=std::cout)
    2.77 @@ -1019,7 +1025,7 @@
    2.78   
    2.79  ///Generates an EPS file from a graph
    2.80  
    2.81 -///\ingroup misc
    2.82 +///\ingroup io_group
    2.83  ///This function does the same as
    2.84  ///\ref graphToEps(G &g,std::ostream& os)
    2.85  ///but it writes its output into the file \c file_name