# HG changeset patch # User alpar # Date 1121846792 0 # Node ID b76a0af36f447bc3f0e76b82328992603ca1906c # Parent ce52ee162ec040b79bf56eaec5b13029885640af - graph_to_eps_demo.cc is rightly documented - Fix/improve documentation of graphToEps() - Missing const added to ColorSet::size(); diff -r ce52ee162ec0 -r b76a0af36f44 demo/graph_to_eps_demo.cc --- a/demo/graph_to_eps_demo.cc Wed Jul 20 08:03:15 2005 +0000 +++ b/demo/graph_to_eps_demo.cc Wed Jul 20 08:06:32 2005 +0000 @@ -14,13 +14,21 @@ * */ -#include -#include -#include -#include +/// \ingroup demos +/// \file +/// \brief Demo of the graph grawing function \ref graphToEps() +/// +/// This demo program shows examples how to use the function \ref +/// graphToEps(). It takes no input but simply creates six +/// .eps files demonstrating how to draw directed/undirected +/// graphs, how to handle parallel egdes, how to change the properties +/// (like color, shape, size, title etc.) of nodes and edges +/// individually using appropriate \ref maps-page "graphmaps". #include +#include +#include using namespace std; using namespace lemon; @@ -66,6 +74,7 @@ IdMap id(g); + cout << "Create 'graph_to_eps_demo_out.eps'" << endl; graphToEps(g,"graph_to_eps_demo_out.eps").scale(10).coords(coords). title("Sample .eps figure"). copyright("(C) 2005 LEMON Project"). @@ -77,6 +86,8 @@ nodeTexts(id).nodeTextSize(3). run(); + + cout << "Create 'graph_to_eps_demo_out_arr.eps'" << endl; graphToEps(g,"graph_to_eps_demo_out_arr.eps").scale(10). title("Sample .eps figure (with arrowheads)"). copyright("(C) 2005 LEMON Project"). @@ -101,6 +112,7 @@ e=g.addEdge(n1,n2); ecolors[e]=6; widths[e]=1; e=g.addEdge(n1,n2); ecolors[e]=7; widths[e]=1; + cout << "Create 'graph_to_eps_demo_out_par.eps'" << endl; graphToEps(g,"graph_to_eps_demo_out_par.eps").scale(10). title("Sample .eps figure (parallel edges)"). copyright("(C) 2005 LEMON Project"). @@ -114,6 +126,7 @@ enableParallel().parEdgeDist(1.5). run(); + cout << "Create 'graph_to_eps_demo_out_par_arr.eps'" << endl; graphToEps(g,"graph_to_eps_demo_out_par_arr.eps").scale(10). title("Sample .eps figure (parallel edges and arrowheads)"). copyright("(C) 2005 LEMON Project"). @@ -128,6 +141,7 @@ drawArrows().arrowWidth(1).arrowLength(1). run(); + cout << "Create 'graph_to_eps_demo_out_a4.eps'" << endl; graphToEps(g,"graph_to_eps_demo_out_a4.eps").scaleToA4(). title("Sample .eps figure (fits to A4)"). copyright("(C) 2005 LEMON Project"). @@ -153,8 +167,9 @@ hcolors[n]=i; } + cout << "Create 'graph_to_eps_demo_out_colors.eps'" << endl; graphToEps(h,"graph_to_eps_demo_out_colors.eps").scale(60). - title("Sample .eps figure (parallel edges and arrowheads)"). + title("Sample .eps figure (ColorSet demo)"). copyright("(C) 2005 LEMON Project"). coords(hcoords). nodeScale(.45). diff -r ce52ee162ec0 -r b76a0af36f44 lemon/graph_to_eps.h --- a/lemon/graph_to_eps.h Wed Jul 20 08:03:15 2005 +0000 +++ b/lemon/graph_to_eps.h Wed Jul 20 08:06:32 2005 +0000 @@ -68,7 +68,7 @@ ///Maps ints to different \ref Color "Color"s -///This map assing one of the predefined \ref Color "Color"s +///This map assigns one of the predefined \ref Color "Color"s ///to each int. It is possible to change the colors as well as their ///number. The integer range is cyclically mapped to the provided set of colors. /// @@ -145,7 +145,7 @@ ///Sets the number of the exiting colors. void resize(int s) { colors.resize(s);} ///Returns the munber of the existing colors. - std::size_t size() { return colors.size();} + std::size_t size() const { return colors.size();} }; ///Returns a visible distinct \ref Color @@ -466,7 +466,7 @@ ///The PS current point will be moved to the centre of the node before ///the PostScript block inserted. /// - ///Before and after the block a newline character is inserted to you + ///Before and after the block a newline character is inserted so you ///don't have to bother with the separators. /// ///\param x must be a node map with type that can be pushed to a standard @@ -502,7 +502,9 @@ ///Sets the map of the node colors ///Sets the map of the node colors - ///\param x must be a node map with \ref Color values. + ///\param x must be a node map with \ref Color values. + /// + ///\sa ColorSet template GraphToEps > nodeColors(const X &x) { @@ -517,6 +519,8 @@ ///Sets the map of the node text colors ///\param x must be a node map with \ref Color values. + /// + ///\sa ColorSet template GraphToEps > nodeTextColors(const X &x) { @@ -533,6 +537,8 @@ ///Sets the map of the edge colors ///\param x must be a edge map with \ref Color values. + /// + ///\sa ColorSet template GraphToEps > edgeColors(const X &x) { @@ -621,7 +627,7 @@ ///Sets the color of the node texts to be as different from the node color ///as it is possible - /// + /// GraphToEps &distantColorNodeTexts() {_nodeTextColorType=DIST_COL;return *this;} ///Sets the color of the node texts to be black or white and always visible. @@ -1008,7 +1014,7 @@ ///\warning Don't forget to put the \ref GraphToEps::run() "run()" ///to the end of the parameter list. ///\sa GraphToEps -///\sa graphToEps(G &g, char *file_name) +///\sa graphToEps(G &g, const char *file_name) template GraphToEps > graphToEps(G &g, std::ostream& os=std::cout) @@ -1019,7 +1025,7 @@ ///Generates an EPS file from a graph -///\ingroup misc +///\ingroup io_group ///This function does the same as ///\ref graphToEps(G &g,std::ostream& os) ///but it writes its output into the file \c file_name