[Lemon-commits] [lemon_svn] alpar: r2072 - in hugo/trunk: demo lemon
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:49:55 CET 2006
Author: alpar
Date: Wed Jul 20 10:06:32 2005
New Revision: 2072
Modified:
hugo/trunk/demo/graph_to_eps_demo.cc
hugo/trunk/lemon/graph_to_eps.h
Log:
- graph_to_eps_demo.cc is rightly documented
- Fix/improve documentation of graphToEps()
- Missing const added to ColorSet::size();
Modified: hugo/trunk/demo/graph_to_eps_demo.cc
==============================================================================
--- hugo/trunk/demo/graph_to_eps_demo.cc (original)
+++ hugo/trunk/demo/graph_to_eps_demo.cc Wed Jul 20 10:06:32 2005
@@ -14,13 +14,21 @@
*
*/
-#include<lemon/graph_to_eps.h>
-#include<lemon/maps.h>
-#include<lemon/list_graph.h>
-#include<lemon/graph_utils.h>
+/// \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
+/// <tt>.eps</tt> 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 <cmath>
+#include<lemon/graph_to_eps.h>
+#include<lemon/list_graph.h>
using namespace std;
using namespace lemon;
@@ -66,6 +74,7 @@
IdMap<ListGraph,Node> 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).
Modified: hugo/trunk/lemon/graph_to_eps.h
==============================================================================
--- hugo/trunk/lemon/graph_to_eps.h (original)
+++ hugo/trunk/lemon/graph_to_eps.h Wed Jul 20 10:06:32 2005
@@ -68,7 +68,7 @@
///Maps <tt>int</tt>s 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 <tt>int</tt>. 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<class X> GraphToEps<NodeColorsTraits<X> >
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<class X> GraphToEps<NodeTextColorsTraits<X> >
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<class X> GraphToEps<EdgeColorsTraits<X> >
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<T> &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<class G>
GraphToEps<DefaultGraphToEpsTraits<G> >
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
More information about the Lemon-commits
mailing list