[Kst] extragear/graphics/kst/kst
Rick Chern
rchern at interchange.ubc.ca
Tue Jun 28 03:19:43 CEST 2005
SVN commit 429542 by rchern:
Vector stat scalars are considered dependencies too
M +17 -0 kstdataobject.cpp
M +18 -4 kstequation.cpp
M +18 -0 kstvector.cpp
M +2 -0 kstvector.h
--- trunk/extragear/graphics/kst/kst/kstdataobject.cpp #429541:429542
@@ -376,6 +376,15 @@
_inputVectors[j.key()] = newVector;
}
}
+
+ QMap<QString, KstScalarPtr> scalarMap = oldVector->scalars();
+ for (KstScalarMap::Iterator j = _inputScalars.begin(); j != _inputScalars.end(); ++j) {
+ for (QMap<QString, KstScalarPtr>::Iterator k = scalarMap.begin(); k != scalarMap.end(); ++k) {
+ if (k.data() == j.data()) {
+ _inputScalars[j.key()] = (newVector->scalars())[k.key()];
+ }
+ }
+ }
}
@@ -387,6 +396,14 @@
return true;
}
}
+ QMap<QString, KstScalarPtr> scalarMap = v->scalars();
+ for (KstScalarMap::ConstIterator j = _inputScalars.begin(); j != _inputScalars.end(); ++j) {
+ for (QMap<QString, KstScalarPtr>::Iterator k = scalarMap.begin(); k != scalarMap.end(); ++k) {
+ if (k.data() == j.data()) {
+ return true;
+ }
+ }
+ }
} else if (KstDataObjectPtr obj = kst_cast<KstDataObject>(p) ) {
// check all connections from this object to p
for (KstVectorMap::Iterator j = obj->outputVectors().begin(); j != obj->outputVectors().end(); ++j) {
--- trunk/extragear/graphics/kst/kst/kstequation.cpp #429541:429542
@@ -447,7 +447,7 @@
QString newExp = _equation;
- // replace all occurences of outputVectors, outputScalars, and outputStrings from oldObject
+ // replace all occurences of outputVectors, outputScalars from oldObject
for (KstVectorMap::Iterator j = oldObject->outputVectors().begin(); j != oldObject->outputVectors().end(); ++j) {
QString oldTag = j.data()->tagName();
QString newTag = ((newObject->outputVectors())[j.key()])->tagName();
@@ -471,12 +471,26 @@
QString oldTag = oldVector->tagName();
QString newTag = newVector->tagName();
- // replace all occurences of oldTag with newTag
+ // replace all occurences of oldTag with newTag
QString newExp = _equation.replace("["+oldTag+"]", "["+newTag+"]");
+
+ // also replace all occurences of scalar stats for the oldVector
+ QMap<QString, KstScalarPtr> scalarMap = oldVector->scalars();
+ for (QMap<QString, KstScalarPtr>::Iterator k = scalarMap.begin(); k != scalarMap.end(); ++k) {
+ QString oldTag = k.data()->tagName();
+ QString newTag = ((newVector->scalars())[k.key()])->tagName();
+ newExp = newExp.replace("[" + oldTag + "]", "[" + newTag + "]");
+ }
+
setEquation(newExp);
- // do the other dependency replacements
- KstDataObject::replaceDependency(oldVector, newVector);
+ // do the dependency replacements for _inputVectors, but don't call parent function as it
+ // replaces _inputScalars
+ for (KstVectorMap::Iterator j = _inputVectors.begin(); j != _inputVectors.end(); ++j) {
+ if (j.data() == oldVector) {
+ _inputVectors[j.key()] = newVector;
+ }
+ }
}
--- trunk/extragear/graphics/kst/kst/kstvector.cpp #429541:429542
@@ -224,6 +224,24 @@
}
+QMap<QString, KstScalarPtr> KstVector::scalars() const {
+
+ QMap<QString, KstScalarPtr> scalarMap;
+ scalarMap.insert("max", _scalars["max"]);
+ scalarMap.insert("min", _scalars["min"]);
+ scalarMap.insert("last", _scalars["last"]);
+ scalarMap.insert("mean", _scalars["mean"]);
+ scalarMap.insert("sigma", _scalars["sigma"]);
+ scalarMap.insert("rms", _scalars["rms"]);
+ scalarMap.insert("ns", _scalars["ns"]);
+ scalarMap.insert("sum", _scalars["sum"]);
+ scalarMap.insert("sumsquared", _scalars["sumsquared"]);
+ scalarMap.insert("minpos", _scalars["minpos"]);
+
+ return scalarMap;
+}
+
+
double* KstVector::realloced(double *memptr, int newSize) {
double *old = _v;
_v = memptr;
--- trunk/extragear/graphics/kst/kst/kstvector.h #429541:429542
@@ -131,6 +131,8 @@
/** access functions for _isScalarList */
bool isScalarList() const { return _isScalarList; }
+
+ QMap<QString, KstScalarPtr> scalars() const;
KstObjectPtr provider() const { return KstObjectPtr(_provider); }
More information about the Kst
mailing list