COIN-OR::LEMON - Graph Library

Changeset 1575:438bc5defad1 in lemon-0.x


Ignore:
Timestamp:
07/20/05 14:13:36 (19 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2074
Message:
  • spellcheck in doc
  • getR(),getG(),getB() -> red(),green(),blue()
  • reformatting
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/graph_to_eps.h

    r1574 r1575  
    5656  Color(double r,double g,double b) :_r(r),_g(g),_b(b) {};
    5757  ///Returns the red component
    58  
    59   ///\todo \c red() could be a better name...
    60   ///
    61   double getR() const {return _r;}
     58  double & red() {return _r;}
     59  ///Returns the red component
     60  const double & red() const {return _r;}
    6261  ///Returns the green component
    63   double getG() const {return _g;}
     62  double & green() {return _g;}
     63  ///Returns the green component
     64  const double & green() const {return _g;}
    6465  ///Returns the blue component
    65   double getB() const {return _b;}
     66  double & blue() {return _b;}
     67  ///Returns the blue component
     68  const double & blue() const {return _b;}
    6669  ///Set the color components
    6770  void set(double r,double g,double b) { _r=r;_g=g;_b=b; };
     
    157160inline Color distantColor(const Color &c)
    158161{
    159   return Color(c.getR()<.5?1:0,c.getG()<.5?1:0,c.getB()<.5?1:0);
     162  return Color(c.red()<.5?1:0,c.green()<.5?1:0,c.blue()<.5?1:0);
    160163}
    161164///Returns black for light colors and white for the dark ones.
     
    163166///Returns black for light colors and white for the dark ones.
    164167inline Color distantBW(const Color &c){
    165   double v=(.2125*c.getR()+.7154*c.getG()+.0721*c.getB())<.5?1:0;
     168  double v=(.2125*c.red()+.7154*c.green()+.0721*c.blue())<.5?1:0;
    166169  return Color(v,v,v);
    167170}
     
    394397    {
    395398      std::ostringstream os;   
    396       os << c.getR() << ' ' << c.getG() << ' ' << c.getB();
     399      os << c.red() << ' ' << c.green() << ' ' << c.blue();
    397400      return os.str();
    398401    }
     
    703706     if(_copyright.size()>0) os << "%%Copyright: " << _copyright << '\n';
    704707//        << "%%Copyright: XXXX\n"
    705     os << "%%Creator: LEMON GraphToEps function\n";
     708    os << "%%Creator: LEMON, graphToEps()\n";
    706709   
    707710    {
     
    726729      os <<"%%BoundingBox: 0 0 596 842\n%%DocumentPaperSizes: a4\n";
    727730    else os << "%%BoundingBox: "
    728             << bb.left()*  _scale-_xBorder << ' '
    729             << bb.bottom()*_scale-_yBorder << ' '
    730             << bb.right()* _scale+_xBorder << ' '
    731             << bb.top()*   _scale+_yBorder << '\n';
     731            << bb.left()   * _scale - _xBorder << ' '
     732            << bb.bottom() * _scale - _yBorder << ' '
     733            << bb.right()  * _scale + _xBorder << ' '
     734            << bb.top()    * _scale + _yBorder << '\n';
    732735   
    733736    os << "%%EndComments\n";
     
    866869//            bez=bez.after((t1+t2)/2);
    867870              os << _edgeWidths[*e]*_edgeWidthScale << " setlinewidth "
    868                  << _edgeColors[*e].getR() << ' '
    869                  << _edgeColors[*e].getG() << ' '
    870                  << _edgeColors[*e].getB() << " setrgbcolor newpath\n"
     871                 << _edgeColors[*e].red() << ' '
     872                 << _edgeColors[*e].green() << ' '
     873                 << _edgeColors[*e].blue() << " setrgbcolor newpath\n"
    871874                 << bez.p1.x << ' ' <<  bez.p1.y << " moveto\n"
    872875                 << bez.p2.x << ' ' << bez.p2.y << ' '
     
    886889                 << _coords[g.target(*e)].x << ' '
    887890                 << _coords[g.target(*e)].y << ' '
    888                  << _edgeColors[*e].getR() << ' '
    889                  << _edgeColors[*e].getG() << ' '
    890                  << _edgeColors[*e].getB() << ' '
     891                 << _edgeColors[*e].red() << ' '
     892                 << _edgeColors[*e].green() << ' '
     893                 << _edgeColors[*e].blue() << ' '
    891894                 << _edgeWidths[*e]*_edgeWidthScale << " lb\n";
    892895            }
     
    913916               << _coords[g.source(e)].x << ' '
    914917               << _coords[g.source(e)].y << ' '
    915                << _edgeColors[e].getR() << ' '
    916                << _edgeColors[e].getG() << ' '
    917                << _edgeColors[e].getB() << " arr\n";
     918               << _edgeColors[e].red() << ' '
     919               << _edgeColors[e].green() << ' '
     920               << _edgeColors[e].blue() << " arr\n";
    918921          }
    919922          else os << _coords[g.source(e)].x << ' '
     
    921924                  << _coords[g.target(e)].x << ' '
    922925                  << _coords[g.target(e)].y << ' '
    923                   << _edgeColors[e].getR() << ' '
    924                   << _edgeColors[e].getG() << ' '
    925                   << _edgeColors[e].getB() << ' '
     926                  << _edgeColors[e].red() << ' '
     927                  << _edgeColors[e].green() << ' '
     928                  << _edgeColors[e].blue() << ' '
    926929                  << _edgeWidths[e]*_edgeWidthScale << " l\n";
    927930      os << "grestore\n";
     
    932935        os << _coords[n].x << ' ' << _coords[n].y << ' '
    933936           << _nodeSizes[n]*_nodeScale << ' '
    934            << _nodeColors[n].getR() << ' '
    935            << _nodeColors[n].getG() << ' '
    936            << _nodeColors[n].getB() << ' ';
     937           << _nodeColors[n].red() << ' '
     938           << _nodeColors[n].green() << ' '
     939           << _nodeColors[n].blue() << ' ';
    937940        switch(_nodeShapes[n]) {
    938941        case CIRCLE:
Note: See TracChangeset for help on using the changeset viewer.