private float _x_correction_factor = 0.0f;
private float _x_distance = 0.0f;
private float _y_distance = 0.0f;
-
+ private int _length_of_longest_text;
+ private int _longest_domain;
// private Image offscreenImage;
// private Graphics offscreenGraphics;
// private Dimension offscreenDimension;
}
}
}
+ _length_of_longest_text = calcLengthOfLongestText();
}
int ext_nodes = _phylogeny.getRoot().getNumberOfExternalNodes();
final int max_depth = PhylogenyMethods.calculateMaxDepth( _phylogeny );
}
int longest = 30;
int longest_txt = 0;
+ _longest_domain = 0;
PhylogenyNode longest_txt_node = _phylogeny.getFirstExternalNode();
for( final PhylogenyNode node : _phylogeny.getExternalNodes() ) {
int sum = 0;
final DomainArchitecture d = node.getNodeData().getSequence().getDomainArchitecture();
sum += ( ( _domain_structure_width / ( ( RenderableDomainArchitecture ) d ).getOriginalSize()
.getWidth() ) * d.getTotalLength() ) + 10;
+ if ( d.getTotalLength() > _longest_domain ) {
+ _longest_domain = d.getTotalLength();
+ }
}
if ( sum >= max_length ) {
_longest_ext_node_info = max_length;
}
if ( c == null ) {
if ( !ForesterUtil.isEmpty( tax.getTaxonomyCode() ) ) {
- c = TreePanelUtil.calculateColorFromString( tax.getTaxonomyCode(), true );
+ c = AptxUtil.calculateColorFromString( tax.getTaxonomyCode(), true );
getControlPanel().getSpeciesColors().put( tax.getTaxonomyCode(), c );
}
else {
- c = TreePanelUtil.calculateColorFromString( tax.getScientificName(), true );
+ c = AptxUtil.calculateColorFromString( tax.getScientificName(), true );
getControlPanel().getSpeciesColors().put( tax.getScientificName(), c );
}
}
final String seq_name = seq.getName();
c = getControlPanel().getSequenceColors().get( seq_name );
if ( c == null ) {
- c = TreePanelUtil.calculateColorFromString( seq_name, false );
+ c = AptxUtil.calculateColorFromString( seq_name, false );
getControlPanel().getSequenceColors().put( seq_name, c );
}
return c;
_control_panel.getColorAccSpeciesCb().setSelected( false );
}
_options.setColorLabelsSameAsParentBranch( true );
+ if ( getMainPanel().getMainFrame()._color_labels_same_as_parent_branch != null ) {
+ getMainPanel().getMainFrame()._color_labels_same_as_parent_branch.setSelected( true );
+ }
_control_panel.repaint();
}
setArrowCursor();
return getTreeColorSet().getSequenceColor();
}
- /**
- * @return pointer to colorset for tree drawing
- */
- final TreeColorSet getTreeColorSet() {
+ public final TreeColorSet getTreeColorSet() {
return getMainPanel().getTreeColorSet();
}
&& ( node.getNodeData().getSequence().getDomainArchitecture() != null ) ) {
RenderableDomainArchitecture rds = null;
if ( !( node.getNodeData().getSequence().getDomainArchitecture() instanceof RenderableDomainArchitecture ) ) {
- rds = new RenderableDomainArchitecture( node.getNodeData().getSequence().getDomainArchitecture(),
- getConfiguration() );
+ rds = new RenderableDomainArchitecture( node.getNodeData().getSequence().getDomainArchitecture() );
node.getNodeData().getSequence().setDomainArchitecture( rds );
}
else {
if ( !ForesterUtil.isEmpty( ann_str ) ) {
c = getControlPanel().getAnnotationColors().get( ann_str );
if ( c == null ) {
- c = TreePanelUtil.calculateColorFromString( ann_str, false );
+ c = AptxUtil.calculateColorFromString( ann_str, false );
getControlPanel().getAnnotationColors().put( ann_str, c );
}
if ( c == null ) {
final boolean disallow_shortcutting = ( dynamic_hiding_factor < 40 );
float min_dist = 1.5f;
if ( !disallow_shortcutting ) {
- // System.out.println( dynamic_hiding_factor );
if ( dynamic_hiding_factor > 4000 ) {
min_dist = 4;
}
if ( ( !getControlPanel().isShowInternalData() && !node.isExternal() ) ) {
return;
}
- int length_of_longest_text = -1;
if ( getControlPanel().isShowDomainArchitectures() && node.getNodeData().isHasSequence()
&& ( node.getNodeData().getSequence().getDomainArchitecture() != null ) ) {
RenderableDomainArchitecture rds = null;
cce.printStackTrace();
}
if ( rds != null ) {
- rds.setRenderingHeight( 6 );
+ final int default_height = 7;
+ float y = getYdistance();
+ if ( getControlPanel().isDynamicallyHideData() ) {
+ y = getTreeFontSet().getFontMetricsLarge().getHeight();
+ }
+ final int h = y < default_height ? ForesterUtil.roundToInt( y ) : default_height;
+ rds.setRenderingHeight( h > 1 ? h : 2 );
if ( getControlPanel().isDrawPhylogram() ) {
- rds.render( node.getXcoord() + x, node.getYcoord() - 3, g, this, to_pdf );
+ if ( getOptions().isLineUpRendarableNodeData() ) {
+ if ( getOptions().isRightLineUpDomains() ) {
+ rds.render( getMaxDistanceToRoot() * getXcorrectionFactor() + _length_of_longest_text
+ + ( _longest_domain - rds.getTotalLength() )
+ * rds.getRenderingFactorWidth(),
+ node.getYcoord() - ( h / 2 ),
+ g,
+ this,
+ to_pdf );
+ }
+ else {
+ rds.render( getMaxDistanceToRoot() * getXcorrectionFactor() + _length_of_longest_text,
+ node.getYcoord() - ( h / 2 ),
+ g,
+ this,
+ to_pdf );
+ }
+ }
+ else {
+ rds.render( node.getXcoord() + x, node.getYcoord() - ( h / 2 ), g, this, to_pdf );
+ }
}
else {
- length_of_longest_text = calcLengthOfLongestText();
- rds.render( getPhylogeny().getFirstExternalNode().getXcoord() + length_of_longest_text,
- node.getYcoord() - 3,
- g,
- this,
- to_pdf );
+ if ( getOptions().isRightLineUpDomains() ) {
+ rds.render( getPhylogeny().getFirstExternalNode().getXcoord() + _length_of_longest_text
+ - 20 + ( _longest_domain - rds.getTotalLength() )
+ * rds.getRenderingFactorWidth(),
+ node.getYcoord() - ( h / 2 ),
+ g,
+ this,
+ to_pdf );
+ }
+ else {
+ rds.render( getPhylogeny().getFirstExternalNode().getXcoord() + _length_of_longest_text,
+ node.getYcoord() - ( h / 2 ),
+ g,
+ this,
+ to_pdf );
+ }
}
}
}
-
if ( getControlPanel().isShowVectorData() && ( node.getNodeData().getVector() != null )
&& ( node.getNodeData().getVector().size() > 0 ) && ( getStatisticsForExpressionValues() != null ) ) {
final RenderableVector rv = RenderableVector.createInstance( node.getNodeData().getVector(),
getStatisticsForExpressionValues(),
getConfiguration() );
-
if ( rv != null ) {
double domain_add = 0;
if ( getControlPanel().isShowDomainArchitectures() && node.getNodeData().isHasSequence()
rv.render( node.getXcoord() + x + domain_add, node.getYcoord() - 3, g, this, to_pdf );
}
else {
- if ( length_of_longest_text < 0 ) {
- length_of_longest_text = calcLengthOfLongestText();
- }
- rv.render( getPhylogeny().getFirstExternalNode().getXcoord() + length_of_longest_text + domain_add,
- node.getYcoord() - 3,
- g,
- this,
- to_pdf );
+ rv.render( getPhylogeny().getFirstExternalNode().getXcoord() + _length_of_longest_text + domain_add,
+ node.getYcoord() - 3,
+ g,
+ this,
+ to_pdf );
}
}
}
}
- private int calcLengthOfLongestText() {
+ final private int calcLengthOfLongestText() {
final StringBuilder sb = new StringBuilder();
nodeDataAsSB( _ext_node_with_longest_txt_info, sb );
if ( _ext_node_with_longest_txt_info.getNodeData().isHasTaxonomy() ) {
nodeTaxonomyDataAsSB( _ext_node_with_longest_txt_info.getNodeData().getTaxonomy(), sb );
}
- return getFontMetricsForLargeDefaultFont().stringWidth( sb.toString() + " " );
+ return getFontMetricsForLargeDefaultFont().stringWidth( sb.toString() );
}
final private void paintOvRectangle( final Graphics2D g ) {