HashMap<Long, Short> _nodeid_dist_to_leaf = new HashMap<Long, Short>();
final private Arc2D _arc = new Arc2D.Double();
private AffineTransform _at;
+ private int _clicked_x;
private int _circ_max_depth;
final private Set<Long> _collapsed_external_nodeid_set = new HashSet<Long>();
private JColorChooser _color_chooser = null;
private final FontRenderContext _frc = new FontRenderContext( null,
false,
false );
+ private float _furthest_node_x;
private PHYLOGENY_GRAPHICS_TYPE _graphics_type = PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR;
private PhylogenyNode _highlight_node = null;
private boolean _in_ov = false;
private float _ov_y_distance = 0;
private int _ov_y_position = 0;
private int _ov_y_start = 0;
+ private boolean _partition_tree = false;
+ private float _partition_threshold = 0;
private final boolean _phy_has_branch_lengths;
private Phylogeny _phylogeny = null;
private final Path2D.Float _polygon = new Path2D.Float();
RenderingHints.VALUE_RENDER_DEFAULT );
private JTextArea _rollover_popup;
private PhylogenyNode _root;
+ private float _root_x;
private final StringBuilder _sb = new StringBuilder();
private double _scale_distance = 0.0;
private String _scale_label = null;
private Map<String, AttributedString> _attributed_string_map = null;
private int _depth_collapse_level = -1;
private int _rank_collapse_level = -1;
- // private boolean _partition_tree = false;
- //private float _root_x;
- //private float _furthest_node_x;
+
+
+
static {
final DecimalFormatSymbols dfs = new DecimalFormatSymbols();
dfs.setDecimalSeparator( '.' );
final private TreeFontSet getTreeFontSet() {
return getMainPanel().getTreeFontSet();
}
+
+ final public float getThreshold() {
+ return _partition_threshold;
+ }
final private float getUrtFactor() {
return _urt_factor;
&& ( !node.isRoot() || ( _subtree_index > 0 ) ) );
}
- final boolean isCurrentTreeIsSubtree() {
+ public final boolean isCurrentTreeIsSubtree() {
return ( _subtree_index > 0 );
}
}
else {
// no node was clicked so partition tree instead
- int clicked_x = e.getX();
-// _partition_tree = true;
_highlight_node = null;
-// PhylogenyNode furthestNode = PhylogenyMethods.calculateNodeWithMaxDistanceToRoot( _phylogeny );
-// _furthest_node_x = furthestNode.getXcoord();
-// _root_x = _phylogeny.getRoot().getXcoord();
-//
-// if (_furthest_node_x != _root_x && !(clicked_x < _root_x || clicked_x > _furthest_node_x)) // don't
-// // of tree
-// {
-// float threshold = (clicked_x - _root_x) / (_furthest_node_x - _root_x);
-// //draw vertical line at clicked_x
-// }
-//
-// _partition_tree = false;}
- }}
+
+ _clicked_x = e.getX();
+ if (!getPhylogeny().isEmpty()) {
+
+ PhylogenyNode furthestNode = PhylogenyMethods.calculateNodeWithMaxDistanceToRoot( _phylogeny );
+ _furthest_node_x = furthestNode.getXcoord();
+ _root_x = _phylogeny.getRoot().getXcoord();
+
+ // don't bother if 0 distance tree or clicked x lies outside of tree
+ if (_furthest_node_x != _root_x && !(_clicked_x < _root_x || _clicked_x > _furthest_node_x))
+ {
+ _partition_tree = true;
+
+ }
+
+
+ }
+ }
+ }
repaint();
}
paintCircularsLite( phy.getRoot(), phy, center_x, center_y, radius, g );
}
+ public final void paintFile( final Graphics2D g,
+ final boolean to_pdf,
+ final int graphics_file_width,
+ final int graphics_file_height,
+ final int graphics_file_x,
+ final int graphics_file_y ) {
+ paintPhylogeny(g,to_pdf,true,graphics_file_width,graphics_file_height,graphics_file_x,graphics_file_y);
+ }
final void paintPhylogeny( final Graphics2D g,
final boolean to_pdf,
final boolean to_graphics_file,
final int graphics_file_height,
final int graphics_file_x,
final int graphics_file_y ) {
- // if (_partition_tree) {
- //
- // }
-
+
if ( ( _phylogeny == null ) || _phylogeny.isEmpty() ) {
return;
}
g.setTransform( _at );
paintOvRectangle( g );
}
- }
+
+
+ }
+ if (_partition_tree) {
+ g.setColor( Color.BLACK );
+ _partition_threshold = (_clicked_x - _root_x) / (_furthest_node_x - _root_x);
+ drawLine( _clicked_x, 0, _clicked_x, getHeight(),g);
+ _partition_tree = false;
+ }
}
+
final void recalculateMaxDistanceToRoot() {
_max_distance_to_root = PhylogenyMethods.calculateMaxDistanceToRoot( getPhylogeny() );