# HG changeset patch # User alpar # Date 1107011381 0 # Node ID d972653c89d56cbbfc2278761d425ebcab3fee31 # Parent 0a7d604a9763052085c89abfbea7757d4c9c7aa3 - Node shapes are shown in the doc. - The generated PS file is closer to be DSC conform. diff -r 0a7d604a9763 -r d972653c89d5 doc/Doxyfile --- a/doc/Doxyfile Fri Jan 28 15:37:08 2005 +0000 +++ b/doc/Doxyfile Sat Jan 29 15:09:41 2005 +0000 @@ -517,7 +517,7 @@ # directories that contain image that are included in the documentation (see # the \image command). -IMAGE_PATH = +IMAGE_PATH = images # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program diff -r 0a7d604a9763 -r d972653c89d5 doc/images/nodeshape_0.eps --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/images/nodeshape_0.eps Sat Jan 29 15:09:41 2005 +0000 @@ -0,0 +1,57 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: LEMON GraphToEps figure +%%Creator: LEMON GraphToEps function +%%BoundingBox: 0 0 200 200 +%%EndComments +/lb { setlinewidth setrgbcolor newpath moveto + 4 2 roll 1 index 1 index curveto stroke } bind def +/l { setlinewidth setrgbcolor newpath moveto lineto stroke } bind def +/c { newpath dup 3 index add 2 index moveto 0 360 arc closepath } bind def +/sq { newpath 2 index 1 index add 2 index 2 index add moveto + 2 index 1 index sub 2 index 2 index add lineto + 2 index 1 index sub 2 index 2 index sub lineto + 2 index 1 index add 2 index 2 index sub lineto + closepath pop pop pop} bind def +/di { newpath 2 index 1 index add 2 index moveto + 2 index 2 index 2 index add lineto + 2 index 1 index sub 2 index lineto + 2 index 2 index 2 index sub lineto + closepath pop pop pop} bind def +/nc { 0 0 0 setrgbcolor 5 index 5 index 5 index c fill + setrgbcolor 1.1 div c fill + } bind def +/nsq { 0 0 0 setrgbcolor 5 index 5 index 5 index sq fill + setrgbcolor 1.1 div sq fill + } bind def +/ndi { 0 0 0 setrgbcolor 5 index 5 index 5 index di fill + setrgbcolor 1.1 div di fill + } bind def +/arrl 1 def +/arrw 0.3 def +/lrl { 2 index mul exch 2 index mul exch rlineto pop} bind def +/arr { setrgbcolor /y1 exch def /x1 exch def /dy exch def /dx exch def + /w exch def /len exch def + newpath x1 dy w 2 div mul add y1 dx w 2 div mul sub moveto + len w sub arrl sub dx dy lrl + arrw dy dx neg lrl + dx arrl w add mul dy w 2 div arrw add mul sub + dy arrl w add mul dx w 2 div arrw add mul add rlineto + dx arrl w add mul neg dy w 2 div arrw add mul sub + dy arrl w add mul neg dx w 2 div arrw add mul add rlineto + arrw dy dx neg lrl + len w sub arrl sub neg dx dy lrl + closepath fill } bind def +/cshow { 2 index 2 index moveto dup stringwidth pop + neg 2 div fosi .35 mul neg rmoveto show pop pop} def + +gsave +100 dup scale +%Edges: +gsave +grestore +%Nodes: +gsave +1 1 1 0.2 1 0.2 nc +grestore +grestore +showpage diff -r 0a7d604a9763 -r d972653c89d5 doc/images/nodeshape_0.png Binary file doc/images/nodeshape_0.png has changed diff -r 0a7d604a9763 -r d972653c89d5 doc/images/nodeshape_0.pnm Binary file doc/images/nodeshape_0.pnm has changed diff -r 0a7d604a9763 -r d972653c89d5 doc/images/nodeshape_1.eps --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/images/nodeshape_1.eps Sat Jan 29 15:09:41 2005 +0000 @@ -0,0 +1,57 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: LEMON GraphToEps figure +%%Creator: LEMON GraphToEps function +%%BoundingBox: 0 0 200 200 +%%EndComments +/lb { setlinewidth setrgbcolor newpath moveto + 4 2 roll 1 index 1 index curveto stroke } bind def +/l { setlinewidth setrgbcolor newpath moveto lineto stroke } bind def +/c { newpath dup 3 index add 2 index moveto 0 360 arc closepath } bind def +/sq { newpath 2 index 1 index add 2 index 2 index add moveto + 2 index 1 index sub 2 index 2 index add lineto + 2 index 1 index sub 2 index 2 index sub lineto + 2 index 1 index add 2 index 2 index sub lineto + closepath pop pop pop} bind def +/di { newpath 2 index 1 index add 2 index moveto + 2 index 2 index 2 index add lineto + 2 index 1 index sub 2 index lineto + 2 index 2 index 2 index sub lineto + closepath pop pop pop} bind def +/nc { 0 0 0 setrgbcolor 5 index 5 index 5 index c fill + setrgbcolor 1.1 div c fill + } bind def +/nsq { 0 0 0 setrgbcolor 5 index 5 index 5 index sq fill + setrgbcolor 1.1 div sq fill + } bind def +/ndi { 0 0 0 setrgbcolor 5 index 5 index 5 index di fill + setrgbcolor 1.1 div di fill + } bind def +/arrl 1 def +/arrw 0.3 def +/lrl { 2 index mul exch 2 index mul exch rlineto pop} bind def +/arr { setrgbcolor /y1 exch def /x1 exch def /dy exch def /dx exch def + /w exch def /len exch def + newpath x1 dy w 2 div mul add y1 dx w 2 div mul sub moveto + len w sub arrl sub dx dy lrl + arrw dy dx neg lrl + dx arrl w add mul dy w 2 div arrw add mul sub + dy arrl w add mul dx w 2 div arrw add mul add rlineto + dx arrl w add mul neg dy w 2 div arrw add mul sub + dy arrl w add mul neg dx w 2 div arrw add mul add rlineto + arrw dy dx neg lrl + len w sub arrl sub neg dx dy lrl + closepath fill } bind def +/cshow { 2 index 2 index moveto dup stringwidth pop + neg 2 div fosi .35 mul neg rmoveto show pop pop} def + +gsave +100 dup scale +%Edges: +gsave +grestore +%Nodes: +gsave +1 1 1 0.2 1 0.2 nsq +grestore +grestore +showpage diff -r 0a7d604a9763 -r d972653c89d5 doc/images/nodeshape_1.png Binary file doc/images/nodeshape_1.png has changed diff -r 0a7d604a9763 -r d972653c89d5 doc/images/nodeshape_2.eps --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/images/nodeshape_2.eps Sat Jan 29 15:09:41 2005 +0000 @@ -0,0 +1,57 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: LEMON GraphToEps figure +%%Creator: LEMON GraphToEps function +%%BoundingBox: 0 0 200 200 +%%EndComments +/lb { setlinewidth setrgbcolor newpath moveto + 4 2 roll 1 index 1 index curveto stroke } bind def +/l { setlinewidth setrgbcolor newpath moveto lineto stroke } bind def +/c { newpath dup 3 index add 2 index moveto 0 360 arc closepath } bind def +/sq { newpath 2 index 1 index add 2 index 2 index add moveto + 2 index 1 index sub 2 index 2 index add lineto + 2 index 1 index sub 2 index 2 index sub lineto + 2 index 1 index add 2 index 2 index sub lineto + closepath pop pop pop} bind def +/di { newpath 2 index 1 index add 2 index moveto + 2 index 2 index 2 index add lineto + 2 index 1 index sub 2 index lineto + 2 index 2 index 2 index sub lineto + closepath pop pop pop} bind def +/nc { 0 0 0 setrgbcolor 5 index 5 index 5 index c fill + setrgbcolor 1.1 div c fill + } bind def +/nsq { 0 0 0 setrgbcolor 5 index 5 index 5 index sq fill + setrgbcolor 1.1 div sq fill + } bind def +/ndi { 0 0 0 setrgbcolor 5 index 5 index 5 index di fill + setrgbcolor 1.1 div di fill + } bind def +/arrl 1 def +/arrw 0.3 def +/lrl { 2 index mul exch 2 index mul exch rlineto pop} bind def +/arr { setrgbcolor /y1 exch def /x1 exch def /dy exch def /dx exch def + /w exch def /len exch def + newpath x1 dy w 2 div mul add y1 dx w 2 div mul sub moveto + len w sub arrl sub dx dy lrl + arrw dy dx neg lrl + dx arrl w add mul dy w 2 div arrw add mul sub + dy arrl w add mul dx w 2 div arrw add mul add rlineto + dx arrl w add mul neg dy w 2 div arrw add mul sub + dy arrl w add mul neg dx w 2 div arrw add mul add rlineto + arrw dy dx neg lrl + len w sub arrl sub neg dx dy lrl + closepath fill } bind def +/cshow { 2 index 2 index moveto dup stringwidth pop + neg 2 div fosi .35 mul neg rmoveto show pop pop} def + +gsave +100 dup scale +%Edges: +gsave +grestore +%Nodes: +gsave +1 1 1 0.2 1 0.2 ndi +grestore +grestore +showpage diff -r 0a7d604a9763 -r d972653c89d5 doc/images/nodeshape_2.png Binary file doc/images/nodeshape_2.png has changed diff -r 0a7d604a9763 -r d972653c89d5 src/lemon/graph_to_eps.h --- a/src/lemon/graph_to_eps.h Fri Jan 28 15:37:08 2005 +0000 +++ b/src/lemon/graph_to_eps.h Sat Jan 29 15:09:41 2005 +0000 @@ -152,7 +152,11 @@ ///\todo Is 'helper class' a good name for this? /// ///\todo Follow PostScript's DSC. -///\todo Use own dictionary. +/// Use own dictionary. +///\todo Provide a way to set %%Title: and %%Copyright:. Set %%CreationDate: +///\todo Useful new features. +/// - Linestyles: dotted, dashed etc. +/// - A second color and percent value for the lines. template class GraphToEps : public T { typedef typename T::Graph Graph; @@ -167,8 +171,29 @@ bool dontPrint; - enum NodeShapes { CIRCLE=0, SQUARE=1, DIAMOND=2 }; - +public: + ///Node shapes + + ///Node shapes + /// + enum NodeShapes { + /// = 0 + ///\image html nodeshape_0.png + ///\image latex nodeshape_0.eps "CIRCLE shape (0)" width=2cm + CIRCLE=0, + /// = 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 + }; + +private: class edgeLess { const Graph &g; public: @@ -235,9 +260,11 @@ }; ///Sets the map of the node shapes - ///Sets the map of the node shapes + ///Sets the map of the node shapes. + ///The availabe shape values + ///can be found in \ref NodeShapes "enum NodeShapes". ///\param x must be a node map with \c int (or convertible) values. - ///\todo Incomplete doc. + ///\sa NodeShapes template GraphToEps > nodeShapes(const X &x) { dontPrint=true; @@ -449,7 +476,12 @@ if(dontPrint) return; os << "%!PS-Adobe-2.0 EPSF-2.0\n"; - //\todo: Chech whether the graph is empty. + os << "%%Title: LEMON GraphToEps figure\n" ///\todo setTitle() is needed +// << "%%Copyright: XXXX\n" + << "%%Creator: LEMON GraphToEps function\n" +// << "%%CreationDate: XXXXXXX\n" + ; + ///\todo: Chech whether the graph is empty. BoundingBox bb; for(NodeIt n(g);n!=INVALID;++n) { double ns=_nodeSizes[n]*_nodeScale; @@ -462,6 +494,9 @@ << bb.bottom()*_scale-_yBorder << ' ' << bb.right()* _scale+_xBorder << ' ' << bb.top()* _scale+_yBorder << '\n'; + + os << "%%EndComments\n"; + //x1 y1 x2 y2 x3 y3 cr cg cb w os << "/lb { setlinewidth setrgbcolor newpath moveto\n" << " 4 2 roll 1 index 1 index curveto stroke } bind def\n"; @@ -739,7 +774,7 @@ ///\sa graphToEps(G &g, std::ostream& os) template GraphToEps > -graphToEps(G &g,char *file_name) +graphToEps(G &g,const char *file_name) { return GraphToEps > (DefaultGraphToEpsTraits(g,*new std::ofstream(file_name),true));