zmapNavigator - the left hand navigator panes

Summary

Which navigator?

There is a possible source of confusion as there two navigators zmapNavigator.c and zmapWindowNavigator.c.

zmapNavigator.c relates to a little used feature at the extreme left of the ZMap window entitled "Region" which could show where in a sequence's parent span (if defined) the currently loaded sequence is.

zmapWindowNavigator.c implements the Scroll Navigator which covers the currently loaded sequence and at higher zoom levels allows the currently accessible scroll region to be moved. It also includes some display of the Locus data and provides a right click menu for this data.

The Scroll Navigator

Display format and implementation

The navigator has its own foo canvas and this can be exposed by a sliding frame. There is a border at the top and bottom of the canvas filled by two shaded regions and between a scale bar similar to the one in the normal window is displayed and this always shows the full extent of the loaded sequence (unlike the window scale bar which shows the visible region within the accessable scroll region).

The Locator is a white rectangle indicating the extent of the accessible scroll region and at higher zooms does not cover the entire loaded sequence.

If the window is resized then the navigator canvas is zoomed to make the displayed data fit within the space on the screen. The border regions are kept the same size regardless of the window size or zoom level of the navigator canvas. This is possibly due to the need to leave enough space in the canvas to display text without it being clipped.

Locus data is displayed as text and these are 'unoverlapped' to make them readable , but note that if the window is resized this may not be preserved. Text is preserved as fixed size regardless of the zoom level.

The navigator canvas is operated as a fixed size region (NAVIGATOR_SIZE, in foo canvas coordinates and the displayed data multiplied by a navigator->scaling_factor to match the loaded sequence to this fixed length coordinate range. The border regions are of variable height in canvas coordinates to achieve the same size in pixels on display.

For configurations where the loaded sequence is not 1-based the navigator does not offset it's data but instead scales it as needed to fit the fixed size canvas and adds the borders at either end.

Source Files

zmapWindowNavigator.c implements drawing the data and handling mouse events.
zmapWindowNavigatorWidget.c fits the naviagotor canvas into the GTK Widget, adding the text-size borders onto the canvas extent, and setting the scroll region.
zmapWindowTextPositioner.c handles unoverlapping locus names.

Operation

Whenever the zmap window is resized for the navigator pane's size changed the function navCanvasItemEventCB() is called and this calls zmapWindowNavigatorFillWidget() which adjusts canvas borders and scroll region to make the border size the same in pixels.

The Scale Bar

This is the vertical strip at the left of the window and also at the left of the navigator that looks a bit like a ruler but is not to be confused with the window ruler which is the horizontal line drawn when the middle mouse button is pressed. To make matters even more confusing the scale bar is implemented in zmapWindow/zmapWindowRuler.c.

Note that there are two functions that provide an interface to the scale bar code:

The navigator scale is fixed in that the navigator window is never zoomed or scrolled, but not that if the ZMap window is resized then there are more/fewer pixels available for display and the display should be adjusted to stay readable. Currenyl (Jun 2011) locus names are un-overlapped on resize but the scale bar is not adjusted.

The window scale bar can be zoomed and scrolled with the window, but on window resize the visible part of the scroll region changes and the display is not adjusted in any way.

Functional specification

This will be broadly as at present but with loose ends tidied up, better choice of labels, and 3 levels of tick. This is an opportunity to tidy up the interface to the two modules using scale bar code.

Specifcially:

Implementation

Choosing tick marks

For a given window the sequence range in the current scrolling region and the number of available pixels will be calculated.

Coordinates are displayed as 1-based but at high zoom the first start coordinate may not be 1. For example, in a sequence of 1 to 756432 bases we may only be displaying 293987 to 345123. The highest order tick mark corresponds to the first leftmost digit that differs between start and end coordinates (NB we may need to add leading zeroes). Note that this is not always the same as the order of end-start. One way to calculate this would be:

Display all the tick marks at the highest level, there should be trailing zeros.

Until the number of available pixels becomes too small display lower orders of tick. Between orders of 10 the middle (5) is larger and the others (12346789) are less pronounced or not displayed. Text labels are displayed until the space available between higher order ticks is less than 5x text height (experiment with this if it looks poor).

Text labels will be rounded to MB or KB as appropriate and minor ticks will have leading digits hidden.

Choosing tick width