[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Fri Jul 16 23:09:08 CEST 2004


CVS commit by arwalker: 

Add the parameter names for a fit from the Parameters vector. At present this is not generic. If there is a rationale for the generic case then it can be simply added. The only problem would be pulling out the parameter names for more than one vector. The best solution would probably be add to another name to the parameterName( ... ) method giving the desired vector index or vector name.


  M +27 -0     kstplugin.cpp   1.54


--- kdeextragear-2/kst/kst/kstplugin.cpp  #1.53:1.54
@@ -254,4 +254,31 @@ KstObject::UpdateType KstPlugin::update(
   }
 
+  //
+  // if we have a fit plugin then create the necessary scalars from the parameter vector...
+  //
+  if( _plugin->data()._isFit ) {
+    KstVectorPtr  vectorParam;
+    QString       strParamName;
+    QString       strScalarName;
+    double        dScalarValue;
+    int           i;
+
+    vectorParam = _outputVectors["Parameters"];
+    if( vectorParam ) {
+      for( i=0; i<vectorParam->length(); i++ ) {
+        strParamName = _plugin->parameterName(i);
+        if( !strParamName.isEmpty() ) {
+          strScalarName = i18n("%1-%2").arg(tagName()).arg(strParamName);
+          dScalarValue = vectorParam->value(i);
+          if (!_outputScalars.contains(strParamName)) {
+            KstScalar *s = new KstScalar(strScalarName);
+            _outputScalars.insert(strParamName, s);
+          }
+          _outputScalars[strParamName]->setValue(dScalarValue);
+        }
+      }
+    }
+  }
+  
   CLEANUP();
 #undef CLEANUP





More information about the Kst mailing list