1.1 --- a/lemon/graph_to_eps.h Mon Apr 14 11:23:56 2008 +0100
1.2 +++ b/lemon/graph_to_eps.h Sun Apr 13 08:20:43 2008 +0100
1.3 @@ -43,9 +43,7 @@
1.4
1.5 ///\ingroup eps_io
1.6 ///\file
1.7 -///\brief Simple graph drawer
1.8 -///
1.9 -///\author Alpar Juttner
1.10 +///\brief A well configurable tool for visualizing graphs
1.11
1.12 namespace lemon {
1.13
1.14 @@ -172,16 +170,9 @@
1.15 {}
1.16 };
1.17
1.18 -///Helper class to implement the named parameters of \ref graphToEps()
1.19 +///Auxiliary class to implement the named parameters of \ref graphToEps()
1.20
1.21 -///Helper class to implement the named parameters of \ref graphToEps()
1.22 -///\todo Is 'helper class' a good name for this?
1.23 -///
1.24 -///\todo Follow PostScript's DSC.
1.25 -/// Use own dictionary.
1.26 -///\todo Useful new features.
1.27 -/// - Linestyles: dotted, dashed etc.
1.28 -/// - A second color and percent value for the lines.
1.29 +///Auxiliary class to implement the named parameters of \ref graphToEps()
1.30 template<class T> class GraphToEps : public T
1.31 {
1.32 // Can't believe it is required by the C++ standard
1.33 @@ -369,7 +360,7 @@
1.34 ///Sets the map of the node shapes
1.35
1.36 ///Sets the map of the node shapes.
1.37 - ///The availabe shape values
1.38 + ///The available shape values
1.39 ///can be found in \ref NodeShapes "enum NodeShapes".
1.40 ///\param x must be a node map with \c int (or convertible) values.
1.41 ///\sa NodeShapes
1.42 @@ -411,8 +402,6 @@
1.43 ///ostream.
1.44 ///
1.45 ///\sa nodePsTextsPreamble()
1.46 - ///\todo Offer the choise not to move to the centre but pass the coordinates
1.47 - ///to the Postscript block inserted.
1.48 template<class X> GraphToEps<NodePsTextsTraits<X> > nodePsTexts(const X &x)
1.49 {
1.50 dontPrint=true;
1.51 @@ -521,13 +510,11 @@
1.52
1.53 ///Negates the Y coordinates.
1.54 ///
1.55 - ///\todo More docs.
1.56 - ///
1.57 GraphToEps<T> &negateY(bool b=true) {
1.58 _negY=b;return *this;
1.59 }
1.60
1.61 - ///Turn on/off prescaling
1.62 + ///Turn on/off pre-scaling
1.63
1.64 ///By default graphToEps() rescales the whole image in order to avoid
1.65 ///very big or very small bounding boxes.
1.66 @@ -578,7 +565,7 @@
1.67
1.68 ///Sets the width of the border around the picture
1.69 ///
1.70 - GraphToEps<T> &border(double b) {_xBorder=_yBorder=b;return *this;}
1.71 + GraphToEps<T> &border(double b=10) {_xBorder=_yBorder=b;return *this;}
1.72 ///Sets the width of the border around the picture
1.73
1.74 ///Sets the width of the border around the picture
1.75 @@ -595,12 +582,12 @@
1.76
1.77 ///Sets the length of the arrowheads
1.78 ///
1.79 - GraphToEps<T> &arrowLength(double d) {_arrowLength*=d;return *this;}
1.80 + GraphToEps<T> &arrowLength(double d=1.0) {_arrowLength*=d;return *this;}
1.81 ///Sets the width of the arrowheads
1.82
1.83 ///Sets the width of the arrowheads
1.84 ///
1.85 - GraphToEps<T> &arrowWidth(double d) {_arrowWidth*=d;return *this;}
1.86 + GraphToEps<T> &arrowWidth(double d=.3) {_arrowWidth*=d;return *this;}
1.87
1.88 ///Scales the drawing to fit to A4 page
1.89
1.90 @@ -662,16 +649,23 @@
1.91 }
1.92 ///Sets whether the the graph is undirected
1.93
1.94 - ///Sets whether the the graph is undirected
1.95 + ///Sets whether the the graph is undirected.
1.96 ///
1.97 - GraphToEps<T> &undirected(bool b=true) {_undirected=b;return *this;}
1.98 + ///This setting is the default for undirected graphs.
1.99 + ///
1.100 + ///\sa directed()
1.101 + GraphToEps<T> &undirected(bool b=true) {_undirected=b;return *this;}
1.102
1.103 ///Sets whether the the graph is directed
1.104
1.105 ///Sets whether the the graph is directed.
1.106 ///Use it to show the edges as a pair of directed ones.
1.107 + ///
1.108 + ///This setting is the default for digraphs.
1.109 + ///
1.110 + ///\sa undirected()
1.111 GraphToEps<T> &directed(bool b=true) {_undirected=!b;return *this;}
1.112 -
1.113 +
1.114 ///Sets the title.
1.115
1.116 ///Sets the title of the generated image,
1.117 @@ -683,7 +677,6 @@
1.118 ///Sets the copyright statement of the generated image,
1.119 ///namely it inserts a <tt>%%Copyright:</tt> DSC field to the header of
1.120 ///the EPS file.
1.121 - ///\todo Multiline copyright notice could be supported.
1.122 GraphToEps<T> ©right(const std::string &t) {_copyright=t;return *this;}
1.123
1.124 protected:
1.125 @@ -709,10 +702,10 @@
1.126
1.127 ///Like other functions using
1.128 ///\ref named-templ-func-param "named template parameters",
1.129 - ///this function calles the algorithm itself, i.e. in this case
1.130 + ///this function calls the algorithm itself, i.e. in this case
1.131 ///it draws the graph.
1.132 void run() {
1.133 - ///\todo better 'epsilon' would be nice here.
1.134 + //\todo better 'epsilon' would be nice here.
1.135 const double EPSILON=1e-9;
1.136 if(dontPrint) return;
1.137
1.138 @@ -930,7 +923,7 @@
1.139 dim2::Point<double>
1.140 dvec(mycoords[g.target(*i)]-mycoords[g.source(*i)]);
1.141 double l=std::sqrt(dvec.normSquare());
1.142 - ///\todo better 'epsilon' would be nice here.
1.143 + //\todo better 'epsilon' would be nice here.
1.144 dim2::Point<double> d(dvec/std::max(l,EPSILON));
1.145 dim2::Point<double> m;
1.146 // m=dim2::Point<double>(mycoords[g.target(*i)]+mycoords[g.source(*i)])/2.0;