// Copyright (C) 2008-2009 Christian M. Zmasek
// Copyright (C) 2008-2009 Burnham Institute for Medical Research
// All rights reserved
-//
+//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
-//
+//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
//
// Contact: phylosoft @ gmail . com
-// WWW: www.phylosoft.org/forester
+// WWW: https://sites.google.com/site/cmzmasek/home/software/forester
package org.forester.archaeopteryx.phylogeny.data;
+import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
+import java.awt.Stroke;
import java.awt.geom.Rectangle2D;
import java.io.IOException;
import java.io.Writer;
+import java.math.BigDecimal;
import java.util.Map;
import java.util.SortedMap;
private final DomainArchitecture _domain_structure;
private final Rectangle2D _rectangle = new Rectangle2D.Float();
private final Configuration _configuration;
+ private static final BasicStroke STROKE_1 = new BasicStroke( 1f );
public RenderableDomainArchitecture( final DomainArchitecture domain_structure, final Configuration configuration ) {
_domain_structure = domain_structure;
}
@Override
- public SortedMap<Double, ProteinDomain> getDomains() {
+ public SortedMap<BigDecimal, ProteinDomain> getDomains() {
return _domain_structure.getDomains();
}
return _domain_structure.getNumberOfDomains();
}
+ @Override
public Dimension getOriginalSize() {
return new Dimension( _domain_structure.getTotalLength(), ForesterUtil.roundToInt( _rendering_height ) );
}
+ @Override
public Object getParameter() {
return new Integer( _e_value_threshold_exp );
}
return _rendering_factor_width;
}
+ @Override
public Dimension getRenderingSize() {
- return new Dimension( ForesterUtil.roundToInt( _domain_structure.getTotalLength() * _rendering_factor_width ),
+ return new Dimension( ForesterUtil.roundToInt( _domain_structure.getTotalLength() * getRenderingFactorWidth() ),
ForesterUtil.roundToInt( _rendering_height ) );
}
return _domain_structure.isEqual( data );
}
+ @Override
public void render( final double x1,
final double y1,
final Graphics2D g,
final double f = getRenderingFactorWidth();
final double y = y1 + ( _rendering_height / 2 );
final double start = x1 + 20.0;
+ final Stroke s = g.getStroke();
+ g.setStroke( STROKE_1 );
g.setColor( getConfiguration().getDomainStructureFontColor() );
_rectangle.setFrame( start, y - 0.5, _domain_structure.getTotalLength() * f, 1 );
g.fill( _rectangle );
for( int i = 0; i < _domain_structure.getDomains().size(); ++i ) {
final ProteinDomain d = _domain_structure.getDomain( i );
if ( d.getConfidence() <= Math.pow( 10, _e_value_threshold_exp ) ) {
- final double xa = start + d.getFrom() * f;
- final double xb = xa + d.getLength() * f;
+ final double xa = start + ( d.getFrom() * f );
+ final double xb = xa + ( d.getLength() * f );
if ( tree_panel.getMainPanel().getOptions().isShowDomainLabels() ) {
g.setFont( tree_panel.getMainPanel().getTreeFontSet().getSmallFont() );
g.setColor( getConfiguration().getDomainStructureFontColor() );
drawDomain( xa, y1, xb - xa, _rendering_height, d.getName(), g, to_pdf );
}
}
+ g.setStroke( s );
}
+ @Override
public void setParameter( final double e_value_threshold_exp ) {
_e_value_threshold_exp = ( int ) e_value_threshold_exp;
}
_rendering_factor_width = rendering_factor_width;
}
+ @Override
public void setRenderingHeight( final double rendering_height ) {
_rendering_height = rendering_height;
}