Pixel resizing/ rescaling in matrix causes drawing issues

Issue #2 closed
Christopher Keil repo owner created an issue

The graphical matrix that represents the data is drawn in rectangles. The width and height of these rectangles is determined by the user, for example by using the resizing buttons in DendroView. The scale is also dependent on the width/ height available in the GlobalView container, because that is the container in which the matrix is drawn.

As per the matrix drawing implementation in the original Java TreeView, only full rectangles can be displayed (not half etc.). When the scale of either width or height of all rectangles in a row or column is miscalculated in the MapContainer class (usually 'xmap' for rows, 'ymap' for columns) , a white-space will occur in the drawing. The yellow selection rectangles subsequently appear shifted.

Relevant classes:

  • DendroView
  • GlobalView
  • MapContainer
  • ArryDrawer/ DoubleArryDrawer
  • DendroViewController

Comments (8)

  1. Robert Leach

    I was testing a bit today and discovered a bit more to this issue. In addition to the blank column, there are 2 other associated erroneous behaviors. I made a screen recording of this test. It's a very large file, as I recorded a whole session, but hopefully you won't need to view it. I'll paste a link to it off of my desktop's web server:

    http://gen-rlimac.princeton.edu/~rleach/TREEVIEWBUGS/multiple_bugs/multiple_bugs.mov

    The following items refer to time indexes 1:05-1:10:

    1. In addition to the last column being completely blank, also: the second to last column (Car1p/Arg...) is missing its column name
    2. The column labels get progressively out of alignment with the spots until they start appearing to label the wrong column about half-way in.

    Rob

  2. Christopher Keil reporter

    Yep. If you actually resize the matrix and the error happens, then there's a log message printed which I was trying to use for debugging. The main issues in the code must lie in MapContainer (mostly setScale(), zoomScale() called DendroController) and related classes, possibly also GlobalView.

    What basically happens is that the method to calculate the scale of the matrix elements miscalculates the correct scale that would fit onto the current screen. There are variables called usedPixels and availablePixels that play a role in this behavior. Furthermore, there is a dependency on the number of elements to display on screen, which determines element size because you always want to fill all the available pixels from GlobalView.

    I think the error shows itself, when the usedPixels are not equal to availablePixels.. Th difference ends up being that white space. Then the other classes dealing with labels and tree alignment get misinformed and display weird stuff.

    I hope that helps a bit.

  3. Robert Leach

    This was a precision issue with a double value that is passed around as a "scale" factor. Sometimes, the value ended in .99999999... and casting as an int was reducing the value instead of bumping it up. So I implemented a way to do the bump up if the value was within a precision threshold, arbitrarily set at 0.000001.

  4. Log in to comment