diff -r c35afa9e89e7 -r ef88c0a30f85 lemon/graph_to_eps.h --- a/lemon/graph_to_eps.h Mon Jan 12 23:11:39 2009 +0100 +++ b/lemon/graph_to_eps.h Thu Nov 05 15:48:01 2009 +0100 @@ -29,9 +29,7 @@ #include #include #else -#define WIN32_LEAN_AND_MEAN -#define NOMINMAX -#include +#include #endif #include @@ -66,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; @@ -141,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), @@ -160,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), @@ -244,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; @@ -271,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 }; @@ -679,29 +674,19 @@ os << "%%Creator: LEMON, graphToEps()\n"; { + os << "%%CreationDate: "; #ifndef WIN32 timeval tv; gettimeofday(&tv, 0); char cbuf[26]; ctime_r(&tv.tv_sec,cbuf); - os << "%%CreationDate: " << cbuf; + os << cbuf; #else - SYSTEMTIME time; - char buf1[11], buf2[9], buf3[5]; - - GetSystemTime(&time); - if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &time, - "ddd MMM dd", buf1, 11) && - GetTimeFormat(LOCALE_USER_DEFAULT, 0, &time, - "HH':'mm':'ss", buf2, 9) && - GetDateFormat(LOCALE_USER_DEFAULT, 0, &time, - "yyyy", buf3, 5)) { - os << "%%CreationDate: " << buf1 << ' ' - << buf2 << ' ' << buf3 << std::endl; - } + os << bits::getWinFormattedDate(); #endif } + os << std::endl; if (_autoArcWidthScale) { double max_w=0; @@ -1146,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