1.1 --- a/lemon/graph_to_eps.h Sat Jul 12 09:45:11 2008 +0100
1.2 +++ b/lemon/graph_to_eps.h Sun Jul 13 16:35:05 2008 +0100
1.3 @@ -63,7 +63,7 @@
1.4
1.5 ///Default traits class of \ref GraphToEps
1.6
1.7 -///Default traits class of \ref GraphToEps
1.8 +///Default traits class of \ref GraphToEps.
1.9 ///
1.10 ///\c G is the type of the underlying graph.
1.11 template<class G>
1.12 @@ -140,12 +140,11 @@
1.13 ///Constructor
1.14
1.15 ///Constructor
1.16 - ///\param _g is a reference to the graph to be printed
1.17 - ///\param _os is a reference to the output stream.
1.18 - ///\param _os is a reference to the output stream.
1.19 + ///\param _g Reference to the graph to be printed.
1.20 + ///\param _os Reference to the output stream.
1.21 + ///\param _os Reference to the output stream. By default it is <tt>std::cout</tt>.
1.22 ///\param _pros If it is \c true, then the \c ostream referenced by \c _os
1.23 ///will be explicitly deallocated by the destructor.
1.24 - ///By default it is <tt>std::cout</tt>
1.25 DefaultGraphToEpsTraits(const G &_g,std::ostream& _os=std::cout,
1.26 bool _pros=false) :
1.27 g(_g), os(_os),
1.28 @@ -173,7 +172,9 @@
1.29
1.30 ///Auxiliary class to implement the named parameters of \ref graphToEps()
1.31
1.32 -///Auxiliary class to implement the named parameters of \ref graphToEps()
1.33 +///Auxiliary class to implement the named parameters of \ref graphToEps().
1.34 +///
1.35 +///For detailed examples see the \ref graph_to_eps_demo.cc demo file.
1.36 template<class T> class GraphToEps : public T
1.37 {
1.38 // Can't believe it is required by the C++ standard
1.39 @@ -258,7 +259,7 @@
1.40 public:
1.41 ///Node shapes
1.42
1.43 - ///Node shapes
1.44 + ///Node shapes.
1.45 ///
1.46 enum NodeShapes {
1.47 /// = 0
1.48 @@ -335,7 +336,7 @@
1.49 ///Sets the map of the node coordinates
1.50
1.51 ///Sets the map of the node coordinates.
1.52 - ///\param x must be a node map with dim2::Point<double> or
1.53 + ///\param x must be a node map with \ref dim2::Point "dim2::Point<double>" or
1.54 ///\ref dim2::Point "dim2::Point<int>" values.
1.55 template<class X> GraphToEps<CoordsTraits<X> > coords(const X &x) {
1.56 dontPrint=true;
1.57 @@ -347,7 +348,7 @@
1.58 };
1.59 ///Sets the map of the node sizes
1.60
1.61 - ///Sets the map of the node sizes
1.62 + ///Sets the map of the node sizes.
1.63 ///\param x must be a node map with \c double (or convertible) values.
1.64 template<class X> GraphToEps<NodeSizesTraits<X> > nodeSizes(const X &x)
1.65 {
1.66 @@ -376,9 +377,9 @@
1.67 };
1.68 ///Sets the text printed on the nodes
1.69
1.70 - ///Sets the text printed on the nodes
1.71 + ///Sets the text printed on the nodes.
1.72 ///\param x must be a node map with type that can be pushed to a standard
1.73 - ///ostream.
1.74 + ///\c ostream.
1.75 template<class X> GraphToEps<NodeTextsTraits<X> > nodeTexts(const X &x)
1.76 {
1.77 dontPrint=true;
1.78 @@ -393,14 +394,14 @@
1.79
1.80 ///With this command it is possible to insert a verbatim PostScript
1.81 ///block to the nodes.
1.82 - ///The PS current point will be moved to the centre of the node before
1.83 + ///The PS current point will be moved to the center of the node before
1.84 ///the PostScript block inserted.
1.85 ///
1.86 ///Before and after the block a newline character is inserted so you
1.87 ///don't have to bother with the separators.
1.88 ///
1.89 ///\param x must be a node map with type that can be pushed to a standard
1.90 - ///ostream.
1.91 + ///\c ostream.
1.92 ///
1.93 ///\sa nodePsTextsPreamble()
1.94 template<class X> GraphToEps<NodePsTextsTraits<X> > nodePsTexts(const X &x)
1.95 @@ -415,7 +416,7 @@
1.96 };
1.97 ///Sets the map of the arc widths
1.98
1.99 - ///Sets the map of the arc widths
1.100 + ///Sets the map of the arc widths.
1.101 ///\param x must be an arc map with \c double (or convertible) values.
1.102 template<class X> GraphToEps<ArcWidthsTraits<X> > arcWidths(const X &x)
1.103 {
1.104 @@ -429,7 +430,7 @@
1.105 };
1.106 ///Sets the map of the node colors
1.107
1.108 - ///Sets the map of the node colors
1.109 + ///Sets the map of the node colors.
1.110 ///\param x must be a node map with \ref Color values.
1.111 ///
1.112 ///\sa Palette
1.113 @@ -445,7 +446,7 @@
1.114 };
1.115 ///Sets the map of the node text colors
1.116
1.117 - ///Sets the map of the node text colors
1.118 + ///Sets the map of the node text colors.
1.119 ///\param x must be a node map with \ref Color values.
1.120 ///
1.121 ///\sa Palette
1.122 @@ -463,7 +464,7 @@
1.123 };
1.124 ///Sets the map of the arc colors
1.125
1.126 - ///Sets the map of the arc colors
1.127 + ///Sets the map of the arc colors.
1.128 ///\param x must be an arc map with \ref Color values.
1.129 ///
1.130 ///\sa Palette
1.131 @@ -487,9 +488,9 @@
1.132 /// \sa nodeSizes()
1.133 /// \sa autoNodeScale()
1.134 GraphToEps<T> &nodeScale(double d=.01) {_nodeScale=d;return *this;}
1.135 - ///Turns on/off the automatic node width scaling.
1.136 + ///Turns on/off the automatic node size scaling.
1.137
1.138 - ///Turns on/off the automatic node width scaling.
1.139 + ///Turns on/off the automatic node size scaling.
1.140 ///
1.141 ///\sa nodeScale()
1.142 ///
1.143 @@ -497,9 +498,9 @@
1.144 _autoNodeScale=b;return *this;
1.145 }
1.146
1.147 - ///Turns on/off the absolutematic node width scaling.
1.148 + ///Turns on/off the absolutematic node size scaling.
1.149
1.150 - ///Turns on/off the absolutematic node width scaling.
1.151 + ///Turns on/off the absolutematic node size scaling.
1.152 ///
1.153 ///\sa nodeScale()
1.154 ///
1.155 @@ -508,9 +509,6 @@
1.156 }
1.157
1.158 ///Negates the Y coordinates.
1.159 -
1.160 - ///Negates the Y coordinates.
1.161 - ///
1.162 GraphToEps<T> &negateY(bool b=true) {
1.163 _negY=b;return *this;
1.164 }
1.165 @@ -557,86 +555,47 @@
1.166 _absoluteArcWidths=b;return *this;
1.167 }
1.168 ///Sets a global scale factor for the whole picture
1.169 -
1.170 - ///Sets a global scale factor for the whole picture
1.171 - ///
1.172 -
1.173 GraphToEps<T> &scale(double d) {_scale=d;return *this;}
1.174 ///Sets the width of the border around the picture
1.175 -
1.176 - ///Sets the width of the border around the picture
1.177 - ///
1.178 GraphToEps<T> &border(double b=10) {_xBorder=_yBorder=b;return *this;}
1.179 ///Sets the width of the border around the picture
1.180 -
1.181 - ///Sets the width of the border around the picture
1.182 - ///
1.183 GraphToEps<T> &border(double x, double y) {
1.184 _xBorder=x;_yBorder=y;return *this;
1.185 }
1.186 ///Sets whether to draw arrows
1.187 -
1.188 - ///Sets whether to draw arrows
1.189 - ///
1.190 GraphToEps<T> &drawArrows(bool b=true) {_drawArrows=b;return *this;}
1.191 ///Sets the length of the arrowheads
1.192 -
1.193 - ///Sets the length of the arrowheads
1.194 - ///
1.195 GraphToEps<T> &arrowLength(double d=1.0) {_arrowLength*=d;return *this;}
1.196 ///Sets the width of the arrowheads
1.197 -
1.198 - ///Sets the width of the arrowheads
1.199 - ///
1.200 GraphToEps<T> &arrowWidth(double d=.3) {_arrowWidth*=d;return *this;}
1.201
1.202 ///Scales the drawing to fit to A4 page
1.203 -
1.204 - ///Scales the drawing to fit to A4 page
1.205 - ///
1.206 GraphToEps<T> &scaleToA4() {_scaleToA4=true;return *this;}
1.207
1.208 ///Enables parallel arcs
1.209 -
1.210 - ///Enables parallel arcs
1.211 GraphToEps<T> &enableParallel(bool b=true) {_enableParallel=b;return *this;}
1.212
1.213 - ///Sets the distance
1.214 -
1.215 - ///Sets the distance
1.216 - ///
1.217 + ///Sets the distance between parallel arcs
1.218 GraphToEps<T> &parArcDist(double d) {_parArcDist*=d;return *this;}
1.219
1.220 ///Hides the arcs
1.221 -
1.222 - ///Hides the arcs
1.223 - ///
1.224 GraphToEps<T> &hideArcs(bool b=true) {_showArcs=!b;return *this;}
1.225 ///Hides the nodes
1.226 -
1.227 - ///Hides the nodes
1.228 - ///
1.229 GraphToEps<T> &hideNodes(bool b=true) {_showNodes=!b;return *this;}
1.230
1.231 ///Sets the size of the node texts
1.232 -
1.233 - ///Sets the size of the node texts
1.234 - ///
1.235 GraphToEps<T> &nodeTextSize(double d) {_nodeTextSize=d;return *this;}
1.236
1.237 ///Sets the color of the node texts to be different from the node color
1.238
1.239 ///Sets the color of the node texts to be as different from the node color
1.240 - ///as it is possible
1.241 - ///
1.242 + ///as it is possible.
1.243 GraphToEps<T> &distantColorNodeTexts()
1.244 {_nodeTextColorType=DIST_COL;return *this;}
1.245 ///Sets the color of the node texts to be black or white and always visible.
1.246
1.247 ///Sets the color of the node texts to be black or white according to
1.248 - ///which is more
1.249 - ///different from the node color
1.250 - ///
1.251 + ///which is more different from the node color.
1.252 GraphToEps<T> &distantBWNodeTexts()
1.253 {_nodeTextColorType=DIST_BW;return *this;}
1.254
1.255 @@ -648,18 +607,18 @@
1.256 GraphToEps<T> & nodePsTextsPreamble(const char *str) {
1.257 _nodePsTextsPreamble=str ;return *this;
1.258 }
1.259 - ///Sets whether the the graph is undirected
1.260 + ///Sets whether the graph is undirected
1.261
1.262 - ///Sets whether the the graph is undirected.
1.263 + ///Sets whether the graph is undirected.
1.264 ///
1.265 ///This setting is the default for undirected graphs.
1.266 ///
1.267 ///\sa directed()
1.268 GraphToEps<T> &undirected(bool b=true) {_undirected=b;return *this;}
1.269
1.270 - ///Sets whether the the graph is directed
1.271 + ///Sets whether the graph is directed
1.272
1.273 - ///Sets whether the the graph is directed.
1.274 + ///Sets whether the graph is directed.
1.275 ///Use it to show the edges as a pair of directed ones.
1.276 ///
1.277 ///This setting is the default for digraphs.
1.278 @@ -716,7 +675,6 @@
1.279 os << "%!PS-Adobe-2.0 EPSF-2.0\n";
1.280 if(_title.size()>0) os << "%%Title: " << _title << '\n';
1.281 if(_copyright.size()>0) os << "%%Copyright: " << _copyright << '\n';
1.282 -// << "%%Copyright: XXXX\n"
1.283 os << "%%Creator: LEMON, graphToEps()\n";
1.284
1.285 {
1.286 @@ -748,7 +706,7 @@
1.287 double max_w=0;
1.288 for(ArcIt e(g);e!=INVALID;++e)
1.289 max_w=std::max(double(_arcWidths[e]),max_w);
1.290 - ///\todo better 'epsilon' would be nice here.
1.291 + //\todo better 'epsilon' would be nice here.
1.292 if(max_w>EPSILON) {
1.293 _arcWidthScale/=max_w;
1.294 }
1.295 @@ -758,7 +716,7 @@
1.296 double max_s=0;
1.297 for(NodeIt n(g);n!=INVALID;++n)
1.298 max_s=std::max(double(_nodeSizes[n]),max_s);
1.299 - ///\todo better 'epsilon' would be nice here.
1.300 + //\todo better 'epsilon' would be nice here.
1.301 if(max_s>EPSILON) {
1.302 _nodeScale/=max_s;
1.303 }
1.304 @@ -1114,18 +1072,12 @@
1.305 ///@{
1.306
1.307 ///An alias for arcWidths()
1.308 -
1.309 - ///An alias for arcWidths()
1.310 - ///
1.311 template<class X> GraphToEps<ArcWidthsTraits<X> > edgeWidths(const X &x)
1.312 {
1.313 return arcWidths(x);
1.314 }
1.315
1.316 ///An alias for arcColors()
1.317 -
1.318 - ///An alias for arcColors()
1.319 - ///
1.320 template<class X> GraphToEps<ArcColorsTraits<X> >
1.321 edgeColors(const X &x)
1.322 {
1.323 @@ -1133,39 +1085,24 @@
1.324 }
1.325
1.326 ///An alias for arcWidthScale()
1.327 -
1.328 - ///An alias for arcWidthScale()
1.329 - ///
1.330 GraphToEps<T> &edgeWidthScale(double d) {return arcWidthScale(d);}
1.331
1.332 ///An alias for autoArcWidthScale()
1.333 -
1.334 - ///An alias for autoArcWidthScale()
1.335 - ///
1.336 GraphToEps<T> &autoEdgeWidthScale(bool b=true)
1.337 {
1.338 return autoArcWidthScale(b);
1.339 }
1.340
1.341 ///An alias for absoluteArcWidths()
1.342 -
1.343 - ///An alias for absoluteArcWidths()
1.344 - ///
1.345 GraphToEps<T> &absoluteEdgeWidths(bool b=true)
1.346 {
1.347 return absoluteArcWidths(b);
1.348 }
1.349
1.350 ///An alias for parArcDist()
1.351 -
1.352 - ///An alias for parArcDist()
1.353 - ///
1.354 GraphToEps<T> &parEdgeDist(double d) {return parArcDist(d);}
1.355
1.356 ///An alias for hideArcs()
1.357 -
1.358 - ///An alias for hideArcs()
1.359 - ///
1.360 GraphToEps<T> &hideEdges(bool b=true) {return hideArcs(b);}
1.361
1.362 ///@}
1.363 @@ -1185,9 +1122,9 @@
1.364
1.365 ///\ingroup eps_io
1.366 ///Generates an EPS file from a graph.
1.367 -///\param g is a reference to the graph to be printed
1.368 -///\param os is a reference to the output stream.
1.369 -///By default it is <tt>std::cout</tt>
1.370 +///\param g Reference to the graph to be printed.
1.371 +///\param os Reference to the output stream.
1.372 +///By default it is <tt>std::cout</tt>.
1.373 ///
1.374 ///This function also has a lot of
1.375 ///\ref named-templ-func-param "named parameters",
1.376 @@ -1198,6 +1135,9 @@
1.377 /// .nodeScale(2).nodeSizes(sizes)
1.378 /// .arcWidthScale(.4).run();
1.379 ///\endcode
1.380 +///
1.381 +///For more detailed examples see the \ref graph_to_eps_demo.cc demo file.
1.382 +///
1.383 ///\warning Don't forget to put the \ref GraphToEps::run() "run()"
1.384 ///to the end of the parameter list.
1.385 ///\sa GraphToEps