lemon/graph_to_eps.h
changeset 1575 438bc5defad1
parent 1574 697ed4dd309a
child 1588 b79bcba43661
     1.1 --- a/lemon/graph_to_eps.h	Wed Jul 20 08:33:33 2005 +0000
     1.2 +++ b/lemon/graph_to_eps.h	Wed Jul 20 12:13:36 2005 +0000
     1.3 @@ -55,14 +55,17 @@
     1.4    ///Constructor
     1.5    Color(double r,double g,double b) :_r(r),_g(g),_b(b) {};
     1.6    ///Returns the red component
     1.7 - 
     1.8 -  ///\todo \c red() could be a better name...
     1.9 -  ///
    1.10 -  double getR() const {return _r;}
    1.11 +  double & red() {return _r;}
    1.12 +  ///Returns the red component
    1.13 +  const double & red() const {return _r;}
    1.14    ///Returns the green component
    1.15 -  double getG() const {return _g;}
    1.16 +  double & green() {return _g;}
    1.17 +  ///Returns the green component
    1.18 +  const double & green() const {return _g;}
    1.19    ///Returns the blue component
    1.20 -  double getB() const {return _b;}
    1.21 +  double & blue() {return _b;}
    1.22 +  ///Returns the blue component
    1.23 +  const double & blue() const {return _b;}
    1.24    ///Set the color components
    1.25    void set(double r,double g,double b) { _r=r;_g=g;_b=b; };
    1.26  };
    1.27 @@ -156,13 +159,13 @@
    1.28  ///as it is possible.
    1.29  inline Color distantColor(const Color &c) 
    1.30  {
    1.31 -  return Color(c.getR()<.5?1:0,c.getG()<.5?1:0,c.getB()<.5?1:0);
    1.32 +  return Color(c.red()<.5?1:0,c.green()<.5?1:0,c.blue()<.5?1:0);
    1.33  }
    1.34  ///Returns black for light colors and white for the dark ones.
    1.35  
    1.36  ///Returns black for light colors and white for the dark ones.
    1.37  inline Color distantBW(const Color &c){
    1.38 -  double v=(.2125*c.getR()+.7154*c.getG()+.0721*c.getB())<.5?1:0;
    1.39 +  double v=(.2125*c.red()+.7154*c.green()+.0721*c.blue())<.5?1:0;
    1.40    return Color(v,v,v);
    1.41  }
    1.42  
    1.43 @@ -393,7 +396,7 @@
    1.44    static std::string psOut(const Color &c) 
    1.45      {
    1.46        std::ostringstream os;	
    1.47 -      os << c.getR() << ' ' << c.getG() << ' ' << c.getB();
    1.48 +      os << c.red() << ' ' << c.green() << ' ' << c.blue();
    1.49        return os.str();
    1.50      }
    1.51    
    1.52 @@ -702,7 +705,7 @@
    1.53      if(_title.size()>0) os << "%%Title: " << _title << '\n';
    1.54       if(_copyright.size()>0) os << "%%Copyright: " << _copyright << '\n';
    1.55  //        << "%%Copyright: XXXX\n"
    1.56 -    os << "%%Creator: LEMON GraphToEps function\n";
    1.57 +    os << "%%Creator: LEMON, graphToEps()\n";
    1.58      
    1.59      {
    1.60        char cbuf[50];
    1.61 @@ -725,10 +728,10 @@
    1.62      if(_scaleToA4)
    1.63        os <<"%%BoundingBox: 0 0 596 842\n%%DocumentPaperSizes: a4\n";
    1.64      else os << "%%BoundingBox: "
    1.65 -	    << bb.left()*  _scale-_xBorder << ' '
    1.66 -	    << bb.bottom()*_scale-_yBorder << ' '
    1.67 -	    << bb.right()* _scale+_xBorder << ' '
    1.68 -	    << bb.top()*   _scale+_yBorder << '\n';
    1.69 +	    << bb.left()   * _scale - _xBorder << ' '
    1.70 +	    << bb.bottom() * _scale - _yBorder << ' '
    1.71 +	    << bb.right()  * _scale + _xBorder << ' '
    1.72 +	    << bb.top()    * _scale + _yBorder << '\n';
    1.73      
    1.74      os << "%%EndComments\n";
    1.75      
    1.76 @@ -865,9 +868,9 @@
    1.77  // 		else t2=(t1+t2)/2;
    1.78  // 	      bez=bez.after((t1+t2)/2);
    1.79  	      os << _edgeWidths[*e]*_edgeWidthScale << " setlinewidth "
    1.80 -		 << _edgeColors[*e].getR() << ' '
    1.81 -		 << _edgeColors[*e].getG() << ' '
    1.82 -		 << _edgeColors[*e].getB() << " setrgbcolor newpath\n"
    1.83 +		 << _edgeColors[*e].red() << ' '
    1.84 +		 << _edgeColors[*e].green() << ' '
    1.85 +		 << _edgeColors[*e].blue() << " setrgbcolor newpath\n"
    1.86  		 << bez.p1.x << ' ' <<  bez.p1.y << " moveto\n"
    1.87  		 << bez.p2.x << ' ' << bez.p2.y << ' '
    1.88  		 << bez.p3.x << ' ' << bez.p3.y << ' '
    1.89 @@ -885,9 +888,9 @@
    1.90  		 << mm.x << ' ' << mm.y << ' '
    1.91  		 << _coords[g.target(*e)].x << ' '
    1.92  		 << _coords[g.target(*e)].y << ' '
    1.93 -		 << _edgeColors[*e].getR() << ' '
    1.94 -		 << _edgeColors[*e].getG() << ' '
    1.95 -		 << _edgeColors[*e].getB() << ' '
    1.96 +		 << _edgeColors[*e].red() << ' '
    1.97 +		 << _edgeColors[*e].green() << ' '
    1.98 +		 << _edgeColors[*e].blue() << ' '
    1.99  		 << _edgeWidths[*e]*_edgeWidthScale << " lb\n";
   1.100  	    }
   1.101  	    sw+=_edgeWidths[*e]*_edgeWidthScale/2.0+_parEdgeDist;
   1.102 @@ -912,17 +915,17 @@
   1.103  	       << d.x << ' ' << d.y << ' '
   1.104  	       << _coords[g.source(e)].x << ' '
   1.105  	       << _coords[g.source(e)].y << ' '
   1.106 -	       << _edgeColors[e].getR() << ' '
   1.107 -	       << _edgeColors[e].getG() << ' '
   1.108 -	       << _edgeColors[e].getB() << " arr\n";
   1.109 +	       << _edgeColors[e].red() << ' '
   1.110 +	       << _edgeColors[e].green() << ' '
   1.111 +	       << _edgeColors[e].blue() << " arr\n";
   1.112  	  }
   1.113  	  else os << _coords[g.source(e)].x << ' '
   1.114  		  << _coords[g.source(e)].y << ' '
   1.115  		  << _coords[g.target(e)].x << ' '
   1.116  		  << _coords[g.target(e)].y << ' '
   1.117 -		  << _edgeColors[e].getR() << ' '
   1.118 -		  << _edgeColors[e].getG() << ' '
   1.119 -		  << _edgeColors[e].getB() << ' '
   1.120 +		  << _edgeColors[e].red() << ' '
   1.121 +		  << _edgeColors[e].green() << ' '
   1.122 +		  << _edgeColors[e].blue() << ' '
   1.123  		  << _edgeWidths[e]*_edgeWidthScale << " l\n";
   1.124        os << "grestore\n";
   1.125      }
   1.126 @@ -931,9 +934,9 @@
   1.127        for(NodeIt n(g);n!=INVALID;++n) {
   1.128  	os << _coords[n].x << ' ' << _coords[n].y << ' '
   1.129  	   << _nodeSizes[n]*_nodeScale << ' '
   1.130 -	   << _nodeColors[n].getR() << ' '
   1.131 -	   << _nodeColors[n].getG() << ' '
   1.132 -	   << _nodeColors[n].getB() << ' ';
   1.133 +	   << _nodeColors[n].red() << ' '
   1.134 +	   << _nodeColors[n].green() << ' '
   1.135 +	   << _nodeColors[n].blue() << ' ';
   1.136  	switch(_nodeShapes[n]) {
   1.137  	case CIRCLE:
   1.138  	  os<< "nc";break;