import org.forester.archaeopteryx.Configuration.EXT_NODE_DATA_RETURN_ON;
import org.forester.archaeopteryx.ControlPanel.NodeClickAction;
-import org.forester.archaeopteryx.ControlPanel.TreeDisplayType;
import org.forester.archaeopteryx.Options.CLADOGRAM_TYPE;
import org.forester.archaeopteryx.Options.NODE_LABEL_DIRECTION;
import org.forester.archaeopteryx.Options.PHYLOGENY_GRAPHICS_TYPE;
import org.forester.phylogeny.data.NodeVisualData.NodeFill;
import org.forester.phylogeny.data.NodeVisualData.NodeShape;
import org.forester.phylogeny.data.PhylogenyDataUtil;
-import org.forester.phylogeny.data.PropertiesMap;
-import org.forester.phylogeny.data.Property;
import org.forester.phylogeny.data.ProteinDomain;
import org.forester.phylogeny.data.Sequence;
import org.forester.phylogeny.data.SequenceRelation;
import org.forester.phylogeny.data.Uri;
import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
import org.forester.phylogeny.iterators.PreorderTreeIterator;
-import org.forester.util.BasicDescriptiveStatistics;
import org.forester.util.DescriptiveStatistics;
import org.forester.util.ForesterConstants;
import org.forester.util.ForesterUtil;
init();
// if ( !_phylogeny.isEmpty() ) {
_phylogeny.recalculateNumberOfExternalDescendants( true );
- checkForVectorProperties( _phylogeny );
// }
setBackground( getTreeColorSet().getBackgroundColor() );
final MouseListener mouse_listener = new MouseListener( this );
type = 'n';
}
}
-
-
try {
Blast.openNcbiBlastWeb( query, type == 'n', this );
}
return _last_drag_point_y;
}
- final private short getMaxBranchesToLeaf( final PhylogenyNode node ) {
- if ( !_nodeid_dist_to_leaf.containsKey( node.getId() ) ) {
- final short m = PhylogenyMethods.calculateMaxBranchesToLeaf( node );
- _nodeid_dist_to_leaf.put( node.getId(), m );
- return m;
- }
- else {
- return _nodeid_dist_to_leaf.get( node.getId() );
- }
- }
final private double getMaxDistanceToRoot() {
if ( _max_distance_to_root < 0 ) {
decreaseOvSize();
}
}
- if ( e.getKeyCode() == KeyEvent.VK_HOME ) {
+ if ( e.getKeyCode() == KeyEvent.VK_HOME || e.getKeyCode() == KeyEvent.VK_ESCAPE ) {
getControlPanel().showWhole();
}
else if ( e.getKeyCode() == KeyEvent.VK_PAGE_UP ) {
if ( !ForesterUtil.isEmpty( uri_strs ) ) {
for( final String uri_str : uri_strs ) {
try {
- AptxUtil.launchWebBrowser( new URI( uri_str ),
- "_aptx_seq" );
+ AptxUtil.launchWebBrowser( new URI( uri_str ), "_aptx_seq" );
}
catch ( final IOException e ) {
AptxUtil.showErrorMessage( this, e.toString() );
final String uri_str = TreePanelUtil.createUriForSeqWeb( node, getConfiguration(), this );
if ( !ForesterUtil.isEmpty( uri_str ) ) {
try {
- AptxUtil.launchWebBrowser( new URI( uri_str ),
-
- "_aptx_seq" );
+ AptxUtil.launchWebBrowser( new URI( uri_str ), "_aptx_seq" );
}
catch ( final IOException e ) {
AptxUtil.showErrorMessage( this, e.toString() );
}
if ( !ForesterUtil.isEmpty( uri_str ) ) {
try {
- AptxUtil.launchWebBrowser( new URI( uri_str ),
- "_aptx_tax" );
+ AptxUtil.launchWebBrowser( new URI( uri_str ), "_aptx_tax" );
}
catch ( final IOException e ) {
AptxUtil.showErrorMessage( this, e.toString() );
( node.getYcoord() - getFontMetricsForLargeDefaultFont().getMaxDescent() ),
g );
g.setColor( getTreeColorSet().getLostCharactersColor() );
- TreePanel.drawString( lost,
- parent_x + ( ( x - parent_x
- - getFontMetricsForLargeDefaultFont().stringWidth( lost ) ) / 2 ),
- ( node.getYcoord() + getFontMetricsForLargeDefaultFont().getMaxAscent() ),
- g );
+ TreePanel
+ .drawString( lost,
+ parent_x + ( ( x - parent_x - getFontMetricsForLargeDefaultFont().stringWidth( lost ) )
+ / 2 ),
+ ( node.getYcoord() + getFontMetricsForLargeDefaultFont().getMaxAscent() ),
+ g );
}
}
|| ( getOptions().isShowDefaultNodeShapesForMarkedNodes()
&& ( node.getNodeData().getNodeVisualData() != null )
&& ( !node.getNodeData().getNodeVisualData().isEmpty() ) )
- || ( getControlPanel().isUseVisualStyles()
- && ( ( node.getNodeData().getNodeVisualData() != null )
- && ( ( node.getNodeData().getNodeVisualData().getNodeColor() != null )
- || ( node.getNodeData().getNodeVisualData()
- .getSize() != NodeVisualData.DEFAULT_SIZE )
- || ( node.getNodeData().getNodeVisualData().getFillType() != NodeFill.DEFAULT )
- || ( node.getNodeData().getNodeVisualData()
- .getShape() != NodeShape.DEFAULT ) ) ) )
+ || ( getControlPanel().isUseVisualStyles() && ( ( node.getNodeData().getNodeVisualData() != null )
+ && ( ( node.getNodeData().getNodeVisualData().getNodeColor() != null )
+ || ( node.getNodeData().getNodeVisualData().getSize() != NodeVisualData.DEFAULT_SIZE )
+ || ( node.getNodeData().getNodeVisualData().getFillType() != NodeFill.DEFAULT )
+ || ( node.getNodeData().getNodeVisualData().getShape() != NodeShape.DEFAULT ) ) ) )
|| ( getControlPanel().isEvents() && node.isHasAssignedEvent()
&& ( node.getNodeData().getEvent().isDuplication()
|| node.getNodeData().getEvent().isSpeciation()
if ( !getControlPanel().isShowInternalData() && !node.isExternal() && !node.isCollapse() ) {
return 0;
}
+ if ( !getControlPanel().isShowExternalData() && ( node.isExternal() || node.isCollapse() ) ) {
+ return 0;
+ }
_sb.setLength( 0 );
int x = 0;
if ( add > 0 ) {
}
else if ( ( _sb.length() > 0 ) || saw_species ) {
// _sb.setLength( 0 );
- _sb.append( " (" );
+ _sb.append( " [" );
_sb.append( node.getAllExternalDescendants().size() );
- _sb.append( ")" );
+ _sb.append( "]" );
}
}
else {
down_shift_factor = 1;
}
float pos_x;
- if ( getControlPanel().getTreeDisplayType() == TreeDisplayType.ALIGNED_PHYLOGRAM
+ if ( getControlPanel().getTreeDisplayType() == Options.PHYLOGENY_DISPLAY_TYPE.ALIGNED_PHYLOGRAM
&& ( node.isExternal() || node.isCollapse() ) ) {
pos_x = ( float ) ( ( getMaxDistanceToRoot() * getXcorrectionFactor() )
+ ( getOptions().getDefaultNodeShapeSize() / 2 ) + x + ( 2 * TreePanel.MOVE ) + getXdistance()
else {
pos_y = ( node.getYcoord() + ( getFontMetrics( g.getFont() ).getAscent() / down_shift_factor ) );
}
- if ( getControlPanel().getTreeDisplayType() == TreeDisplayType.ALIGNED_PHYLOGRAM
+ if ( getControlPanel().getTreeDisplayType() == Options.PHYLOGENY_DISPLAY_TYPE.ALIGNED_PHYLOGRAM
&& ( node.isExternal() || node.isCollapse() ) ) {
drawConnection( node.getXcoord(), pos_x - x, node.getYcoord(), 5, 20, g, to_pdf );
if ( node.isCollapse() ) {
if ( !node.isExternal() && !node.isCollapse() ) {
boolean first_child = true;
float y2 = 0.0f;
- final int parent_max_branch_to_leaf = getMaxBranchesToLeaf( node );
+ //final int parent_max_branch_to_leaf = getMaxBranchesToLeaf( node );
for( int i = 0; i < node.getNumberOfDescendants(); ++i ) {
final PhylogenyNode child_node = node.getChildNode( i );
final int factor_x = node.getNumberOfExternalNodes() - child_node.getNumberOfExternalNodes();
&& ( !ForesterUtil.isEmpty( node.getNodeData().getSequence().getMolecularSequence() ) ) ) {
paintMolecularSequences( g, node, to_pdf );
}
- if ( dynamically_hide && !is_in_found_nodes && ( ( node.isExternal()
- && ( ( _external_node_index % dynamic_hiding_factor ) != 1 ) )
+ if ( dynamically_hide && ( ( node.isExternal() && ( ( _external_node_index % dynamic_hiding_factor ) != 1 ) )
|| ( !node.isExternal() && ( ( new_x_min < 20 )
|| ( ( _y_distance * node.getNumberOfExternalNodes() ) < getFontMetricsForLargeDefaultFont()
.getHeight() ) ) ) ) ) {
if ( ( !getControlPanel().isShowInternalData() && !node.isExternal() ) ) {
return;
}
+ if ( ( !getControlPanel().isShowExternalData() && node.isExternal() ) ) {
+ return;
+ }
if ( getControlPanel().isShowDomainArchitectures() && node.getNodeData().isHasSequence()
&& ( node.getNodeData().getSequence().getDomainArchitecture() != null ) && ( node.getNodeData()
.getSequence().getDomainArchitecture() instanceof RenderableDomainArchitecture ) ) {
final boolean using_visual_font = setFont( g, node, is_in_found_nodes );
setColor( g, node, to_graphics_file, to_pdf, is_in_found_nodes, getTreeColorSet().getTaxonomyColor() );
float start_x = node.getXcoord() + 3 + ( getOptions().getDefaultNodeShapeSize() / 2 ) + x_shift;
- if ( getControlPanel().getTreeDisplayType() == TreeDisplayType.ALIGNED_PHYLOGRAM && node.isExternal() ) {
+ if ( getControlPanel().getTreeDisplayType() == Options.PHYLOGENY_DISPLAY_TYPE.ALIGNED_PHYLOGRAM
+ && node.isExternal() ) {
start_x = ( float ) ( ( getMaxDistanceToRoot() * getXcorrectionFactor() )
+ ( getOptions().getDefaultNodeShapeSize() / 2 ) + x_shift + ( 2 * TreePanel.MOVE ) + getXdistance()
+ 3 );
}
private final StringBuffer propertiesToString( final PhylogenyNode node ) {
- final PropertiesMap properties = node.getNodeData().getProperties();
- final StringBuffer sb = new StringBuffer();
- boolean first = true;
- for( final String ref : properties.getPropertyRefs() ) {
- if ( first ) {
- first = false;
- }
- else {
- sb.append( " " );
- }
- final Property p = properties.getProperty( ref );
- sb.append( TreePanelUtil.getPartAfterColon( p.getRef() ) );
- sb.append( "=" );
- sb.append( p.getValue() );
- if ( !ForesterUtil.isEmpty( p.getUnit() ) ) {
- sb.append( TreePanelUtil.getPartAfterColon( p.getUnit() ) );
- }
- }
- return sb;
+ return node.getNodeData().getProperties().asText();
}
private void setColor( final Graphics2D g,
+ ", unique entries: " + size;
}
final String s = sb.toString().trim();
-
- getMainPanel().getMainFrame().showTextFrame( s, title );
-
+ getMainPanel().getMainFrame().showTextFrame( s, title );
}
}
}
}
}
if ( node.getNodeData().isHasProperties() ) {
- final PropertiesMap properties = node.getNodeData().getProperties();
- for( final String ref : properties.getPropertyRefs() ) {
+ if ( _popup_buffer.length() > 0 ) {
_popup_buffer.append( "\n" );
- final Property p = properties.getProperty( ref );
- _popup_buffer.append( TreePanelUtil.getPartAfterColon( p.getRef() ) );
- _popup_buffer.append( "=" );
- _popup_buffer.append( p.getValue() );
- if ( !ForesterUtil.isEmpty( p.getUnit() ) ) {
- _popup_buffer.append( TreePanelUtil.getPartAfterColon( p.getUnit() ) );
- }
}
+ _popup_buffer.append( node.getNodeData().getProperties().asText() );
}
if ( _popup_buffer.length() > 0 ) {
if ( !getConfiguration().isUseNativeUI() ) {
else {
getControlPanel().setDrawPhylogramEnabled( false );
}
-
- getMainPanel().getMainFrame().setSelectedTypeInTypeMenu( getPhylogenyGraphicsType() );
-
+ getMainPanel().getMainFrame().setSelectedTypeInTypeMenu( getPhylogenyGraphicsType() );
}
final void calcMaxDepth() {
}
}
- void checkForVectorProperties( final Phylogeny phy ) {
- final DescriptiveStatistics stats = new BasicDescriptiveStatistics();
- for( final PhylogenyNodeIterator iter = phy.iteratorPreorder(); iter.hasNext(); ) {
- final PhylogenyNode node = iter.next();
- if ( node.getNodeData().getProperties() != null ) {
- final PropertiesMap pm = node.getNodeData().getProperties();
- final double[] vector = new double[ pm.getProperties().size() ];
- int counter = 0;
- for( final String ref : pm.getProperties().keySet() ) {
- if ( ref.startsWith( PhyloXmlUtil.VECTOR_PROPERTY_REF ) ) {
- final Property p = pm.getProperty( ref );
- final String value_str = p.getValue();
- final String index_str = ref.substring( PhyloXmlUtil.VECTOR_PROPERTY_REF.length(),
- ref.length() );
- double d = -100;
- try {
- d = Double.parseDouble( value_str );
- }
- catch ( final NumberFormatException e ) {
- JOptionPane.showMessageDialog( this,
- "Could not parse \"" + value_str + "\" into a decimal value",
- "Problem with Vector Data",
- JOptionPane.ERROR_MESSAGE );
- return;
- }
- int i = -1;
- try {
- i = Integer.parseInt( index_str );
- }
- catch ( final NumberFormatException e ) {
- JOptionPane.showMessageDialog( this,
- "Could not parse \"" + index_str
- + "\" into index for vector data",
- "Problem with Vector Data",
- JOptionPane.ERROR_MESSAGE );
- return;
- }
- if ( i < 0 ) {
- JOptionPane.showMessageDialog( this,
- "Attempt to use negative index for vector data",
- "Problem with Vector Data",
- JOptionPane.ERROR_MESSAGE );
- return;
- }
- vector[ i ] = d;
- ++counter;
- stats.addValue( d );
- }
- }
- final List<Double> vector_l = new ArrayList<Double>( counter );
- for( int i = 0; i < counter; ++i ) {
- vector_l.add( vector[ i ] );
- }
- node.getNodeData().setVector( vector_l );
- }
- }
- if ( stats.getN() > 0 ) {
- _statistics_for_vector_data = stats;
- }
- }
-
void clearCurrentExternalNodesDataBuffer() {
setCurrentExternalNodesDataBuffer( new StringBuilder() );
}
&& ( e.getY() <= ( getOvRectangle().getY() + getOvRectangle().getHeight() + 1 ) ) );
}
-
-
final boolean isCanCollapse() {
return ( getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.UNROOTED );
}
_urt_factor *= f;
}
-
-
final void paintBranchCircular( final PhylogenyNode p,
final PhylogenyNode c,
final Graphics2D g,
}
}
final boolean disallow_shortcutting = ( dynamic_hiding_factor < 40 )
- || getControlPanel().isUseVisualStyles() || getOptions().isShowDefaultNodeShapesForMarkedNodes()
- || ( ( getFoundNodes0() != null ) && !getFoundNodes0().isEmpty() )
- || ( ( getFoundNodes1() != null ) && !getFoundNodes1().isEmpty() )
- || ( ( getCurrentExternalNodes() != null ) && !getCurrentExternalNodes().isEmpty() )
+ /* || getControlPanel().isUseVisualStyles() || getOptions().isShowDefaultNodeShapesForMarkedNodes()*/ //TODO check if this is really not needed.
|| to_graphics_file || to_pdf;
for( final PhylogenyNode element : _nodes_in_preorder ) {
paintNodeRectangular( g,