import org.forester.archaeopteryx.Options.PHYLOGENY_GRAPHICS_TYPE;
import org.forester.archaeopteryx.phylogeny.data.RenderableDomainArchitecture;
import org.forester.archaeopteryx.phylogeny.data.RenderableVector;
+import org.forester.archaeopteryx.tools.Blast;
+import org.forester.archaeopteryx.tools.ImageLoader;
import org.forester.io.parsers.phyloxml.PhyloXmlUtil;
import org.forester.phylogeny.Phylogeny;
import org.forester.phylogeny.PhylogenyMethods;
false );
// expression values menu:
private DescriptiveStatistics _statistics_for_vector_data;
+ private PhylogenyNode[] _nodes_in_preorder = null;
// private Image offscreenImage;
// private Graphics offscreenGraphics;
// private Dimension offscreenDimension;
else {
phy.addAsChild( node );
}
+ _nodes_in_preorder = null;
_phylogeny.externalNodesHaveChanged();
_phylogeny.hashIDs();
_phylogeny.recalculateNumberOfExternalDescendants( true );
_phylogeny.recalculateNumberOfExternalDescendants( true );
resetNodeIdToDistToLeafMap();
calculateLongestExtNodeInfo();
+ _nodes_in_preorder = null;
resetPreferredSize();
updateOvSizes();
_main_panel.adjustJScrollPane();
_phylogeny.recalculateNumberOfExternalDescendants( true );
resetNodeIdToDistToLeafMap();
calculateLongestExtNodeInfo();
+ _nodes_in_preorder = null;
resetPreferredSize();
_main_panel.adjustJScrollPane();
setArrowCursor();
errorMessageNoCutCopyPasteInUnrootedDisplay();
return;
}
+ _nodes_in_preorder = null;
setCutOrCopiedTree( _phylogeny.copy( node ) );
final List<PhylogenyNode> nodes = PhylogenyMethods.getAllDescendants( node );
final Set<Integer> node_ids = new HashSet<Integer>( nodes.size() );
if ( r != JOptionPane.OK_OPTION ) {
return;
}
+ _nodes_in_preorder = null;
setCopiedAndPastedNodes( null );
setCutOrCopiedTree( _phylogeny.copy( node ) );
_phylogeny.deleteSubtree( node, true );
null,
options,
options[ 2 ] );
+ _nodes_in_preorder = null;
boolean node_only = true;
if ( r == 1 ) {
node_only = false;
*
* @return a pointer to the phylogeny
*/
- final Phylogeny getPhylogeny() {
+ public final Phylogeny getPhylogeny() {
return _phylogeny;
}
JOptionPane.WARNING_MESSAGE );
return;
}
+ _nodes_in_preorder = null;
setWaitCursor();
PhylogenyMethods.midpointRoot( _phylogeny );
resetNodeIdToDistToLeafMap();
if ( getControlPanel().isShowTaxonomyCode() && ( PhylogenyMethods.getSpecies( node ).length() > 0 ) ) {
x += getTreeFontSet()._fm_large_italic.stringWidth( PhylogenyMethods.getSpecies( node ) + " " );
}
+ if ( getControlPanel().isShowGeneNames() ) {
+ x += getTreeFontSet()._fm_large.stringWidth( node.getNodeData().getSequence().getName() + " " );
+ }
+ if ( getControlPanel().isShowGeneSymbols() ) {
+ x += getTreeFontSet()._fm_large.stringWidth( node.getNodeData().getSequence().getSymbol() + " " );
+ }
+ if ( getControlPanel().isShowSequenceAcc() ) {
+ x += getTreeFontSet()._fm_large.stringWidth( node.getNodeData().getSequence().getAccession()
+ .toString()
+ + " " );
+ }
if ( getControlPanel().isShowNodeNames() && ( node.getName().length() > 0 ) ) {
x += getTreeFontSet()._fm_large.stringWidth( node.getName() + " " );
}
getControlPanel().setDynamicHidingIsOn( false );
}
}
- final PhylogenyNodeIterator it;
- for( it = _phylogeny.iteratorPreorder(); it.hasNext(); ) {
- paintNodeRectangular( g, it.next(), to_pdf, getControlPanel().isDynamicallyHideData()
+ if ( _nodes_in_preorder == null ) {
+ _nodes_in_preorder = new PhylogenyNode[ _phylogeny.getNodeCount() ];
+ int i = 0;
+ for( final PhylogenyNodeIterator it = _phylogeny.iteratorPreorder(); it.hasNext(); ) {
+ _nodes_in_preorder[ i++ ] = it.next();
+ }
+ }
+ //final PhylogenyNodeIterator it;
+ //for( it = _phylogeny.iteratorPreorder(); it.hasNext(); ) {
+ // paintNodeRectangular( g, it.next(), to_pdf, getControlPanel().isDynamicallyHideData()
+ // && ( dynamic_hiding_factor > 1 ), dynamic_hiding_factor, to_graphics_file );
+ //}
+ for( int i = 0; i < _nodes_in_preorder.length; ++i ) {
+ paintNodeRectangular( g, _nodes_in_preorder[ i ], to_pdf, getControlPanel().isDynamicallyHideData()
&& ( dynamic_hiding_factor > 1 ), dynamic_hiding_factor, to_graphics_file );
}
if ( getOptions().isShowScale() && getControlPanel().isDrawPhylogram() && ( getScaleDistance() > 0.0 ) ) {
.setXSecondary( ( float ) ( getVisibleRect().x + getOvXPosition() + ( MOVE / ( getVisibleRect().width / getOvRectangle()
.getWidth() ) ) ) );
_phylogeny.getRoot().setYSecondary( ( getVisibleRect().y + getOvYStart() ) );
- final PhylogenyNodeIterator it;
- for( it = _phylogeny.iteratorPreorder(); it.hasNext(); ) {
- paintNodeLite( g, it.next() );
+ //final PhylogenyNodeIterator it;
+ //for( it = _phylogeny.iteratorPreorder(); it.hasNext(); ) {
+ // paintNodeLite( g, it.next() );
+ //}
+ for( int i = 0; i < _nodes_in_preorder.length; ++i ) {
+ paintNodeLite( g, _nodes_in_preorder[ i ] );
}
paintOvRectangle( g );
}
}
node_ids.add( node.getId() );
getCopiedAndPastedNodes().addAll( node_ids );
+ _nodes_in_preorder = null;
_phylogeny.externalNodesHaveChanged();
_phylogeny.hashIDs();
_phylogeny.recalculateNumberOfExternalDescendants( true );
getPhylogeny().reRoot( node );
getPhylogeny().recalculateNumberOfExternalDescendants( true );
resetNodeIdToDistToLeafMap();
+ _nodes_in_preorder = null;
resetPreferredSize();
getMainPanel().adjustJScrollPane();
repaint();
setPreferredSize( new Dimension( x, y ) );
}
- final void setArrowCursor() {
+ public final void setArrowCursor() {
setCursor( ARROW_CURSOR );
repaint();
}
getMainPanel().setCutOrCopiedTree( cut_or_copied_tree );
}
- final void setEdited( final boolean edited ) {
+ public final void setEdited( final boolean edited ) {
_edited = edited;
}
* @param t
* an instance of a Phylogeny
*/
- final void setTree( final Phylogeny t ) {
+ public final void setTree( final Phylogeny t ) {
+ _nodes_in_preorder = null;
_phylogeny = t;
}
_urt_factor_ov = urt_factor_ov;
}
- final void setWaitCursor() {
+ public final void setWaitCursor() {
setCursor( WAIT_CURSOR );
repaint();
}
final void swap( final PhylogenyNode node ) {
if ( !node.isExternal() ) {
_phylogeny.swapChildren( node );
+ _nodes_in_preorder = null;
}
repaint();
}
}
}
- synchronized void setImageMap( final Hashtable<String, BufferedImage> image_map ) {
+ public synchronized void setImageMap( final Hashtable<String, BufferedImage> image_map ) {
getMainPanel().setImageMap( image_map );
}
- synchronized Hashtable<String, BufferedImage> getImageMap() {
+ public synchronized Hashtable<String, BufferedImage> getImageMap() {
return getMainPanel().getImageMap();
}
}