public void drawPairs ( Graphics g ) { if ( aligs == null ) return ; int nr = aligs . length ; Graphics2D g2D = ( Graphics2D ) g ; Stroke oldStroke = g2D . getStroke ( ) ; g2D . setStroke ( stroke ) ; Color color ; float hue ; int width = Math . round ( scale ) ; int w2 = width / 2 ; for ( int i = 0 ; i < aligs . length ; i ++ ) { AlternativeAlignment a = aligs [ i ] ; int [ ] idx1 = a . getIdx1 ( ) ; int [ ] idx2 = a . getIdx2 ( ) ; int xold = - 1 ; int yold = - 1 ; boolean start = true ; if ( ( selectedAlignmentPos != - 1 ) && ( selectedAlignmentPos == i ) ) { color = Color . white ; } else { hue = i * ( 1 / ( float ) nr ) ; color = Color . getHSBColor ( hue , 1.0f , 1.0f ) ; } g . setColor ( color ) ; for ( int j = 0 ; j < idx1 . length ; j ++ ) { int x1 = Math . round ( idx1 [ j ] * scale ) ; int y1 = Math . round ( idx2 [ j ] * scale ) ; if ( ! start ) { //g.drawLine(xold+1,yold,x1+1,y1); //g2D.draw(new Line2D.Double(xold,yold,x1,y1)); g . fillRect ( xold , yold , 2 , 2 ) ; } else { g . fillRect ( x1 , y1 , w2 , w2 ) ; start = false ; } xold = x1 ; yold = y1 ; } if ( ! start ) g . fillRect ( xold , yold , w2 , w2 ) ; } g2D . setStroke ( oldStroke ) ; }
draw alternative alignments