[Lemon-commits] [lemon_svn] alpar: r1506 - in hugo/trunk: doc doc/images src/lemon

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:45:56 CET 2006


Author: alpar
Date: Sat Jan 29 16:09:41 2005
New Revision: 1506

Added:
   hugo/trunk/doc/images/
   hugo/trunk/doc/images/nodeshape_0.eps
   hugo/trunk/doc/images/nodeshape_0.png   (contents, props changed)
   hugo/trunk/doc/images/nodeshape_0.pnm   (contents, props changed)
   hugo/trunk/doc/images/nodeshape_1.eps
   hugo/trunk/doc/images/nodeshape_1.png   (contents, props changed)
   hugo/trunk/doc/images/nodeshape_2.eps
   hugo/trunk/doc/images/nodeshape_2.png   (contents, props changed)
Modified:
   hugo/trunk/doc/Doxyfile
   hugo/trunk/src/lemon/graph_to_eps.h

Log:
- Node shapes are shown in the doc.
- The generated PS file is closer to be DSC conform.

Modified: hugo/trunk/doc/Doxyfile
==============================================================================
--- hugo/trunk/doc/Doxyfile	(original)
+++ hugo/trunk/doc/Doxyfile	Sat Jan 29 16:09:41 2005
@@ -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 

Added: hugo/trunk/doc/images/nodeshape_0.eps
==============================================================================
--- (empty file)
+++ hugo/trunk/doc/images/nodeshape_0.eps	Sat Jan 29 16:09:41 2005
@@ -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

Added: hugo/trunk/doc/images/nodeshape_0.png
==============================================================================
Binary file. No diff available.

Added: hugo/trunk/doc/images/nodeshape_0.pnm
==============================================================================
Binary file. No diff available.

Added: hugo/trunk/doc/images/nodeshape_1.eps
==============================================================================
--- (empty file)
+++ hugo/trunk/doc/images/nodeshape_1.eps	Sat Jan 29 16:09:41 2005
@@ -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

Added: hugo/trunk/doc/images/nodeshape_1.png
==============================================================================
Binary file. No diff available.

Added: hugo/trunk/doc/images/nodeshape_2.eps
==============================================================================
--- (empty file)
+++ hugo/trunk/doc/images/nodeshape_2.eps	Sat Jan 29 16:09:41 2005
@@ -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

Added: hugo/trunk/doc/images/nodeshape_2.png
==============================================================================
Binary file. No diff available.

Modified: hugo/trunk/src/lemon/graph_to_eps.h
==============================================================================
--- hugo/trunk/src/lemon/graph_to_eps.h	(original)
+++ hugo/trunk/src/lemon/graph_to_eps.h	Sat Jan 29 16:09:41 2005
@@ -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 T> 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<class X> GraphToEps<NodeShapesTraits<X> > 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<double> 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<class G>
 GraphToEps<DefaultGraphToEpsTraits<G> > 
-graphToEps(G &g,char *file_name)
+graphToEps(G &g,const char *file_name)
 {
   return GraphToEps<DefaultGraphToEpsTraits<G> >
     (DefaultGraphToEpsTraits<G>(g,*new std::ofstream(file_name),true));



More information about the Lemon-commits mailing list