1.1 --- a/demo/graph_to_eps_demo.cc Sat Jul 12 09:45:11 2008 +0100
1.2 +++ b/demo/graph_to_eps_demo.cc Sun Jul 13 16:35:05 2008 +0100
1.3 @@ -18,23 +18,22 @@
1.4
1.5 /// \ingroup demos
1.6 /// \file
1.7 -/// \brief Demo of the graph grawing function \ref graphToEps()
1.8 +/// \brief Demo of the graph drawing function \ref graphToEps()
1.9 ///
1.10 /// This demo program shows examples how to use the function \ref
1.11 /// graphToEps(). It takes no input but simply creates six
1.12 /// <tt>.eps</tt> files demonstrating the capability of \ref
1.13 -/// graphToEps(), and showing how to draw directed/graphs,
1.14 +/// graphToEps(), and showing how to draw directed graphs,
1.15 /// how to handle parallel egdes, how to change the properties (like
1.16 /// color, shape, size, title etc.) of nodes and arcs individually
1.17 /// using appropriate \ref maps-page "graph maps".
1.18 ///
1.19 /// \include graph_to_eps_demo.cc
1.20
1.21 -#include <lemon/math.h>
1.22 -
1.23 -#include<lemon/graph_to_eps.h>
1.24 #include<lemon/list_graph.h>
1.25 #include<lemon/graph_utils.h>
1.26 +#include<lemon/graph_to_eps.h>
1.27 +#include<lemon/math.h>
1.28
1.29 using namespace std;
1.30 using namespace lemon;
1.31 @@ -44,6 +43,7 @@
1.32 Palette palette;
1.33 Palette paletteW(true);
1.34
1.35 + // Create a small digraph
1.36 ListDigraph g;
1.37 typedef ListDigraph::Node Node;
1.38 typedef ListDigraph::NodeIt NodeIt;
1.39 @@ -60,7 +60,7 @@
1.40 ListDigraph::NodeMap<double> sizes(g);
1.41 ListDigraph::NodeMap<int> colors(g);
1.42 ListDigraph::NodeMap<int> shapes(g);
1.43 - ListDigraph::ArcMap<int> ecolors(g);
1.44 + ListDigraph::ArcMap<int> acolors(g);
1.45 ListDigraph::ArcMap<int> widths(g);
1.46
1.47 coords[n1]=Point(50,50); sizes[n1]=1; colors[n1]=1; shapes[n1]=0;
1.48 @@ -69,118 +69,116 @@
1.49 coords[n4]=Point(70,50); sizes[n4]=2; colors[n4]=4; shapes[n4]=1;
1.50 coords[n5]=Point(85,60); sizes[n5]=3; colors[n5]=5; shapes[n5]=2;
1.51
1.52 - Arc e;
1.53 + Arc a;
1.54
1.55 - e=g.addArc(n1,n2); ecolors[e]=0; widths[e]=1;
1.56 - e=g.addArc(n2,n3); ecolors[e]=0; widths[e]=1;
1.57 - e=g.addArc(n3,n5); ecolors[e]=0; widths[e]=3;
1.58 - e=g.addArc(n5,n4); ecolors[e]=0; widths[e]=1;
1.59 - e=g.addArc(n4,n1); ecolors[e]=0; widths[e]=1;
1.60 - e=g.addArc(n2,n4); ecolors[e]=1; widths[e]=2;
1.61 - e=g.addArc(n3,n4); ecolors[e]=2; widths[e]=1;
1.62 + a=g.addArc(n1,n2); acolors[a]=0; widths[a]=1;
1.63 + a=g.addArc(n2,n3); acolors[a]=0; widths[a]=1;
1.64 + a=g.addArc(n3,n5); acolors[a]=0; widths[a]=3;
1.65 + a=g.addArc(n5,n4); acolors[a]=0; widths[a]=1;
1.66 + a=g.addArc(n4,n1); acolors[a]=0; widths[a]=1;
1.67 + a=g.addArc(n2,n4); acolors[a]=1; widths[a]=2;
1.68 + a=g.addArc(n3,n4); acolors[a]=2; widths[a]=1;
1.69
1.70 IdMap<ListDigraph,Node> id(g);
1.71
1.72 - cout << "Create 'graph_to_eps_demo_out_pure.eps'" << endl;
1.73 - graphToEps(g,"graph_to_eps_demo_out_pure.eps").
1.74 - //scale(10).
1.75 + // Create five .eps files showing the digraph with different options
1.76 + cout << "Create 'graph_to_eps_demo_out_1_pure.eps'" << endl;
1.77 + graphToEps(g,"graph_to_eps_demo_out_1_pure.eps").
1.78 coords(coords).
1.79 title("Sample .eps figure").
1.80 - copyright("(C) 2003-2007 LEMON Project").
1.81 + copyright("(C) 2003-2008 LEMON Project").
1.82 run();
1.83
1.84 - cout << "Create 'graph_to_eps_demo_out.eps'" << endl;
1.85 - graphToEps(g,"graph_to_eps_demo_out.eps").
1.86 - //scale(10).
1.87 + cout << "Create 'graph_to_eps_demo_out_2.eps'" << endl;
1.88 + graphToEps(g,"graph_to_eps_demo_out_2.eps").
1.89 coords(coords).
1.90 title("Sample .eps figure").
1.91 - copyright("(C) 2003-2007 LEMON Project").
1.92 + copyright("(C) 2003-2008 LEMON Project").
1.93 absoluteNodeSizes().absoluteArcWidths().
1.94 nodeScale(2).nodeSizes(sizes).
1.95 nodeShapes(shapes).
1.96 nodeColors(composeMap(palette,colors)).
1.97 - arcColors(composeMap(palette,ecolors)).
1.98 + arcColors(composeMap(palette,acolors)).
1.99 arcWidthScale(.4).arcWidths(widths).
1.100 nodeTexts(id).nodeTextSize(3).
1.101 run();
1.102
1.103 -
1.104 - cout << "Create 'graph_to_eps_demo_out_arr.eps'" << endl;
1.105 - graphToEps(g,"graph_to_eps_demo_out_arr.eps").
1.106 - //scale(10).
1.107 + cout << "Create 'graph_to_eps_demo_out_3_arr.eps'" << endl;
1.108 + graphToEps(g,"graph_to_eps_demo_out_3_arr.eps").
1.109 title("Sample .eps figure (with arrowheads)").
1.110 - copyright("(C) 2003-2007 LEMON Project").
1.111 + copyright("(C) 2003-2008 LEMON Project").
1.112 absoluteNodeSizes().absoluteArcWidths().
1.113 nodeColors(composeMap(palette,colors)).
1.114 coords(coords).
1.115 nodeScale(2).nodeSizes(sizes).
1.116 nodeShapes(shapes).
1.117 - arcColors(composeMap(palette,ecolors)).
1.118 + arcColors(composeMap(palette,acolors)).
1.119 arcWidthScale(.4).arcWidths(widths).
1.120 nodeTexts(id).nodeTextSize(3).
1.121 - drawArrows().arrowWidth(1).arrowLength(1).
1.122 + drawArrows().arrowWidth(2).arrowLength(2).
1.123 run();
1.124
1.125 - e=g.addArc(n1,n4); ecolors[e]=2; widths[e]=1;
1.126 - e=g.addArc(n4,n1); ecolors[e]=1; widths[e]=2;
1.127 + a=g.addArc(n1,n4); acolors[a]=2; widths[a]=1;
1.128 + a=g.addArc(n4,n1); acolors[a]=1; widths[a]=2;
1.129
1.130 - e=g.addArc(n1,n2); ecolors[e]=1; widths[e]=1;
1.131 - e=g.addArc(n1,n2); ecolors[e]=2; widths[e]=1;
1.132 - e=g.addArc(n1,n2); ecolors[e]=3; widths[e]=1;
1.133 - e=g.addArc(n1,n2); ecolors[e]=4; widths[e]=1;
1.134 - e=g.addArc(n1,n2); ecolors[e]=5; widths[e]=1;
1.135 - e=g.addArc(n1,n2); ecolors[e]=6; widths[e]=1;
1.136 - e=g.addArc(n1,n2); ecolors[e]=7; widths[e]=1;
1.137 + a=g.addArc(n1,n2); acolors[a]=1; widths[a]=1;
1.138 + a=g.addArc(n1,n2); acolors[a]=2; widths[a]=1;
1.139 + a=g.addArc(n1,n2); acolors[a]=3; widths[a]=1;
1.140 + a=g.addArc(n1,n2); acolors[a]=4; widths[a]=1;
1.141 + a=g.addArc(n1,n2); acolors[a]=5; widths[a]=1;
1.142 + a=g.addArc(n1,n2); acolors[a]=6; widths[a]=1;
1.143 + a=g.addArc(n1,n2); acolors[a]=7; widths[a]=1;
1.144
1.145 cout << "Create 'graph_to_eps_demo_out_par.eps'" << endl;
1.146 graphToEps(g,"graph_to_eps_demo_out_par.eps").
1.147 //scale(10).
1.148 title("Sample .eps figure (parallel arcs)").
1.149 - copyright("(C) 2003-2007 LEMON Project").
1.150 + copyright("(C) 2003-2008 LEMON Project").
1.151 absoluteNodeSizes().absoluteArcWidths().
1.152 nodeShapes(shapes).
1.153 coords(coords).
1.154 nodeScale(2).nodeSizes(sizes).
1.155 nodeColors(composeMap(palette,colors)).
1.156 - arcColors(composeMap(palette,ecolors)).
1.157 + arcColors(composeMap(palette,acolors)).
1.158 arcWidthScale(.4).arcWidths(widths).
1.159 nodeTexts(id).nodeTextSize(3).
1.160 enableParallel().parArcDist(1.5).
1.161 run();
1.162 -
1.163 - cout << "Create 'graph_to_eps_demo_out_par_arr.eps'" << endl;
1.164 - graphToEps(g,"graph_to_eps_demo_out_par_arr.eps").
1.165 - //scale(10).
1.166 +
1.167 + cout << "Create 'graph_to_eps_demo_out_4_par_arr.eps'" << endl;
1.168 + graphToEps(g,"graph_to_eps_demo_out_4_par_arr.eps").
1.169 title("Sample .eps figure (parallel arcs and arrowheads)").
1.170 - copyright("(C) 2003-2007 LEMON Project").
1.171 + copyright("(C) 2003-2008 LEMON Project").
1.172 absoluteNodeSizes().absoluteArcWidths().
1.173 nodeScale(2).nodeSizes(sizes).
1.174 coords(coords).
1.175 nodeShapes(shapes).
1.176 nodeColors(composeMap(palette,colors)).
1.177 - arcColors(composeMap(palette,ecolors)).
1.178 + arcColors(composeMap(palette,acolors)).
1.179 arcWidthScale(.3).arcWidths(widths).
1.180 nodeTexts(id).nodeTextSize(3).
1.181 enableParallel().parArcDist(1).
1.182 drawArrows().arrowWidth(1).arrowLength(1).
1.183 run();
1.184
1.185 - cout << "Create 'graph_to_eps_demo_out_a4.eps'" << endl;
1.186 - graphToEps(g,"graph_to_eps_demo_out_a4.eps").scaleToA4().
1.187 + cout << "Create 'graph_to_eps_demo_out_5_par_arr_a4.eps'" << endl;
1.188 + graphToEps(g,"graph_to_eps_demo_out_5_par_arr_a4.eps").
1.189 title("Sample .eps figure (fits to A4)").
1.190 - copyright("(C) 2003-2007 LEMON Project").
1.191 + copyright("(C) 2003-2008 LEMON Project").
1.192 + scaleToA4().
1.193 absoluteNodeSizes().absoluteArcWidths().
1.194 nodeScale(2).nodeSizes(sizes).
1.195 coords(coords).
1.196 nodeShapes(shapes).
1.197 nodeColors(composeMap(palette,colors)).
1.198 - arcColors(composeMap(palette,ecolors)).
1.199 + arcColors(composeMap(palette,acolors)).
1.200 arcWidthScale(.3).arcWidths(widths).
1.201 nodeTexts(id).nodeTextSize(3).
1.202 enableParallel().parArcDist(1).
1.203 drawArrows().arrowWidth(1).arrowLength(1).
1.204 run();
1.205
1.206 + // Create an .eps file showing the colors of a default Palette
1.207 ListDigraph h;
1.208 ListDigraph::NodeMap<int> hcolors(h);
1.209 ListDigraph::NodeMap<Point> hcoords(h);
1.210 @@ -188,21 +186,22 @@
1.211 int cols=int(sqrt(double(palette.size())));
1.212 for(int i=0;i<int(paletteW.size());i++) {
1.213 Node n=h.addNode();
1.214 - hcoords[n]=Point(i%cols,i/cols);
1.215 + hcoords[n]=Point(1+i%cols,1+i/cols);
1.216 hcolors[n]=i;
1.217 }
1.218
1.219 - cout << "Create 'graph_to_eps_demo_out_colors.eps'" << endl;
1.220 - graphToEps(h,"graph_to_eps_demo_out_colors.eps").
1.221 - //scale(60).
1.222 + cout << "Create 'graph_to_eps_demo_out_6_colors.eps'" << endl;
1.223 + graphToEps(h,"graph_to_eps_demo_out_6_colors.eps").
1.224 + scale(60).
1.225 title("Sample .eps figure (Palette demo)").
1.226 - copyright("(C) 2003-2007 LEMON Project").
1.227 + copyright("(C) 2003-2008 LEMON Project").
1.228 coords(hcoords).
1.229 absoluteNodeSizes().absoluteArcWidths().
1.230 nodeScale(.45).
1.231 distantColorNodeTexts().
1.232 - // distantBWNodeTexts().
1.233 nodeTexts(hcolors).nodeTextSize(.6).
1.234 nodeColors(composeMap(paletteW,hcolors)).
1.235 run();
1.236 +
1.237 + return 0;
1.238 }
2.1 --- a/lemon/color.h Sat Jul 12 09:45:11 2008 +0100
2.2 +++ b/lemon/color.h Sun Jul 13 16:35:05 2008 +0100
2.3 @@ -108,11 +108,11 @@
2.4 public:
2.5 ///Constructor
2.6
2.7 - ///Constructor
2.8 - ///\param have_white indicates whether white is amongst the
2.9 + ///Constructor.
2.10 + ///\param have_white Indicates whether white is among the
2.11 ///provided initial colors (\c true) or not (\c false). If it is true,
2.12 ///white will be assigned to \c 0.
2.13 - ///\param num the number of the allocated colors. If it is \c -1,
2.14 + ///\param num The number of the allocated colors. If it is \c -1,
2.15 ///the default color configuration is set up (26 color plus optionaly the
2.16 ///white). If \c num is less then 26/27 then the default color
2.17 ///list is cut. Otherwise the color list is filled repeatedly with
2.18 @@ -153,7 +153,6 @@
2.19 colors.push_back(Color(0,.5,1));
2.20 colors.push_back(Color(.5,0,1));
2.21 } while(int(colors.size())<num);
2.22 - // colors.push_back(Color(1,1,1));
2.23 if(num>=0) colors.resize(num);
2.24 }
2.25 ///\e
2.26 @@ -171,13 +170,13 @@
2.27 {
2.28 colors[i%colors.size()]=c;
2.29 }
2.30 - ///Add a new color to the end of the color list.
2.31 + ///Adds a new color to the end of the color list.
2.32 void add(const Color &c)
2.33 {
2.34 colors.push_back(c);
2.35 }
2.36
2.37 - ///Sets the number of the exiting colors.
2.38 + ///Sets the number of the existing colors.
2.39 void resize(int s) { colors.resize(s);}
2.40 ///Returns the number of the existing colors.
2.41 int size() const { return int(colors.size());}
3.1 --- a/lemon/graph_to_eps.h Sat Jul 12 09:45:11 2008 +0100
3.2 +++ b/lemon/graph_to_eps.h Sun Jul 13 16:35:05 2008 +0100
3.3 @@ -63,7 +63,7 @@
3.4
3.5 ///Default traits class of \ref GraphToEps
3.6
3.7 -///Default traits class of \ref GraphToEps
3.8 +///Default traits class of \ref GraphToEps.
3.9 ///
3.10 ///\c G is the type of the underlying graph.
3.11 template<class G>
3.12 @@ -140,12 +140,11 @@
3.13 ///Constructor
3.14
3.15 ///Constructor
3.16 - ///\param _g is a reference to the graph to be printed
3.17 - ///\param _os is a reference to the output stream.
3.18 - ///\param _os is a reference to the output stream.
3.19 + ///\param _g Reference to the graph to be printed.
3.20 + ///\param _os Reference to the output stream.
3.21 + ///\param _os Reference to the output stream. By default it is <tt>std::cout</tt>.
3.22 ///\param _pros If it is \c true, then the \c ostream referenced by \c _os
3.23 ///will be explicitly deallocated by the destructor.
3.24 - ///By default it is <tt>std::cout</tt>
3.25 DefaultGraphToEpsTraits(const G &_g,std::ostream& _os=std::cout,
3.26 bool _pros=false) :
3.27 g(_g), os(_os),
3.28 @@ -173,7 +172,9 @@
3.29
3.30 ///Auxiliary class to implement the named parameters of \ref graphToEps()
3.31
3.32 -///Auxiliary class to implement the named parameters of \ref graphToEps()
3.33 +///Auxiliary class to implement the named parameters of \ref graphToEps().
3.34 +///
3.35 +///For detailed examples see the \ref graph_to_eps_demo.cc demo file.
3.36 template<class T> class GraphToEps : public T
3.37 {
3.38 // Can't believe it is required by the C++ standard
3.39 @@ -258,7 +259,7 @@
3.40 public:
3.41 ///Node shapes
3.42
3.43 - ///Node shapes
3.44 + ///Node shapes.
3.45 ///
3.46 enum NodeShapes {
3.47 /// = 0
3.48 @@ -335,7 +336,7 @@
3.49 ///Sets the map of the node coordinates
3.50
3.51 ///Sets the map of the node coordinates.
3.52 - ///\param x must be a node map with dim2::Point<double> or
3.53 + ///\param x must be a node map with \ref dim2::Point "dim2::Point<double>" or
3.54 ///\ref dim2::Point "dim2::Point<int>" values.
3.55 template<class X> GraphToEps<CoordsTraits<X> > coords(const X &x) {
3.56 dontPrint=true;
3.57 @@ -347,7 +348,7 @@
3.58 };
3.59 ///Sets the map of the node sizes
3.60
3.61 - ///Sets the map of the node sizes
3.62 + ///Sets the map of the node sizes.
3.63 ///\param x must be a node map with \c double (or convertible) values.
3.64 template<class X> GraphToEps<NodeSizesTraits<X> > nodeSizes(const X &x)
3.65 {
3.66 @@ -376,9 +377,9 @@
3.67 };
3.68 ///Sets the text printed on the nodes
3.69
3.70 - ///Sets the text printed on the nodes
3.71 + ///Sets the text printed on the nodes.
3.72 ///\param x must be a node map with type that can be pushed to a standard
3.73 - ///ostream.
3.74 + ///\c ostream.
3.75 template<class X> GraphToEps<NodeTextsTraits<X> > nodeTexts(const X &x)
3.76 {
3.77 dontPrint=true;
3.78 @@ -393,14 +394,14 @@
3.79
3.80 ///With this command it is possible to insert a verbatim PostScript
3.81 ///block to the nodes.
3.82 - ///The PS current point will be moved to the centre of the node before
3.83 + ///The PS current point will be moved to the center of the node before
3.84 ///the PostScript block inserted.
3.85 ///
3.86 ///Before and after the block a newline character is inserted so you
3.87 ///don't have to bother with the separators.
3.88 ///
3.89 ///\param x must be a node map with type that can be pushed to a standard
3.90 - ///ostream.
3.91 + ///\c ostream.
3.92 ///
3.93 ///\sa nodePsTextsPreamble()
3.94 template<class X> GraphToEps<NodePsTextsTraits<X> > nodePsTexts(const X &x)
3.95 @@ -415,7 +416,7 @@
3.96 };
3.97 ///Sets the map of the arc widths
3.98
3.99 - ///Sets the map of the arc widths
3.100 + ///Sets the map of the arc widths.
3.101 ///\param x must be an arc map with \c double (or convertible) values.
3.102 template<class X> GraphToEps<ArcWidthsTraits<X> > arcWidths(const X &x)
3.103 {
3.104 @@ -429,7 +430,7 @@
3.105 };
3.106 ///Sets the map of the node colors
3.107
3.108 - ///Sets the map of the node colors
3.109 + ///Sets the map of the node colors.
3.110 ///\param x must be a node map with \ref Color values.
3.111 ///
3.112 ///\sa Palette
3.113 @@ -445,7 +446,7 @@
3.114 };
3.115 ///Sets the map of the node text colors
3.116
3.117 - ///Sets the map of the node text colors
3.118 + ///Sets the map of the node text colors.
3.119 ///\param x must be a node map with \ref Color values.
3.120 ///
3.121 ///\sa Palette
3.122 @@ -463,7 +464,7 @@
3.123 };
3.124 ///Sets the map of the arc colors
3.125
3.126 - ///Sets the map of the arc colors
3.127 + ///Sets the map of the arc colors.
3.128 ///\param x must be an arc map with \ref Color values.
3.129 ///
3.130 ///\sa Palette
3.131 @@ -487,9 +488,9 @@
3.132 /// \sa nodeSizes()
3.133 /// \sa autoNodeScale()
3.134 GraphToEps<T> &nodeScale(double d=.01) {_nodeScale=d;return *this;}
3.135 - ///Turns on/off the automatic node width scaling.
3.136 + ///Turns on/off the automatic node size scaling.
3.137
3.138 - ///Turns on/off the automatic node width scaling.
3.139 + ///Turns on/off the automatic node size scaling.
3.140 ///
3.141 ///\sa nodeScale()
3.142 ///
3.143 @@ -497,9 +498,9 @@
3.144 _autoNodeScale=b;return *this;
3.145 }
3.146
3.147 - ///Turns on/off the absolutematic node width scaling.
3.148 + ///Turns on/off the absolutematic node size scaling.
3.149
3.150 - ///Turns on/off the absolutematic node width scaling.
3.151 + ///Turns on/off the absolutematic node size scaling.
3.152 ///
3.153 ///\sa nodeScale()
3.154 ///
3.155 @@ -508,9 +509,6 @@
3.156 }
3.157
3.158 ///Negates the Y coordinates.
3.159 -
3.160 - ///Negates the Y coordinates.
3.161 - ///
3.162 GraphToEps<T> &negateY(bool b=true) {
3.163 _negY=b;return *this;
3.164 }
3.165 @@ -557,86 +555,47 @@
3.166 _absoluteArcWidths=b;return *this;
3.167 }
3.168 ///Sets a global scale factor for the whole picture
3.169 -
3.170 - ///Sets a global scale factor for the whole picture
3.171 - ///
3.172 -
3.173 GraphToEps<T> &scale(double d) {_scale=d;return *this;}
3.174 ///Sets the width of the border around the picture
3.175 -
3.176 - ///Sets the width of the border around the picture
3.177 - ///
3.178 GraphToEps<T> &border(double b=10) {_xBorder=_yBorder=b;return *this;}
3.179 ///Sets the width of the border around the picture
3.180 -
3.181 - ///Sets the width of the border around the picture
3.182 - ///
3.183 GraphToEps<T> &border(double x, double y) {
3.184 _xBorder=x;_yBorder=y;return *this;
3.185 }
3.186 ///Sets whether to draw arrows
3.187 -
3.188 - ///Sets whether to draw arrows
3.189 - ///
3.190 GraphToEps<T> &drawArrows(bool b=true) {_drawArrows=b;return *this;}
3.191 ///Sets the length of the arrowheads
3.192 -
3.193 - ///Sets the length of the arrowheads
3.194 - ///
3.195 GraphToEps<T> &arrowLength(double d=1.0) {_arrowLength*=d;return *this;}
3.196 ///Sets the width of the arrowheads
3.197 -
3.198 - ///Sets the width of the arrowheads
3.199 - ///
3.200 GraphToEps<T> &arrowWidth(double d=.3) {_arrowWidth*=d;return *this;}
3.201
3.202 ///Scales the drawing to fit to A4 page
3.203 -
3.204 - ///Scales the drawing to fit to A4 page
3.205 - ///
3.206 GraphToEps<T> &scaleToA4() {_scaleToA4=true;return *this;}
3.207
3.208 ///Enables parallel arcs
3.209 -
3.210 - ///Enables parallel arcs
3.211 GraphToEps<T> &enableParallel(bool b=true) {_enableParallel=b;return *this;}
3.212
3.213 - ///Sets the distance
3.214 -
3.215 - ///Sets the distance
3.216 - ///
3.217 + ///Sets the distance between parallel arcs
3.218 GraphToEps<T> &parArcDist(double d) {_parArcDist*=d;return *this;}
3.219
3.220 ///Hides the arcs
3.221 -
3.222 - ///Hides the arcs
3.223 - ///
3.224 GraphToEps<T> &hideArcs(bool b=true) {_showArcs=!b;return *this;}
3.225 ///Hides the nodes
3.226 -
3.227 - ///Hides the nodes
3.228 - ///
3.229 GraphToEps<T> &hideNodes(bool b=true) {_showNodes=!b;return *this;}
3.230
3.231 ///Sets the size of the node texts
3.232 -
3.233 - ///Sets the size of the node texts
3.234 - ///
3.235 GraphToEps<T> &nodeTextSize(double d) {_nodeTextSize=d;return *this;}
3.236
3.237 ///Sets the color of the node texts to be different from the node color
3.238
3.239 ///Sets the color of the node texts to be as different from the node color
3.240 - ///as it is possible
3.241 - ///
3.242 + ///as it is possible.
3.243 GraphToEps<T> &distantColorNodeTexts()
3.244 {_nodeTextColorType=DIST_COL;return *this;}
3.245 ///Sets the color of the node texts to be black or white and always visible.
3.246
3.247 ///Sets the color of the node texts to be black or white according to
3.248 - ///which is more
3.249 - ///different from the node color
3.250 - ///
3.251 + ///which is more different from the node color.
3.252 GraphToEps<T> &distantBWNodeTexts()
3.253 {_nodeTextColorType=DIST_BW;return *this;}
3.254
3.255 @@ -648,18 +607,18 @@
3.256 GraphToEps<T> & nodePsTextsPreamble(const char *str) {
3.257 _nodePsTextsPreamble=str ;return *this;
3.258 }
3.259 - ///Sets whether the the graph is undirected
3.260 + ///Sets whether the graph is undirected
3.261
3.262 - ///Sets whether the the graph is undirected.
3.263 + ///Sets whether the graph is undirected.
3.264 ///
3.265 ///This setting is the default for undirected graphs.
3.266 ///
3.267 ///\sa directed()
3.268 GraphToEps<T> &undirected(bool b=true) {_undirected=b;return *this;}
3.269
3.270 - ///Sets whether the the graph is directed
3.271 + ///Sets whether the graph is directed
3.272
3.273 - ///Sets whether the the graph is directed.
3.274 + ///Sets whether the graph is directed.
3.275 ///Use it to show the edges as a pair of directed ones.
3.276 ///
3.277 ///This setting is the default for digraphs.
3.278 @@ -716,7 +675,6 @@
3.279 os << "%!PS-Adobe-2.0 EPSF-2.0\n";
3.280 if(_title.size()>0) os << "%%Title: " << _title << '\n';
3.281 if(_copyright.size()>0) os << "%%Copyright: " << _copyright << '\n';
3.282 -// << "%%Copyright: XXXX\n"
3.283 os << "%%Creator: LEMON, graphToEps()\n";
3.284
3.285 {
3.286 @@ -748,7 +706,7 @@
3.287 double max_w=0;
3.288 for(ArcIt e(g);e!=INVALID;++e)
3.289 max_w=std::max(double(_arcWidths[e]),max_w);
3.290 - ///\todo better 'epsilon' would be nice here.
3.291 + //\todo better 'epsilon' would be nice here.
3.292 if(max_w>EPSILON) {
3.293 _arcWidthScale/=max_w;
3.294 }
3.295 @@ -758,7 +716,7 @@
3.296 double max_s=0;
3.297 for(NodeIt n(g);n!=INVALID;++n)
3.298 max_s=std::max(double(_nodeSizes[n]),max_s);
3.299 - ///\todo better 'epsilon' would be nice here.
3.300 + //\todo better 'epsilon' would be nice here.
3.301 if(max_s>EPSILON) {
3.302 _nodeScale/=max_s;
3.303 }
3.304 @@ -1114,18 +1072,12 @@
3.305 ///@{
3.306
3.307 ///An alias for arcWidths()
3.308 -
3.309 - ///An alias for arcWidths()
3.310 - ///
3.311 template<class X> GraphToEps<ArcWidthsTraits<X> > edgeWidths(const X &x)
3.312 {
3.313 return arcWidths(x);
3.314 }
3.315
3.316 ///An alias for arcColors()
3.317 -
3.318 - ///An alias for arcColors()
3.319 - ///
3.320 template<class X> GraphToEps<ArcColorsTraits<X> >
3.321 edgeColors(const X &x)
3.322 {
3.323 @@ -1133,39 +1085,24 @@
3.324 }
3.325
3.326 ///An alias for arcWidthScale()
3.327 -
3.328 - ///An alias for arcWidthScale()
3.329 - ///
3.330 GraphToEps<T> &edgeWidthScale(double d) {return arcWidthScale(d);}
3.331
3.332 ///An alias for autoArcWidthScale()
3.333 -
3.334 - ///An alias for autoArcWidthScale()
3.335 - ///
3.336 GraphToEps<T> &autoEdgeWidthScale(bool b=true)
3.337 {
3.338 return autoArcWidthScale(b);
3.339 }
3.340
3.341 ///An alias for absoluteArcWidths()
3.342 -
3.343 - ///An alias for absoluteArcWidths()
3.344 - ///
3.345 GraphToEps<T> &absoluteEdgeWidths(bool b=true)
3.346 {
3.347 return absoluteArcWidths(b);
3.348 }
3.349
3.350 ///An alias for parArcDist()
3.351 -
3.352 - ///An alias for parArcDist()
3.353 - ///
3.354 GraphToEps<T> &parEdgeDist(double d) {return parArcDist(d);}
3.355
3.356 ///An alias for hideArcs()
3.357 -
3.358 - ///An alias for hideArcs()
3.359 - ///
3.360 GraphToEps<T> &hideEdges(bool b=true) {return hideArcs(b);}
3.361
3.362 ///@}
3.363 @@ -1185,9 +1122,9 @@
3.364
3.365 ///\ingroup eps_io
3.366 ///Generates an EPS file from a graph.
3.367 -///\param g is a reference to the graph to be printed
3.368 -///\param os is a reference to the output stream.
3.369 -///By default it is <tt>std::cout</tt>
3.370 +///\param g Reference to the graph to be printed.
3.371 +///\param os Reference to the output stream.
3.372 +///By default it is <tt>std::cout</tt>.
3.373 ///
3.374 ///This function also has a lot of
3.375 ///\ref named-templ-func-param "named parameters",
3.376 @@ -1198,6 +1135,9 @@
3.377 /// .nodeScale(2).nodeSizes(sizes)
3.378 /// .arcWidthScale(.4).run();
3.379 ///\endcode
3.380 +///
3.381 +///For more detailed examples see the \ref graph_to_eps_demo.cc demo file.
3.382 +///
3.383 ///\warning Don't forget to put the \ref GraphToEps::run() "run()"
3.384 ///to the end of the parameter list.
3.385 ///\sa GraphToEps