[Kst] kdeextragear-2/kst/kst

Barth Netterfield netterfield at astro.utoronto.ca
Thu Aug 12 16:04:15 CEST 2004


CVS commit by netterfield: 

Fix for 
Bug 87017: attempting to fit a curve to a psd crashes kst

work toward fixing
Bug 87016: attempting to fit a curve to a histogram crashes kst

BaseCurves now have getXVTag() etc which returns i18n("<None>") if
	they are not defined
The fit dialog now grabs BaseCurves not VCurves, and verifies that
	getXVTag and getYVTag are not <None>.
PSD's now return the proper things in get[XY}VTag().
The PSD's x vector is now the same lenght as the YV as a temp workaround for
Bug 87018 (fit problems)

CCMAIL: 87017-done at bugs.kde.org
CCMAIL: 87016 at bugs.kde.org


  M +7 -2      kstbasecurve.h   1.19
  M +5 -2      kstfitdialog_i.cpp   1.32
  M +6 -7      kstpsdcurve.cpp   1.35
  M +3 -0      kstpsdcurve.h   1.21


--- kdeextragear-2/kst/kst/kstbasecurve.h  #1.18:1.19
@@ -23,4 +23,5 @@
 #include <qstring.h>
 #include <qcolor.h>
+#include <klocale.h>
 
 /**A class for handling curves for kst
@@ -29,5 +30,5 @@
  */
 
-typedef enum {KST_VCURVE, KST_PSDCURVE, KST_EQUATIONCURVE, KST_HISTOGRAM, KST_FITCURVE} KstCurveType;
+typedef enum {KST_VCURVE, KST_PSDCURVE, KST_EQUATIONCURVE, KST_HISTOGRAM} KstCurveType;
 
 class KstBaseCurve: public KstDataObject {
@@ -91,4 +92,8 @@ public:
   virtual int samplesPerFrame() const { return 1; }
   
+  virtual QString getXVTag() const {return i18n("<None>");}
+  virtual QString getYVTag() const {return i18n("<None>");}
+  virtual QString getYETag() const {return i18n("<None>");}
+  virtual QString getXETag() const {return i18n("<None>");}
   KstPoint Point;
 

--- kdeextragear-2/kst/kst/kstfitdialog_i.cpp  #1.31:1.32
@@ -121,6 +121,6 @@ void KstFitDialogI::show_setCurve(const 
                                   const QString& strWindow) {
 
-  KstVCurvePtr  curve;
-  KstVCurveList curves = kstObjectSubList<KstDataObject, KstVCurve>(KST::dataObjectList);
+  KstBaseCurvePtr  curve;
+  KstBaseCurveList curves = kstObjectSubList<KstDataObject, KstBaseCurve>(KST::dataObjectList);
   KstPluginList c = kstObjectSubList<KstDataObject, KstPlugin>(KST::dataObjectList);
   QString new_label;
@@ -136,4 +136,7 @@ void KstFitDialogI::show_setCurve(const 
   }
 
+  if ( _xvector==i18n("<None>") ) return;
+  if ( _yvector==i18n("<None>") ) return;
+
    _tagName->setText(newFitPluginString);
 

--- kdeextragear-2/kst/kst/kstpsdcurve.cpp  #1.34:1.35
@@ -10,5 +10,5 @@
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
+ *   it under the terms of the GNU Geeral Public License as published by  *
  *   the Free Software Foundation; either version 2 of the License, or     *
  *   (at your option) any later version.                                   *
@@ -167,5 +167,5 @@ void KstPSDCurve::commonConstructor(cons
   last_n_new = 0;
 
-  KstVectorPtr iv = new KstVector(in_tag+"-freq", 2);
+  KstVectorPtr iv = new KstVector(in_tag+"-freq", PSDLen);
   KST::addVectorToList(iv);
   _fVector = _outputVectors.insert(FVECTOR, iv);
@@ -221,5 +221,5 @@ KstObject::UpdateType KstPSDCurve::updat
   KstVectorPtr iv = _inputVectors[INVECTOR];
 
-  double *psd;
+  double *psd,  *f;
 
   if (KstObject::checkUpdateCounter(update_counter))
@@ -245,7 +245,9 @@ KstObject::UpdateType KstPSDCurve::updat
 
   psd = (*_sVector)->value();
+  f = (*_fVector)->value();
 
   for (i_samp = 0; i_samp < PSDLen; i_samp++) {
     psd[i_samp] = 0;
+    f[i_samp] = i_samp*0.5*Freq/( PSDLen-1 );
   }
 
@@ -336,8 +338,4 @@ KstObject::UpdateType KstPSDCurve::updat
   MeanX = MaxX/2.0;
 
-  double *f = (*_fVector)->value();
-  f[0] = 0;
-  f[1] = Freq/2.0;
-
   (*_sVector)->update(update_counter);
   (*_fVector)->update(update_counter);
@@ -424,4 +422,5 @@ void KstPSDCurve::_adjustLengths() {
     PSDLen = psdlen;
     (*_sVector)->resize(PSDLen);
+    (*_fVector)->resize(PSDLen);
 
     ALen = PSDLen*2;

--- kdeextragear-2/kst/kst/kstpsdcurve.h  #1.20:1.21
@@ -74,4 +74,7 @@ public:
   virtual void _showDialog();
 
+  virtual QString getXVTag() const {return (*_fVector)->tagName();}
+  virtual QString getYVTag() const {return (*_sVector)->tagName();}
+
 private:
   double Freq;





More information about the Kst mailing list