lemon/graph_to_eps.h
changeset 1573 b76a0af36f44
parent 1539 8f589de42c76
child 1574 697ed4dd309a
equal deleted inserted replaced
3:5f3ff6eb1c8b 4:cfa306139f4a
    66   void set(double r,double g,double b) { _r=r;_g=g;_b=b; };
    66   void set(double r,double g,double b) { _r=r;_g=g;_b=b; };
    67 };
    67 };
    68 
    68 
    69 ///Maps <tt>int</tt>s to different \ref Color "Color"s
    69 ///Maps <tt>int</tt>s to different \ref Color "Color"s
    70 
    70 
    71 ///This map assing one of the predefined \ref Color "Color"s
    71 ///This map assigns one of the predefined \ref Color "Color"s
    72 ///to each <tt>int</tt>. It is possible to change the colors as well as their
    72 ///to each <tt>int</tt>. It is possible to change the colors as well as their
    73 ///number. The integer range is cyclically mapped to the provided set of colors.
    73 ///number. The integer range is cyclically mapped to the provided set of colors.
    74 ///
    74 ///
    75 ///This is a true \ref concept::ReferenceMap "reference map", so you can also
    75 ///This is a true \ref concept::ReferenceMap "reference map", so you can also
    76 ///change the actual colors.
    76 ///change the actual colors.
   143     colors[i%colors.size()]=c;
   143     colors[i%colors.size()]=c;
   144   }
   144   }
   145   ///Sets the number of the exiting colors.
   145   ///Sets the number of the exiting colors.
   146   void resize(int s) { colors.resize(s);}
   146   void resize(int s) { colors.resize(s);}
   147   ///Returns the munber of the existing colors.
   147   ///Returns the munber of the existing colors.
   148   std::size_t size() { return colors.size();}
   148   std::size_t size() const { return colors.size();}
   149 };
   149 };
   150 
   150 
   151 ///Returns a visible distinct \ref Color
   151 ///Returns a visible distinct \ref Color
   152 
   152 
   153 ///Returns a \ref Color which is as different from the given parameter
   153 ///Returns a \ref Color which is as different from the given parameter
   464   ///With this command it is possible to insert a verbatim PostScript
   464   ///With this command it is possible to insert a verbatim PostScript
   465   ///block to the nodes.
   465   ///block to the nodes.
   466   ///The PS current point will be moved to the centre of the node before
   466   ///The PS current point will be moved to the centre of the node before
   467   ///the PostScript block inserted.
   467   ///the PostScript block inserted.
   468   ///
   468   ///
   469   ///Before and after the block a newline character is inserted to you
   469   ///Before and after the block a newline character is inserted so you
   470   ///don't have to bother with the separators.
   470   ///don't have to bother with the separators.
   471   ///
   471   ///
   472   ///\param x must be a node map with type that can be pushed to a standard
   472   ///\param x must be a node map with type that can be pushed to a standard
   473   ///ostream.
   473   ///ostream.
   474   ///
   474   ///
   500     NodeColorsTraits(const T &t,const X &x) : T(t), _nodeColors(x) {}
   500     NodeColorsTraits(const T &t,const X &x) : T(t), _nodeColors(x) {}
   501   };
   501   };
   502   ///Sets the map of the node colors
   502   ///Sets the map of the node colors
   503 
   503 
   504   ///Sets the map of the node colors
   504   ///Sets the map of the node colors
   505   ///\param x must be a node map with \ref Color values. 
   505   ///\param x must be a node map with \ref Color values.
       
   506   ///
       
   507   ///\sa ColorSet
   506   template<class X> GraphToEps<NodeColorsTraits<X> >
   508   template<class X> GraphToEps<NodeColorsTraits<X> >
   507   nodeColors(const X &x)
   509   nodeColors(const X &x)
   508   {
   510   {
   509     dontPrint=true;
   511     dontPrint=true;
   510     return GraphToEps<NodeColorsTraits<X> >(NodeColorsTraits<X>(*this,x));
   512     return GraphToEps<NodeColorsTraits<X> >(NodeColorsTraits<X>(*this,x));
   515   };
   517   };
   516   ///Sets the map of the node text colors
   518   ///Sets the map of the node text colors
   517 
   519 
   518   ///Sets the map of the node text colors
   520   ///Sets the map of the node text colors
   519   ///\param x must be a node map with \ref Color values. 
   521   ///\param x must be a node map with \ref Color values. 
       
   522   ///
       
   523   ///\sa ColorSet
   520   template<class X> GraphToEps<NodeTextColorsTraits<X> >
   524   template<class X> GraphToEps<NodeTextColorsTraits<X> >
   521   nodeTextColors(const X &x)
   525   nodeTextColors(const X &x)
   522   {
   526   {
   523     dontPrint=true;
   527     dontPrint=true;
   524     _nodeTextColorType=CUST_COL;
   528     _nodeTextColorType=CUST_COL;
   531   };
   535   };
   532   ///Sets the map of the edge colors
   536   ///Sets the map of the edge colors
   533 
   537 
   534   ///Sets the map of the edge colors
   538   ///Sets the map of the edge colors
   535   ///\param x must be a edge map with \ref Color values. 
   539   ///\param x must be a edge map with \ref Color values. 
       
   540   ///
       
   541   ///\sa ColorSet
   536   template<class X> GraphToEps<EdgeColorsTraits<X> >
   542   template<class X> GraphToEps<EdgeColorsTraits<X> >
   537   edgeColors(const X &x)
   543   edgeColors(const X &x)
   538   {
   544   {
   539     dontPrint=true;
   545     dontPrint=true;
   540     return GraphToEps<EdgeColorsTraits<X> >(EdgeColorsTraits<X>(*this,x));
   546     return GraphToEps<EdgeColorsTraits<X> >(EdgeColorsTraits<X>(*this,x));
   619 
   625 
   620   ///Sets the color of the node texts to be different from the node color
   626   ///Sets the color of the node texts to be different from the node color
   621 
   627 
   622   ///Sets the color of the node texts to be as different from the node color
   628   ///Sets the color of the node texts to be as different from the node color
   623   ///as it is possible
   629   ///as it is possible
   624     ///
   630   ///
   625   GraphToEps<T> &distantColorNodeTexts()
   631   GraphToEps<T> &distantColorNodeTexts()
   626   {_nodeTextColorType=DIST_COL;return *this;}
   632   {_nodeTextColorType=DIST_COL;return *this;}
   627   ///Sets the color of the node texts to be black or white and always visible.
   633   ///Sets the color of the node texts to be black or white and always visible.
   628 
   634 
   629   ///Sets the color of the node texts to be black or white according to
   635   ///Sets the color of the node texts to be black or white according to
  1006 ///              .edgeWidthScale(.4).run();
  1012 ///              .edgeWidthScale(.4).run();
  1007 ///\endcode
  1013 ///\endcode
  1008 ///\warning Don't forget to put the \ref GraphToEps::run() "run()"
  1014 ///\warning Don't forget to put the \ref GraphToEps::run() "run()"
  1009 ///to the end of the parameter list.
  1015 ///to the end of the parameter list.
  1010 ///\sa GraphToEps
  1016 ///\sa GraphToEps
  1011 ///\sa graphToEps(G &g, char *file_name)
  1017 ///\sa graphToEps(G &g, const char *file_name)
  1012 template<class G>
  1018 template<class G>
  1013 GraphToEps<DefaultGraphToEpsTraits<G> > 
  1019 GraphToEps<DefaultGraphToEpsTraits<G> > 
  1014 graphToEps(G &g, std::ostream& os=std::cout)
  1020 graphToEps(G &g, std::ostream& os=std::cout)
  1015 {
  1021 {
  1016   return 
  1022   return 
  1017     GraphToEps<DefaultGraphToEpsTraits<G> >(DefaultGraphToEpsTraits<G>(g,os));
  1023     GraphToEps<DefaultGraphToEpsTraits<G> >(DefaultGraphToEpsTraits<G>(g,os));
  1018 }
  1024 }
  1019  
  1025  
  1020 ///Generates an EPS file from a graph
  1026 ///Generates an EPS file from a graph
  1021 
  1027 
  1022 ///\ingroup misc
  1028 ///\ingroup io_group
  1023 ///This function does the same as
  1029 ///This function does the same as
  1024 ///\ref graphToEps(G &g,std::ostream& os)
  1030 ///\ref graphToEps(G &g,std::ostream& os)
  1025 ///but it writes its output into the file \c file_name
  1031 ///but it writes its output into the file \c file_name
  1026 ///instead of a stream.
  1032 ///instead of a stream.
  1027 ///\sa graphToEps(G &g, std::ostream& os)
  1033 ///\sa graphToEps(G &g, std::ostream& os)