src/lemon/graph_to_eps.h
changeset 1107 d972653c89d5
parent 1103 f196dc4f1b31
child 1108 253b66e7e41d
     1.1 --- a/src/lemon/graph_to_eps.h	Fri Jan 28 15:37:08 2005 +0000
     1.2 +++ b/src/lemon/graph_to_eps.h	Sat Jan 29 15:09:41 2005 +0000
     1.3 @@ -152,7 +152,11 @@
     1.4  ///\todo Is 'helper class' a good name for this?
     1.5  ///
     1.6  ///\todo Follow PostScript's DSC.
     1.7 -///\todo Use own dictionary.
     1.8 +/// Use own dictionary.
     1.9 +///\todo Provide a way to set %%Title: and %%Copyright:. Set %%CreationDate:
    1.10 +///\todo Useful new features.
    1.11 +/// - Linestyles: dotted, dashed etc.
    1.12 +/// - A second color and percent value for the lines.
    1.13  template<class T> class GraphToEps : public T 
    1.14  {
    1.15    typedef typename T::Graph Graph;
    1.16 @@ -167,8 +171,29 @@
    1.17  
    1.18    bool dontPrint;
    1.19  
    1.20 -  enum NodeShapes { CIRCLE=0, SQUARE=1, DIAMOND=2 };
    1.21 -		   
    1.22 +public:
    1.23 +  ///Node shapes
    1.24 +
    1.25 +  ///Node shapes
    1.26 +  ///
    1.27 +  enum NodeShapes { 
    1.28 +    /// = 0
    1.29 +    ///\image html nodeshape_0.png
    1.30 +    ///\image latex nodeshape_0.eps "CIRCLE shape (0)" width=2cm
    1.31 +    CIRCLE=0, 
    1.32 +    /// = 1
    1.33 +    ///\image html nodeshape_1.png
    1.34 +    ///\image latex nodeshape_1.eps "SQUARE shape (1)" width=2cm
    1.35 +    ///
    1.36 +    SQUARE=1, 
    1.37 +    /// = 2
    1.38 +    ///\image html nodeshape_2.png
    1.39 +    ///\image latex nodeshape_2.eps "DIAMOND shape (2)" width=2cm
    1.40 +    ///
    1.41 +    DIAMOND=2
    1.42 +  };
    1.43 +
    1.44 +private:
    1.45    class edgeLess {
    1.46      const Graph &g;
    1.47    public:
    1.48 @@ -235,9 +260,11 @@
    1.49    };
    1.50    ///Sets the map of the node shapes
    1.51  
    1.52 -  ///Sets the map of the node shapes
    1.53 +  ///Sets the map of the node shapes.
    1.54 +  ///The availabe shape values
    1.55 +  ///can be found in \ref NodeShapes "enum NodeShapes".
    1.56    ///\param x must be a node map with \c int (or convertible) values. 
    1.57 -  ///\todo Incomplete doc.
    1.58 +  ///\sa NodeShapes
    1.59    template<class X> GraphToEps<NodeShapesTraits<X> > nodeShapes(const X &x)
    1.60    {
    1.61      dontPrint=true;
    1.62 @@ -449,7 +476,12 @@
    1.63      if(dontPrint) return;
    1.64      
    1.65      os << "%!PS-Adobe-2.0 EPSF-2.0\n";
    1.66 -    //\todo: Chech whether the graph is empty.
    1.67 +    os << "%%Title: LEMON GraphToEps figure\n" ///\todo setTitle() is needed
    1.68 +//        << "%%Copyright: XXXX\n"
    1.69 +       << "%%Creator: LEMON GraphToEps function\n"
    1.70 +//        << "%%CreationDate: XXXXXXX\n"
    1.71 +      ;
    1.72 +    ///\todo: Chech whether the graph is empty.
    1.73      BoundingBox<double> bb;
    1.74      for(NodeIt n(g);n!=INVALID;++n) {
    1.75        double ns=_nodeSizes[n]*_nodeScale;
    1.76 @@ -462,6 +494,9 @@
    1.77  		      << bb.bottom()*_scale-_yBorder << ' '
    1.78  		      << bb.right()* _scale+_xBorder << ' '
    1.79  		      << bb.top()*   _scale+_yBorder << '\n';
    1.80 +
    1.81 +    os << "%%EndComments\n";
    1.82 +    
    1.83      //x1 y1 x2 y2 x3 y3 cr cg cb w
    1.84      os << "/lb { setlinewidth setrgbcolor newpath moveto\n"
    1.85         << "      4 2 roll 1 index 1 index curveto stroke } bind def\n";
    1.86 @@ -739,7 +774,7 @@
    1.87  ///\sa graphToEps(G &g, std::ostream& os)
    1.88  template<class G>
    1.89  GraphToEps<DefaultGraphToEpsTraits<G> > 
    1.90 -graphToEps(G &g,char *file_name)
    1.91 +graphToEps(G &g,const char *file_name)
    1.92  {
    1.93    return GraphToEps<DefaultGraphToEpsTraits<G> >
    1.94      (DefaultGraphToEpsTraits<G>(g,*new std::ofstream(file_name),true));