[Kst] kdeextragear-2/kst/kst
Andrew Walker
arwalker at sumusltd.com
Mon Oct 25 20:55:34 CEST 2004
CVS commit by arwalker:
Only create data markers for rising edges where the y-value goes from 0 to some +ve vale.
Only create data markers for falling edges where the y-value goes from sonme +ve value to 0.
Previously this was also done for -ve values, which was confusing; as a rising edge marker would be created, for example, for a value changing from 0 to -1.
M +33 -17 kst2dplot.cpp 1.289
--- kdeextragear-2/kst/kst/kst2dplot.cpp #1.288:1.289
@@ -2253,5 +2253,7 @@ void Kst2DPlot::save(QTextStream& ts, co
}
- //save the plot colors, but only if they are different from default
+ //
+ // save the plot colors, but only if they are different from default
+ //
if (_foregroundColor != KstSettings::globalSettings()->foregroundColor) {
ts << indent << "<plotforecolor>" << QStyleSheet::escape(_foregroundColor.name()) << "</plotforecolor>" << endl;
@@ -2261,6 +2263,8 @@ void Kst2DPlot::save(QTextStream& ts, co
}
- //save the plot markers
- //makes sure autogenerated markers are here
+ //
+ // save the plot markers
+ // makes sure autogenerated markers are here
+ //
updateMarkersFromCurve();
for (i = 0; i < _plotMarkers.count(); i++) {
@@ -2273,5 +2277,7 @@ void Kst2DPlot::save(QTextStream& ts, co
}
- //save the image names
+ //
+ // save the image names
+ //
for (i = 0; i < _images.count(); i++) {
ts << indent << "<image>" << _images[i]->tagName() << "</image>" << endl;
@@ -2649,5 +2655,8 @@ bool Kst2DPlot::popupMenu(KPopupMenu *me
submenu->insertItem(i18n("Down"), this, SLOT(menuMoveDown()), Key_Down);
submenu->insertSeparator();
- //disable next or previous marker items if necessary
+
+ //
+ // disable next or previous marker items if necessary
+ //
#ifndef MARKER_NUM_SEGS
#define MARKER_NUM_SEGS 50 //sort of get around rounding errors? Also used in MoveToMarker function
@@ -4535,14 +4544,20 @@ KstBaseCurvePtr Kst2DPlot::curveToMarker
void Kst2DPlot::updateMarkersFromCurve() {
if (hasCurveToMarkers() && _curveToMarkers->sampleCount() > 0) {
- //scan through the whole curve
+ int count = _curveToMarkers->sampleCount();
+
+ if (count > 0) {
double prevX, prevY;
- _curveToMarkers->point(0, prevX, prevY);
- for (int i = 1; i < _curveToMarkers->sampleCount(); i++) {
double curX, curY;
+
+ //
+ // scan through the whole curve
+ //
+ _curveToMarkers->point(0, prevX, prevY);
+ for (int i = 1; i < count; i++) {
_curveToMarkers->point(i, curX, curY);
- if (_curveToMarkersRisingDetect && prevY == 0 && curY != 0) {
+ if (_curveToMarkersRisingDetect && prevY == 0.0 && curY > 0.0) {
setPlotMarker(curX);
}
- if (_curveToMarkersFallingDetect && prevY != 0 && curY == 0) {
+ if (_curveToMarkersFallingDetect && prevY > 0.0 && curY == 0.0) {
setPlotMarker(prevX);
}
@@ -4551,4 +4566,5 @@ void Kst2DPlot::updateMarkersFromCurve()
}
}
+ }
}
More information about the Kst
mailing list