- Node shapes are shown in the doc.
authoralpar
Sat, 29 Jan 2005 15:09:41 +0000
changeset 1107d972653c89d5
parent 1106 0a7d604a9763
child 1108 253b66e7e41d
- Node shapes are shown in the doc.
- The generated PS file is closer to be DSC conform.
doc/Doxyfile
doc/images/nodeshape_0.eps
doc/images/nodeshape_0.png
doc/images/nodeshape_0.pnm
doc/images/nodeshape_1.eps
doc/images/nodeshape_1.png
doc/images/nodeshape_2.eps
doc/images/nodeshape_2.png
src/lemon/graph_to_eps.h
     1.1 --- a/doc/Doxyfile	Fri Jan 28 15:37:08 2005 +0000
     1.2 +++ b/doc/Doxyfile	Sat Jan 29 15:09:41 2005 +0000
     1.3 @@ -517,7 +517,7 @@
     1.4  # directories that contain image that are included in the documentation (see 
     1.5  # the \image command).
     1.6  
     1.7 -IMAGE_PATH             = 
     1.8 +IMAGE_PATH             = images
     1.9  
    1.10  # The INPUT_FILTER tag can be used to specify a program that doxygen should 
    1.11  # invoke to filter for each input file. Doxygen will invoke the filter program 
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/doc/images/nodeshape_0.eps	Sat Jan 29 15:09:41 2005 +0000
     2.3 @@ -0,0 +1,57 @@
     2.4 +%!PS-Adobe-2.0 EPSF-2.0
     2.5 +%%Title: LEMON GraphToEps figure
     2.6 +%%Creator: LEMON GraphToEps function
     2.7 +%%BoundingBox: 0 0 200 200
     2.8 +%%EndComments
     2.9 +/lb { setlinewidth setrgbcolor newpath moveto
    2.10 +      4 2 roll 1 index 1 index curveto stroke } bind def
    2.11 +/l { setlinewidth setrgbcolor newpath moveto lineto stroke } bind def
    2.12 +/c { newpath dup 3 index add 2 index moveto 0 360 arc closepath } bind def
    2.13 +/sq { newpath 2 index 1 index add 2 index 2 index add moveto
    2.14 +      2 index 1 index sub 2 index 2 index add lineto
    2.15 +      2 index 1 index sub 2 index 2 index sub lineto
    2.16 +      2 index 1 index add 2 index 2 index sub lineto
    2.17 +      closepath pop pop pop} bind def
    2.18 +/di { newpath 2 index 1 index add 2 index moveto
    2.19 +      2 index             2 index 2 index add lineto
    2.20 +      2 index 1 index sub 2 index             lineto
    2.21 +      2 index             2 index 2 index sub lineto
    2.22 +      closepath pop pop pop} bind def
    2.23 +/nc { 0 0 0 setrgbcolor 5 index 5 index 5 index c fill
    2.24 +     setrgbcolor 1.1 div c fill
    2.25 +   } bind def
    2.26 +/nsq { 0 0 0 setrgbcolor 5 index 5 index 5 index sq fill
    2.27 +     setrgbcolor 1.1 div sq fill
    2.28 +   } bind def
    2.29 +/ndi { 0 0 0 setrgbcolor 5 index 5 index 5 index di fill
    2.30 +     setrgbcolor 1.1 div di fill
    2.31 +   } bind def
    2.32 +/arrl 1 def
    2.33 +/arrw 0.3 def
    2.34 +/lrl { 2 index mul exch 2 index mul exch rlineto pop} bind def
    2.35 +/arr { setrgbcolor /y1 exch def /x1 exch def /dy exch def /dx exch def
    2.36 +       /w exch def /len exch def
    2.37 +       newpath x1 dy w 2 div mul add y1 dx w 2 div mul sub moveto
    2.38 +       len w sub arrl sub dx dy lrl
    2.39 +       arrw dy dx neg lrl
    2.40 +       dx arrl w add mul dy w 2 div arrw add mul sub
    2.41 +       dy arrl w add mul dx w 2 div arrw add mul add rlineto
    2.42 +       dx arrl w add mul neg dy w 2 div arrw add mul sub
    2.43 +       dy arrl w add mul neg dx w 2 div arrw add mul add rlineto
    2.44 +       arrw dy dx neg lrl
    2.45 +       len w sub arrl sub neg dx dy lrl
    2.46 +       closepath fill } bind def
    2.47 +/cshow { 2 index 2 index moveto dup stringwidth pop
    2.48 +         neg 2 div fosi .35 mul neg rmoveto show pop pop} def
    2.49 +
    2.50 +gsave
    2.51 +100 dup scale
    2.52 +%Edges:
    2.53 +gsave
    2.54 +grestore
    2.55 +%Nodes:
    2.56 +gsave
    2.57 +1 1 1 0.2 1 0.2 nc
    2.58 +grestore
    2.59 +grestore
    2.60 +showpage
     3.1 Binary file doc/images/nodeshape_0.png has changed
     4.1 Binary file doc/images/nodeshape_0.pnm has changed
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/doc/images/nodeshape_1.eps	Sat Jan 29 15:09:41 2005 +0000
     5.3 @@ -0,0 +1,57 @@
     5.4 +%!PS-Adobe-2.0 EPSF-2.0
     5.5 +%%Title: LEMON GraphToEps figure
     5.6 +%%Creator: LEMON GraphToEps function
     5.7 +%%BoundingBox: 0 0 200 200
     5.8 +%%EndComments
     5.9 +/lb { setlinewidth setrgbcolor newpath moveto
    5.10 +      4 2 roll 1 index 1 index curveto stroke } bind def
    5.11 +/l { setlinewidth setrgbcolor newpath moveto lineto stroke } bind def
    5.12 +/c { newpath dup 3 index add 2 index moveto 0 360 arc closepath } bind def
    5.13 +/sq { newpath 2 index 1 index add 2 index 2 index add moveto
    5.14 +      2 index 1 index sub 2 index 2 index add lineto
    5.15 +      2 index 1 index sub 2 index 2 index sub lineto
    5.16 +      2 index 1 index add 2 index 2 index sub lineto
    5.17 +      closepath pop pop pop} bind def
    5.18 +/di { newpath 2 index 1 index add 2 index moveto
    5.19 +      2 index             2 index 2 index add lineto
    5.20 +      2 index 1 index sub 2 index             lineto
    5.21 +      2 index             2 index 2 index sub lineto
    5.22 +      closepath pop pop pop} bind def
    5.23 +/nc { 0 0 0 setrgbcolor 5 index 5 index 5 index c fill
    5.24 +     setrgbcolor 1.1 div c fill
    5.25 +   } bind def
    5.26 +/nsq { 0 0 0 setrgbcolor 5 index 5 index 5 index sq fill
    5.27 +     setrgbcolor 1.1 div sq fill
    5.28 +   } bind def
    5.29 +/ndi { 0 0 0 setrgbcolor 5 index 5 index 5 index di fill
    5.30 +     setrgbcolor 1.1 div di fill
    5.31 +   } bind def
    5.32 +/arrl 1 def
    5.33 +/arrw 0.3 def
    5.34 +/lrl { 2 index mul exch 2 index mul exch rlineto pop} bind def
    5.35 +/arr { setrgbcolor /y1 exch def /x1 exch def /dy exch def /dx exch def
    5.36 +       /w exch def /len exch def
    5.37 +       newpath x1 dy w 2 div mul add y1 dx w 2 div mul sub moveto
    5.38 +       len w sub arrl sub dx dy lrl
    5.39 +       arrw dy dx neg lrl
    5.40 +       dx arrl w add mul dy w 2 div arrw add mul sub
    5.41 +       dy arrl w add mul dx w 2 div arrw add mul add rlineto
    5.42 +       dx arrl w add mul neg dy w 2 div arrw add mul sub
    5.43 +       dy arrl w add mul neg dx w 2 div arrw add mul add rlineto
    5.44 +       arrw dy dx neg lrl
    5.45 +       len w sub arrl sub neg dx dy lrl
    5.46 +       closepath fill } bind def
    5.47 +/cshow { 2 index 2 index moveto dup stringwidth pop
    5.48 +         neg 2 div fosi .35 mul neg rmoveto show pop pop} def
    5.49 +
    5.50 +gsave
    5.51 +100 dup scale
    5.52 +%Edges:
    5.53 +gsave
    5.54 +grestore
    5.55 +%Nodes:
    5.56 +gsave
    5.57 +1 1 1 0.2 1 0.2 nsq
    5.58 +grestore
    5.59 +grestore
    5.60 +showpage
     6.1 Binary file doc/images/nodeshape_1.png has changed
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/doc/images/nodeshape_2.eps	Sat Jan 29 15:09:41 2005 +0000
     7.3 @@ -0,0 +1,57 @@
     7.4 +%!PS-Adobe-2.0 EPSF-2.0
     7.5 +%%Title: LEMON GraphToEps figure
     7.6 +%%Creator: LEMON GraphToEps function
     7.7 +%%BoundingBox: 0 0 200 200
     7.8 +%%EndComments
     7.9 +/lb { setlinewidth setrgbcolor newpath moveto
    7.10 +      4 2 roll 1 index 1 index curveto stroke } bind def
    7.11 +/l { setlinewidth setrgbcolor newpath moveto lineto stroke } bind def
    7.12 +/c { newpath dup 3 index add 2 index moveto 0 360 arc closepath } bind def
    7.13 +/sq { newpath 2 index 1 index add 2 index 2 index add moveto
    7.14 +      2 index 1 index sub 2 index 2 index add lineto
    7.15 +      2 index 1 index sub 2 index 2 index sub lineto
    7.16 +      2 index 1 index add 2 index 2 index sub lineto
    7.17 +      closepath pop pop pop} bind def
    7.18 +/di { newpath 2 index 1 index add 2 index moveto
    7.19 +      2 index             2 index 2 index add lineto
    7.20 +      2 index 1 index sub 2 index             lineto
    7.21 +      2 index             2 index 2 index sub lineto
    7.22 +      closepath pop pop pop} bind def
    7.23 +/nc { 0 0 0 setrgbcolor 5 index 5 index 5 index c fill
    7.24 +     setrgbcolor 1.1 div c fill
    7.25 +   } bind def
    7.26 +/nsq { 0 0 0 setrgbcolor 5 index 5 index 5 index sq fill
    7.27 +     setrgbcolor 1.1 div sq fill
    7.28 +   } bind def
    7.29 +/ndi { 0 0 0 setrgbcolor 5 index 5 index 5 index di fill
    7.30 +     setrgbcolor 1.1 div di fill
    7.31 +   } bind def
    7.32 +/arrl 1 def
    7.33 +/arrw 0.3 def
    7.34 +/lrl { 2 index mul exch 2 index mul exch rlineto pop} bind def
    7.35 +/arr { setrgbcolor /y1 exch def /x1 exch def /dy exch def /dx exch def
    7.36 +       /w exch def /len exch def
    7.37 +       newpath x1 dy w 2 div mul add y1 dx w 2 div mul sub moveto
    7.38 +       len w sub arrl sub dx dy lrl
    7.39 +       arrw dy dx neg lrl
    7.40 +       dx arrl w add mul dy w 2 div arrw add mul sub
    7.41 +       dy arrl w add mul dx w 2 div arrw add mul add rlineto
    7.42 +       dx arrl w add mul neg dy w 2 div arrw add mul sub
    7.43 +       dy arrl w add mul neg dx w 2 div arrw add mul add rlineto
    7.44 +       arrw dy dx neg lrl
    7.45 +       len w sub arrl sub neg dx dy lrl
    7.46 +       closepath fill } bind def
    7.47 +/cshow { 2 index 2 index moveto dup stringwidth pop
    7.48 +         neg 2 div fosi .35 mul neg rmoveto show pop pop} def
    7.49 +
    7.50 +gsave
    7.51 +100 dup scale
    7.52 +%Edges:
    7.53 +gsave
    7.54 +grestore
    7.55 +%Nodes:
    7.56 +gsave
    7.57 +1 1 1 0.2 1 0.2 ndi
    7.58 +grestore
    7.59 +grestore
    7.60 +showpage
     8.1 Binary file doc/images/nodeshape_2.png has changed
     9.1 --- a/src/lemon/graph_to_eps.h	Fri Jan 28 15:37:08 2005 +0000
     9.2 +++ b/src/lemon/graph_to_eps.h	Sat Jan 29 15:09:41 2005 +0000
     9.3 @@ -152,7 +152,11 @@
     9.4  ///\todo Is 'helper class' a good name for this?
     9.5  ///
     9.6  ///\todo Follow PostScript's DSC.
     9.7 -///\todo Use own dictionary.
     9.8 +/// Use own dictionary.
     9.9 +///\todo Provide a way to set %%Title: and %%Copyright:. Set %%CreationDate:
    9.10 +///\todo Useful new features.
    9.11 +/// - Linestyles: dotted, dashed etc.
    9.12 +/// - A second color and percent value for the lines.
    9.13  template<class T> class GraphToEps : public T 
    9.14  {
    9.15    typedef typename T::Graph Graph;
    9.16 @@ -167,8 +171,29 @@
    9.17  
    9.18    bool dontPrint;
    9.19  
    9.20 -  enum NodeShapes { CIRCLE=0, SQUARE=1, DIAMOND=2 };
    9.21 -		   
    9.22 +public:
    9.23 +  ///Node shapes
    9.24 +
    9.25 +  ///Node shapes
    9.26 +  ///
    9.27 +  enum NodeShapes { 
    9.28 +    /// = 0
    9.29 +    ///\image html nodeshape_0.png
    9.30 +    ///\image latex nodeshape_0.eps "CIRCLE shape (0)" width=2cm
    9.31 +    CIRCLE=0, 
    9.32 +    /// = 1
    9.33 +    ///\image html nodeshape_1.png
    9.34 +    ///\image latex nodeshape_1.eps "SQUARE shape (1)" width=2cm
    9.35 +    ///
    9.36 +    SQUARE=1, 
    9.37 +    /// = 2
    9.38 +    ///\image html nodeshape_2.png
    9.39 +    ///\image latex nodeshape_2.eps "DIAMOND shape (2)" width=2cm
    9.40 +    ///
    9.41 +    DIAMOND=2
    9.42 +  };
    9.43 +
    9.44 +private:
    9.45    class edgeLess {
    9.46      const Graph &g;
    9.47    public:
    9.48 @@ -235,9 +260,11 @@
    9.49    };
    9.50    ///Sets the map of the node shapes
    9.51  
    9.52 -  ///Sets the map of the node shapes
    9.53 +  ///Sets the map of the node shapes.
    9.54 +  ///The availabe shape values
    9.55 +  ///can be found in \ref NodeShapes "enum NodeShapes".
    9.56    ///\param x must be a node map with \c int (or convertible) values. 
    9.57 -  ///\todo Incomplete doc.
    9.58 +  ///\sa NodeShapes
    9.59    template<class X> GraphToEps<NodeShapesTraits<X> > nodeShapes(const X &x)
    9.60    {
    9.61      dontPrint=true;
    9.62 @@ -449,7 +476,12 @@
    9.63      if(dontPrint) return;
    9.64      
    9.65      os << "%!PS-Adobe-2.0 EPSF-2.0\n";
    9.66 -    //\todo: Chech whether the graph is empty.
    9.67 +    os << "%%Title: LEMON GraphToEps figure\n" ///\todo setTitle() is needed
    9.68 +//        << "%%Copyright: XXXX\n"
    9.69 +       << "%%Creator: LEMON GraphToEps function\n"
    9.70 +//        << "%%CreationDate: XXXXXXX\n"
    9.71 +      ;
    9.72 +    ///\todo: Chech whether the graph is empty.
    9.73      BoundingBox<double> bb;
    9.74      for(NodeIt n(g);n!=INVALID;++n) {
    9.75        double ns=_nodeSizes[n]*_nodeScale;
    9.76 @@ -462,6 +494,9 @@
    9.77  		      << bb.bottom()*_scale-_yBorder << ' '
    9.78  		      << bb.right()* _scale+_xBorder << ' '
    9.79  		      << bb.top()*   _scale+_yBorder << '\n';
    9.80 +
    9.81 +    os << "%%EndComments\n";
    9.82 +    
    9.83      //x1 y1 x2 y2 x3 y3 cr cg cb w
    9.84      os << "/lb { setlinewidth setrgbcolor newpath moveto\n"
    9.85         << "      4 2 roll 1 index 1 index curveto stroke } bind def\n";
    9.86 @@ -739,7 +774,7 @@
    9.87  ///\sa graphToEps(G &g, std::ostream& os)
    9.88  template<class G>
    9.89  GraphToEps<DefaultGraphToEpsTraits<G> > 
    9.90 -graphToEps(G &g,char *file_name)
    9.91 +graphToEps(G &g,const char *file_name)
    9.92  {
    9.93    return GraphToEps<DefaultGraphToEpsTraits<G> >
    9.94      (DefaultGraphToEpsTraits<G>(g,*new std::ofstream(file_name),true));