X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Farchaeopteryx%2FTreePanel.java;h=559d12033d052e9273027c2b467d6bc62e6e5102;hb=789f3450d14e1f922072f4288833afab71993667;hp=1a5fc6f446355e5e85baa544c2f14f9542ea244c;hpb=d17f81782b4ce0a50c963ccb0394e0d2ae796ad0;p=jalview.git diff --git a/forester/java/src/org/forester/archaeopteryx/TreePanel.java b/forester/java/src/org/forester/archaeopteryx/TreePanel.java index 1a5fc6f..559d120 100644 --- a/forester/java/src/org/forester/archaeopteryx/TreePanel.java +++ b/forester/java/src/org/forester/archaeopteryx/TreePanel.java @@ -131,6 +131,13 @@ import org.forester.util.SequenceIdParser; public final class TreePanel extends JPanel implements ActionListener, MouseWheelListener, Printable { + private static final BasicStroke STROKE_2 = new BasicStroke( 2f ); + private static final BasicStroke STROKE_1 = new BasicStroke( 1f ); + private static final BasicStroke STROKE_075 = new BasicStroke( 0.75f ); + private static final BasicStroke STROKE_05 = new BasicStroke( 0.5f ); + private static final BasicStroke STROKE_025 = new BasicStroke( 0.25f ); + private static final BasicStroke STROKE_01 = new BasicStroke( 0.1f ); + private static final BasicStroke STROKE_005 = new BasicStroke( 0.05f ); private static final float PI = ( float ) ( Math.PI ); private static final double TWO_PI = 2 * Math.PI; private static final float ONEHALF_PI = ( float ) ( 1.5 * Math.PI ); @@ -696,7 +703,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee if ( !ForesterUtil.isEmpty( tax.getTaxonomyCode() ) ) { c = getControlPanel().getSpeciesColors().get( tax.getTaxonomyCode() ); } - if ( c == null && !ForesterUtil.isEmpty( tax.getScientificName() ) ) { + if ( ( c == null ) && !ForesterUtil.isEmpty( tax.getScientificName() ) ) { c = getControlPanel().getSpeciesColors().get( tax.getScientificName() ); } if ( c == null ) { @@ -704,7 +711,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee c = AptxUtil.calculateColorFromString( tax.getTaxonomyCode() ); getControlPanel().getSpeciesColors().put( tax.getTaxonomyCode(), c ); } - else { + else { c = AptxUtil.calculateColorFromString( tax.getScientificName() ); getControlPanel().getSpeciesColors().put( tax.getScientificName(), c ); } @@ -1526,7 +1533,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee g.fillRect( graphics_file_x, graphics_file_y, graphics_file_width, graphics_file_height ); } } - g.setStroke( new BasicStroke( 1 ) ); + setupStroke( g ); } else { g.setStroke( new BasicStroke( getOptions().getPrintLineWidth() ) ); @@ -2906,6 +2913,20 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee return Blast.isContainsQueryForBlast( node ); } + final private String isCanOpenSeqWeb( final PhylogenyNode node ) { + String v = ForesterUtil.extractUniProtKbProteinSeqIdentifier( node ); + if ( ForesterUtil.isEmpty( v ) ) { + v = ForesterUtil.extractGenbankAccessor( node ); + } + if ( ForesterUtil.isEmpty( v ) ) { + v = ForesterUtil.extractRefSeqAccessorAccessor( node ); + } + if ( ForesterUtil.isEmpty( v ) ) { + v = ForesterUtil.extractGInumber( node ); + } + return v; + } + final private boolean isCanOpenTaxWeb( final PhylogenyNode node ) { if ( node.getNodeData().isHasTaxonomy() && ( ( !ForesterUtil.isEmpty( node.getNodeData().getTaxonomy().getScientificName() ) ) @@ -3230,20 +3251,6 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee } } - final private String isCanOpenSeqWeb( final PhylogenyNode node ) { - String v = ForesterUtil.extractUniProtKbProteinSeqIdentifier( node ); - if ( ForesterUtil.isEmpty( v ) ) { - v = ForesterUtil.extractGenbankAccessor( node ); - } - if ( ForesterUtil.isEmpty( v ) ) { - v = ForesterUtil.extractRefSeqAccessorAccessor( node ); - } - if ( ForesterUtil.isEmpty( v ) ) { - v = ForesterUtil.extractGInumber( node ); - } - return v; - } - final private void openSeqWeb( final PhylogenyNode node ) { if ( ForesterUtil.isEmpty( isCanOpenSeqWeb( node ) ) ) { cannotOpenBrowserWarningMessage( "sequence" ); @@ -4532,6 +4539,8 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee final float y = getVisibleRect().y + getOvYPosition() + ( getOvMaxHeight() / y_ratio ); g.setColor( getTreeColorSet().getFoundColor() ); getOvRectangle().setRect( x, y, width, height ); + final Stroke s = g.getStroke(); + g.setStroke( STROKE_1 ); if ( ( width < 6 ) && ( height < 6 ) ) { drawRectFilled( x, y, 6, 6, g ); getOvVirtualRectangle().setRect( x, y, 6, 6 ); @@ -4551,6 +4560,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee } getOvVirtualRectangle().setRect( x, y, width, height ); } + g.setStroke( s ); } final private void paintPhylogenyLite( final Graphics2D g ) { @@ -4560,7 +4570,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee .getWidth() ) ) ) ); _phylogeny.getRoot().setYSecondary( ( getVisibleRect().y + getOvYStart() ) ); final Stroke s = g.getStroke(); - g.setStroke( new BasicStroke( 0.5f ) ); //TODO + g.setStroke( STROKE_05 ); for( final PhylogenyNode element : _nodes_in_preorder ) { paintNodeLite( g, element ); } @@ -4616,12 +4626,15 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee else { g.setColor( getTreeColorSet().getBranchLengthColor() ); } + final Stroke s = g.getStroke(); + g.setStroke( STROKE_1 ); drawLine( x1, y1, x1, y2, g ); drawLine( x2, y1, x2, y2, g ); drawLine( x1, y3, x2, y3, g ); if ( getScaleLabel() != null ) { g.drawString( getScaleLabel(), ( x1 + 2 ), y3 - 2 ); } + g.setStroke( s ); } final private int paintTaxonomy( final Graphics2D g, @@ -5002,6 +5015,30 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee _scale_label = scale_label; } + private final void setupStroke( final Graphics2D g ) { + if ( getYdistance() < 0.001 ) { + g.setStroke( STROKE_005 ); + } + else if ( getYdistance() < 0.01 ) { + g.setStroke( STROKE_01 ); + } + else if ( getYdistance() < 0.5 ) { + g.setStroke( STROKE_025 ); + } + else if ( getYdistance() < 1 ) { + g.setStroke( STROKE_05 ); + } + else if ( getYdistance() < 2 ) { + g.setStroke( STROKE_075 ); + } + else if ( getYdistance() < 20 ) { + g.setStroke( STROKE_1 ); + } + else { + g.setStroke( STROKE_2 ); + } + } + final private void setUpUrtFactor() { final int d = getVisibleRect().width < getVisibleRect().height ? getVisibleRect().width : getVisibleRect().height;