From a74fa37950477b51d8352bdb1c6273a91b348aac Mon Sep 17 00:00:00 2001 From: rnv Date: Tue, 24 Apr 2012 13:55:03 +0000 Subject: [PATCH] Fix for the bug IPAL22911 TC6.5.0: Problem with the curve normalization . --- src/Plot2d/Plot2d.cxx | 4 ++++ src/Plot2d/Plot2d_Curve.cxx | 10 ++++------ src/Plot2d/Plot2d_PlotItems.cxx | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Plot2d/Plot2d.cxx b/src/Plot2d/Plot2d.cxx index 57b6c178c..4737c228b 100755 --- a/src/Plot2d/Plot2d.cxx +++ b/src/Plot2d/Plot2d.cxx @@ -102,6 +102,8 @@ bool Plot2d_Point::minDeviation(double& min) const { if(hasDeviation()) { min = deviationPtr[0]; return true; + } else { + min = 0; } return false; } @@ -113,6 +115,8 @@ bool Plot2d_Point::maxDeviation(double& max) const { if(hasDeviation()) { max = deviationPtr[1]; return true; + } else { + max = 0; } return false; } diff --git a/src/Plot2d/Plot2d_Curve.cxx b/src/Plot2d/Plot2d_Curve.cxx index be7caa90d..0aae4b04e 100755 --- a/src/Plot2d/Plot2d_Curve.cxx +++ b/src/Plot2d/Plot2d_Curve.cxx @@ -339,9 +339,8 @@ double Plot2d_Curve::getMinY() const pointList::const_iterator aIt; double coeff = 0.0; for (aIt = myPoints.begin(); aIt != myPoints.end(); ++aIt) { - aMinY = qMin( aMinY, myScale * (*aIt).y ); - if((*aIt).minDeviation(coeff)) - aMinY = qMin( aMinY, coeff ); + (*aIt).minDeviation(coeff); + aMinY = qMin( aMinY, myScale * (*aIt).y - coeff); } return aMinY; } @@ -355,9 +354,8 @@ double Plot2d_Curve::getMaxY() const pointList::const_iterator aIt; double coeff = 0.0; for (aIt = myPoints.begin(); aIt != myPoints.end(); ++aIt) { - aMaxY = qMax( aMaxY, myScale * (*aIt).y); - if((*aIt).maxDeviation(coeff)) - aMaxY = qMax( aMaxY, coeff); + (*aIt).maxDeviation(coeff); + aMaxY = qMax( aMaxY, myScale * (*aIt).y + coeff); } return aMaxY; } diff --git a/src/Plot2d/Plot2d_PlotItems.cxx b/src/Plot2d/Plot2d_PlotItems.cxx index 24871dc8d..95a2d2def 100644 --- a/src/Plot2d/Plot2d_PlotItems.cxx +++ b/src/Plot2d/Plot2d_PlotItems.cxx @@ -324,8 +324,8 @@ void Plot2d_QwtPlotCurve::draw(QPainter *painter, xi = x(i); yi = y(i); xp = xMap.transform(xi); - ytop = yMap.transform(max); - ybtm = yMap.transform(min); + ytop = yMap.transform(yi + max); + ybtm = yMap.transform(yi - min); tickl = xp - tickSz; tickr = xp + tickSz; painter->drawLine(tickl,ytop,tickr,ytop); -- 2.39.2