question: protected int evaluateSpacing ( float up , float down , float left , float right ) { int ret = SHOW_TENS ; if ( ! showOneAndFiveLines && ! showBelowOneLines ) { return ret ; } float nsdiff = up - down ; float ewdiff ; if ( ( left > 0 && right < 0 ) || ( left > right ) || ( Math . abs ( left - right ) < 1 ) ) { ewdiff = ( 180.0f - left ) + ( right + 180.0f ) ; } else { ewdiff = right - left ; } float diff = ( nsdiff < ewdiff ) ? nsdiff : ewdiff ; if ( ( diff / 10 ) <= ( float ) threshold ) ret = SHOW_FIVES ; if ( ( diff / 5 ) <= ( float ) threshold ) ret = SHOW_ONES ; return ret ; }
target:  Figure out which graticule lines should be drawn based on the treshold set in the layer, and the coordinates of the screen. Method checks for crossing of the dateline, but still assumes that the up and down latitude coordinates are less than abs(+/-80). This is because the projection shouldn't give anything above 90 degrees, and we limit the lines to less than 80..