[Kst] branches/work/kst/portto4/kst/src
Barth Netterfield
netterfield at astro.utoronto.ca
Wed Oct 10 13:37:15 UTC 2012
SVN commit 1320033 by netterfield:
Don't purge vectors only used in labels.
Remove some dead code.
M +17 -2 libkstapp/datamanager.cpp
M +3 -0 libkstapp/labelrenderer.cpp
M +0 -17 libkstmath/curve.cpp
M +0 -3 libkstmath/curve.h
M +0 -19 libkstmath/image.cpp
M +0 -3 libkstmath/image.h
M +0 -6 libkstmath/relation.h
--- branches/work/kst/portto4/kst/src/libkstapp/datamanager.cpp #1320032:1320033
@@ -405,6 +405,9 @@
}
}
+// search through all the objects to see what is a dependency of anything shown.
+// FIXME: this is very fragile - objects use objects in all sorts of ways,
+// all which have to be listed here.
void DataManager::setUsedFlags() {
_doc->objectStore()->clearUsedFlags();
@@ -417,17 +420,29 @@
relation->setUsed(true);
}
}
+ if (plot->xAxis()->axisPlotMarkers().isCurveSource()) {
+ plot->xAxis()->axisPlotMarkers().curve()->setUsed(true);
}
+ if (plot->yAxis()->axisPlotMarkers().isCurveSource()) {
+ plot->yAxis()->axisPlotMarkers().curve()->setUsed(true);
}
+ if (plot->xAxis()->axisPlotMarkers().isVectorSource()) {
+ plot->xAxis()->axisPlotMarkers().vector()->setUsed(true);
+ }
+ if (plot->yAxis()->axisPlotMarkers().isVectorSource()) {
+ plot->yAxis()->axisPlotMarkers().vector()->setUsed(true);
+ }
+ }
+ }
- // TODO: for each primitive used in an unhidden label mark 'used' - O(N)
QList<LabelItem*> labels = ViewItem::getItems<LabelItem>();
foreach (LabelItem * label, labels) {
+ if (label->_labelRc) {
foreach (Primitive* primitive, label->_labelRc->_refObjects) {
primitive->setUsed(true);
}
- //qDebug() << "label " << label->Name() << "dependencies: " << label->_labelRc->_refObjects.size();
}
+ }
// for each primitive used by a relation mark 'used' - O(N)
ObjectList<Relation> relationList = _doc->objectStore()->getObjects<Relation>();
--- branches/work/kst/portto4/kst/src/libkstapp/labelrenderer.cpp #1320032:1320033
@@ -140,6 +140,9 @@
Kst::VectorPtr vp = Kst::kst_cast<Kst::Vector>(store->retrieveObject(fi->text));
if (vp) {
if (!fi->expression.isEmpty()) {
+ if (cache) {
+ rc.addObject(vp);
+ }
// Parse and evaluate as an equation
bool ok = false;
// FIXME: make more efficient: cache the parsed equation
--- branches/work/kst/portto4/kst/src/libkstmath/curve.cpp #1320032:1320033
@@ -1506,23 +1506,6 @@
}
-DataObjectPtr Curve::providerDataObject() const {
- DataObjectPtr provider = 0L;
- // FIXME: fix this.. I don't know what's going on here
-#if 0
- vectorList.lock().readLock();
- VectorPtr vp = *vectorList.findTag(yVTag().tag()); // FIXME: should use full tag
- vectorList.lock().unlock();
- if (vp) {
- vp->readLock();
- provider = kst_cast<DataObject>(vp->provider());
- vp->unlock();
- }
-#endif
- return provider;
-}
-
-
double Curve::distanceToPoint(double xpos, double dx, double ypos) const {
// find the y distance between the curve and a point. return 1.0E300 if this distance is undefined. i don't want to use -1 because it will make the code which uses this function messy.
VectorPtr xv = *_inputVectors.find(XVECTOR);
--- branches/work/kst/portto4/kst/src/libkstmath/curve.h #1320032:1320033
@@ -153,9 +153,6 @@
// see KstRelation::distanceToPoint
virtual double distanceToPoint(double xpos, double dx, double ypos) const;
- // see KstRelation::providerDataObject
- virtual DataObjectPtr providerDataObject() const;
-
virtual QString descriptionTip() const;
// labels for plots
--- branches/work/kst/portto4/kst/src/libkstmath/image.cpp #1320032:1320033
@@ -397,25 +397,6 @@
}
}
-
-DataObjectPtr Image::providerDataObject() const {
- DataObjectPtr provider = 0L;
- // FIXME: fix this.. I don't know what's going on here
-#if 0
- matrixList.lock().readLock();
- MatrixPtr mp = *matrixList.findTag(matrixTag());
- matrixList.lock().unlock();
- DataObjectPtr provider = 0L;
- if (mp) {
- mp->readLock();
- provider = kst_cast<DataObject>(mp->provider());
- mp->unlock();
- }
-#endif
- return provider;
-}
-
-
double Image::distanceToPoint(double xpos, double dx, double ypos) const {
Q_UNUSED(dx)
// dx is not relevant for double clicks on images - clicks must be inside the image
--- branches/work/kst/portto4/kst/src/libkstmath/image.h #1320032:1320033
@@ -100,9 +100,6 @@
virtual RelationPtr makeDuplicate() const;
- // see KstRelation::providerDataObject
- virtual DataObjectPtr providerDataObject() const;
-
// see KstRelation::distanceToPoint
virtual double distanceToPoint(double xpos, double dx, double ypos) const;
--- branches/work/kst/portto4/kst/src/libkstmath/relation.h #1320032:1320033
@@ -114,12 +114,6 @@
virtual bool uses(ObjectPtr p) const;
- // this returns the data object providing the data for this basecurve.
- // E.g. for VCurves, it returns the data object providing the y vector
- // E.g. for Images, it returns the data object providing the matrix
- // Null is returned if no provider exists
- virtual DataObjectPtr providerDataObject() const = 0;
-
// return closest distance to the given point
// images always return a rating >= 5
virtual double distanceToPoint(double xpos, double dx, double ypos) const = 0;
More information about the Kst
mailing list