From ac9bc36d6167f776a713736658fe25b2ba521359 Mon Sep 17 00:00:00 2001 From: sln Date: Tue, 31 Oct 2006 07:36:47 +0000 Subject: [PATCH] Merged with BR_L_2_3_5 // Protection against QwtCurve::drawLines() bug in Qwt 0.4.x: // sometimes it crashes (FPE) if draws curve with big abciss or ordinate cooridates // after curve with small values double getMaxX() const; double getMaxY() const; --- src/Plot2d/Plot2d_Curve.cxx | 30 ++++++++++++++++++++++++++++++ src/Plot2d/Plot2d_Curve.h | 6 ++++++ 2 files changed, 36 insertions(+) diff --git a/src/Plot2d/Plot2d_Curve.cxx b/src/Plot2d/Plot2d_Curve.cxx index bec633fdc..3c61680e3 100755 --- a/src/Plot2d/Plot2d_Curve.cxx +++ b/src/Plot2d/Plot2d_Curve.cxx @@ -376,6 +376,21 @@ double Plot2d_Curve::getMinX() const return aMinX; } +/*! + Gets curve's maxiaml abscissa +*/ +double Plot2d_Curve::getMaxX() const +{ + QValueList::const_iterator aIt; + double aMaxX = -1e150; + int aCurrent = 0; + for(aIt = myPoints.begin(); aIt != myPoints.end(); ++aIt) { + if ( (*aIt).x > aMaxX ) + aMaxX = (*aIt).x; + } + return aMaxX; +} + /*! Gets curve's minimal ordinate */ @@ -391,6 +406,21 @@ double Plot2d_Curve::getMinY() const return aMinY; } +/*! + Gets curve's maximal ordinate +*/ +double Plot2d_Curve::getMaxY() const +{ + QValueList::const_iterator aIt; + double aMaxY = -1e150; + int aCurrent = 0; + for(aIt = myPoints.begin(); aIt != myPoints.end(); ++aIt) { + if ( (*aIt).y > aMaxY ) + aMaxY = (*aIt).y; + } + return aMaxY; +} + /*! Changes text assigned to point of curve \param ind -- index of point diff --git a/src/Plot2d/Plot2d_Curve.h b/src/Plot2d/Plot2d_Curve.h index bd3be97bd..b8668b879 100755 --- a/src/Plot2d/Plot2d_Curve.h +++ b/src/Plot2d/Plot2d_Curve.h @@ -91,6 +91,12 @@ public: // non-positive X/Y coordinate double getMinX() const; double getMinY() const; + // Protection against QwtCurve::drawLines() bug in Qwt 0.4.x: + // sometimes it crashes (FPE) if draws curve with big abciss or ordinate cooridates + // after curve with small values + double getMaxX() const; + double getMaxY() const; + protected: bool myAutoAssign; -- 2.39.2