[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Thu Oct 21 18:52:06 CEST 2004


CVS commit by staikos: 

- Generate curve hints for filters automatically
- Inefficiently support filter output in equations


  M +19 -0     enodes.cpp   1.20
  M +7 -0      pluginxmlparser.cpp   1.29


--- kdeextragear-2/kst/kst/enodes.cpp  #1.19:1.20
@@ -352,4 +352,23 @@ double Function::evaluatePlugin(Context 
   }
 
+  if (!_plugin->data()._filterOutputVector.isEmpty()) {
+    int loc = 0;
+    bool found = false;
+    // FIXME: cache this for efficiency
+    const QValueList<Plugin::Data::IOValue>& otable = _plugin->data()._outputs;
+    for (QValueList<Plugin::Data::IOValue>::ConstIterator it = otable.begin(); it != otable.end(); ++it) {
+      if ((*it)._type == Plugin::Data::IOValue::TableType) {
+        if ((*it)._name == _plugin->data()._filterOutputVector) {
+          found = true;
+          break;
+        }
+        loc++;
+      }
+    }
+    if (found) {
+      return ::interpolate(_outVectors[loc], _outArrayLens[loc], ctx->i, ctx->sampleCount);
+    }
+  }
+  
   if (_outputVectorCnt > 0) {
     if (_outVectors[0] && _outArrayLens[0] > 1) {

--- kdeextragear-2/kst/kst/pluginxmlparser.cpp  #1.28:1.29
@@ -19,4 +19,5 @@
 
 #include <kdebug.h>
+#include <klocale.h>
 #include <qfile.h>
 
@@ -216,4 +217,10 @@ QDomNode n = element.firstChild();
       _pluginData._filterInputVector = e.attribute(QS_filter_input);
       _pluginData._filterOutputVector = e.attribute(QS_filter_output);
+      QString n = i18n("Filter Output");
+      QString x = _pluginData._filterInputVector;
+      QString y = _pluginData._filterOutputVector;
+      if (!y.isEmpty() && !x.isEmpty()) {
+        _pluginData._hints.append(Plugin::Data::CurveHint(n, x, y));
+      }
     } else if (tn == QS_author) {
       _pluginData._author = e.attribute(QS_name);





More information about the Kst mailing list