[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Sat Dec 20 06:00:36 CET 2003


CVS commit by staikos: 

Make filters work in the case of a filterset with exactly 1 filter defined,
and only constants for the input scalars.  Fixes to follow, including
save support.  Also seems that a bug in gcc 3.3-prerelease (suse) was
tripped by this code, but I was unable to make a good testcase so far.
Worked around until more can be determined.


  M +1 -1      filterlisteditor.ui.h   1.11
  M +24 -1     kstfilter.cpp   1.4
  M +4 -2      kstfilter.h   1.7
  M +3 -0      kstfilteredvector.cpp   1.4


--- kdeextragear-2/kst/kst/filterlisteditor.ui.h  #1.10:1.11
@@ -245,5 +245,5 @@ void FilterListEditor::applyChanges()
         KSharedPtr<Plugin> pp = PluginCollection::self()->plugin(txt);
         if (pp) {
-            KstFilterPtr fp = new KstFilter;
+            KstFilterPtr fp = new KstFilter();
             fp->setPlugin(pp);
             fp->setTagName(txt);

--- kdeextragear-2/kst/kst/kstfilter.cpp  #1.3:1.4
@@ -18,4 +18,7 @@
 #include "kstfilter.h"
 
+#include <kdebug.h>
+
+#include <assert.h>
 
 KstFilter::KstFilter() : KstPlugin() {
@@ -35,6 +38,25 @@ void KstFilter::apply(const KstVectorPtr
   double *outVector = out->value();
   int outLen = out->length();
+  int scalarCnt = 0;
+
+  assert(_plugin.data());
+
+  const QValueList<Plugin::Data::IOValue>& table = _plugin->data()._inputs;
+  QValueList<Plugin::Data::IOValue>::ConstIterator it;
+  // This might be condensed to _inputScalars.count() but let's be safe for now
+  for (it = table.begin(); it != table.end(); ++it) {
+    if ((*it)._type == Plugin::Data::IOValue::FloatType) {
+      scalarCnt++;
+    }
+  }
+
+  inScalars = new double[scalarCnt];
+  scalarCnt = 0;
+  for (it = table.begin(); it != table.end(); ++it) {
+    if ((*it)._type == Plugin::Data::IOValue::FloatType) {
+      inScalars[scalarCnt++] = _inputScalars[(*it)._name]->value();
+    }
+  }
 
-  // FIXME: set scalars
 
   int rc = plugin()->filter(in->value(), in->length(), inScalars, outVector, &outLen);
@@ -47,4 +69,5 @@ void KstFilter::apply(const KstVectorPtr
 
 bool KstFilter::setPlugin(KSharedPtr<Plugin> plugin) {
+  kdDebug() << "KstFilter: Setting plugin to " << (void*)plugin.data() << endl;
   _plugin = plugin;
   return true;

--- kdeextragear-2/kst/kst/kstfilter.h  #1.6:1.7
@@ -21,9 +21,11 @@
 #include <qstring.h>
 
+#include <kdebug.h>
+
 #include "kstplugin.h"
 
 class KstFilter : public KstPlugin {
   public:
-    KstFilter();
+    explicit KstFilter();
     KstFilter(QDomElement &e);
     virtual ~KstFilter();
@@ -41,5 +43,5 @@ class KstFilterSet : public KstObjectLis
     virtual ~KstFilterSet() {}
 
-    virtual void apply(const KstVectorPtr in, KstVectorPtr out) {
+    void apply(const KstVectorPtr in, KstVectorPtr out) {
       for (Iterator it = begin(); it != end(); ++it) {
         // FIXME: must use temps here

--- kdeextragear-2/kst/kst/kstfilteredvector.cpp  #1.3:1.4
@@ -18,4 +18,7 @@
 #include "kstfilteredvector.h"
 
+#include <kdebug.h>
+
+
 KstFilteredVector::KstFilteredVector(KstVectorPtr parent, KstFilterSetPtr filterSet)
 : KstVector(parent->tagName() + "-" + filterSet->name(), parent->length()), _parent(parent), _filterSet(filterSet) {





More information about the Kst mailing list