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

Barth Netterfield netterfield at astro.utoronto.ca
Fri Jun 12 17:58:14 CEST 2009


SVN commit 980840 by netterfield:

'I' key adjusts image color ranges.



 M  +6 -2      devel-docs/Kst2Specs/Bugs  
 M  +3 -1      devel-docs/Kst2Specs/FixedBugs  
 M  +0 -4      devel-docs/Kst2Specs/Wishlist  
 M  +0 -1      src/libkstapp/imagedialog.h  
 M  +29 -1     src/libkstapp/plotitem.cpp  
 M  +4 -0      src/libkstapp/plotitem.h  


--- branches/work/kst/portto4/kst/devel-docs/Kst2Specs/Bugs #980839:980840
@@ -98,16 +98,20 @@
 
 ---------------------
    1. In the « edit plot item » dialog: the size of this dialog box is not scalable. Problem is that the size is computed with the longest name of all the curves in the plot. And these names can be very long if automatically generated… Maybe I should order a 3rd screen ;)
+
    2. “Configure ASCII file” : -it seems that these settings are not saved as global settings, but for each file ! Such that for my 10^5 files having the same format, I have to define 10^5 the same ascii format. It may be useful to have global settings and to overwrite them with settings stored in the .kst files. Note: I informed him that it was possible to edit manually the kstdatarc file to get the desired result, but a global setting UI has to be provided at some point.
 
    4. Reloading a previously saved kst files seems to forget all the “configure ascii file” settings (in particularly “read fields names from”) so that no vector can be generated because kst tries to read an unknown field! This may explain why the relative path names did not work (see bug reported earlier). In the meantime, it has been confirmed that reloading works with the appropriate kstdatarc file in the right place.
+
    5. For the « kst --help » I first get the message
-
 “Runtime Error! Program: c:\Program\klst\bin\kst.exe This application has requested the runtim to terminate it in an unusual way. Please contact the application’s support team for more information.”
 
 Then kst closes and and I get the help in the console (cygwin) in the windows cmd.exe I don’t get any help…
 
    6. I did not found an option for forcing the use of a specific kstdatarc file. Meaning that now I’m having a kstdatarc in each folder where I want to start kst.
+
    7. Even if I don’t modify anything on a kst file (no click at all) kst always ask for saving the changes on closing.
+
    9. the font resizing does not work so well as in the 1.7. If you resize the windows, the fonts are not resized so well. It may come from the windows fonts. I tried several different fonts but did not succeed to get a clear one. Note: it seems to be somewhat better with the latest changes.
-  10. would it be possible to have the kst file name written in the windows title? (or the current path where you are or something configurable?)
\ No newline at end of file
+  
+10. would it be possible to have the kst file name written in the windows title? (or the current path where you are or something configurable?)
\ No newline at end of file
--- branches/work/kst/portto4/kst/devel-docs/Kst2Specs/FixedBugs #980839:980840
@@ -768,4 +768,6 @@
 plots.  
 This proper fix for this will be part of the logic rework for shared axis as it is related directly to the above 
 bug.
----------------------------
\ No newline at end of file
+---------------------------
+
+'I' key in a plot with an image should adjust the image color scale; see 1.x for correct behavior.
--- branches/work/kst/portto4/kst/devel-docs/Kst2Specs/Wishlist #980839:980840
@@ -4,10 +4,6 @@
 
 ---------
 
-'I' key in a plot with an image should adjust the image color scale; see 1.x for correct behavior.  Consider <shift>I as doing smaller steps.
-
----------
-
 Easier way to specify reversed axis when loading sky images:
   -can desire to reverse be gleaned from the fits image?
   -command line option?
--- branches/work/kst/portto4/kst/src/libkstapp/imagedialog.h #980839:980840
@@ -112,7 +112,6 @@
     void setMatrix(MatrixPtr matrix);
 
   protected:
-//     virtual QString tagString() const;
     virtual ObjectPtr createNewDataObject();
     virtual ObjectPtr editExistingDataObject() const;
 
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #980839:980840
@@ -14,6 +14,8 @@
 #include "plotitemmanager.h"
 #include "plotrenderitem.h"
 
+#include "image.h"
+
 #include "layoutboxitem.h"
 #include "viewgridlayout.h"
 #include "debug.h"
@@ -88,7 +90,8 @@
   _fitMenu(0),
   _sharedBox(0),
   _axisLabelsDirty(true),
-  _plotPixmapDirty(true)
+  _plotPixmapDirty(true),
+  _i_per(0)
 {
 
   setTypeName("Plot");
@@ -348,6 +351,11 @@
   registerShortcut(_zoomLogY);
   connect(_zoomLogY, SIGNAL(triggered()), this, SLOT(zoomLogY()));
 
+  _adjustImageColorscale = new QAction(tr("Ajust Image Color Scale"), this);
+  _adjustImageColorscale->setShortcut(Qt::Key_I);
+  registerShortcut(_adjustImageColorscale);
+  connect(_adjustImageColorscale, SIGNAL(triggered()), this, SLOT(adjustImageColorScale()));
+
   createZoomMenu();
 
   _plotMaximize = new QAction(tr("Maximize Plot"), this);
@@ -355,6 +363,7 @@
   _plotMaximize->setCheckable(true);
   registerShortcut(_plotMaximize);
   connect(_plotMaximize, SIGNAL(triggered()), this, SLOT(plotMaximize()));
+
 }
 
 
@@ -371,6 +380,7 @@
   _zoomMenu->addAction(_zoomPrevious);
   _zoomMenu->addAction(_zoomYMeanCentered);
   _zoomMenu->addAction(_zoomTied);
+  _zoomMenu->addAction(_adjustImageColorscale);
 
   _zoomMenu->addSeparator();
 
@@ -2496,7 +2506,25 @@
   }
 }
 
+void PlotItem::adjustImageColorScale() {
+  const double per[] = {0.0, 0.0001, 0.001, 0.005, 0.02};
+  const int length = sizeof(per) / sizeof(double);
 
+  if (++_i_per >= length) {
+    _i_per = 0;
+  }
+  foreach (PlotRenderItem *renderer, renderItems()) {
+    foreach (RelationPtr relation, renderer->relationList()) {
+      if (ImagePtr image = kst_cast<Image>(relation)) {
+        image->writeLock();
+        image->setThresholdToSpikeInsensitive(per[_i_per]);
+        image->processUpdate(image);
+        image->unlock();
+      }
+    }
+  }
+}
+
 void PlotItem::zoomMaxSpikeInsensitive(bool force) {
 #if DEBUG_ZOOM
   qDebug() << "zoomMaxSpikeInsensitive" << endl;
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.h #980839:980840
@@ -258,6 +258,7 @@
     void zoomMaximum(bool force = false);
     void zoomMaxSpikeInsensitive(bool force = false);
     void zoomPrevious();
+    void adjustImageColorScale();
 
     void zoomTied();
     void zoomXTied();
@@ -463,6 +464,7 @@
     QAction *_zoomNormalizeYtoX;
     QAction *_zoomLogY;
     QAction *_plotMaximize;
+    QAction *_adjustImageColorscale;
 
     QMenu *_filterMenu;
     QAction *_filterAction;
@@ -497,6 +499,8 @@
 
     QUndoStack *_undoStack;
 
+    int _i_per; // index for image smart ranges
+
     friend class ZoomCommand;
     friend class ZoomMaximumCommand;
     friend class ZoomGeneralCommand;


More information about the Kst mailing list