[Kst] branches/work/kst/portto4/kst/src

Barth Netterfield netterfield at astro.utoronto.ca
Thu Apr 19 13:50:53 UTC 2012


SVN commit 1290378 by netterfield:

BUG:295664
Fix zoom y local maximum bug in tied shared axis boxes.


 M  +1 -0      libkst/datasource.h  
 M  +2 -2      libkstapp/plotitem.cpp  
 M  +8 -28     libkstapp/sharedaxisboxitem.cpp  


--- branches/work/kst/portto4/kst/src/libkst/datasource.h #1290377:1290378
@@ -59,6 +59,7 @@
     struct DataInterface
     {
 
+      virtual ~DataInterface() {}
       // read one element
       virtual int read(const QString& name, typename T::ReadInfo&) = 0;
 
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #1290377:1290378
@@ -2686,7 +2686,7 @@
 
 
 void PlotItem::computedRelationalMax(qreal &minimum, qreal &maximum) {
-  QRectF rect;
+  //QRectF rect;
   foreach (PlotRenderItem *renderer, renderItems()) {
     foreach (RelationPtr relation, renderer->relationList()) {
       if (relation->ignoreAutoScale())
@@ -2711,7 +2711,7 @@
 
 
 void PlotItem::computeBorder(Qt::Orientation orientation, qreal &minimum, qreal &maximum) const {
-  QRectF rect;
+  //QRectF rect;
   foreach (PlotRenderItem *renderer, renderItems()) {
     qreal min = maximum;
     qreal max = minimum;
--- branches/work/kst/portto4/kst/src/libkstapp/sharedaxisboxitem.cpp #1290377:1290378
@@ -825,44 +825,23 @@
 
 
 void SharedAxisBoxItem::zoomYLocalMaximum(PlotItem* originPlotItem) {
-
-  bool origin_tied = false;
-  if (originPlotItem) {
-    origin_tied = originPlotItem->isTiedZoom();
+  if (!originPlotItem) {
+    originPlotItem = keyPlot();
   }
 
-  if (!(_shareY || origin_tied)) {
-
+  _yAxisZoomMode = PlotAxis::FixedExpression;
     if (originPlotItem) {
       originPlotItem->zoomYLocalMaximum(true);
-    }
-  } else {
-    QRectF computedRect;
-    foreach(PlotItem *plotItem, getSharedPlots()) {
-      qreal minimum = plotItem->yAxis()->axisLog() ? 0.0 : -0.1;
-      qreal maximum = 0.1;
-      plotItem->computedRelationalMax(minimum, maximum);
-      plotItem->computeBorder(Qt::Vertical, minimum, maximum);
+    if (originPlotItem->isTiedZoom() && originPlotItem->isInSharedAxisBox() && (originPlotItem->sharedAxisBox() == this)) {
+      QList<PlotItem*> plotTied = PlotItemManager::tiedZoomPlotsForView(view());
 
-      QRectF compute = plotItem->projectionRect();
-      compute.setTop(minimum);
-      compute.setBottom(maximum);
-
-      if (computedRect.isValid()) {
-        computedRect = computedRect.united(compute);
-      } else {
-        computedRect = compute;
+      foreach(PlotItem* plotItem, plotTied) {
+        plotItem->zoomYLocalMaximum(true);
       }
     }
-    _yAxisZoomMode = PlotAxis::FixedExpression;
-    if (originPlotItem) {
-      originPlotItem->zoomYLocalMaximum(true);
     }
-    applyZoom(computedRect, originPlotItem, false, true);
   }
-}
 
-
 void SharedAxisBoxItem::zoomYMaximum(PlotItem* originPlotItem) {
   _yAxisZoomMode = PlotAxis::Auto;
   if (originPlotItem) {
@@ -1114,6 +1093,7 @@
 }
 
 
+
 void SharedAxisBoxItem::updateZoomForDataUpdate(qint64 serial) {
   if (serial == _serialOfLastChange) {
     return;


More information about the Kst mailing list