private JMenuItem _choose_font_mi;
private JMenuItem _switch_colors_mi;
JCheckBoxMenuItem _label_direction_cbmi;
- private JCheckBoxMenuItem _show_node_boxes_cbmi;
private JCheckBoxMenuItem _show_scale_cbmi;
private JCheckBoxMenuItem _search_case_senstive_cbmi;
private JCheckBoxMenuItem _search_whole_words_only_cbmi;
private JMenuItem _collapse_species_specific_subtrees;
private JMenuItem _overview_placment_mi;
private ButtonGroup _radio_group_1;
+ private JCheckBoxMenuItem _show_default_node_shapes_cbmi;
+ private JMenuItem _cycle_node_shape_mi;
+ private JMenuItem _cycle_node_fill_mi;
+ private JMenuItem _choose_node_size_mi;
+ private JCheckBoxMenuItem _taxonomy_colorize_node_shapes_cbmi;
@Override
public void actionPerformed( final ActionEvent e ) {
else if ( o == _choose_minimal_confidence_mi ) {
chooseMinimalConfidence();
}
+ else if ( o == _choose_node_size_mi ) {
+ MainFrame.chooseNodeSize( getOptions(), this );
+ }
else if ( o == _overview_placment_mi ) {
MainFrame.cycleOverview( getOptions(), getCurrentTreePanel() );
}
- else if ( o == _show_node_boxes_cbmi ) {
- updateOptions( getOptions() );
+ else if ( o == _cycle_node_fill_mi ) {
+ MainFrame.cycleNodeFill( getOptions(), getCurrentTreePanel() );
+ }
+ else if ( o == _cycle_node_shape_mi ) {
+ MainFrame.cycleNodeShape( getOptions(), getCurrentTreePanel() );
}
else if ( o == _non_lined_up_cladograms_rbmi ) {
updateOptions( getOptions() );
else if ( o == _color_labels_same_as_parent_branch ) {
updateOptions( getOptions() );
}
+ else if ( o == _show_default_node_shapes_cbmi ) {
+ updateOptions( getOptions() );
+ }
+ else if ( o == _taxonomy_colorize_node_shapes_cbmi ) {
+ updateOptions( getOptions() );
+ }
else if ( o == _about_item ) {
MainFrame.about();
}
@Override
public void stateChanged( final ChangeEvent e ) {
- MainFrame.setOvPlacementColorChooseMenuItem( _overview_placment_mi, getCurrentTreePanel() );
+ MainFrame.setOvPlacementColorChooseMenuItem( _overview_placment_mi, getOptions() );
MainFrame.setTextColorChooseMenuItem( _switch_colors_mi, getCurrentTreePanel() );
MainFrame
.setTextMinSupportMenuItem( _choose_minimal_confidence_mi, getOptions(), getCurrentTreePanel() );
_uniform_cladograms_rbmi,
_ext_node_dependent_cladogram_rbmi,
_label_direction_cbmi );
+ MainFrame.setCycleNodeFillMenuItem( _cycle_node_fill_mi, getOptions() );
+ MainFrame.setCycleNodeShapeMenuItem( _cycle_node_shape_mi, getOptions() );
+ MainFrame.setTextNodeSizeMenuItem( _choose_node_size_mi, getOptions() );
}
} );
_options_jmenu.add( MainFrame.customizeMenuItemAsLabel( new JMenuItem( MainFrame.DISPLAY_SUBHEADER ),
_radio_group_1.add( _ext_node_dependent_cladogram_rbmi );
_radio_group_1.add( _uniform_cladograms_rbmi );
_radio_group_1.add( _non_lined_up_cladograms_rbmi );
- _options_jmenu.add( _show_node_boxes_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_NODE_BOXES_LABEL ) );
+ //
+ _options_jmenu
+ .add( _show_default_node_shapes_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_NODE_BOXES_LABEL ) );
+ _options_jmenu
+ .add( _taxonomy_colorize_node_shapes_cbmi = new JCheckBoxMenuItem( MainFrame.TAXONOMY_COLORIZE_NODE_SHAPES_LABEL ) );
+ _options_jmenu.add( _cycle_node_shape_mi = new JMenuItem( MainFrame.CYCLE_NODE_SHAPE_LABEL ) );
+ _options_jmenu.add( _cycle_node_fill_mi = new JMenuItem( MainFrame.CYCLE_NODE_FILL_LABEL ) );
+ _options_jmenu.add( _choose_node_size_mi = new JMenuItem( MainFrame.CHOOSE_NODE_SIZE_LABEL ) );
+ //
_options_jmenu.add( _show_scale_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_SCALE_LABEL ) );
_options_jmenu
.add( _show_branch_length_values_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_BRANCH_LENGTH_VALUES_LABEL ) );
customizeJMenuItem( _choose_minimal_confidence_mi );
customizeJMenuItem( _switch_colors_mi );
customizeJMenuItem( _overview_placment_mi );
- customizeCheckBoxMenuItem( _show_node_boxes_cbmi, getOptions().getDefaultNodeShape() );
customizeCheckBoxMenuItem( _label_direction_cbmi,
getOptions().getNodeLabelDirection() == NODE_LABEL_DIRECTION.RADIAL );
customizeCheckBoxMenuItem( _screen_antialias_cbmi, getOptions().isAntialiasScreen() );
customizeCheckBoxMenuItem( _background_gradient_cbmi, getOptions().isBackgroundColorGradient() );
customizeCheckBoxMenuItem( _show_domain_labels, getOptions().isShowDomainLabels() );
customizeCheckBoxMenuItem( _abbreviate_scientific_names, getOptions().isAbbreviateScientificTaxonNames() );
+ customizeCheckBoxMenuItem( _show_default_node_shapes_cbmi, getOptions().isShowDefaultNodeShapes() );
+ customizeCheckBoxMenuItem( _taxonomy_colorize_node_shapes_cbmi, getOptions().isTaxonomyColorizeNodeShapes() );
+ customizeJMenuItem( _cycle_node_shape_mi );
+ customizeJMenuItem( _cycle_node_fill_mi );
+ customizeJMenuItem( _choose_node_size_mi );
customizeCheckBoxMenuItem( _color_labels_same_as_parent_branch, getOptions().isColorLabelsSameAsParentBranch() );
customizeCheckBoxMenuItem( _search_case_senstive_cbmi, getOptions().isSearchCaseSensitive() );
customizeCheckBoxMenuItem( _show_scale_cbmi, getOptions().isShowScale() );
&& _abbreviate_scientific_names.isSelected() );
options.setColorLabelsSameAsParentBranch( ( _color_labels_same_as_parent_branch != null )
&& _color_labels_same_as_parent_branch.isSelected() );
- options.setShowNodeBoxes( ( _show_node_boxes_cbmi != null ) && _show_node_boxes_cbmi.isSelected() );
+ options.setShowDefaultNodeShapes( ( _show_default_node_shapes_cbmi != null )
+ && _show_default_node_shapes_cbmi.isSelected() );
+ options.setTaxonomyColorizeNodeShapes( ( _taxonomy_colorize_node_shapes_cbmi != null )
+ && _taxonomy_colorize_node_shapes_cbmi.isSelected() );
if ( ( _non_lined_up_cladograms_rbmi != null ) && ( _non_lined_up_cladograms_rbmi.isSelected() ) ) {
options.setCladogramType( CLADOGRAM_TYPE.NON_LINED_UP );
}
package org.forester.archaeopteryx;
+import java.awt.Component;
import java.awt.Container;
import java.awt.Font;
import java.awt.event.ActionEvent;
else if ( o == _choose_minimal_confidence_mi ) {
chooseMinimalConfidence();
}
+ else if ( o == _choose_node_size_mi ) {
+ chooseNodeSize( getOptions(), this );
+ }
else if ( o == _overview_placment_mi ) {
MainFrame.cycleOverview( getOptions(), getCurrentTreePanel() );
}
+ else if ( o == _cycle_node_fill_mi ) {
+ MainFrame.cycleNodeFill( getOptions(), getCurrentTreePanel() );
+ }
+ else if ( o == _cycle_node_shape_mi ) {
+ MainFrame.cycleNodeShape( getOptions(), getCurrentTreePanel() );
+ }
else if ( o == _screen_antialias_cbmi ) {
updateOptions( getOptions() );
updateScreenTextAntialias( getMainPanel().getTreePanels() );
}
}
+ static void chooseNodeSize( final Options options, final Component parent ) {
+ final String s = ( String ) JOptionPane.showInputDialog( parent,
+ "Please enter the default size for node shapes.\n"
+ + "[current value: "
+ + options.getDefaultNodeShapeSize() + "]\n",
+ "Node Shape Size",
+ JOptionPane.QUESTION_MESSAGE,
+ null,
+ null,
+ options.getDefaultNodeShapeSize() );
+ if ( !ForesterUtil.isEmpty( s ) ) {
+ boolean success = true;
+ double m = 0.0;
+ final String m_str = s.trim();
+ if ( !ForesterUtil.isEmpty( m_str ) ) {
+ try {
+ m = Double.parseDouble( m_str );
+ }
+ catch ( final Exception ex ) {
+ success = false;
+ }
+ }
+ else {
+ success = false;
+ }
+ if ( success && ( m >= 0.0 ) ) {
+ final short size = ForesterUtil.roundToShort( m );
+ if ( size >= 0.0 ) {
+ options.setDefaultNodeShapeSize( size );
+ }
+ }
+ }
+ }
+
void close() {
removeTextFrame();
if ( _mainpanel != null ) {
&& _abbreviate_scientific_names.isSelected() );
options.setColorLabelsSameAsParentBranch( ( _color_labels_same_as_parent_branch != null )
&& _color_labels_same_as_parent_branch.isSelected() );
- //TODO FIXME ~~
options.setShowDefaultNodeShapes( ( _show_default_node_shapes_cbmi != null )
&& _show_default_node_shapes_cbmi.isSelected() );
options.setTaxonomyColorizeNodeShapes( ( _taxonomy_colorize_node_shapes_cbmi != null )
&& _taxonomy_colorize_node_shapes_cbmi.isSelected() );
- //TODO FIXME ~~
if ( ( _non_lined_up_cladograms_rbmi != null ) && ( _non_lined_up_cladograms_rbmi.isSelected() ) ) {
options.setCladogramType( CLADOGRAM_TYPE.NON_LINED_UP );
}
default:
throw new RuntimeException( "unknown placement: " + op.getOvPlacement() );
}
- tree_panel.updateOvSettings();
+ if ( tree_panel != null ) {
+ tree_panel.updateOvSettings();
+ }
+ }
+
+ static void cycleNodeFill( final Options op, final TreePanel tree_panel ) {
+ switch ( op.getDefaultNodeFill() ) {
+ case GRADIENT:
+ op.setDefaultNodeFill( Options.NodeFill.SOLID );
+ break;
+ case NONE:
+ op.setDefaultNodeFill( Options.NodeFill.GRADIENT );
+ break;
+ case SOLID:
+ op.setDefaultNodeFill( Options.NodeFill.NONE );
+ break;
+ default:
+ throw new RuntimeException( "unknown fill: " + op.getDefaultNodeFill() );
+ }
+ }
+
+ static void cycleNodeShape( final Options op, final TreePanel tree_panel ) {
+ switch ( op.getDefaultNodeShape() ) {
+ case CIRCLE:
+ op.setDefaultNodeShape( Options.NodeShape.RECTANGLE );
+ break;
+ case RECTANGLE:
+ op.setDefaultNodeShape( Options.NodeShape.CIRCLE );
+ break;
+ default:
+ throw new RuntimeException( "unknown shape: " + op.getDefaultNodeShape() );
+ }
}
static void help( final Map<String, WebLink> weblinks ) {
TextFrame.instantiate( sb.toString() );
}
- static void setOvPlacementColorChooseMenuItem( final JMenuItem mi, final TreePanel tree_panel ) {
- if ( ( tree_panel != null ) && ( tree_panel.getTreeColorSet() != null ) ) {
- mi.setText( "Overview Placement... (current: " + tree_panel.getOptions().getOvPlacement() + ")" );
+ static void setOvPlacementColorChooseMenuItem( final JMenuItem mi, final Options options ) {
+ if ( ( options != null ) && ( options.getOvPlacement() != null ) ) {
+ mi.setText( "Cycle Overview Placement... (current: " + options.getOvPlacement() + ")" );
}
else {
- mi.setText( "Overview Placement..." );
+ mi.setText( "Cycle Overview Placement..." );
+ }
+ }
+
+ static void setCycleNodeFillMenuItem( final JMenuItem mi, final Options options ) {
+ if ( ( options != null ) && ( options.getDefaultNodeFill() != null ) ) {
+ mi.setText( "Cycle Node Shape Fill Type... (current: "
+ + options.getDefaultNodeFill().toString().toLowerCase() + ")" );
+ }
+ else {
+ mi.setText( "Cycle Node Shape Fill Type..." );
+ }
+ }
+
+ static void setCycleNodeShapeMenuItem( final JMenuItem mi, final Options options ) {
+ if ( ( options != null ) && ( options.getDefaultNodeShape() != null ) ) {
+ mi.setText( "Cycle Node Shape Fill Type... (current: "
+ + options.getDefaultNodeShape().toString().toLowerCase() + ")" );
+ }
+ else {
+ mi.setText( "Cycle Node Shape Fill Type..." );
}
}
mi.setText( "Enter Min Confidence Value... (current: " + options.getMinConfidenceValue() + ")" );
}
+ static void setTextNodeSizeMenuItem( final JMenuItem mi, final Options options ) {
+ mi.setText( "Enter Default Node Shape Size... (current: " + options.getDefaultNodeShapeSize() + ")" );
+ }
+
static void updateOptionsMenuDependingOnPhylogenyType( final MainPanel main_panel,
final JCheckBoxMenuItem scale,
final JCheckBoxMenuItem branch_lengths,
setFocusable( true );
requestFocus();
requestFocusInWindow();
- // All done: hello, world!
setVisible( true );
System.gc();
}
@Override
public void stateChanged( final ChangeEvent e ) {
- MainFrame.setOvPlacementColorChooseMenuItem( _overview_placment_mi, getCurrentTreePanel() );
+ MainFrame.setOvPlacementColorChooseMenuItem( _overview_placment_mi, getOptions() );
MainFrame.setTextColorChooseMenuItem( _switch_colors_mi, getCurrentTreePanel() );
MainFrame
.setTextMinSupportMenuItem( _choose_minimal_confidence_mi, getOptions(), getCurrentTreePanel() );
_uniform_cladograms_rbmi,
_ext_node_dependent_cladogram_rbmi,
_label_direction_cbmi );
+ MainFrame.setCycleNodeFillMenuItem( _cycle_node_fill_mi, getOptions() );
+ MainFrame.setCycleNodeShapeMenuItem( _cycle_node_shape_mi, getOptions() );
+ MainFrame.setTextNodeSizeMenuItem( _choose_node_size_mi, getOptions() );
}
} );
_options_jmenu.add( MainFrame.customizeMenuItemAsLabel( new JMenuItem( MainFrame.DISPLAY_SUBHEADER ),
_radio_group_1.add( _ext_node_dependent_cladogram_rbmi );
_radio_group_1.add( _uniform_cladograms_rbmi );
_radio_group_1.add( _non_lined_up_cladograms_rbmi );
+ _options_jmenu.add( _show_default_node_shapes_cbmi = new JCheckBoxMenuItem( DISPLAY_NODE_BOXES_LABEL ) );
_options_jmenu
- .add( _show_default_node_shapes_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_NODE_BOXES_LABEL ) );
+ .add( _taxonomy_colorize_node_shapes_cbmi = new JCheckBoxMenuItem( MainFrame.TAXONOMY_COLORIZE_NODE_SHAPES_LABEL ) );
+ _options_jmenu.add( _cycle_node_shape_mi = new JMenuItem( MainFrame.CYCLE_NODE_SHAPE_LABEL ) );
+ _options_jmenu.add( _cycle_node_fill_mi = new JMenuItem( MainFrame.CYCLE_NODE_FILL_LABEL ) );
+ _options_jmenu.add( _choose_node_size_mi = new JMenuItem( MainFrame.CHOOSE_NODE_SIZE_LABEL ) );
_options_jmenu.add( _show_scale_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_SCALE_LABEL ) );
_options_jmenu
.add( _show_branch_length_values_cbmi = new JCheckBoxMenuItem( MainFrame.DISPLAY_BRANCH_LENGTH_VALUES_LABEL ) );
customizeJMenuItem( _switch_colors_mi );
customizeJMenuItem( _choose_minimal_confidence_mi );
customizeJMenuItem( _overview_placment_mi );
- customizeCheckBoxMenuItem( _show_default_node_shapes_cbmi, getOptions().getDefaultNodeShape() );
+ customizeCheckBoxMenuItem( _show_default_node_shapes_cbmi, getOptions().isShowDefaultNodeShapes() );
+ customizeCheckBoxMenuItem( _taxonomy_colorize_node_shapes_cbmi, getOptions().isTaxonomyColorizeNodeShapes() );
+ customizeJMenuItem( _cycle_node_shape_mi );
+ customizeJMenuItem( _cycle_node_fill_mi );
+ customizeJMenuItem( _choose_node_size_mi );
customizeCheckBoxMenuItem( _color_labels_same_as_parent_branch, getOptions().isColorLabelsSameAsParentBranch() );
customizeCheckBoxMenuItem( _screen_antialias_cbmi, getOptions().isAntialiasScreen() );
customizeCheckBoxMenuItem( _background_gradient_cbmi, getOptions().isBackgroundColorGradient() );
@Override
public void stateChanged( final ChangeEvent e ) {
- MainFrame.setOvPlacementColorChooseMenuItem( _overview_placment_mi, getCurrentTreePanel() );
+ MainFrame.setOvPlacementColorChooseMenuItem( _overview_placment_mi, getOptions() );
MainFrame.setTextColorChooseMenuItem( _switch_colors_mi, getCurrentTreePanel() );
MainFrame
.setTextMinSupportMenuItem( _choose_minimal_confidence_mi, getOptions(), getCurrentTreePanel() );
_uniform_cladograms_rbmi,
_ext_node_dependent_cladogram_rbmi,
_label_direction_cbmi );
+ MainFrame.setCycleNodeFillMenuItem( _cycle_node_fill_mi, getOptions() );
+ MainFrame.setCycleNodeShapeMenuItem( _cycle_node_shape_mi, getOptions() );
+ MainFrame.setTextNodeSizeMenuItem( _choose_node_size_mi, getOptions() );
}
} );
_options_jmenu.add( customizeMenuItemAsLabel( new JMenuItem( DISPLAY_SUBHEADER ), getConfiguration() ) );
_radio_group_1.add( _ext_node_dependent_cladogram_rbmi );
_radio_group_1.add( _uniform_cladograms_rbmi );
_radio_group_1.add( _non_lined_up_cladograms_rbmi );
- //
_options_jmenu.add( _show_default_node_shapes_cbmi = new JCheckBoxMenuItem( DISPLAY_NODE_BOXES_LABEL ) );
_options_jmenu
.add( _taxonomy_colorize_node_shapes_cbmi = new JCheckBoxMenuItem( MainFrame.TAXONOMY_COLORIZE_NODE_SHAPES_LABEL ) );
_options_jmenu.add( _cycle_node_shape_mi = new JMenuItem( MainFrame.CYCLE_NODE_SHAPE_LABEL ) );
_options_jmenu.add( _cycle_node_fill_mi = new JMenuItem( MainFrame.CYCLE_NODE_FILL_LABEL ) );
_options_jmenu.add( _choose_node_size_mi = new JMenuItem( MainFrame.CHOOSE_NODE_SIZE_LABEL ) );
- //
_options_jmenu.add( _show_scale_cbmi = new JCheckBoxMenuItem( DISPLAY_SCALE_LABEL ) );
_options_jmenu
.add( _show_branch_length_values_cbmi = new JCheckBoxMenuItem( DISPLAY_BRANCH_LENGTH_VALUES_LABEL ) );
customizeJMenuItem( _print_size_mi );
customizeJMenuItem( _choose_pdf_width_mi );
customizeJMenuItem( _overview_placment_mi );
- //TODO FIXME ~~
customizeCheckBoxMenuItem( _show_default_node_shapes_cbmi, getOptions().isShowDefaultNodeShapes() );
customizeCheckBoxMenuItem( _taxonomy_colorize_node_shapes_cbmi, getOptions().isTaxonomyColorizeNodeShapes() );
customizeJMenuItem( _cycle_node_shape_mi );
customizeJMenuItem( _cycle_node_fill_mi );
customizeJMenuItem( _choose_node_size_mi );
- //TODO FIXME ~~
customizeCheckBoxMenuItem( _color_labels_same_as_parent_branch, getOptions().isColorLabelsSameAsParentBranch() );
customizeCheckBoxMenuItem( _screen_antialias_cbmi, getOptions().isAntialiasScreen() );
customizeCheckBoxMenuItem( _background_gradient_cbmi, getOptions().isBackgroundColorGradient() );
private final static NumberFormat FORMATTER_CONFIDENCE;
private final static NumberFormat FORMATTER_BRANCH_LENGTH;
private final static int WIGGLE = 2;
- private final int _half_box_size_plus_wiggle;
+ //private final int _half_box_size_plus_wiggle;
private final static int LIMIT_FOR_HQ_RENDERING = 1000;
private final static int CONFIDENCE_LEFT_MARGIN = 4;
// TODO "rendering_hints" was static before. Need to make sure everything is OK with it not
private boolean _edited = false;
private Popup _node_desc_popup;
private JTextArea _rollover_popup;
- private final int _box_size;
- private final int _half_box_size;
+ // private final int _box_size;
+ // private final int _half_box_size;
//private final short _skip_counter = 0;
private final StringBuffer _popup_buffer = new StringBuffer();
final private static Font POPUP_FONT = new Font( Configuration.getDefaultFontFamilyName(),
_configuration = configuration;
_phylogeny = t;
_phy_has_branch_lengths = ForesterUtil.isHasAtLeastOneBranchLengthLargerThanZero( _phylogeny );
- _box_size = tjp.getOptions().getDefaultNodeShapeSize();
- _half_box_size = tjp.getOptions().getDefaultNodeShapeSize() / 2;
- _half_box_size_plus_wiggle = _half_box_size + WIGGLE;
init();
// if ( !_phylogeny.isEmpty() ) {
_phylogeny.recalculateNumberOfExternalDescendants( true );
g.fill( _rectangle );
}
- //TODO FIXME
final private void drawRectGradient( final double x,
final double y,
final double width,
}
}
- //TODO FIXME
final private void drawOvalGradient( final double x,
final double y,
final double width,
if ( ( _phylogeny == null ) || _phylogeny.isEmpty() ) {
return null;
}
+ final int half_box_size_plus_wiggle = getOptions().getDefaultNodeShapeSize() / 2 + WIGGLE;
for( final PhylogenyNodeIterator iter = _phylogeny.iteratorPostorder(); iter.hasNext(); ) {
final PhylogenyNode node = iter.next();
if ( ( _phylogeny.isRooted() || !node.isRoot() || ( node.getNumberOfDescendants() > 2 ) )
- && ( ( node.getXcoord() - _half_box_size_plus_wiggle ) <= x )
- && ( ( node.getXcoord() + _half_box_size_plus_wiggle ) >= x )
- && ( ( node.getYcoord() - _half_box_size_plus_wiggle ) <= y )
- && ( ( node.getYcoord() + _half_box_size_plus_wiggle ) >= y ) ) {
+ && ( ( node.getXcoord() - half_box_size_plus_wiggle ) <= x )
+ && ( ( node.getXcoord() + half_box_size_plus_wiggle ) >= x )
+ && ( ( node.getYcoord() - half_box_size_plus_wiggle ) <= y )
+ && ( ( node.getYcoord() + half_box_size_plus_wiggle ) >= y ) ) {
return node;
}
}
g.draw( _arc );
}
}
- //TODO new *****
if ( node.isExternal() ) {
- //TODO new *****
paintNodeBox( x2, y2, node, g, to_pdf, to_graphics_file, isInFoundNodes( node ) );
}
}
final boolean to_graphics_file,
final boolean to_pdf,
final boolean is_in_found_nodes ) {
+ Color c = null;
if ( ( to_pdf || to_graphics_file ) && getOptions().isPrintBlackAndWhite() ) {
- g.setColor( Color.BLACK );
+ c = Color.BLACK;
}
else if ( is_in_found_nodes ) {
- g.setColor( getTreeColorSet().getFoundColor() );
+ c = getTreeColorSet().getFoundColor();
}
else if ( getControlPanel().isColorAccordingToTaxonomy() ) {
- g.setColor( getTaxonomyBasedColor( node ) );
+ c = getTaxonomyBasedColor( node );
}
else if ( getOptions().isColorLabelsSameAsParentBranch() && getControlPanel().isColorBranches()
&& ( PhylogenyMethods.getBranchColorValue( node ) != null ) ) {
- g.setColor( PhylogenyMethods.getBranchColorValue( node ) );
+ c = PhylogenyMethods.getBranchColorValue( node );
}
else {
- g.setColor( getTreeColorSet().getCollapseFillColor() );
+ c = getTreeColorSet().getCollapseFillColor();
}
double d = node.getAllExternalDescendants().size();
if ( d > 1000 ) {
else {
d = ( Math.log10( d ) * _y_distance ) / 2.5;
}
- if ( d < _box_size ) {
- d = _box_size;
+ final int box_size = getOptions().getDefaultNodeShapeSize();
+ if ( d < box_size ) {
+ d = box_size;
}
_polygon.reset();
- _polygon.addPoint( ForesterUtil.roundToInt( node.getXcoord() - _box_size ),
+ _polygon.addPoint( ForesterUtil.roundToInt( node.getXcoord() - box_size ),
ForesterUtil.roundToInt( node.getYcoord() ) );
- _polygon.addPoint( ForesterUtil.roundToInt( node.getXcoord() + _box_size ),
+ _polygon.addPoint( ForesterUtil.roundToInt( node.getXcoord() + box_size ),
ForesterUtil.roundToInt( node.getYcoord() - d ) );
- _polygon.addPoint( ForesterUtil.roundToInt( node.getXcoord() + _box_size ),
+ _polygon.addPoint( ForesterUtil.roundToInt( node.getXcoord() + box_size ),
ForesterUtil.roundToInt( node.getYcoord() + d ) );
- g.fillPolygon( _polygon );
+ if ( getOptions().getDefaultNodeFill() == NodeFill.SOLID ) {
+ g.setColor( c );
+ g.fillPolygon( _polygon );
+ }
+ else if ( getOptions().getDefaultNodeFill() == NodeFill.NONE ) {
+ g.setColor( getBackground() );
+ g.fillPolygon( _polygon );
+ g.setColor( c );
+ g.drawPolygon( _polygon );
+ }
+ else if ( getOptions().getDefaultNodeFill() == NodeFill.GRADIENT ) {
+ g.setPaint( new GradientPaint( node.getXcoord() - box_size, node.getYcoord(), getBackground(), ( node
+ .getXcoord() + box_size ), ( float ) ( node.getYcoord() - d ), c, false ) );
+ g.fill( _polygon );
+ g.setPaint( c );
+ g.draw( _polygon );
+ }
paintNodeData( g, node, to_graphics_file, to_pdf, is_in_found_nodes );
}
}
final private void paintFoundNode( final int x, final int y, final Graphics2D g ) {
+ final int box_size = getOptions().getDefaultNodeShapeSize();
+ final int half_box_size = getOptions().getDefaultNodeShapeSize() / 2;
g.setColor( getTreeColorSet().getFoundColor() );
- g.fillRect( x - _half_box_size, y - _half_box_size, _box_size, _box_size );
+ g.fillRect( x - half_box_size, y - half_box_size, box_size, box_size );
}
final private void paintGainedAndLostCharacters( final Graphics2D g,
else {
outline_color = getGraphicsForNodeBoxWithColorForParentBranch( node );
}
+ final int half_box_size = getOptions().getDefaultNodeShapeSize() / 2;
+ final int box_size = getOptions().getDefaultNodeShapeSize();
if ( ( ( getOptions().isShowDefaultNodeShapes() ) /*&& !to_pdf && !to_graphics_file*/)
|| ( getControlPanel().isEvents() && node.isHasAssignedEvent() ) ) {
if ( to_pdf || to_graphics_file ) {
if ( node.isDuplication() || !getOptions().isPrintBlackAndWhite() ) {
- //TODO FIXME
- //drawOvalFilled( x - _half_box_size, y - _half_box_size, _box_size, _box_size, g );
- drawOvalGradient( x - _half_box_size,
- y - _half_box_size,
- _box_size,
- _box_size,
+ drawOvalGradient( x - half_box_size,
+ y - half_box_size,
+ box_size,
+ box_size,
g,
outline_color,
getBackground(),
}
}
else {
- //TODO FIXME
- //drawRectFilled( x - HALF_BOX_SIZE, y - HALF_BOX_SIZE, BOX_SIZE, BOX_SIZE, g );
if ( getOptions().getDefaultNodeShape() == NodeShape.CIRCLE ) {
if ( getOptions().getDefaultNodeFill() == NodeFill.GRADIENT ) {
- drawOvalGradient( x - _half_box_size,
- y - _half_box_size,
- _box_size,
- _box_size,
+ drawOvalGradient( x - half_box_size,
+ y - half_box_size,
+ box_size,
+ box_size,
g,
outline_color,
getBackground(),
outline_color );
}
else if ( getOptions().getDefaultNodeFill() == NodeFill.NONE ) {
- drawOvalGradient( x - _half_box_size,
- y - _half_box_size,
- _box_size,
- _box_size,
+ drawOvalGradient( x - half_box_size,
+ y - half_box_size,
+ box_size,
+ box_size,
g,
getBackground(),
getBackground(),
}
else if ( getOptions().getDefaultNodeFill() == NodeFill.SOLID ) {
g.setColor( outline_color );
- drawOvalFilled( x - _half_box_size, y - _half_box_size, _box_size, _box_size, g );
+ drawOvalFilled( x - half_box_size, y - half_box_size, box_size, box_size, g );
}
}
else if ( getOptions().getDefaultNodeShape() == NodeShape.RECTANGLE ) {
if ( getOptions().getDefaultNodeFill() == NodeFill.GRADIENT ) {
- drawRectGradient( x - _half_box_size,
- y - _half_box_size,
- _box_size,
- _box_size,
+ drawRectGradient( x - half_box_size,
+ y - half_box_size,
+ box_size,
+ box_size,
g,
outline_color,
getBackground(),
outline_color );
}
else if ( getOptions().getDefaultNodeFill() == NodeFill.NONE ) {
- drawRectGradient( x - _half_box_size,
- y - _half_box_size,
- _box_size,
- _box_size,
+ drawRectGradient( x - half_box_size,
+ y - half_box_size,
+ box_size,
+ box_size,
g,
getBackground(),
getBackground(),
}
else if ( getOptions().getDefaultNodeFill() == NodeFill.SOLID ) {
g.setColor( outline_color );
- drawRectFilled( x - _half_box_size, y - _half_box_size, _box_size, _box_size, g );
+ drawRectFilled( x - half_box_size, y - half_box_size, box_size, box_size, g );
}
}
}
return;
}
int x = 0;
+ final int half_box_size = getOptions().getDefaultNodeShapeSize() / 2;
if ( getControlPanel().isShowTaxonomyImages()
&& ( getImageMap() != null )
&& !getImageMap().isEmpty()
&& node.getNodeData().isHasTaxonomy()
&& ( ( node.getNodeData().getTaxonomy().getUris() != null ) && !node.getNodeData().getTaxonomy()
.getUris().isEmpty() ) ) {
- x += drawTaxonomyImage( node.getXcoord() + 2 + _half_box_size, node.getYcoord(), node, g );
+ x += drawTaxonomyImage( node.getXcoord() + 2 + half_box_size, node.getYcoord(), node, g );
}
if ( ( getControlPanel().isShowTaxonomyCode() || getControlPanel().isShowTaxonomyScientificNames() || getControlPanel()
.isShowTaxonomyCommonNames() ) && node.getNodeData().isHasTaxonomy() ) {
if ( !node.isExternal() && ( node.getNumberOfDescendants() == 1 ) ) {
down_shift_factor = 1;
}
- final double pos_x = node.getXcoord() + x + 2 + _half_box_size;
+ final double pos_x = node.getXcoord() + x + 2 + half_box_size;
final double pos_y = ( node.getYcoord() + ( getTreeFontSet()._fm_large.getAscent() / down_shift_factor ) );
final String sb_str = _sb.toString();
// GUILHEM_BEG ______________
&& seqRelation.getType().equals( getControlPanel().getSequenceRelationTypeBox()
.getSelectedItem() );
if ( fGotRelationWithQuery ) { // we will underline the text to show that this sequence is ortholog to the query
- final double linePosX = node.getXcoord() + 2 + _half_box_size;
+ final double linePosX = node.getXcoord() + 2 + half_box_size;
final String sConfidence = ( !getControlPanel().isShowSequenceRelationConfidence() || ( seqRelation
.getConfidence() == null ) ) ? null : " (" + seqRelation.getConfidence().getValue()
+ ")";
g.setColor( calculateColorForAnnotation( ann ) );
}
final String ann_str = ann.asSimpleText().toString();
- TreePanel.drawString( ann_str, node.getXcoord() + x + 3 + _half_box_size, node.getYcoord()
+ TreePanel.drawString( ann_str, node.getXcoord() + x + 3 + half_box_size, node.getYcoord()
+ ( getTreeFontSet()._fm_large.getAscent() / down_shift_factor ), g );
_sb.setLength( 0 );
_sb.append( ann_str );
}
if ( getControlPanel().isShowBinaryCharacters() ) {
TreePanel.drawString( node.getNodeData().getBinaryCharacters().getPresentCharactersAsStringBuffer()
- .toString(), node.getXcoord() + x + 1 + _half_box_size, node.getYcoord()
+ .toString(), node.getXcoord() + x + 1 + half_box_size, node.getYcoord()
+ ( getTreeFontSet()._fm_large.getAscent() / down_shift_factor ), g );
paintGainedAndLostCharacters( g, node, node.getNodeData().getBinaryCharacters()
.getGainedCharactersAsStringBuffer().toString(), node.getNodeData().getBinaryCharacters()
}
final double mean = ForesterUtil.round( sum / count, 1 );
TreePanel.drawString( " " + node.getNodeData().getBinaryCharacters().getPresentCount() + " ["
- + mean + "]", node.getXcoord() + x + 4 + _half_box_size, node.getYcoord()
+ + mean + "]", node.getXcoord() + x + 4 + half_box_size, node.getYcoord()
+ ( getTreeFontSet()._fm_large.getAscent() / down_shift_factor ), g );
}
else {
TreePanel.drawString( " " + node.getNodeData().getBinaryCharacters().getPresentCount(),
- node.getXcoord() + x + 4 + _half_box_size,
+ node.getXcoord() + x + 4 + half_box_size,
node.getYcoord()
+ ( getTreeFontSet()._fm_large.getAscent() / down_shift_factor ),
g );
child_node.setYcoord( y2 );
y2 += _y_distance * child_node.getNumberOfExternalNodes();
}
- //TODO new *****
paintNodeBox( node.getXcoord(), node.getYcoord(), node, g, to_pdf, to_graphics_file, isInFoundNodes( node ) );
- //TODO new *****
}
if ( dynamically_hide
&& !is_in_found_nodes
else {
g.setColor( getTreeColorSet().getTaxonomyColor() );
}
- final double start_x = node.getXcoord() + 3 + _half_box_size + x_shift;
+ final double start_x = node.getXcoord() + 3 + ( getOptions().getDefaultNodeShapeSize() / 2 ) + x_shift;
final double start_y = node.getYcoord()
+ ( getTreeFontSet()._fm_large.getAscent() / ( node.getNumberOfDescendants() == 1 ? 1 : 3.0 ) );
_sb.setLength( 0 );
return ( int ) ( d + 0.5 );
}
+ final public static short roundToShort( final double d ) {
+ return ( short ) ( d + 0.5 );
+ }
+
final public static int roundToInt( final float f ) {
return ( int ) ( f + 0.5f );
}