diff --git a/lemon/graph_to_eps.h b/lemon/graph_to_eps.h --- a/lemon/graph_to_eps.h +++ b/lemon/graph_to_eps.h @@ -2,7 +2,7 @@ * * This file is a part of LEMON, a generic C++ optimization library. * - * Copyright (C) 2003-2008 + * Copyright (C) 2003-2009 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport * (Egervary Research Group on Combinatorial Optimization, EGRES). * @@ -64,11 +64,12 @@ ///Default traits class of \ref GraphToEps. /// -///\c G is the type of the underlying graph. -template +///\param GR is the type of the underlying graph. +template struct DefaultGraphToEpsTraits { - typedef G Graph; + typedef GR Graph; + typedef GR Digraph; typedef typename Graph::Node Node; typedef typename Graph::NodeIt NodeIt; typedef typename Graph::Arc Arc; @@ -139,15 +140,14 @@ ///Constructor ///Constructor - ///\param _g Reference to the graph to be printed. - ///\param _os Reference to the output stream. - ///\param _os Reference to the output stream. + ///\param gr Reference to the graph to be printed. + ///\param ost Reference to the output stream. ///By default it is std::cout. - ///\param _pros If it is \c true, then the \c ostream referenced by \c _os + ///\param pros If it is \c true, then the \c ostream referenced by \c os ///will be explicitly deallocated by the destructor. - DefaultGraphToEpsTraits(const G &_g,std::ostream& _os=std::cout, - bool _pros=false) : - g(_g), os(_os), + DefaultGraphToEpsTraits(const GR &gr, std::ostream& ost = std::cout, + bool pros = false) : + g(gr), os(ost), _coords(dim2::Point(1,1)), _nodeSizes(1), _nodeShapes(0), _nodeColors(WHITE), _arcColors(BLACK), _arcWidths(1.0), _arcWidthScale(0.003), @@ -158,8 +158,8 @@ _enableParallel(false), _parArcDist(1), _showNodeText(false), _nodeTexts(false), _nodeTextSize(1), _showNodePsText(false), _nodePsTexts(false), _nodePsTextsPreamble(0), - _undirected(lemon::UndirectedTagIndicator::value), - _pleaseRemoveOsStream(_pros), _scaleToA4(false), + _undirected(lemon::UndirectedTagIndicator::value), + _pleaseRemoveOsStream(pros), _scaleToA4(false), _nodeTextColorType(SAME_COL), _nodeTextColors(BLACK), _autoNodeScale(false), _autoArcWidthScale(false), @@ -242,6 +242,7 @@ // dradnats ++C eht yb deriuqer si ti eveileb t'naC typedef typename T::Graph Graph; + typedef typename T::Digraph Digraph; typedef typename Graph::Node Node; typedef typename Graph::NodeIt NodeIt; typedef typename Graph::Arc Arc; @@ -269,22 +270,18 @@ /// = 1 ///\image html nodeshape_1.png ///\image latex nodeshape_1.eps "SQUARE shape (1)" width=2cm - /// SQUARE=1, /// = 2 ///\image html nodeshape_2.png ///\image latex nodeshape_2.eps "DIAMOND shape (2)" width=2cm - /// DIAMOND=2, /// = 3 ///\image html nodeshape_3.png - ///\image latex nodeshape_2.eps "MALE shape (4)" width=2cm - /// + ///\image latex nodeshape_3.eps "MALE shape (3)" width=2cm MALE=3, /// = 4 ///\image html nodeshape_4.png - ///\image latex nodeshape_2.eps "FEMALE shape (4)" width=2cm - /// + ///\image latex nodeshape_4.eps "FEMALE shape (4)" width=2cm FEMALE=4 }; @@ -1134,55 +1131,55 @@ ///\warning Don't forget to put the \ref GraphToEps::run() "run()" ///to the end of the parameter list. ///\sa GraphToEps -///\sa graphToEps(G &g, const char *file_name) -template -GraphToEps > -graphToEps(G &g, std::ostream& os=std::cout) +///\sa graphToEps(GR &g, const char *file_name) +template +GraphToEps > +graphToEps(GR &g, std::ostream& os=std::cout) { return - GraphToEps >(DefaultGraphToEpsTraits(g,os)); + GraphToEps >(DefaultGraphToEpsTraits(g,os)); } ///Generates an EPS file from a graph ///\ingroup eps_io ///This function does the same as -///\ref graphToEps(G &g,std::ostream& os) +///\ref graphToEps(GR &g,std::ostream& os) ///but it writes its output into the file \c file_name ///instead of a stream. -///\sa graphToEps(G &g, std::ostream& os) -template -GraphToEps > -graphToEps(G &g,const char *file_name) +///\sa graphToEps(GR &g, std::ostream& os) +template +GraphToEps > +graphToEps(GR &g,const char *file_name) { std::ostream* os = new std::ofstream(file_name); if (!(*os)) { delete os; throw IoError("Cannot write file", file_name); } - return GraphToEps > - (DefaultGraphToEpsTraits(g,*os,true)); + return GraphToEps > + (DefaultGraphToEpsTraits(g,*os,true)); } ///Generates an EPS file from a graph ///\ingroup eps_io ///This function does the same as -///\ref graphToEps(G &g,std::ostream& os) +///\ref graphToEps(GR &g,std::ostream& os) ///but it writes its output into the file \c file_name ///instead of a stream. -///\sa graphToEps(G &g, std::ostream& os) -template -GraphToEps > -graphToEps(G &g,const std::string& file_name) +///\sa graphToEps(GR &g, std::ostream& os) +template +GraphToEps > +graphToEps(GR &g,const std::string& file_name) { std::ostream* os = new std::ofstream(file_name.c_str()); if (!(*os)) { delete os; throw IoError("Cannot write file", file_name); } - return GraphToEps > - (DefaultGraphToEpsTraits(g,*os,true)); + return GraphToEps > + (DefaultGraphToEpsTraits(g,*os,true)); } } //END OF NAMESPACE LEMON