[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Tue Jul 15 21:21:42 CEST 2003


CVS commit by staikos: 

- fix equations which were rather broken
- fix a c&p copyright that was never editted


  M +3 -3      kstbasecurve.cpp   1.6
  M +1 -1      kstbasecurve.h   1.9
  M +9 -41     kstequationcurve.cpp   1.30


--- kdeextragear-2/kst/kst/kstbasecurve.cpp  #1.5:1.6
@@ -1,7 +1,7 @@
 /***************************************************************************
-                          kstcurve.cpp: holds info for a curve
+                   kstbasecurve.cpp: base class for a curve
                              -------------------
-    begin                : Fri Nov 3 2000
-    copyright            : (C) 2000 by cbn
+    begin                : June 2003
+    copyright            : (C) 2003 University of Toronto
     email                :
  ***************************************************************************/

--- kdeextragear-2/kst/kst/kstequationcurve.cpp  #1.29:1.30
@@ -157,5 +157,5 @@ void KstEquationCurve::commonConstructor
 
   KstVectorPtr yv = new KstVector(_tag + "-sv", NS);
-  _outputVectors[0] = yv;
+  _outputVectors.append(yv);
   yv->zero();
 
@@ -238,4 +238,8 @@ void KstEquationCurve::setEquation(const
 
 void KstEquationCurve::setExistingXVector(KstVectorPtr in_xv, bool do_interp) {
+  if (_staticX) {
+    KST::vectorList.remove(_inputVectors[0]);
+  }
+
   _inputVectors[0] = in_xv;
 
@@ -245,48 +249,12 @@ void KstEquationCurve::setExistingXVecto
 }
 
-void KstEquationCurve::setStaticXVector(double x0, double x1, int nx) {
-  int i;
-  QString tag;
-  double tx;
-
-  if (nx < 2) {
-    nx = 2;
-  }
-  if (x0 > x1) {
-    tx = x0;
-    x0 = x1;
-    x1 = tx;
-  }
-
-  if (x0 == x1)
-    x1 = x0 + 0.1;
-
-  KstVectorPtr xv;
+void KstEquationCurve::setStaticXVector(double xmin, double xmax, int n) {
   if (_staticX) {
-    xv = _inputVectors[0];
-  } else {
-    xv = new KstVector;
-    _inputVectors[0] = xv;
-  }
-  xv->resize(nx);
-
-  for (i = 0; i < nx; i++) {
-    xv->value()[i] = x0 + double(i) * (x1 - x0) / (nx - 1);
-  }
-
-  tag = "V" + QString::number(KST::vectorList.count()+1) + "-" + "X(" + QString::number(x0) + ".." + QString::number(x1) + ")";
-
-  if (xv->tagName() != tag) {
-    while (KST::vectorList.findTag(tag) != KST::vectorList.end()) {
-      tag += "'";
-    }
+    KST::vectorList.remove(_inputVectors[0]);
   }
-  xv->setTagName(tag);
-  xv->update();
-
   _staticX = true;
-  DoInterp = false;
-  NS = 2; // reset the updating
+  _inputVectors[0] = KstVector::generateVector(xmin, xmax, n, QString::null);
 }
+
 
 QString KstEquationCurve::getYLabel() const {




More information about the Kst mailing list