Oh - and also don't purge curves and vectors used as plot markers.<br><br><div class="gmail_quote">On Wed, Oct 10, 2012 at 9:37 AM, Barth Netterfield <span dir="ltr"><<a href="mailto:netterfield@astro.utoronto.ca" target="_blank">netterfield@astro.utoronto.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">SVN commit 1320033 by netterfield:<br>
<br>
Don't purge vectors only used in labels.<br>
<br>
Remove some dead code.<br>
<br>
<br>
M +17 -2 libkstapp/datamanager.cpp<br>
M +3 -0 libkstapp/labelrenderer.cpp<br>
M +0 -17 libkstmath/curve.cpp<br>
M +0 -3 libkstmath/curve.h<br>
M +0 -19 libkstmath/image.cpp<br>
M +0 -3 libkstmath/image.h<br>
M +0 -6 libkstmath/relation.h<br>
<br>
<br>
--- branches/work/kst/portto4/kst/src/libkstapp/datamanager.cpp #1320032:1320033<br>
@@ -405,6 +405,9 @@<br>
}<br>
}<br>
<br>
+// search through all the objects to see what is a dependency of anything shown.<br>
+// FIXME: this is very fragile - objects use objects in all sorts of ways,<br>
+// all which have to be listed here.<br>
void DataManager::setUsedFlags() {<br>
_doc->objectStore()->clearUsedFlags();<br>
<br>
@@ -417,17 +420,29 @@<br>
relation->setUsed(true);<br>
}<br>
}<br>
+ if (plot->xAxis()->axisPlotMarkers().isCurveSource()) {<br>
+ plot->xAxis()->axisPlotMarkers().curve()->setUsed(true);<br>
}<br>
+ if (plot->yAxis()->axisPlotMarkers().isCurveSource()) {<br>
+ plot->yAxis()->axisPlotMarkers().curve()->setUsed(true);<br>
}<br>
+ if (plot->xAxis()->axisPlotMarkers().isVectorSource()) {<br>
+ plot->xAxis()->axisPlotMarkers().vector()->setUsed(true);<br>
+ }<br>
+ if (plot->yAxis()->axisPlotMarkers().isVectorSource()) {<br>
+ plot->yAxis()->axisPlotMarkers().vector()->setUsed(true);<br>
+ }<br>
+ }<br>
+ }<br>
<br>
- // TODO: for each primitive used in an unhidden label mark 'used' - O(N)<br>
QList<LabelItem*> labels = ViewItem::getItems<LabelItem>();<br>
foreach (LabelItem * label, labels) {<br>
+ if (label->_labelRc) {<br>
foreach (Primitive* primitive, label->_labelRc->_refObjects) {<br>
primitive->setUsed(true);<br>
}<br>
- //qDebug() << "label " << label->Name() << "dependencies: " << label->_labelRc->_refObjects.size();<br>
}<br>
+ }<br>
<br>
// for each primitive used by a relation mark 'used' - O(N)<br>
ObjectList<Relation> relationList = _doc->objectStore()->getObjects<Relation>();<br>
--- branches/work/kst/portto4/kst/src/libkstapp/labelrenderer.cpp #1320032:1320033<br>
@@ -140,6 +140,9 @@<br>
Kst::VectorPtr vp = Kst::kst_cast<Kst::Vector>(store->retrieveObject(fi->text));<br>
if (vp) {<br>
if (!fi->expression.isEmpty()) {<br>
+ if (cache) {<br>
+ rc.addObject(vp);<br>
+ }<br>
// Parse and evaluate as an equation<br>
bool ok = false;<br>
// FIXME: make more efficient: cache the parsed equation<br>
--- branches/work/kst/portto4/kst/src/libkstmath/curve.cpp #1320032:1320033<br>
@@ -1506,23 +1506,6 @@<br>
}<br>
<br>
<br>
-DataObjectPtr Curve::providerDataObject() const {<br>
- DataObjectPtr provider = 0L;<br>
- // FIXME: fix this.. I don't know what's going on here<br>
-#if 0<br>
- vectorList.lock().readLock();<br>
- VectorPtr vp = *vectorList.findTag(yVTag().tag()); // FIXME: should use full tag<br>
- vectorList.lock().unlock();<br>
- if (vp) {<br>
- vp->readLock();<br>
- provider = kst_cast<DataObject>(vp->provider());<br>
- vp->unlock();<br>
- }<br>
-#endif<br>
- return provider;<br>
-}<br>
-<br>
-<br>
double Curve::distanceToPoint(double xpos, double dx, double ypos) const {<br>
// 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.<br>
VectorPtr xv = *_inputVectors.find(XVECTOR);<br>
--- branches/work/kst/portto4/kst/src/libkstmath/curve.h #1320032:1320033<br>
@@ -153,9 +153,6 @@<br>
// see KstRelation::distanceToPoint<br>
virtual double distanceToPoint(double xpos, double dx, double ypos) const;<br>
<br>
- // see KstRelation::providerDataObject<br>
- virtual DataObjectPtr providerDataObject() const;<br>
-<br>
virtual QString descriptionTip() const;<br>
<br>
// labels for plots<br>
--- branches/work/kst/portto4/kst/src/libkstmath/image.cpp #1320032:1320033<br>
@@ -397,25 +397,6 @@<br>
}<br>
}<br>
<br>
-<br>
-DataObjectPtr Image::providerDataObject() const {<br>
- DataObjectPtr provider = 0L;<br>
- // FIXME: fix this.. I don't know what's going on here<br>
-#if 0<br>
- matrixList.lock().readLock();<br>
- MatrixPtr mp = *matrixList.findTag(matrixTag());<br>
- matrixList.lock().unlock();<br>
- DataObjectPtr provider = 0L;<br>
- if (mp) {<br>
- mp->readLock();<br>
- provider = kst_cast<DataObject>(mp->provider());<br>
- mp->unlock();<br>
- }<br>
-#endif<br>
- return provider;<br>
-}<br>
-<br>
-<br>
double Image::distanceToPoint(double xpos, double dx, double ypos) const {<br>
Q_UNUSED(dx)<br>
// dx is not relevant for double clicks on images - clicks must be inside the image<br>
--- branches/work/kst/portto4/kst/src/libkstmath/image.h #1320032:1320033<br>
@@ -100,9 +100,6 @@<br>
<br>
virtual RelationPtr makeDuplicate() const;<br>
<br>
- // see KstRelation::providerDataObject<br>
- virtual DataObjectPtr providerDataObject() const;<br>
-<br>
// see KstRelation::distanceToPoint<br>
virtual double distanceToPoint(double xpos, double dx, double ypos) const;<br>
<br>
--- branches/work/kst/portto4/kst/src/libkstmath/relation.h #1320032:1320033<br>
@@ -114,12 +114,6 @@<br>
<br>
virtual bool uses(ObjectPtr p) const;<br>
<br>
- // this returns the data object providing the data for this basecurve.<br>
- // E.g. for VCurves, it returns the data object providing the y vector<br>
- // E.g. for Images, it returns the data object providing the matrix<br>
- // Null is returned if no provider exists<br>
- virtual DataObjectPtr providerDataObject() const = 0;<br>
-<br>
// return closest distance to the given point<br>
// images always return a rating >= 5<br>
virtual double distanceToPoint(double xpos, double dx, double ypos) const = 0;<br>
_______________________________________________<br>
Kst mailing list<br>
<a href="mailto:Kst@kde.org">Kst@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/kst" target="_blank">https://mail.kde.org/mailman/listinfo/kst</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse;color:rgb(136,136,136)">C. Barth Netterfield<br>University of Toronto<br>416-845-0946</span><div>
<span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse;color:rgb(136,136,136)"><br></span></div><br>