lemon/graph_to_eps.h
changeset 208 4317d277ba21
parent 184 716b220697a0
child 209 765619b7cbb2
equal deleted inserted replaced
8:42741cfcad87 9:360e7be999db
    61     };
    61     };
    62   }
    62   }
    63   
    63   
    64 ///Default traits class of \ref GraphToEps
    64 ///Default traits class of \ref GraphToEps
    65 
    65 
    66 ///Default traits class of \ref GraphToEps
    66 ///Default traits class of \ref GraphToEps.
    67 ///
    67 ///
    68 ///\c G is the type of the underlying graph.
    68 ///\c G is the type of the underlying graph.
    69 template<class G>
    69 template<class G>
    70 struct DefaultGraphToEpsTraits
    70 struct DefaultGraphToEpsTraits
    71 {
    71 {
   138 
   138 
   139   bool _preScale;
   139   bool _preScale;
   140   ///Constructor
   140   ///Constructor
   141 
   141 
   142   ///Constructor
   142   ///Constructor
   143   ///\param _g is a reference to the graph to be printed
   143   ///\param _g  Reference to the graph to be printed.
   144   ///\param _os is a reference to the output stream.
   144   ///\param _os Reference to the output stream.
   145   ///\param _os is a reference to the output stream.
   145   ///\param _os Reference to the output stream. By default it is <tt>std::cout</tt>.
   146   ///\param _pros If it is \c true, then the \c ostream referenced by \c _os
   146   ///\param _pros If it is \c true, then the \c ostream referenced by \c _os
   147   ///will be explicitly deallocated by the destructor.
   147   ///will be explicitly deallocated by the destructor.
   148   ///By default it is <tt>std::cout</tt>
       
   149   DefaultGraphToEpsTraits(const G &_g,std::ostream& _os=std::cout,
   148   DefaultGraphToEpsTraits(const G &_g,std::ostream& _os=std::cout,
   150 			  bool _pros=false) :
   149 			  bool _pros=false) :
   151     g(_g), os(_os),
   150     g(_g), os(_os),
   152     _coords(dim2::Point<double>(1,1)), _nodeSizes(1), _nodeShapes(0),
   151     _coords(dim2::Point<double>(1,1)), _nodeSizes(1), _nodeShapes(0),
   153     _nodeColors(WHITE), _arcColors(BLACK),
   152     _nodeColors(WHITE), _arcColors(BLACK),
   171   {}
   170   {}
   172 };
   171 };
   173 
   172 
   174 ///Auxiliary class to implement the named parameters of \ref graphToEps()
   173 ///Auxiliary class to implement the named parameters of \ref graphToEps()
   175 
   174 
   176 ///Auxiliary class to implement the named parameters of \ref graphToEps()
   175 ///Auxiliary class to implement the named parameters of \ref graphToEps().
       
   176 ///
       
   177 ///For detailed examples see the \ref graph_to_eps_demo.cc demo file.
   177 template<class T> class GraphToEps : public T 
   178 template<class T> class GraphToEps : public T 
   178 {
   179 {
   179   // Can't believe it is required by the C++ standard
   180   // Can't believe it is required by the C++ standard
   180   using T::g;
   181   using T::g;
   181   using T::os;
   182   using T::os;
   256   bool dontPrint;
   257   bool dontPrint;
   257 
   258 
   258 public:
   259 public:
   259   ///Node shapes
   260   ///Node shapes
   260 
   261 
   261   ///Node shapes
   262   ///Node shapes.
   262   ///
   263   ///
   263   enum NodeShapes { 
   264   enum NodeShapes { 
   264     /// = 0
   265     /// = 0
   265     ///\image html nodeshape_0.png
   266     ///\image html nodeshape_0.png
   266     ///\image latex nodeshape_0.eps "CIRCLE shape (0)" width=2cm
   267     ///\image latex nodeshape_0.eps "CIRCLE shape (0)" width=2cm
   333     CoordsTraits(const T &t,const X &x) : T(t), _coords(x) {}
   334     CoordsTraits(const T &t,const X &x) : T(t), _coords(x) {}
   334   };
   335   };
   335   ///Sets the map of the node coordinates
   336   ///Sets the map of the node coordinates
   336 
   337 
   337   ///Sets the map of the node coordinates.
   338   ///Sets the map of the node coordinates.
   338   ///\param x must be a node map with dim2::Point<double> or
   339   ///\param x must be a node map with \ref dim2::Point "dim2::Point<double>" or
   339   ///\ref dim2::Point "dim2::Point<int>" values. 
   340   ///\ref dim2::Point "dim2::Point<int>" values. 
   340   template<class X> GraphToEps<CoordsTraits<X> > coords(const X &x) {
   341   template<class X> GraphToEps<CoordsTraits<X> > coords(const X &x) {
   341     dontPrint=true;
   342     dontPrint=true;
   342     return GraphToEps<CoordsTraits<X> >(CoordsTraits<X>(*this,x));
   343     return GraphToEps<CoordsTraits<X> >(CoordsTraits<X>(*this,x));
   343   }
   344   }
   345     const X &_nodeSizes;
   346     const X &_nodeSizes;
   346     NodeSizesTraits(const T &t,const X &x) : T(t), _nodeSizes(x) {}
   347     NodeSizesTraits(const T &t,const X &x) : T(t), _nodeSizes(x) {}
   347   };
   348   };
   348   ///Sets the map of the node sizes
   349   ///Sets the map of the node sizes
   349 
   350 
   350   ///Sets the map of the node sizes
   351   ///Sets the map of the node sizes.
   351   ///\param x must be a node map with \c double (or convertible) values. 
   352   ///\param x must be a node map with \c double (or convertible) values. 
   352   template<class X> GraphToEps<NodeSizesTraits<X> > nodeSizes(const X &x)
   353   template<class X> GraphToEps<NodeSizesTraits<X> > nodeSizes(const X &x)
   353   {
   354   {
   354     dontPrint=true;
   355     dontPrint=true;
   355     return GraphToEps<NodeSizesTraits<X> >(NodeSizesTraits<X>(*this,x));
   356     return GraphToEps<NodeSizesTraits<X> >(NodeSizesTraits<X>(*this,x));
   374     const X &_nodeTexts;
   375     const X &_nodeTexts;
   375     NodeTextsTraits(const T &t,const X &x) : T(t), _nodeTexts(x) {}
   376     NodeTextsTraits(const T &t,const X &x) : T(t), _nodeTexts(x) {}
   376   };
   377   };
   377   ///Sets the text printed on the nodes
   378   ///Sets the text printed on the nodes
   378 
   379 
   379   ///Sets the text printed on the nodes
   380   ///Sets the text printed on the nodes.
   380   ///\param x must be a node map with type that can be pushed to a standard
   381   ///\param x must be a node map with type that can be pushed to a standard
   381   ///ostream. 
   382   ///\c ostream. 
   382   template<class X> GraphToEps<NodeTextsTraits<X> > nodeTexts(const X &x)
   383   template<class X> GraphToEps<NodeTextsTraits<X> > nodeTexts(const X &x)
   383   {
   384   {
   384     dontPrint=true;
   385     dontPrint=true;
   385     _showNodeText=true;
   386     _showNodeText=true;
   386     return GraphToEps<NodeTextsTraits<X> >(NodeTextsTraits<X>(*this,x));
   387     return GraphToEps<NodeTextsTraits<X> >(NodeTextsTraits<X>(*this,x));
   391   };
   392   };
   392   ///Inserts a PostScript block to the nodes
   393   ///Inserts a PostScript block to the nodes
   393 
   394 
   394   ///With this command it is possible to insert a verbatim PostScript
   395   ///With this command it is possible to insert a verbatim PostScript
   395   ///block to the nodes.
   396   ///block to the nodes.
   396   ///The PS current point will be moved to the centre of the node before
   397   ///The PS current point will be moved to the center of the node before
   397   ///the PostScript block inserted.
   398   ///the PostScript block inserted.
   398   ///
   399   ///
   399   ///Before and after the block a newline character is inserted so you
   400   ///Before and after the block a newline character is inserted so you
   400   ///don't have to bother with the separators.
   401   ///don't have to bother with the separators.
   401   ///
   402   ///
   402   ///\param x must be a node map with type that can be pushed to a standard
   403   ///\param x must be a node map with type that can be pushed to a standard
   403   ///ostream.
   404   ///\c ostream.
   404   ///
   405   ///
   405   ///\sa nodePsTextsPreamble()
   406   ///\sa nodePsTextsPreamble()
   406   template<class X> GraphToEps<NodePsTextsTraits<X> > nodePsTexts(const X &x)
   407   template<class X> GraphToEps<NodePsTextsTraits<X> > nodePsTexts(const X &x)
   407   {
   408   {
   408     dontPrint=true;
   409     dontPrint=true;
   413     const X &_arcWidths;
   414     const X &_arcWidths;
   414     ArcWidthsTraits(const T &t,const X &x) : T(t), _arcWidths(x) {}
   415     ArcWidthsTraits(const T &t,const X &x) : T(t), _arcWidths(x) {}
   415   };
   416   };
   416   ///Sets the map of the arc widths
   417   ///Sets the map of the arc widths
   417 
   418 
   418   ///Sets the map of the arc widths
   419   ///Sets the map of the arc widths.
   419   ///\param x must be an arc map with \c double (or convertible) values. 
   420   ///\param x must be an arc map with \c double (or convertible) values. 
   420   template<class X> GraphToEps<ArcWidthsTraits<X> > arcWidths(const X &x)
   421   template<class X> GraphToEps<ArcWidthsTraits<X> > arcWidths(const X &x)
   421   {
   422   {
   422     dontPrint=true;
   423     dontPrint=true;
   423     return GraphToEps<ArcWidthsTraits<X> >(ArcWidthsTraits<X>(*this,x));
   424     return GraphToEps<ArcWidthsTraits<X> >(ArcWidthsTraits<X>(*this,x));
   427     const X &_nodeColors;
   428     const X &_nodeColors;
   428     NodeColorsTraits(const T &t,const X &x) : T(t), _nodeColors(x) {}
   429     NodeColorsTraits(const T &t,const X &x) : T(t), _nodeColors(x) {}
   429   };
   430   };
   430   ///Sets the map of the node colors
   431   ///Sets the map of the node colors
   431 
   432 
   432   ///Sets the map of the node colors
   433   ///Sets the map of the node colors.
   433   ///\param x must be a node map with \ref Color values.
   434   ///\param x must be a node map with \ref Color values.
   434   ///
   435   ///
   435   ///\sa Palette
   436   ///\sa Palette
   436   template<class X> GraphToEps<NodeColorsTraits<X> >
   437   template<class X> GraphToEps<NodeColorsTraits<X> >
   437   nodeColors(const X &x)
   438   nodeColors(const X &x)
   443     const X &_nodeTextColors;
   444     const X &_nodeTextColors;
   444     NodeTextColorsTraits(const T &t,const X &x) : T(t), _nodeTextColors(x) {}
   445     NodeTextColorsTraits(const T &t,const X &x) : T(t), _nodeTextColors(x) {}
   445   };
   446   };
   446   ///Sets the map of the node text colors
   447   ///Sets the map of the node text colors
   447 
   448 
   448   ///Sets the map of the node text colors
   449   ///Sets the map of the node text colors.
   449   ///\param x must be a node map with \ref Color values. 
   450   ///\param x must be a node map with \ref Color values. 
   450   ///
   451   ///
   451   ///\sa Palette
   452   ///\sa Palette
   452   template<class X> GraphToEps<NodeTextColorsTraits<X> >
   453   template<class X> GraphToEps<NodeTextColorsTraits<X> >
   453   nodeTextColors(const X &x)
   454   nodeTextColors(const X &x)
   461     const X &_arcColors;
   462     const X &_arcColors;
   462     ArcColorsTraits(const T &t,const X &x) : T(t), _arcColors(x) {}
   463     ArcColorsTraits(const T &t,const X &x) : T(t), _arcColors(x) {}
   463   };
   464   };
   464   ///Sets the map of the arc colors
   465   ///Sets the map of the arc colors
   465 
   466 
   466   ///Sets the map of the arc colors
   467   ///Sets the map of the arc colors.
   467   ///\param x must be an arc map with \ref Color values. 
   468   ///\param x must be an arc map with \ref Color values. 
   468   ///
   469   ///
   469   ///\sa Palette
   470   ///\sa Palette
   470   template<class X> GraphToEps<ArcColorsTraits<X> >
   471   template<class X> GraphToEps<ArcColorsTraits<X> >
   471   arcColors(const X &x)
   472   arcColors(const X &x)
   485   /// node sizes will be scaled in such a way that the greatest size will be
   486   /// node sizes will be scaled in such a way that the greatest size will be
   486   /// equal to \c d.
   487   /// equal to \c d.
   487   /// \sa nodeSizes()
   488   /// \sa nodeSizes()
   488   /// \sa autoNodeScale()
   489   /// \sa autoNodeScale()
   489   GraphToEps<T> &nodeScale(double d=.01) {_nodeScale=d;return *this;}
   490   GraphToEps<T> &nodeScale(double d=.01) {_nodeScale=d;return *this;}
   490   ///Turns on/off the automatic node width scaling.
   491   ///Turns on/off the automatic node size scaling.
   491 
   492 
   492   ///Turns on/off the automatic node width scaling.
   493   ///Turns on/off the automatic node size scaling.
   493   ///
   494   ///
   494   ///\sa nodeScale()
   495   ///\sa nodeScale()
   495   ///
   496   ///
   496   GraphToEps<T> &autoNodeScale(bool b=true) {
   497   GraphToEps<T> &autoNodeScale(bool b=true) {
   497     _autoNodeScale=b;return *this;
   498     _autoNodeScale=b;return *this;
   498   }
   499   }
   499 
   500 
   500   ///Turns on/off the absolutematic node width scaling.
   501   ///Turns on/off the absolutematic node size scaling.
   501 
   502 
   502   ///Turns on/off the absolutematic node width scaling.
   503   ///Turns on/off the absolutematic node size scaling.
   503   ///
   504   ///
   504   ///\sa nodeScale()
   505   ///\sa nodeScale()
   505   ///
   506   ///
   506   GraphToEps<T> &absoluteNodeSizes(bool b=true) {
   507   GraphToEps<T> &absoluteNodeSizes(bool b=true) {
   507     _absoluteNodeSizes=b;return *this;
   508     _absoluteNodeSizes=b;return *this;
   508   }
   509   }
   509 
   510 
   510   ///Negates the Y coordinates.
   511   ///Negates the Y coordinates.
   511 
       
   512   ///Negates the Y coordinates.
       
   513   ///
       
   514   GraphToEps<T> &negateY(bool b=true) {
   512   GraphToEps<T> &negateY(bool b=true) {
   515     _negY=b;return *this;
   513     _negY=b;return *this;
   516   }
   514   }
   517 
   515 
   518   ///Turn on/off pre-scaling
   516   ///Turn on/off pre-scaling
   555   ///
   553   ///
   556   GraphToEps<T> &absoluteArcWidths(bool b=true) {
   554   GraphToEps<T> &absoluteArcWidths(bool b=true) {
   557     _absoluteArcWidths=b;return *this;
   555     _absoluteArcWidths=b;return *this;
   558   }
   556   }
   559   ///Sets a global scale factor for the whole picture
   557   ///Sets a global scale factor for the whole picture
   560 
       
   561   ///Sets a global scale factor for the whole picture
       
   562   ///
       
   563 
       
   564   GraphToEps<T> &scale(double d) {_scale=d;return *this;}
   558   GraphToEps<T> &scale(double d) {_scale=d;return *this;}
   565   ///Sets the width of the border around the picture
   559   ///Sets the width of the border around the picture
   566 
       
   567   ///Sets the width of the border around the picture
       
   568   ///
       
   569   GraphToEps<T> &border(double b=10) {_xBorder=_yBorder=b;return *this;}
   560   GraphToEps<T> &border(double b=10) {_xBorder=_yBorder=b;return *this;}
   570   ///Sets the width of the border around the picture
   561   ///Sets the width of the border around the picture
   571 
       
   572   ///Sets the width of the border around the picture
       
   573   ///
       
   574   GraphToEps<T> &border(double x, double y) {
   562   GraphToEps<T> &border(double x, double y) {
   575     _xBorder=x;_yBorder=y;return *this;
   563     _xBorder=x;_yBorder=y;return *this;
   576   }
   564   }
   577   ///Sets whether to draw arrows
   565   ///Sets whether to draw arrows
   578 
       
   579   ///Sets whether to draw arrows
       
   580   ///
       
   581   GraphToEps<T> &drawArrows(bool b=true) {_drawArrows=b;return *this;}
   566   GraphToEps<T> &drawArrows(bool b=true) {_drawArrows=b;return *this;}
   582   ///Sets the length of the arrowheads
   567   ///Sets the length of the arrowheads
   583 
       
   584   ///Sets the length of the arrowheads
       
   585   ///
       
   586   GraphToEps<T> &arrowLength(double d=1.0) {_arrowLength*=d;return *this;}
   568   GraphToEps<T> &arrowLength(double d=1.0) {_arrowLength*=d;return *this;}
   587   ///Sets the width of the arrowheads
   569   ///Sets the width of the arrowheads
   588 
       
   589   ///Sets the width of the arrowheads
       
   590   ///
       
   591   GraphToEps<T> &arrowWidth(double d=.3) {_arrowWidth*=d;return *this;}
   570   GraphToEps<T> &arrowWidth(double d=.3) {_arrowWidth*=d;return *this;}
   592   
   571   
   593   ///Scales the drawing to fit to A4 page
   572   ///Scales the drawing to fit to A4 page
   594 
       
   595   ///Scales the drawing to fit to A4 page
       
   596   ///
       
   597   GraphToEps<T> &scaleToA4() {_scaleToA4=true;return *this;}
   573   GraphToEps<T> &scaleToA4() {_scaleToA4=true;return *this;}
   598   
   574   
   599   ///Enables parallel arcs
       
   600 
       
   601   ///Enables parallel arcs
   575   ///Enables parallel arcs
   602   GraphToEps<T> &enableParallel(bool b=true) {_enableParallel=b;return *this;}
   576   GraphToEps<T> &enableParallel(bool b=true) {_enableParallel=b;return *this;}
   603   
   577   
   604   ///Sets the distance 
   578   ///Sets the distance between parallel arcs
   605   
       
   606   ///Sets the distance 
       
   607   ///
       
   608   GraphToEps<T> &parArcDist(double d) {_parArcDist*=d;return *this;}
   579   GraphToEps<T> &parArcDist(double d) {_parArcDist*=d;return *this;}
   609   
   580   
   610   ///Hides the arcs
   581   ///Hides the arcs
   611   
       
   612   ///Hides the arcs
       
   613   ///
       
   614   GraphToEps<T> &hideArcs(bool b=true) {_showArcs=!b;return *this;}
   582   GraphToEps<T> &hideArcs(bool b=true) {_showArcs=!b;return *this;}
   615   ///Hides the nodes
   583   ///Hides the nodes
   616   
       
   617   ///Hides the nodes
       
   618   ///
       
   619   GraphToEps<T> &hideNodes(bool b=true) {_showNodes=!b;return *this;}
   584   GraphToEps<T> &hideNodes(bool b=true) {_showNodes=!b;return *this;}
   620   
   585   
   621   ///Sets the size of the node texts
   586   ///Sets the size of the node texts
   622   
       
   623   ///Sets the size of the node texts
       
   624   ///
       
   625   GraphToEps<T> &nodeTextSize(double d) {_nodeTextSize=d;return *this;}
   587   GraphToEps<T> &nodeTextSize(double d) {_nodeTextSize=d;return *this;}
   626 
   588 
   627   ///Sets the color of the node texts to be different from the node color
   589   ///Sets the color of the node texts to be different from the node color
   628 
   590 
   629   ///Sets the color of the node texts to be as different from the node color
   591   ///Sets the color of the node texts to be as different from the node color
   630   ///as it is possible
   592   ///as it is possible.
   631   ///
       
   632   GraphToEps<T> &distantColorNodeTexts()
   593   GraphToEps<T> &distantColorNodeTexts()
   633   {_nodeTextColorType=DIST_COL;return *this;}
   594   {_nodeTextColorType=DIST_COL;return *this;}
   634   ///Sets the color of the node texts to be black or white and always visible.
   595   ///Sets the color of the node texts to be black or white and always visible.
   635 
   596 
   636   ///Sets the color of the node texts to be black or white according to
   597   ///Sets the color of the node texts to be black or white according to
   637   ///which is more 
   598   ///which is more different from the node color.
   638   ///different from the node color
       
   639   ///
       
   640   GraphToEps<T> &distantBWNodeTexts()
   599   GraphToEps<T> &distantBWNodeTexts()
   641   {_nodeTextColorType=DIST_BW;return *this;}
   600   {_nodeTextColorType=DIST_BW;return *this;}
   642 
   601 
   643   ///Gives a preamble block for node Postscript block.
   602   ///Gives a preamble block for node Postscript block.
   644   
   603   
   646   ///
   605   ///
   647   ///\sa nodePsTexts()
   606   ///\sa nodePsTexts()
   648   GraphToEps<T> & nodePsTextsPreamble(const char *str) {
   607   GraphToEps<T> & nodePsTextsPreamble(const char *str) {
   649     _nodePsTextsPreamble=str ;return *this;
   608     _nodePsTextsPreamble=str ;return *this;
   650   }
   609   }
   651   ///Sets whether the the graph is undirected
   610   ///Sets whether the graph is undirected
   652 
   611 
   653   ///Sets whether the the graph is undirected.
   612   ///Sets whether the graph is undirected.
   654   ///
   613   ///
   655   ///This setting is the default for undirected graphs.
   614   ///This setting is the default for undirected graphs.
   656   ///
   615   ///
   657   ///\sa directed()
   616   ///\sa directed()
   658    GraphToEps<T> &undirected(bool b=true) {_undirected=b;return *this;}
   617    GraphToEps<T> &undirected(bool b=true) {_undirected=b;return *this;}
   659 
   618 
   660   ///Sets whether the the graph is directed
   619   ///Sets whether the graph is directed
   661 
   620 
   662   ///Sets whether the the graph is directed.
   621   ///Sets whether the graph is directed.
   663   ///Use it to show the edges as a pair of directed ones.
   622   ///Use it to show the edges as a pair of directed ones.
   664   ///
   623   ///
   665   ///This setting is the default for digraphs.
   624   ///This setting is the default for digraphs.
   666   ///
   625   ///
   667   ///\sa undirected()
   626   ///\sa undirected()
   714       mycoords(_coords,_negY);
   673       mycoords(_coords,_negY);
   715 
   674 
   716     os << "%!PS-Adobe-2.0 EPSF-2.0\n";
   675     os << "%!PS-Adobe-2.0 EPSF-2.0\n";
   717     if(_title.size()>0) os << "%%Title: " << _title << '\n';
   676     if(_title.size()>0) os << "%%Title: " << _title << '\n';
   718      if(_copyright.size()>0) os << "%%Copyright: " << _copyright << '\n';
   677      if(_copyright.size()>0) os << "%%Copyright: " << _copyright << '\n';
   719 //        << "%%Copyright: XXXX\n"
       
   720     os << "%%Creator: LEMON, graphToEps()\n";
   678     os << "%%Creator: LEMON, graphToEps()\n";
   721 
   679 
   722     {    
   680     {    
   723 #ifndef WIN32 
   681 #ifndef WIN32 
   724       timeval tv;
   682       timeval tv;
   746 
   704 
   747     if (_autoArcWidthScale) {
   705     if (_autoArcWidthScale) {
   748       double max_w=0;
   706       double max_w=0;
   749       for(ArcIt e(g);e!=INVALID;++e)
   707       for(ArcIt e(g);e!=INVALID;++e)
   750 	max_w=std::max(double(_arcWidths[e]),max_w);
   708 	max_w=std::max(double(_arcWidths[e]),max_w);
   751       ///\todo better 'epsilon' would be nice here.
   709       //\todo better 'epsilon' would be nice here.
   752       if(max_w>EPSILON) {
   710       if(max_w>EPSILON) {
   753 	_arcWidthScale/=max_w;
   711 	_arcWidthScale/=max_w;
   754       }
   712       }
   755     }
   713     }
   756 
   714 
   757     if (_autoNodeScale) {
   715     if (_autoNodeScale) {
   758       double max_s=0;
   716       double max_s=0;
   759       for(NodeIt n(g);n!=INVALID;++n)
   717       for(NodeIt n(g);n!=INVALID;++n)
   760 	max_s=std::max(double(_nodeSizes[n]),max_s);
   718 	max_s=std::max(double(_nodeSizes[n]),max_s);
   761       ///\todo better 'epsilon' would be nice here.
   719       //\todo better 'epsilon' would be nice here.
   762       if(max_s>EPSILON) {
   720       if(max_s>EPSILON) {
   763 	_nodeScale/=max_s;
   721 	_nodeScale/=max_s;
   764       }
   722       }
   765     }
   723     }
   766 
   724 
  1112   ///These are just some aliases to other parameter setting functions.
  1070   ///These are just some aliases to other parameter setting functions.
  1113 
  1071 
  1114   ///@{
  1072   ///@{
  1115 
  1073 
  1116   ///An alias for arcWidths()
  1074   ///An alias for arcWidths()
  1117 
       
  1118   ///An alias for arcWidths()
       
  1119   ///
       
  1120   template<class X> GraphToEps<ArcWidthsTraits<X> > edgeWidths(const X &x)
  1075   template<class X> GraphToEps<ArcWidthsTraits<X> > edgeWidths(const X &x)
  1121   {
  1076   {
  1122     return arcWidths(x);
  1077     return arcWidths(x);
  1123   }
  1078   }
  1124 
  1079 
  1125   ///An alias for arcColors()
  1080   ///An alias for arcColors()
  1126 
       
  1127   ///An alias for arcColors()
       
  1128   ///
       
  1129   template<class X> GraphToEps<ArcColorsTraits<X> >
  1081   template<class X> GraphToEps<ArcColorsTraits<X> >
  1130   edgeColors(const X &x)
  1082   edgeColors(const X &x)
  1131   {
  1083   {
  1132     return arcColors(x);
  1084     return arcColors(x);
  1133   }
  1085   }
  1134 
  1086 
  1135   ///An alias for arcWidthScale()
  1087   ///An alias for arcWidthScale()
  1136 
       
  1137   ///An alias for arcWidthScale()
       
  1138   ///
       
  1139   GraphToEps<T> &edgeWidthScale(double d) {return arcWidthScale(d);}
  1088   GraphToEps<T> &edgeWidthScale(double d) {return arcWidthScale(d);}
  1140 
  1089 
  1141   ///An alias for autoArcWidthScale()
  1090   ///An alias for autoArcWidthScale()
  1142 
       
  1143   ///An alias for autoArcWidthScale()
       
  1144   ///
       
  1145   GraphToEps<T> &autoEdgeWidthScale(bool b=true)
  1091   GraphToEps<T> &autoEdgeWidthScale(bool b=true)
  1146   {
  1092   {
  1147     return autoArcWidthScale(b);
  1093     return autoArcWidthScale(b);
  1148   }
  1094   }
  1149   
  1095   
  1150   ///An alias for absoluteArcWidths()
  1096   ///An alias for absoluteArcWidths()
  1151 
       
  1152   ///An alias for absoluteArcWidths()
       
  1153   ///
       
  1154   GraphToEps<T> &absoluteEdgeWidths(bool b=true)
  1097   GraphToEps<T> &absoluteEdgeWidths(bool b=true)
  1155   {
  1098   {
  1156     return absoluteArcWidths(b);
  1099     return absoluteArcWidths(b);
  1157   }
  1100   }
  1158   
  1101   
  1159   ///An alias for parArcDist()
  1102   ///An alias for parArcDist()
  1160 
       
  1161   ///An alias for parArcDist()
       
  1162   ///
       
  1163   GraphToEps<T> &parEdgeDist(double d) {return parArcDist(d);}
  1103   GraphToEps<T> &parEdgeDist(double d) {return parArcDist(d);}
  1164   
  1104   
  1165   ///An alias for hideArcs()
  1105   ///An alias for hideArcs()
  1166   
       
  1167   ///An alias for hideArcs()
       
  1168   ///
       
  1169   GraphToEps<T> &hideEdges(bool b=true) {return hideArcs(b);}
  1106   GraphToEps<T> &hideEdges(bool b=true) {return hideArcs(b);}
  1170 
  1107 
  1171   ///@}
  1108   ///@}
  1172 };
  1109 };
  1173 
  1110 
  1183 
  1120 
  1184 ///Generates an EPS file from a graph
  1121 ///Generates an EPS file from a graph
  1185 
  1122 
  1186 ///\ingroup eps_io
  1123 ///\ingroup eps_io
  1187 ///Generates an EPS file from a graph.
  1124 ///Generates an EPS file from a graph.
  1188 ///\param g is a reference to the graph to be printed
  1125 ///\param g Reference to the graph to be printed.
  1189 ///\param os is a reference to the output stream.
  1126 ///\param os Reference to the output stream.
  1190 ///By default it is <tt>std::cout</tt>
  1127 ///By default it is <tt>std::cout</tt>.
  1191 ///
  1128 ///
  1192 ///This function also has a lot of
  1129 ///This function also has a lot of
  1193 ///\ref named-templ-func-param "named parameters",
  1130 ///\ref named-templ-func-param "named parameters",
  1194 ///they are declared as the members of class \ref GraphToEps. The following
  1131 ///they are declared as the members of class \ref GraphToEps. The following
  1195 ///example shows how to use these parameters.
  1132 ///example shows how to use these parameters.
  1196 ///\code
  1133 ///\code
  1197 /// graphToEps(g,os).scale(10).coords(coords)
  1134 /// graphToEps(g,os).scale(10).coords(coords)
  1198 ///              .nodeScale(2).nodeSizes(sizes)
  1135 ///              .nodeScale(2).nodeSizes(sizes)
  1199 ///              .arcWidthScale(.4).run();
  1136 ///              .arcWidthScale(.4).run();
  1200 ///\endcode
  1137 ///\endcode
       
  1138 ///
       
  1139 ///For more detailed examples see the \ref graph_to_eps_demo.cc demo file.
       
  1140 ///
  1201 ///\warning Don't forget to put the \ref GraphToEps::run() "run()"
  1141 ///\warning Don't forget to put the \ref GraphToEps::run() "run()"
  1202 ///to the end of the parameter list.
  1142 ///to the end of the parameter list.
  1203 ///\sa GraphToEps
  1143 ///\sa GraphToEps
  1204 ///\sa graphToEps(G &g, const char *file_name)
  1144 ///\sa graphToEps(G &g, const char *file_name)
  1205 template<class G>
  1145 template<class G>