Some color constants added (BLACK, WHITE, RED etc)
authoralpar
Thu, 10 Aug 2006 13:52:56 +0000
changeset 2174f9e43b5cc617
parent 2173 b4de9aed7709
child 2175 0975cad06c2b
Some color constants added (BLACK, WHITE, RED etc)
demo/disjoint_paths_demo.cc
demo/strongly_connected_orientation.cc
demo/topology_demo.cc
lemon/Makefile.am
lemon/color.cc
lemon/color.h
lemon/eps.h
lemon/graph_to_eps.h
     1.1 --- a/demo/disjoint_paths_demo.cc	Thu Aug 10 12:26:29 2006 +0000
     1.2 +++ b/demo/disjoint_paths_demo.cc	Thu Aug 10 13:52:56 2006 +0000
     1.3 @@ -41,7 +41,7 @@
     1.4  using namespace std;
     1.5  
     1.6  Color color(bool b) {
     1.7 -  return b ? Color(1.0, 0.0, 0.0) : Color(0.0, 0.0, 0.0);
     1.8 +  return b ? RED : BLACK;
     1.9  }
    1.10  
    1.11  int main() {
     2.1 --- a/demo/strongly_connected_orientation.cc	Thu Aug 10 12:26:29 2006 +0000
     2.2 +++ b/demo/strongly_connected_orientation.cc	Thu Aug 10 13:52:56 2006 +0000
     2.3 @@ -45,7 +45,7 @@
     2.4  UGRAPH_TYPEDEFS(UGraph)
     2.5  
     2.6  Color color(bool c) {
     2.7 -  return c ? Color(0.0, 0.0, 0.0) : Color(1.0, 0.0, 0.0);
     2.8 +  return c ? BLACK : RED;
     2.9  }
    2.10  
    2.11  template <typename DirMap>
     3.1 --- a/demo/topology_demo.cc	Thu Aug 10 12:26:29 2006 +0000
     3.2 +++ b/demo/topology_demo.cc	Thu Aug 10 13:52:56 2006 +0000
     3.3 @@ -40,7 +40,7 @@
     3.4  
     3.5  
     3.6  Color color(bool val) {
     3.7 -  return val ? Color(1.0, 0.0, 0.0) : Color(0.0, 0.0, 1.0);
     3.8 +  return val ? RED : BLUE;
     3.9  }
    3.10  
    3.11  
     4.1 --- a/lemon/Makefile.am	Thu Aug 10 12:26:29 2006 +0000
     4.2 +++ b/lemon/Makefile.am	Thu Aug 10 13:52:56 2006 +0000
     4.3 @@ -10,6 +10,7 @@
     4.4  	lemon/lp_base.cc \
     4.5  	lemon/lp_skeleton.cc \
     4.6  	lemon/base.cc \
     4.7 +	lemon/color.cc \
     4.8  	lemon/eps.cc \
     4.9  	lemon/bits/mingw32_rand.cc \
    4.10  	lemon/bits/mingw32_time.cc
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/lemon/color.cc	Thu Aug 10 13:52:56 2006 +0000
     5.3 @@ -0,0 +1,44 @@
     5.4 + /* -*- C++ -*-
     5.5 + *
     5.6 + * This file is a part of LEMON, a generic C++ optimization library
     5.7 + *
     5.8 + * Copyright (C) 2003-2006
     5.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    5.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
    5.11 + *
    5.12 + * Permission to use, modify and distribute this software is granted
    5.13 + * provided that this copyright notice appears in all copies. For
    5.14 + * precise terms see the accompanying LICENSE file.
    5.15 + *
    5.16 + * This software is provided "AS IS" with no warranty of any kind,
    5.17 + * express or implied, and with no claim as to its suitability for any
    5.18 + * purpose.
    5.19 + *
    5.20 + */
    5.21 +
    5.22 +///\file
    5.23 +///\brief Color constants
    5.24 +
    5.25 +#include<lemon/color.h>
    5.26 +
    5.27 +namespace lemon {
    5.28 +
    5.29 +  const Color WHITE(1,1,1);
    5.30 +  
    5.31 +  const Color BLACK(0,0,0);
    5.32 +  const Color RED(1,0,0);
    5.33 +  const Color GREEN(0,1,0);
    5.34 +  const Color BLUE(0,0,1);
    5.35 +  const Color YELLOW(1,1,0);
    5.36 +  const Color MAGENTA(1,0,1);
    5.37 +  const Color CYAN(0,1,1);
    5.38 +
    5.39 +  const Color GREY(0,0,0);
    5.40 +  const Color DARK_RED(.5,0,0);
    5.41 +  const Color DARK_GREEN(0,.5,0);
    5.42 +  const Color DARK_BLUE(0,0,.5);
    5.43 +  const Color DARK_YELLOW(.5,.5,0);
    5.44 +  const Color DARK_MAGENTA(.5,0,.5);
    5.45 +  const Color DARK_CYAN(0,.5,.5);
    5.46 +    
    5.47 +} //namespace lemon
     6.1 --- a/lemon/color.h	Thu Aug 10 12:26:29 2006 +0000
     6.2 +++ b/lemon/color.h	Thu Aug 10 13:52:56 2006 +0000
     6.3 @@ -44,6 +44,9 @@
     6.4  
     6.5  namespace lemon {
     6.6  
     6.7 +  /// \addtogroup misc
     6.8 +  /// @{
     6.9 +
    6.10  ///Data structure representing RGB colors.
    6.11  
    6.12  ///Data structure representing RGB colors.
    6.13 @@ -72,6 +75,37 @@
    6.14    void set(double r,double g,double b) { _r=r;_g=g;_b=b; };
    6.15  };
    6.16  
    6.17 +  /// White color constant
    6.18 +  extern const Color WHITE;  
    6.19 +  /// Black color constant
    6.20 +  extern const Color BLACK;
    6.21 +  /// Red color constant
    6.22 +  extern const Color RED;
    6.23 +  /// Green color constant
    6.24 +  extern const Color GREEN;
    6.25 +  /// Blue color constant
    6.26 +  extern const Color BLUE;
    6.27 +  /// Yellow color constant
    6.28 +  extern const Color YELLOW;
    6.29 +  /// Magenta color constant
    6.30 +  extern const Color MAGENTA;
    6.31 +  /// Cyan color constant
    6.32 +  extern const Color CYAN;
    6.33 +  /// Grey color constant
    6.34 +  extern const Color GREY;
    6.35 +  /// Dark red color constant
    6.36 +  extern const Color DARK_RED;
    6.37 +  /// Dark green color constant
    6.38 +  extern const Color DARK_GREEN;
    6.39 +  /// Drak blue color constant
    6.40 +  extern const Color DARK_BLUE;
    6.41 +  /// Dark yellow color constant
    6.42 +  extern const Color DARK_YELLOW;
    6.43 +  /// Dark magenta color constant
    6.44 +  extern const Color DARK_MAGENTA;
    6.45 +  /// Dark cyan color constant
    6.46 +  extern const Color DARK_CYAN;
    6.47 +
    6.48  ///Maps <tt>int</tt>s to different \ref Color "Color"s
    6.49  
    6.50  ///This map assigns one of the predefined \ref Color "Color"s
    6.51 @@ -91,8 +125,8 @@
    6.52    ///\param have_white indicates whether white is
    6.53    ///amongst the provided color (\c true) or not (\c false). If it is true,
    6.54    ///white will be assigned to \c 0.
    6.55 -  ///\param num the number of the allocated colors. If it is \c 0
    6.56 -  ///the default color configuration is set up (26 color plus the while).
    6.57 +  ///\param num the number of the allocated colors. If it is \c 0,
    6.58 +  ///the default color configuration is set up (26 color plus the white).
    6.59    ///If \c num is less then 26/27 then the default color list is cut. Otherwise
    6.60    ///the color list is filled repeatedly with the default color list.
    6.61    ///(The colors can be changed later on.)
    6.62 @@ -167,10 +201,11 @@
    6.63  
    6.64  ///Returns black for light colors and white for the dark ones.
    6.65  inline Color distantBW(const Color &c){
    6.66 -  double v=(.2125*c.red()+.7154*c.green()+.0721*c.blue())<.5?1:0;
    6.67 -  return Color(v,v,v);
    6.68 +  return (.2125*c.red()+.7154*c.green()+.0721*c.blue())<.5 ? WHITE : BLACK;
    6.69  }
    6.70  
    6.71 +/// @}
    6.72 +
    6.73  } //END OF NAMESPACE LEMON
    6.74  
    6.75  #endif // LEMON_COLOR_H
     7.1 --- a/lemon/eps.h	Thu Aug 10 12:26:29 2006 +0000
     7.2 +++ b/lemon/eps.h	Thu Aug 10 13:52:56 2006 +0000
     7.3 @@ -286,7 +286,7 @@
     7.4      ///\param col Color of the node. The default color is white
     7.5      ///\param brd Color of the node border. The default color is black
     7.6      EpsDrawer &node(NodeShapes t, double x, double y, double r,
     7.7 -		    Color col=Color(1,1,1), Color brd=Color(0,0,0));
     7.8 +		    Color col=WHITE, Color brd=BLACK);
     7.9      ///Draw a node shape
    7.10      
    7.11      ///Draw a node shape.
    7.12 @@ -297,7 +297,7 @@
    7.13      ///\param brd Color of the node border. The default color is black
    7.14      template<class T>
    7.15      EpsDrawer &node(NodeShapes t, xy<T> pos, double r,
    7.16 -		    Color col=Color(1,1,1), Color brd=Color(0,0,0))
    7.17 +		    Color col=WHITE, Color brd=BLACK)
    7.18      {
    7.19        return node(t,pos.x,pos.y,r,col,brd);
    7.20      }
     8.1 --- a/lemon/graph_to_eps.h	Thu Aug 10 12:26:29 2006 +0000
     8.2 +++ b/lemon/graph_to_eps.h	Thu Aug 10 13:52:56 2006 +0000
     8.3 @@ -144,7 +144,7 @@
     8.4  			  bool _pros=false) :
     8.5      g(_g), os(_os),
     8.6      _coords(xy<double>(1,1)), _nodeSizes(1.0), _nodeShapes(0),
     8.7 -    _nodeColors(Color(1,1,1)), _edgeColors(Color(0,0,0)),
     8.8 +    _nodeColors(WHITE), _edgeColors(BLACK),
     8.9      _edgeWidths(1), _edgeWidthScale(0.3),
    8.10      _nodeScale(1.0), _xBorder(10), _yBorder(10), _scale(1.0),
    8.11      _nodeBorderQuotient(.1),
    8.12 @@ -155,7 +155,7 @@
    8.13      _showNodePsText(false), _nodePsTexts(false), _nodePsTextsPreamble(0),
    8.14      _undirected(false),
    8.15      _pleaseRemoveOsStream(_pros), _scaleToA4(false),
    8.16 -    _nodeTextColorType(SAME_COL), _nodeTextColors(Color(0,0,0)),
    8.17 +    _nodeTextColorType(SAME_COL), _nodeTextColors(BLACK),
    8.18      _autoNodeScale(false),
    8.19      _autoEdgeWidthScale(false),
    8.20      _negY(false)