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

Barth Netterfield netterfield at astro.utoronto.ca
Sun Jun 6 02:10:37 CEST 2010


SVN commit 1134986 by netterfield:

Remove some N^2 behavior in shared axis boxes.
Make 'z' mode in shared axis boxes work in real time mode.



 M  +6 -6      plotitem.cpp  
 M  +5 -1      sharedaxisboxitem.cpp  
 M  +2 -1      sharedaxisboxitem.h  


--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #1134985:1134986
@@ -730,13 +730,14 @@
 
   _serialOfLastChange = serial;
 
+  if (isInSharedAxisBox()) {
+    // Need to update the box's projectionRect.
+    sharedAxisBox()->updateZoomForDataUpdate(serial);
+  }
+
   QRectF compute = computedProjectionRect();
   QRectF newProjectionRec = projectionRect();
 
-  if (isInSharedAxisBox()) {
-    // Need to update the box's projectionRect.
-    sharedAxisBox()->updateZoomForDataUpdate();
-  }
   if ((xAxis()->axisZoomMode() == PlotAxis::Auto) ||
         (xAxis()->axisZoomMode() == PlotAxis::MeanCentered) ||
         (xAxis()->axisZoomMode() == PlotAxis::AutoBorder) ||
@@ -2525,8 +2526,7 @@
 
 
 void PlotItem::setProjectionRect(const QRectF &rect, bool forceAxisUpdate) {
-  if (!(/*_projectionRect == rect ||*/ rect.isEmpty() || !rect.isValid())) {
-
+  if (!(rect.isEmpty() || !rect.isValid())) {
     _projectionRect = rect;
     setPlotBordersDirty(true);
     emit updateAxes();
--- branches/work/kst/portto4/kst/src/libkstapp/sharedaxisboxitem.cpp #1134985:1134986
@@ -1142,7 +1142,11 @@
 }
 
 
-void SharedAxisBoxItem::updateZoomForDataUpdate() {
+void SharedAxisBoxItem::updateZoomForDataUpdate(qint64 serial) {
+  if (serial == _serialOfLastChange) {
+    return;
+  }
+  _serialOfLastChange = serial;
   if (_shareX) {
     switch (xAxisZoomMode()) {
       case PlotAxis::Auto:
--- branches/work/kst/portto4/kst/src/libkstapp/sharedaxisboxitem.h #1134985:1134986
@@ -48,7 +48,7 @@
     PlotAxis::ZoomMode yAxisZoomMode() const { return _yAxisZoomMode; }
     void setYAxisZoomMode(PlotAxis::ZoomMode mode);
 
-    void updateZoomForDataUpdate();
+    void updateZoomForDataUpdate(qint64 serial);
 
     PlotItem* keyPlot() { return _keyPlot; };
 
@@ -118,6 +118,7 @@
     bool _firstPaint;
     bool _dirty;
     bool _shareX, _shareY;
+    qint64 _serialOfLastChange;
 
     PlotAxis::ZoomMode _xAxisZoomMode, _yAxisZoomMode;
 };


More information about the Kst mailing list