+ final void midpointRoot() {
+ if ( ( _phylogeny == null ) || ( _phylogeny.getNumberOfExternalNodes() < 2 ) ) {
+ return;
+ }
+ if ( !_phylogeny.isRerootable() ) {
+ JOptionPane.showMessageDialog( this,
+ "This is not rerootable",
+ "Not rerootable",
+ JOptionPane.WARNING_MESSAGE );
+ return;
+ }
+ setNodeInPreorderToNull();
+ setWaitCursor();
+ PhylogenyMethods.midpointRoot( _phylogeny );
+ resetNodeIdToDistToLeafMap();
+ setArrowCursor();
+ setEdited( true );
+ repaint();
+ }
+
+ final void mouseClicked( final MouseEvent e ) {
+ if ( getOptions().isShowOverview() && isOvOn() && isInOv() ) {
+ final double w_ratio = getVisibleRect().width / getOvRectangle().getWidth();
+ final double h_ratio = getVisibleRect().height / getOvRectangle().getHeight();
+ double x = ( e.getX() - getVisibleRect().x - getOvXPosition() - ( getOvRectangle().getWidth() / 2.0 ) )
+ * w_ratio;
+ double y = ( e.getY() - getVisibleRect().y - getOvYPosition() - ( getOvRectangle().getHeight() / 2.0 ) )
+ * h_ratio;
+ if ( x < 0 ) {
+ x = 0;
+ }
+ if ( y < 0 ) {
+ y = 0;
+ }
+ final double max_x = getWidth() - getVisibleRect().width;
+ final double max_y = getHeight() - getVisibleRect().height;
+ if ( x > max_x ) {
+ x = max_x;
+ }
+ if ( y > max_y ) {
+ y = max_y;
+ }
+ getMainPanel().getCurrentScrollPane().getViewport()
+ .setViewPosition( new Point( ForesterUtil.roundToInt( x ), ForesterUtil.roundToInt( y ) ) );
+ setInOvRect( true );
+ repaint();
+ }
+ else {
+ final PhylogenyNode node = findNode( e.getX(), e.getY() );
+ if ( node != null ) {
+ if ( !node.isRoot() && node.getParent().isCollapse() ) {
+ return;
+ }
+ _highlight_node = node;
+ // Check if shift key is down
+ if ( ( e.getModifiers() & InputEvent.SHIFT_MASK ) != 0 ) {
+ // Yes, so add to _found_nodes
+ if ( getFoundNodes() == null ) {
+ setFoundNodes( new HashSet<Long>() );
+ }
+ getFoundNodes().add( node.getId() );
+ // Check if control key is down
+ }
+ else if ( ( e.getModifiers() & InputEvent.CTRL_MASK ) != 0 ) {
+ // Yes, so pop-up menu
+ displayNodePopupMenu( node, e.getX(), e.getY() );
+ // Handle unadorned click
+ }
+ else {
+ // Check for right mouse button
+ if ( e.getModifiers() == 4 ) {
+ displayNodePopupMenu( node, e.getX(), e.getY() );
+ }
+ else {
+ // if not in _found_nodes, clear _found_nodes
+ handleClickToAction( _control_panel.getActionWhenNodeClicked(), node );
+ }
+ }
+ }
+ else {
+ // no node was clicked
+ _highlight_node = null;
+ }
+ }
+ repaint();
+ }
+
+ final void mouseDragInBrowserPanel( final MouseEvent e ) {
+ setCursor( MOVE_CURSOR );
+ final Point scroll_position = getMainPanel().getCurrentScrollPane().getViewport().getViewPosition();
+ scroll_position.x -= ( e.getX() - getLastDragPointX() );
+ scroll_position.y -= ( e.getY() - getLastDragPointY() );
+ if ( scroll_position.x < 0 ) {
+ scroll_position.x = 0;
+ }
+ else {
+ final int max_x = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar().getMaximum()
+ - getMainPanel().getCurrentScrollPane().getHorizontalScrollBar().getVisibleAmount();
+ if ( scroll_position.x > max_x ) {
+ scroll_position.x = max_x;
+ }
+ }
+ if ( scroll_position.y < 0 ) {
+ scroll_position.y = 0;
+ }
+ else {
+ final int max_y = getMainPanel().getCurrentScrollPane().getVerticalScrollBar().getMaximum()
+ - getMainPanel().getCurrentScrollPane().getVerticalScrollBar().getVisibleAmount();
+ if ( scroll_position.y > max_y ) {
+ scroll_position.y = max_y;
+ }
+ }
+ if ( isOvOn() || getOptions().isShowScale() ) {
+ repaint();
+ }
+ getMainPanel().getCurrentScrollPane().getViewport().setViewPosition( scroll_position );
+ }
+
+ final void mouseDragInOvRectangle( final MouseEvent e ) {
+ setCursor( HAND_CURSOR );
+ final double w_ratio = getVisibleRect().width / getOvRectangle().getWidth();
+ final double h_ratio = getVisibleRect().height / getOvRectangle().getHeight();
+ final Point scroll_position = getMainPanel().getCurrentScrollPane().getViewport().getViewPosition();
+ double dx = ( ( w_ratio * e.getX() ) - ( w_ratio * getLastDragPointX() ) );
+ double dy = ( ( h_ratio * e.getY() ) - ( h_ratio * getLastDragPointY() ) );
+ scroll_position.x = ForesterUtil.roundToInt( scroll_position.x + dx );
+ scroll_position.y = ForesterUtil.roundToInt( scroll_position.y + dy );
+ if ( scroll_position.x <= 0 ) {
+ scroll_position.x = 0;
+ dx = 0;
+ }
+ else {
+ final int max_x = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar().getMaximum()
+ - getMainPanel().getCurrentScrollPane().getHorizontalScrollBar().getVisibleAmount();
+ if ( scroll_position.x >= max_x ) {
+ dx = 0;
+ scroll_position.x = max_x;
+ }
+ }
+ if ( scroll_position.y <= 0 ) {
+ dy = 0;
+ scroll_position.y = 0;
+ }
+ else {
+ final int max_y = getMainPanel().getCurrentScrollPane().getVerticalScrollBar().getMaximum()
+ - getMainPanel().getCurrentScrollPane().getVerticalScrollBar().getVisibleAmount();
+ if ( scroll_position.y >= max_y ) {
+ dy = 0;
+ scroll_position.y = max_y;
+ }
+ }
+ repaint();
+ getMainPanel().getCurrentScrollPane().getViewport().setViewPosition( scroll_position );
+ setLastMouseDragPointX( ( float ) ( e.getX() + dx ) );
+ setLastMouseDragPointY( ( float ) ( e.getY() + dy ) );
+ }
+
+ final void mouseMoved( final MouseEvent e ) {
+ requestFocusInWindow();
+ if ( _current_external_nodes != null ) {
+ _current_external_nodes = null;
+ repaint();
+ }
+ if ( getControlPanel().isNodeDescPopup() ) {
+ if ( _node_desc_popup != null ) {
+ _node_desc_popup.hide();
+ _node_desc_popup = null;
+ }
+ }
+ if ( getOptions().isShowOverview() && isOvOn() ) {
+ if ( inOvVirtualRectangle( e ) ) {
+ if ( !isInOvRect() ) {
+ setInOvRect( true );
+ repaint();
+ }
+ }
+ else {
+ if ( isInOvRect() ) {
+ setInOvRect( false );
+ repaint();
+ }
+ }
+ }
+ if ( inOv( e ) && getOptions().isShowOverview() && isOvOn() ) {
+ if ( !isInOv() ) {
+ setInOv( true );
+ }
+ }
+ else {
+ if ( isInOv() ) {
+ setInOv( false );
+ }
+ final PhylogenyNode node = findNode( e.getX(), e.getY() );
+ if ( ( node != null ) && ( node.isRoot() || !node.getParent().isCollapse() ) ) {
+ if ( ( getControlPanel().getActionWhenNodeClicked() == NodeClickAction.GET_EXT_DESC_DATA ) ) {
+ for( final PhylogenyNode n : node.getAllExternalDescendants() ) {
+ addToCurrentExternalNodes( n.getId() );
+ }
+ setCursor( HAND_CURSOR );
+ repaint();
+ }
+ else if ( ( getControlPanel().getActionWhenNodeClicked() == NodeClickAction.CUT_SUBTREE )
+ || ( getControlPanel().getActionWhenNodeClicked() == NodeClickAction.COPY_SUBTREE )
+ || ( getControlPanel().getActionWhenNodeClicked() == NodeClickAction.PASTE_SUBTREE )
+ || ( getControlPanel().getActionWhenNodeClicked() == NodeClickAction.DELETE_NODE_OR_SUBTREE )
+ || ( getControlPanel().getActionWhenNodeClicked() == NodeClickAction.REROOT )
+ || ( getControlPanel().getActionWhenNodeClicked() == NodeClickAction.ADD_NEW_NODE ) ) {
+ setCursor( CUT_CURSOR );
+ }
+ else {
+ setCursor( HAND_CURSOR );
+ if ( getControlPanel().isNodeDescPopup() ) {
+ showNodeDataPopup( e, node );
+ }
+ }
+ }
+ else {
+ setCursor( ARROW_CURSOR );
+ }
+ }
+ }
+
+ final void mouseReleasedInBrowserPanel( final MouseEvent e ) {
+ setCursor( ARROW_CURSOR );
+ }
+
+ final void multiplyUrtFactor( final float f ) {
+ _urt_factor *= f;
+ }
+
+ final JApplet obtainApplet() {
+ return ( ( MainPanelApplets ) getMainPanel() ).getApplet();
+ }
+
+ final void paintBranchCircular( final PhylogenyNode p,
+ final PhylogenyNode c,
+ final Graphics2D g,
+ final boolean radial_labels,
+ final boolean to_pdf,
+ final boolean to_graphics_file ) {
+ final double angle = _urt_nodeid_angle_map.get( c.getId() );
+ final double root_x = _root.getXcoord();
+ final double root_y = _root.getYcoord();
+ final double dx = root_x - p.getXcoord();
+ final double dy = root_y - p.getYcoord();
+ final double parent_radius = Math.sqrt( ( dx * dx ) + ( dy * dy ) );
+ final double arc = ( _urt_nodeid_angle_map.get( p.getId() ) ) - angle;
+ assignGraphicsForBranchWithColorForParentBranch( c, false, g, to_pdf, to_graphics_file );
+ if ( ( c.isFirstChildNode() || c.isLastChildNode() )
+ && ( ( Math.abs( parent_radius * arc ) > 1.5 ) || to_pdf || to_graphics_file ) ) {
+ final double r2 = 2.0 * parent_radius;
+ drawArc( root_x - parent_radius, root_y - parent_radius, r2, r2, ( -angle - arc ), arc, g );
+ }
+ drawLine( c.getXcoord(),
+ c.getYcoord(),
+ root_x + ( Math.cos( angle ) * parent_radius ),
+ root_y + ( Math.sin( angle ) * parent_radius ),
+ g );
+ paintNodeBox( c.getXcoord(), c.getYcoord(), c, g, to_pdf, to_graphics_file, isInFoundNodes( c )
+ || isInCurrentExternalNodes( c ) );
+ if ( c.isExternal() ) {
+ final boolean is_in_found_nodes = isInFoundNodes( c ) || isInCurrentExternalNodes( c );
+ if ( ( _dynamic_hiding_factor > 1 ) && !is_in_found_nodes
+ && ( ( _urt_nodeid_index_map.get( c.getId() ) % _dynamic_hiding_factor ) != 1 ) ) {
+ return;
+ }
+ paintNodeDataUnrootedCirc( g, c, to_pdf, to_graphics_file, radial_labels, 0, is_in_found_nodes );
+ }
+ }
+
+ final void paintBranchCircularLite( final PhylogenyNode p, final PhylogenyNode c, final Graphics2D g ) {
+ final double angle = _urt_nodeid_angle_map.get( c.getId() );
+ final double root_x = _root.getXSecondary();
+ final double root_y = _root.getYSecondary();
+ final double dx = root_x - p.getXSecondary();
+ final double dy = root_y - p.getYSecondary();
+ final double arc = ( _urt_nodeid_angle_map.get( p.getId() ) ) - angle;
+ final double parent_radius = Math.sqrt( ( dx * dx ) + ( dy * dy ) );
+ g.setColor( getTreeColorSet().getOvColor() );
+ if ( ( c.isFirstChildNode() || c.isLastChildNode() ) && ( Math.abs( arc ) > 0.02 ) ) {
+ final double r2 = 2.0 * parent_radius;
+ drawArc( root_x - parent_radius, root_y - parent_radius, r2, r2, ( -angle - arc ), arc, g );
+ }
+ drawLine( c.getXSecondary(),
+ c.getYSecondary(),
+ root_x + ( Math.cos( angle ) * parent_radius ),
+ root_y + ( Math.sin( angle ) * parent_radius ),
+ g );
+ if ( isInFoundNodes( c ) || isInCurrentExternalNodes( c ) ) {
+ g.setColor( getTreeColorSet().getFoundColor() );
+ drawRectFilled( c.getXSecondary() - 1, c.getYSecondary() - 1, 3, 3, g );
+ }
+ }
+
+ final void paintCircular( final Phylogeny phy,
+ final double starting_angle,
+ final int center_x,
+ final int center_y,
+ final int radius,
+ final Graphics2D g,
+ final boolean to_pdf,
+ final boolean to_graphics_file ) {
+ final int circ_num_ext_nodes = phy.getNumberOfExternalNodes() - _collapsed_external_nodeid_set.size();
+ System.out.println( "# collapsed external = " + _collapsed_external_nodeid_set.size() );
+ _root = phy.getRoot();
+ _root.setXcoord( center_x );
+ _root.setYcoord( center_y );
+ final boolean radial_labels = getOptions().getNodeLabelDirection() == NODE_LABEL_DIRECTION.RADIAL;
+ double current_angle = starting_angle;
+ int i = 0;
+ for( final PhylogenyNodeIterator it = phy.iteratorExternalForward(); it.hasNext(); ) {
+ final PhylogenyNode n = it.next();
+ if ( !n.isCollapse() ) {
+ n.setXcoord( ( float ) ( center_x + ( radius * Math.cos( current_angle ) ) ) );
+ n.setYcoord( ( float ) ( center_y + ( radius * Math.sin( current_angle ) ) ) );
+ _urt_nodeid_angle_map.put( n.getId(), current_angle );
+ _urt_nodeid_index_map.put( n.getId(), i++ );
+ current_angle += ( TWO_PI / circ_num_ext_nodes );
+ }
+ else {
+ //TODO remove me
+ System.out.println( "is collapse" + n.getName() );
+ }
+ }
+ paintCirculars( phy.getRoot(), phy, center_x, center_y, radius, radial_labels, g, to_pdf, to_graphics_file );
+ paintNodeBox( _root.getXcoord(), _root.getYcoord(), _root, g, to_pdf, to_graphics_file, isInFoundNodes( _root ) );
+ }
+
+ final void paintCircularLite( final Phylogeny phy,
+ final double starting_angle,
+ final int center_x,
+ final int center_y,
+ final int radius,
+ final Graphics2D g ) {
+ final int circ_num_ext_nodes = phy.getNumberOfExternalNodes();
+ _root = phy.getRoot();
+ _root.setXSecondary( center_x );
+ _root.setYSecondary( center_y );
+ double current_angle = starting_angle;
+ for( final PhylogenyNodeIterator it = phy.iteratorExternalForward(); it.hasNext(); ) {
+ final PhylogenyNode n = it.next();
+ n.setXSecondary( ( float ) ( center_x + ( radius * Math.cos( current_angle ) ) ) );
+ n.setYSecondary( ( float ) ( center_y + ( radius * Math.sin( current_angle ) ) ) );
+ _urt_nodeid_angle_map.put( n.getId(), current_angle );
+ current_angle += ( TWO_PI / circ_num_ext_nodes );
+ }
+ paintCircularsLite( phy.getRoot(), phy, center_x, center_y, radius, g );
+ }
+
+ final void paintPhylogeny( final Graphics2D g,
+ final boolean to_pdf,
+ final boolean to_graphics_file,
+ final int graphics_file_width,
+ final int graphics_file_height,
+ final int graphics_file_x,
+ final int graphics_file_y ) {
+ if ( ( _phylogeny == null ) || _phylogeny.isEmpty() ) {
+ return;
+ }
+ if ( _control_panel.isShowSequenceRelations() ) {
+ _query_sequence = _control_panel.getSelectedQuerySequence();
+ }
+ // Color the background
+ if ( !to_pdf ) {
+ final Rectangle r = getVisibleRect();
+ if ( !getOptions().isBackgroundColorGradient() || getOptions().isPrintBlackAndWhite() ) {
+ g.setColor( getTreeColorSet().getBackgroundColor() );
+ if ( !to_graphics_file ) {
+ g.fill( r );
+ }
+ else {
+ if ( getOptions().isPrintBlackAndWhite() ) {
+ g.setColor( Color.WHITE );
+ }
+ g.fillRect( graphics_file_x, graphics_file_y, graphics_file_width, graphics_file_height );
+ }
+ }
+ else {
+ if ( !to_graphics_file ) {
+ g.setPaint( new GradientPaint( r.x, r.y, getTreeColorSet().getBackgroundColor(), r.x, r.y
+ + r.height, getTreeColorSet().getBackgroundColorGradientBottom() ) );
+ g.fill( r );
+ }
+ else {
+ g.setPaint( new GradientPaint( graphics_file_x,
+ graphics_file_y,
+ getTreeColorSet().getBackgroundColor(),
+ graphics_file_x,
+ graphics_file_y + graphics_file_height,
+ getTreeColorSet().getBackgroundColorGradientBottom() ) );
+ g.fillRect( graphics_file_x, graphics_file_y, graphics_file_width, graphics_file_height );
+ }
+ }
+ setupStroke( g );
+ }
+ else {
+ g.setStroke( new BasicStroke( getOptions().getPrintLineWidth() ) );
+ }
+ if ( ( getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
+ && ( getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) {
+ _external_node_index = 0;
+ // Position starting X of tree
+ if ( !_phylogeny.isRooted() /*|| ( _subtree_index > 0 )*/) {
+ _phylogeny.getRoot().setXcoord( TreePanel.MOVE );
+ }
+ else if ( ( _phylogeny.getRoot().getDistanceToParent() > 0.0 ) && getControlPanel().isDrawPhylogram() ) {
+ _phylogeny.getRoot().setXcoord( ( float ) ( TreePanel.MOVE + ( _phylogeny.getRoot()
+ .getDistanceToParent() * getXcorrectionFactor() ) ) );
+ }
+ else {
+ _phylogeny.getRoot().setXcoord( TreePanel.MOVE + getXdistance() );
+ }
+ // Position starting Y of tree
+ _phylogeny.getRoot().setYcoord( ( getYdistance() * _phylogeny.getRoot().getNumberOfExternalNodes() )
+ + ( TreePanel.MOVE / 2.0f ) );
+ final int dynamic_hiding_factor = calcDynamicHidingFactor();
+ if ( getControlPanel().isDynamicallyHideData() ) {
+ if ( dynamic_hiding_factor > 1 ) {
+ getControlPanel().setDynamicHidingIsOn( true );
+ }
+ else {
+ getControlPanel().setDynamicHidingIsOn( false );
+ }
+ }
+ 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( final PhylogenyNode element : _nodes_in_preorder ) {
+ paintNodeRectangular( g, element, to_pdf, getControlPanel().isDynamicallyHideData()
+ && ( dynamic_hiding_factor > 1 ), dynamic_hiding_factor, to_graphics_file );
+ }
+ if ( getOptions().isShowScale() && getControlPanel().isDrawPhylogram() && ( getScaleDistance() > 0.0 ) ) {
+ if ( !( to_graphics_file || to_pdf ) ) {
+ paintScale( g,
+ getVisibleRect().x,
+ getVisibleRect().y + getVisibleRect().height,
+ to_pdf,
+ to_graphics_file );
+ }
+ else {
+ paintScale( g, graphics_file_x, graphics_file_y + graphics_file_height, to_pdf, to_graphics_file );
+ }
+ }
+ if ( getOptions().isShowOverview() && isOvOn() && !to_graphics_file && !to_pdf ) {
+ paintPhylogenyLite( g );
+ }
+ }
+ else if ( getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) {
+ if ( getControlPanel().getDynamicallyHideData() != null ) {
+ getControlPanel().setDynamicHidingIsOn( false );
+ }
+ final double angle = getStartingAngle();
+ final boolean radial_labels = getOptions().getNodeLabelDirection() == NODE_LABEL_DIRECTION.RADIAL;
+ _dynamic_hiding_factor = 0;
+ if ( getControlPanel().isDynamicallyHideData() ) {
+ _dynamic_hiding_factor = ( int ) ( ( getTreeFontSet()._fm_large.getHeight() * 1.5 * getPhylogeny()
+ .getNumberOfExternalNodes() ) / ( TWO_PI * 10 ) );
+ }
+ if ( getControlPanel().getDynamicallyHideData() != null ) {
+ if ( _dynamic_hiding_factor > 1 ) {
+ getControlPanel().setDynamicHidingIsOn( true );
+ }
+ else {
+ getControlPanel().setDynamicHidingIsOn( false );
+ }
+ }
+ paintUnrooted( _phylogeny.getRoot(),
+ angle,
+ ( float ) ( angle + ( 2 * Math.PI ) ),
+ radial_labels,
+ g,
+ to_pdf,
+ to_graphics_file );
+ if ( getOptions().isShowScale() ) {
+ if ( !( to_graphics_file || to_pdf ) ) {
+ paintScale( g,
+ getVisibleRect().x,
+ getVisibleRect().y + getVisibleRect().height,
+ to_pdf,
+ to_graphics_file );
+ }
+ else {
+ paintScale( g, graphics_file_x, graphics_file_y + graphics_file_height, to_pdf, to_graphics_file );
+ }
+ }
+ if ( getOptions().isShowOverview() && isOvOn() && !to_graphics_file && !to_pdf ) {
+ g.setColor( getTreeColorSet().getOvColor() );
+ paintUnrootedLite( _phylogeny.getRoot(),
+ angle,
+ angle + ( 2 * Math.PI ),
+ g,
+ ( getUrtFactorOv() / ( getVisibleRect().width / getOvMaxWidth() ) ) );
+ paintOvRectangle( g );
+ }
+ }
+ else if ( getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) {
+ final int radius = ( int ) ( ( Math.min( getPreferredSize().getWidth(), getPreferredSize().getHeight() ) / 2 ) - ( MOVE + getLongestExtNodeInfo() ) );
+ final int d = radius + MOVE + getLongestExtNodeInfo();
+ _dynamic_hiding_factor = 0;
+ if ( getControlPanel().isDynamicallyHideData() && ( radius > 0 ) ) {
+ _dynamic_hiding_factor = ( int ) ( ( getTreeFontSet()._fm_large.getHeight() * 1.5 * getPhylogeny()
+ .getNumberOfExternalNodes() ) / ( TWO_PI * radius ) );
+ }
+ if ( getControlPanel().getDynamicallyHideData() != null ) {
+ if ( _dynamic_hiding_factor > 1 ) {
+ getControlPanel().setDynamicHidingIsOn( true );
+ }
+ else {
+ getControlPanel().setDynamicHidingIsOn( false );
+ }
+ }
+ paintCircular( _phylogeny, getStartingAngle(), d, d, radius > 0 ? radius : 0, g, to_pdf, to_graphics_file );
+ if ( getOptions().isShowOverview() && isOvOn() && !to_graphics_file && !to_pdf ) {
+ final int radius_ov = ( int ) ( getOvMaxHeight() < getOvMaxWidth() ? getOvMaxHeight() / 2
+ : getOvMaxWidth() / 2 );
+ double x_scale = 1.0;
+ double y_scale = 1.0;
+ int x_pos = getVisibleRect().x + getOvXPosition();
+ int y_pos = getVisibleRect().y + getOvYPosition();
+ if ( getWidth() > getHeight() ) {
+ x_scale = ( double ) getHeight() / getWidth();
+ x_pos = ForesterUtil.roundToInt( x_pos / x_scale );
+ }
+ else {
+ y_scale = ( double ) getWidth() / getHeight();
+ y_pos = ForesterUtil.roundToInt( y_pos / y_scale );
+ }
+ _at = g.getTransform();
+ g.scale( x_scale, y_scale );
+ paintCircularLite( _phylogeny,
+ getStartingAngle(),
+ x_pos + radius_ov,
+ y_pos + radius_ov,
+ ( int ) ( radius_ov - ( getLongestExtNodeInfo() / ( getVisibleRect().width / getOvRectangle()
+ .getWidth() ) ) ),
+ g );
+ g.setTransform( _at );
+ paintOvRectangle( g );
+ }
+ }
+ }
+
+ final void recalculateMaxDistanceToRoot() {
+ _max_distance_to_root = PhylogenyMethods.calculateMaxDistanceToRoot( getPhylogeny() );
+ }
+
+ /**
+ * Remove all edit-node frames