lemon/graph_to_eps.h
changeset 802 994c7df296c9
parent 584 33c6b6e755cd
child 786 e20173729589
child 959 17e36e175725
     1.1 --- a/lemon/graph_to_eps.h	Fri Nov 13 12:33:33 2009 +0100
     1.2 +++ b/lemon/graph_to_eps.h	Thu Dec 10 17:05:35 2009 +0100
     1.3 @@ -2,7 +2,7 @@
     1.4   *
     1.5   * This file is a part of LEMON, a generic C++ optimization library.
     1.6   *
     1.7 - * Copyright (C) 2003-2008
     1.8 + * Copyright (C) 2003-2009
     1.9   * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    1.10   * (Egervary Research Group on Combinatorial Optimization, EGRES).
    1.11   *
    1.12 @@ -64,11 +64,12 @@
    1.13  
    1.14  ///Default traits class of \ref GraphToEps.
    1.15  ///
    1.16 -///\c G is the type of the underlying graph.
    1.17 -template<class G>
    1.18 +///\param GR is the type of the underlying graph.
    1.19 +template<class GR>
    1.20  struct DefaultGraphToEpsTraits
    1.21  {
    1.22 -  typedef G Graph;
    1.23 +  typedef GR Graph;
    1.24 +  typedef GR Digraph;
    1.25    typedef typename Graph::Node Node;
    1.26    typedef typename Graph::NodeIt NodeIt;
    1.27    typedef typename Graph::Arc Arc;
    1.28 @@ -139,15 +140,14 @@
    1.29    ///Constructor
    1.30  
    1.31    ///Constructor
    1.32 -  ///\param _g  Reference to the graph to be printed.
    1.33 -  ///\param _os Reference to the output stream.
    1.34 -  ///\param _os Reference to the output stream.
    1.35 +  ///\param gr  Reference to the graph to be printed.
    1.36 +  ///\param ost Reference to the output stream.
    1.37    ///By default it is <tt>std::cout</tt>.
    1.38 -  ///\param _pros If it is \c true, then the \c ostream referenced by \c _os
    1.39 +  ///\param pros If it is \c true, then the \c ostream referenced by \c os
    1.40    ///will be explicitly deallocated by the destructor.
    1.41 -  DefaultGraphToEpsTraits(const G &_g,std::ostream& _os=std::cout,
    1.42 -                          bool _pros=false) :
    1.43 -    g(_g), os(_os),
    1.44 +  DefaultGraphToEpsTraits(const GR &gr, std::ostream& ost = std::cout,
    1.45 +                          bool pros = false) :
    1.46 +    g(gr), os(ost),
    1.47      _coords(dim2::Point<double>(1,1)), _nodeSizes(1), _nodeShapes(0),
    1.48      _nodeColors(WHITE), _arcColors(BLACK),
    1.49      _arcWidths(1.0), _arcWidthScale(0.003),
    1.50 @@ -158,8 +158,8 @@
    1.51      _enableParallel(false), _parArcDist(1),
    1.52      _showNodeText(false), _nodeTexts(false), _nodeTextSize(1),
    1.53      _showNodePsText(false), _nodePsTexts(false), _nodePsTextsPreamble(0),
    1.54 -    _undirected(lemon::UndirectedTagIndicator<G>::value),
    1.55 -    _pleaseRemoveOsStream(_pros), _scaleToA4(false),
    1.56 +    _undirected(lemon::UndirectedTagIndicator<GR>::value),
    1.57 +    _pleaseRemoveOsStream(pros), _scaleToA4(false),
    1.58      _nodeTextColorType(SAME_COL), _nodeTextColors(BLACK),
    1.59      _autoNodeScale(false),
    1.60      _autoArcWidthScale(false),
    1.61 @@ -242,6 +242,7 @@
    1.62    // dradnats ++C eht yb deriuqer si ti eveileb t'naC
    1.63  
    1.64    typedef typename T::Graph Graph;
    1.65 +  typedef typename T::Digraph Digraph;
    1.66    typedef typename Graph::Node Node;
    1.67    typedef typename Graph::NodeIt NodeIt;
    1.68    typedef typename Graph::Arc Arc;
    1.69 @@ -269,22 +270,18 @@
    1.70      /// = 1
    1.71      ///\image html nodeshape_1.png
    1.72      ///\image latex nodeshape_1.eps "SQUARE shape (1)" width=2cm
    1.73 -    ///
    1.74      SQUARE=1,
    1.75      /// = 2
    1.76      ///\image html nodeshape_2.png
    1.77      ///\image latex nodeshape_2.eps "DIAMOND shape (2)" width=2cm
    1.78 -    ///
    1.79      DIAMOND=2,
    1.80      /// = 3
    1.81      ///\image html nodeshape_3.png
    1.82 -    ///\image latex nodeshape_2.eps "MALE shape (4)" width=2cm
    1.83 -    ///
    1.84 +    ///\image latex nodeshape_3.eps "MALE shape (3)" width=2cm
    1.85      MALE=3,
    1.86      /// = 4
    1.87      ///\image html nodeshape_4.png
    1.88 -    ///\image latex nodeshape_2.eps "FEMALE shape (4)" width=2cm
    1.89 -    ///
    1.90 +    ///\image latex nodeshape_4.eps "FEMALE shape (4)" width=2cm
    1.91      FEMALE=4
    1.92    };
    1.93  
    1.94 @@ -1134,55 +1131,55 @@
    1.95  ///\warning Don't forget to put the \ref GraphToEps::run() "run()"
    1.96  ///to the end of the parameter list.
    1.97  ///\sa GraphToEps
    1.98 -///\sa graphToEps(G &g, const char *file_name)
    1.99 -template<class G>
   1.100 -GraphToEps<DefaultGraphToEpsTraits<G> >
   1.101 -graphToEps(G &g, std::ostream& os=std::cout)
   1.102 +///\sa graphToEps(GR &g, const char *file_name)
   1.103 +template<class GR>
   1.104 +GraphToEps<DefaultGraphToEpsTraits<GR> >
   1.105 +graphToEps(GR &g, std::ostream& os=std::cout)
   1.106  {
   1.107    return
   1.108 -    GraphToEps<DefaultGraphToEpsTraits<G> >(DefaultGraphToEpsTraits<G>(g,os));
   1.109 +    GraphToEps<DefaultGraphToEpsTraits<GR> >(DefaultGraphToEpsTraits<GR>(g,os));
   1.110  }
   1.111  
   1.112  ///Generates an EPS file from a graph
   1.113  
   1.114  ///\ingroup eps_io
   1.115  ///This function does the same as
   1.116 -///\ref graphToEps(G &g,std::ostream& os)
   1.117 +///\ref graphToEps(GR &g,std::ostream& os)
   1.118  ///but it writes its output into the file \c file_name
   1.119  ///instead of a stream.
   1.120 -///\sa graphToEps(G &g, std::ostream& os)
   1.121 -template<class G>
   1.122 -GraphToEps<DefaultGraphToEpsTraits<G> >
   1.123 -graphToEps(G &g,const char *file_name)
   1.124 +///\sa graphToEps(GR &g, std::ostream& os)
   1.125 +template<class GR>
   1.126 +GraphToEps<DefaultGraphToEpsTraits<GR> >
   1.127 +graphToEps(GR &g,const char *file_name)
   1.128  {
   1.129    std::ostream* os = new std::ofstream(file_name);
   1.130    if (!(*os)) {
   1.131      delete os;
   1.132      throw IoError("Cannot write file", file_name);
   1.133    }
   1.134 -  return GraphToEps<DefaultGraphToEpsTraits<G> >
   1.135 -    (DefaultGraphToEpsTraits<G>(g,*os,true));
   1.136 +  return GraphToEps<DefaultGraphToEpsTraits<GR> >
   1.137 +    (DefaultGraphToEpsTraits<GR>(g,*os,true));
   1.138  }
   1.139  
   1.140  ///Generates an EPS file from a graph
   1.141  
   1.142  ///\ingroup eps_io
   1.143  ///This function does the same as
   1.144 -///\ref graphToEps(G &g,std::ostream& os)
   1.145 +///\ref graphToEps(GR &g,std::ostream& os)
   1.146  ///but it writes its output into the file \c file_name
   1.147  ///instead of a stream.
   1.148 -///\sa graphToEps(G &g, std::ostream& os)
   1.149 -template<class G>
   1.150 -GraphToEps<DefaultGraphToEpsTraits<G> >
   1.151 -graphToEps(G &g,const std::string& file_name)
   1.152 +///\sa graphToEps(GR &g, std::ostream& os)
   1.153 +template<class GR>
   1.154 +GraphToEps<DefaultGraphToEpsTraits<GR> >
   1.155 +graphToEps(GR &g,const std::string& file_name)
   1.156  {
   1.157    std::ostream* os = new std::ofstream(file_name.c_str());
   1.158    if (!(*os)) {
   1.159      delete os;
   1.160      throw IoError("Cannot write file", file_name);
   1.161    }
   1.162 -  return GraphToEps<DefaultGraphToEpsTraits<G> >
   1.163 -    (DefaultGraphToEpsTraits<G>(g,*os,true));
   1.164 +  return GraphToEps<DefaultGraphToEpsTraits<GR> >
   1.165 +    (DefaultGraphToEpsTraits<GR>(g,*os,true));
   1.166  }
   1.167  
   1.168  } //END OF NAMESPACE LEMON