octave-patch-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-patch-tracker] [patch #8722] For image() and imagesc(), added va


From: anonymous
Subject: [Octave-patch-tracker] [patch #8722] For image() and imagesc(), added value readout in status bar when mousing over a figure
Date: Fri, 21 Aug 2015 17:14:33 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/43.0.2357.130 Chrome/43.0.2357.130 Safari/537.36

URL:
  <http://savannah.gnu.org/patch/?8722>

                 Summary: For image() and imagesc(), added value readout in
status bar when mousing over a figure
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Fri 21 Aug 2015 05:14:32 PM UTC
                Category: None
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

This patch attempts to address the following entry on the Octave wiki projects
page (http://wiki.octave.org/Projects)

-- On 'imagesc' plots, report the matrix values also based on the mouse
position, updating on mouse moving.

This has been accomplished by altering the Figure::updateStatusBar() method to
take an additional QString parameter, i.e. 

Figure::updateStatusBar (ColumnVector pt, QString val)

The method was updated to display this QString in the message bar, i.e.

    m_statusBar->showMessage (QString ("(%1, %2)%3")
                              .arg (pt(0), 0, 'g', 5)
                              .arg (pt(1), 0, 'g', 5)
                              .arg(val));
The QString was built inside of the Canvas::canvasMouseMoveEvent() method. The
added code computes the integer index location of the mouse in the x and y
directions from a combination of the current mouse pixel position and the
xdata and ydata properties of the graphics object, then uses these indices to
retrieve the double value from cdata. Here is the added code:

          ColumnVector v = ap.pixel2coord (event->x (), event->y ());
          QString val = QString ("");
          if (currentObj.isa ("image"))
           {
              octave_value xdata = currentObj.get ("xdata");
              octave_value ydata = currentObj.get ("ydata");
              octave_value cdata = currentObj.get ("cdata");
              int x = floor (xdata.size ()(0) * v(0) 
                             / xdata.matrix_value()(xdata.size ()(0)-1) -
0.5);
              int y = floor (ydata.size ()(0) * v(1) 
                             / ydata.matrix_value ()(ydata.size ()(0)-1) -
0.5);
              val = QString (" : %1").arg (cdata.matrix_value
()(y,x),0,'g',5);
            }
          fig->updateStatusBar (v,val);




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Fri 21 Aug 2015 05:14:32 PM UTC  Name: displayImageValues.diff  Size:
3kB   By: None
Diff file to update Figure.h, Figure.cc, and Canvas.h
<http://savannah.gnu.org/patch/download.php?file_id=34690>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?8722>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]