From: ptv Date: Thu, 13 Jul 2006 11:46:13 +0000 (+0000) Subject: extend API X-Git-Tag: For_CTH_V1_1~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=51c86e28083389520dc533088f09e272e928a11a;p=modules%2Fgui.git extend API --- diff --git a/src/Plot2d/Plot2d_Curve.cxx b/src/Plot2d/Plot2d_Curve.cxx index c0a9abbb6..731f332d1 100755 --- a/src/Plot2d/Plot2d_Curve.cxx +++ b/src/Plot2d/Plot2d_Curve.cxx @@ -369,6 +369,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 */ @@ -383,3 +398,18 @@ 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; +} diff --git a/src/Plot2d/Plot2d_Curve.h b/src/Plot2d/Plot2d_Curve.h index b17f7c327..ab2e53abc 100755 --- a/src/Plot2d/Plot2d_Curve.h +++ b/src/Plot2d/Plot2d_Curve.h @@ -87,6 +87,11 @@ 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;