[Kst] kdeextragear-2/kst/kst
Andrew Walker
arwalker at sumusltd.com
Tue Aug 10 01:08:03 CEST 2004
CVS commit by arwalker:
Fix for 86869
M +59 -26 kst2dplot.cpp 1.217
M +1 -1 kst2dplot.h 1.88
--- kdeextragear-2/kst/kst/kst2dplot.cpp #1.216:1.217
@@ -452,31 +452,56 @@ void Kst2DPlot::setYLabel(const QString&
-void Kst2DPlot::checkRange(double &min_in, double &max_in) {
+bool Kst2DPlot::checkRange(double &min_in, double &max_in, bool bIsLog) {
double diff = fabs(1000.0 * min_in) * DBL_EPSILON;
+ bool rc = true;
- if (max_in <= min_in + diff) {
+ if (bIsLog) {
+ if (isnan(pow(10.0,min_in)) || isnan(pow(10.0,max_in)) ||
+ isinf(pow(10.0,min_in)) || isinf(pow(10.0,max_in))) {
+ rc = false;
+ }
+ } else if (isnan(min_in) || isnan(max_in) ||
+ isinf(min_in) || isinf(max_in)) {
+ rc = false;
+ }
+
+ if (rc && max_in <= min_in + diff) {
max_in = min_in + diff;
}
+
+ return rc;
}
bool Kst2DPlot::setXScale(double xmin_in, double xmax_in) {
- checkRange(xmin_in, xmax_in);
+ bool rc = false;
+
+ if (checkRange(xmin_in, xmax_in, _xLog)) {
XMax = xmax_in;
XMin = xmin_in;
- return true;
+ rc = true;
+ }
+
+ return rc;
}
bool Kst2DPlot::setYScale(double ymin_in, double ymax_in) {
- checkRange(ymin_in, ymax_in);
+ bool rc = false;
+
+ if (checkRange(ymin_in, ymax_in, _yLog)) {
YMax = ymax_in;
YMin = ymin_in;
- return true;
+ rc = true;
+ }
+
+ return rc;
}
bool Kst2DPlot::setLXScale(double xmin_in, double xmax_in) {
- checkRange(xmin_in, xmax_in);
+ bool rc = false;
+
+ if (checkRange(xmin_in, xmax_in, _xLog)) {
if (_xLog) {
XMax = pow(10.0, xmax_in);
@@ -486,10 +511,15 @@ bool Kst2DPlot::setLXScale(double xmin_i
XMin = xmin_in;
}
- return true;
+ rc = true;
+ }
+
+ return rc;
}
bool Kst2DPlot::setLYScale(double ymin_in, double ymax_in) {
- checkRange(ymin_in, ymax_in);
+ bool rc = false;
+
+ if (checkRange(ymin_in, ymax_in, _yLog)) {
if (_yLog) {
YMax = pow(10.0, ymax_in);
@@ -499,5 +529,8 @@ bool Kst2DPlot::setLYScale(double ymin_i
YMin = ymin_in;
}
- return true;
+ rc = true;
+ }
+
+ return rc;
}
--- kdeextragear-2/kst/kst/kst2dplot.h #1.87:1.88
@@ -71,5 +71,5 @@ public:
static Kst2DPlotList globalPlotList();
- static void checkRange(double &min_in, double &max_in);
+ static bool checkRange(double &min_in, double &max_in, bool bIsLog);
static void genAxisTickLabelFullPrecision(QString& label, double z, bool isLog);
static void genAxisTickLabelDifference(QString& label, double zbase, double zvalue, bool isLog);
More information about the Kst
mailing list