/*!
Return minimal deviation value.
*/
-double Plot2d_Point::minDeviation() const {
- if(hasDeviation())
- return deviationPtr[0];
- return 0.;
+bool Plot2d_Point::minDeviation(double& min) const {
+ if(hasDeviation()) {
+ min = deviationPtr[0];
+ return true;
+ }
+ return false;
}
/*!
Return minimal deviation value.
*/
-double Plot2d_Point::maxDeviation() const {
- if(hasDeviation())
- return deviationPtr[1];
- return 0.;
+bool Plot2d_Point::maxDeviation(double& max) const {
+ if(hasDeviation()) {
+ max = deviationPtr[1];
+ return true;
+ }
+ return false;
}
bool hasDeviation() const;
void setDeviation(double min, double max);
void clearDeviation();
- double minDeviation() const;
- double maxDeviation() const;
+ bool minDeviation(double& min) const;
+ bool maxDeviation(double& max) const;
};
typedef QList<Plot2d_Point> pointList;
double aMinY = 1e150;
pointList::const_iterator aIt;
double coeff = 0.0;
- for (aIt = myPoints.begin(); aIt != myPoints.end(); ++aIt) {
- coeff = (*aIt).minDeviation();
- aMinY = qMin( aMinY, myScale * (*aIt).y - coeff );
+ for (aIt = myPoints.begin(); aIt != myPoints.end(); ++aIt) {
+ aMinY = qMin( aMinY, myScale * (*aIt).y );
+ if((*aIt).minDeviation(coeff))
+ aMinY = qMin( aMinY, coeff );
}
return aMinY;
}
pointList::const_iterator aIt;
double coeff = 0.0;
for (aIt = myPoints.begin(); aIt != myPoints.end(); ++aIt) {
- coeff = (*aIt).maxDeviation();
- aMaxY = qMax( aMaxY, myScale * (*aIt).y + coeff );
+ aMaxY = qMax( aMaxY, myScale * (*aIt).y);
+ if((*aIt).maxDeviation(coeff))
+ aMaxY = qMax( aMaxY, coeff);
}
return aMaxY;
}
\ No newline at end of file
xi = x(i);
yi = y(i);
xp = xMap.transform(xi);
- ytop = yMap.transform(yi + max);
- ybtm = yMap.transform(yi - min);
+ ytop = yMap.transform(max);
+ ybtm = yMap.transform(min);
tickl = xp - tickSz;
tickr = xp + tickSz;
painter->drawLine(tickl,ytop,tickr,ytop);