419 } |
419 } |
420 return false; |
420 return false; |
421 } |
421 } |
422 |
422 |
423 public: |
423 public: |
424 ~GraphToEps() |
424 ~GraphToEps() { } |
425 { |
425 |
|
426 ///Draws the graph. |
|
427 |
|
428 ///Like other functions using |
|
429 ///\ref named-templ-func-param "named template parameters", |
|
430 ///this function calles the algorithm itself, i.e. in this case |
|
431 ///it draws the graph. |
|
432 void run() { |
426 if(dontPrint) return; |
433 if(dontPrint) return; |
427 |
434 |
428 os << "%!PS-Adobe-2.0 EPSF-2.0\n"; |
435 os << "%!PS-Adobe-2.0 EPSF-2.0\n"; |
429 //\todo: Chech whether the graph is empty. |
436 //\todo: Chech whether the graph is empty. |
430 BoundingBox<double> bb; |
437 BoundingBox<double> bb; |
665 ///Generates an EPS file from a graph. |
672 ///Generates an EPS file from a graph. |
666 ///\param g is a reference to the graph to be printed |
673 ///\param g is a reference to the graph to be printed |
667 ///\param os is a reference to the output stream. |
674 ///\param os is a reference to the output stream. |
668 ///By default it is <tt>std::cout</tt> |
675 ///By default it is <tt>std::cout</tt> |
669 /// |
676 /// |
670 ///This function also has a lot of \ref named-templ-param "named parameters", |
677 ///This function also has a lot of |
|
678 ///\ref named-templ-func-param "named parameters", |
671 ///they are declared as the members of class \ref GraphToEps. The following |
679 ///they are declared as the members of class \ref GraphToEps. The following |
672 ///example shows how to use these parameters. |
680 ///example shows how to use these parameters. |
673 ///\code |
681 ///\code |
674 /// graphToEps(g).scale(10).coords(coords) |
682 /// graphToEps(g).scale(10).coords(coords) |
675 /// .nodeScale(2).nodeSizes(sizes) |
683 /// .nodeScale(2).nodeSizes(sizes) |
676 /// .edgeWidthScale(.4); |
684 /// .edgeWidthScale(.4).run(); |
677 ///\endcode |
685 ///\endcode |
|
686 ///\warning Don't forget to put the \ref GraphToEps::run() "run()" |
|
687 ///to the end of the parameter list. |
678 ///\sa GraphToEps |
688 ///\sa GraphToEps |
679 ///\sa graphToEps(G &g, char *file_name) |
689 ///\sa graphToEps(G &g, char *file_name) |
680 template<class G> |
690 template<class G> |
681 GraphToEps<DefaultGraphToEpsTraits<G> > |
691 GraphToEps<DefaultGraphToEpsTraits<G> > |
682 graphToEps(G &g, std::ostream& os=std::cout) |
692 graphToEps(G &g, std::ostream& os=std::cout) |