[Lemon-commits] [lemon_svn] alpar: r2074 - hugo/trunk/lemon
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:49:56 CET 2006
Author: alpar
Date: Wed Jul 20 14:13:36 2005
New Revision: 2074
Modified:
hugo/trunk/lemon/graph_to_eps.h
Log:
- spellcheck in doc
- getR(),getG(),getB() -> red(),green(),blue()
- reformatting
Modified: hugo/trunk/lemon/graph_to_eps.h
==============================================================================
--- hugo/trunk/lemon/graph_to_eps.h (original)
+++ hugo/trunk/lemon/graph_to_eps.h Wed Jul 20 14:13:36 2005
@@ -55,14 +55,17 @@
///Constructor
Color(double r,double g,double b) :_r(r),_g(g),_b(b) {};
///Returns the red component
-
- ///\todo \c red() could be a better name...
- ///
- double getR() const {return _r;}
+ double & red() {return _r;}
+ ///Returns the red component
+ const double & red() const {return _r;}
///Returns the green component
- double getG() const {return _g;}
+ double & green() {return _g;}
+ ///Returns the green component
+ const double & green() const {return _g;}
+ ///Returns the blue component
+ double & blue() {return _b;}
///Returns the blue component
- double getB() const {return _b;}
+ const double & blue() const {return _b;}
///Set the color components
void set(double r,double g,double b) { _r=r;_g=g;_b=b; };
};
@@ -156,13 +159,13 @@
///as it is possible.
inline Color distantColor(const Color &c)
{
- return Color(c.getR()<.5?1:0,c.getG()<.5?1:0,c.getB()<.5?1:0);
+ return Color(c.red()<.5?1:0,c.green()<.5?1:0,c.blue()<.5?1:0);
}
///Returns black for light colors and white for the dark ones.
///Returns black for light colors and white for the dark ones.
inline Color distantBW(const Color &c){
- double v=(.2125*c.getR()+.7154*c.getG()+.0721*c.getB())<.5?1:0;
+ double v=(.2125*c.red()+.7154*c.green()+.0721*c.blue())<.5?1:0;
return Color(v,v,v);
}
@@ -393,7 +396,7 @@
static std::string psOut(const Color &c)
{
std::ostringstream os;
- os << c.getR() << ' ' << c.getG() << ' ' << c.getB();
+ os << c.red() << ' ' << c.green() << ' ' << c.blue();
return os.str();
}
@@ -702,7 +705,7 @@
if(_title.size()>0) os << "%%Title: " << _title << '\n';
if(_copyright.size()>0) os << "%%Copyright: " << _copyright << '\n';
// << "%%Copyright: XXXX\n"
- os << "%%Creator: LEMON GraphToEps function\n";
+ os << "%%Creator: LEMON, graphToEps()\n";
{
char cbuf[50];
@@ -725,10 +728,10 @@
if(_scaleToA4)
os <<"%%BoundingBox: 0 0 596 842\n%%DocumentPaperSizes: a4\n";
else os << "%%BoundingBox: "
- << bb.left()* _scale-_xBorder << ' '
- << bb.bottom()*_scale-_yBorder << ' '
- << bb.right()* _scale+_xBorder << ' '
- << bb.top()* _scale+_yBorder << '\n';
+ << bb.left() * _scale - _xBorder << ' '
+ << bb.bottom() * _scale - _yBorder << ' '
+ << bb.right() * _scale + _xBorder << ' '
+ << bb.top() * _scale + _yBorder << '\n';
os << "%%EndComments\n";
@@ -865,9 +868,9 @@
// else t2=(t1+t2)/2;
// bez=bez.after((t1+t2)/2);
os << _edgeWidths[*e]*_edgeWidthScale << " setlinewidth "
- << _edgeColors[*e].getR() << ' '
- << _edgeColors[*e].getG() << ' '
- << _edgeColors[*e].getB() << " setrgbcolor newpath\n"
+ << _edgeColors[*e].red() << ' '
+ << _edgeColors[*e].green() << ' '
+ << _edgeColors[*e].blue() << " setrgbcolor newpath\n"
<< bez.p1.x << ' ' << bez.p1.y << " moveto\n"
<< bez.p2.x << ' ' << bez.p2.y << ' '
<< bez.p3.x << ' ' << bez.p3.y << ' '
@@ -885,9 +888,9 @@
<< mm.x << ' ' << mm.y << ' '
<< _coords[g.target(*e)].x << ' '
<< _coords[g.target(*e)].y << ' '
- << _edgeColors[*e].getR() << ' '
- << _edgeColors[*e].getG() << ' '
- << _edgeColors[*e].getB() << ' '
+ << _edgeColors[*e].red() << ' '
+ << _edgeColors[*e].green() << ' '
+ << _edgeColors[*e].blue() << ' '
<< _edgeWidths[*e]*_edgeWidthScale << " lb\n";
}
sw+=_edgeWidths[*e]*_edgeWidthScale/2.0+_parEdgeDist;
@@ -912,17 +915,17 @@
<< d.x << ' ' << d.y << ' '
<< _coords[g.source(e)].x << ' '
<< _coords[g.source(e)].y << ' '
- << _edgeColors[e].getR() << ' '
- << _edgeColors[e].getG() << ' '
- << _edgeColors[e].getB() << " arr\n";
+ << _edgeColors[e].red() << ' '
+ << _edgeColors[e].green() << ' '
+ << _edgeColors[e].blue() << " arr\n";
}
else os << _coords[g.source(e)].x << ' '
<< _coords[g.source(e)].y << ' '
<< _coords[g.target(e)].x << ' '
<< _coords[g.target(e)].y << ' '
- << _edgeColors[e].getR() << ' '
- << _edgeColors[e].getG() << ' '
- << _edgeColors[e].getB() << ' '
+ << _edgeColors[e].red() << ' '
+ << _edgeColors[e].green() << ' '
+ << _edgeColors[e].blue() << ' '
<< _edgeWidths[e]*_edgeWidthScale << " l\n";
os << "grestore\n";
}
@@ -931,9 +934,9 @@
for(NodeIt n(g);n!=INVALID;++n) {
os << _coords[n].x << ' ' << _coords[n].y << ' '
<< _nodeSizes[n]*_nodeScale << ' '
- << _nodeColors[n].getR() << ' '
- << _nodeColors[n].getG() << ' '
- << _nodeColors[n].getB() << ' ';
+ << _nodeColors[n].red() << ' '
+ << _nodeColors[n].green() << ' '
+ << _nodeColors[n].blue() << ' ';
switch(_nodeShapes[n]) {
case CIRCLE:
os<< "nc";break;
More information about the Lemon-commits
mailing list