[Kst] extragear/graphics/kst/src/libkst

Nicolas Brisset nicolas.brisset at eurocopter.com
Wed Oct 4 16:42:06 CEST 2006


SVN commit 592357 by brisset:

Add a -First scalar when loading vectors, with the first value of the vector.
I think it would be useful to also add -MinIndex and -MaxIndex scalars, so I'll leave the bug open.
I have just one question: what happens to these scalars when vectors are interpolated ?

CCBUG: 135090



 M  +8 -2      kstvector.cpp  


--- trunk/extragear/graphics/kst/src/libkst/kstvector.cpp #592356:592357
@@ -250,6 +250,8 @@
     sp->_KShared_ref();
     _scalars.insert("last", sp = new KstScalar(tagName() + "-Last", this));
     sp->_KShared_ref();
+    _scalars.insert("first", sp = new KstScalar(tagName() + "-First", this));
+    sp->_KShared_ref();
     _scalars.insert("mean", sp = new KstScalar(tagName() + "-Mean", this));
     sp->_KShared_ref();
     _scalars.insert("sigma", sp = new KstScalar(tagName() + "-Sigma", this));
@@ -272,6 +274,7 @@
     _scalars["max"]->setTagName(tagName() + "-Max");
     _scalars["min"]->setTagName(tagName() + "-Min");
     _scalars["last"]->setTagName(tagName() + "-Last");
+    _scalars["first"]->setTagName(tagName() + "-First");
     _scalars["mean"]->setTagName(tagName() + "-Mean");
     _scalars["sigma"]->setTagName(tagName() + "-Sigma");
     _scalars["rms"]->setTagName(tagName() + "-Rms");
@@ -375,11 +378,11 @@
 
 KstObject::UpdateType KstVector::internalUpdate(KstObject::UpdateType providerRC) {
   int i, i0;
-  double sum, sum2, last, v;
+  double sum, sum2, last, first, v;
   double last_v;
   double dv2 = 0.0, dv, no_spike_max_dv;
   
-  _max = _min = sum = sum2 = _minPos = last = KST::NOPOINT;
+  _max = _min = sum = sum2 = _minPos = last = first = KST::NOPOINT;
   _nsum = 0;
   
   if (_size > 0) {
@@ -398,6 +401,7 @@
         _scalars["min"]->setValue(_min);
         _scalars["minpos"]->setValue(_minPos);
         _scalars["last"]->setValue(last);
+        _scalars["first"]->setValue(first);
       }
       _ns_max = _ns_min = 0;
 
@@ -460,6 +464,7 @@
     _ns_max = _ns_min = last_v = _v[i0];
 
     last = _v[_size-1];
+    first = _v[0];
 
     for (i = i0; i < _size; i++) {
       v = _v[i]; // get rid of redirections
@@ -490,6 +495,7 @@
       _scalars["min"]->setValue(_min);
       _scalars["minpos"]->setValue(_minPos);
       _scalars["last"]->setValue(last);
+      _scalars["first"]->setValue(first);
     }
 
     updateScalars();


More information about the Kst mailing list