X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Farchaeopteryx%2FOptions.java;h=a228d299268bf0a931b3281ec59b91bb26e65542;hb=refs%2Fheads%2Fkjvdh%2Ffeatures%2Fforester;hp=80f0861edbc70c95b5ea370b26e36488c29c15fc;hpb=74409250720d04a225c98497ff395e04757d8c81;p=jalview.git diff --git a/forester/java/src/org/forester/archaeopteryx/Options.java b/forester/java/src/org/forester/archaeopteryx/Options.java index 80f0861..a228d29 100644 --- a/forester/java/src/org/forester/archaeopteryx/Options.java +++ b/forester/java/src/org/forester/archaeopteryx/Options.java @@ -40,6 +40,46 @@ import org.forester.util.ForesterUtil; */ final public class Options { + public static enum CLADOGRAM_TYPE { + LINED_UP, NON_LINED_UP; + } + + public static enum NODE_LABEL_DIRECTION { + HORIZONTAL, RADIAL; + } + + public static enum PHYLOGENY_GRAPHICS_TYPE { + CIRCULAR, CONVEX, CURVED, EURO_STYLE, RECTANGULAR, ROUNDED, TRIANGULAR, UNROOTED; + } + + static enum PHYLOGENY_DISPLAY_TYPE { + CLADOGRAM, + ALIGNED_PHYLOGRAM, + UNALIGNED_PHYLOGRAM + } + + static enum OVERVIEW_PLACEMENT_TYPE { + LOWER_LEFT( "lower left" ), + LOWER_RIGHT( "lower right" ), + UPPER_LEFT( "upper left" ), + UPPER_RIGHT( "upper right" ); + + private final String _name; + + private OVERVIEW_PLACEMENT_TYPE( final String name ) { + _name = name; + } + + @Override + public String toString() { + return _name; + } + + public String toTag() { + return toString().replaceAll( " ", "_" ); + } + } + static final double MIN_CONFIDENCE_DEFAULT = 0.0; private boolean _abbreviate_scientific_names; private boolean _allow_errors_in_distance_to_parent; @@ -54,8 +94,8 @@ final public class Options { private NodeVisualData.NodeShape _default_node_shape; private short _default_node_shape_size; private boolean _editable; - private NodeDataField _ext_desc_data_to_return; - private boolean _graphics_export_using_actual_size; + private NodeDataField _ext_desc_data_to_return; + private final boolean _graphics_export_using_actual_size = true; private boolean _graphics_export_visible_only; private boolean _internal_number_are_confidence_for_nh_parsing; private boolean _inverse_search_result; @@ -71,9 +111,7 @@ final public class Options { private PHYLOGENY_GRAPHICS_TYPE _phylogeny_graphics_type; private boolean _print_black_and_white; private float _print_line_width; - private int _print_size_x; - private int _print_size_y; - private boolean _print_using_actual_size; + private final boolean _print_using_actual_size = true; private double _scale_bar_length; private boolean _search_case_sensitive; private boolean _show_annotation_ref_source; @@ -87,7 +125,11 @@ final public class Options { private TAXONOMY_EXTRACTION _taxonomy_extraction; private boolean _line_up_renderable_node_data; private boolean _right_align_domains; - + private boolean _color_all_found_nodes_when_coloring_subtree; + private boolean _parse_beast_style_extended_nexus_tags; + private boolean _collapsed_with_average_height; + private boolean _show_abbreviated_labels_for_collapsed_nodes; + private Options() { init(); } @@ -100,6 +142,14 @@ final public class Options { return _allow_errors_in_distance_to_parent; } + final public boolean isLineUpRendarableNodeData() { + return _line_up_renderable_node_data; + } + + final public boolean isRightLineUpDomains() { + return _right_align_domains; + } + public final boolean isShowAnnotationRefSource() { return _show_annotation_ref_source; } @@ -124,6 +174,14 @@ final public class Options { _ext_desc_data_to_return = ext_desc_data_to_return; } + final public void setLineUpRendarableNodeData( final boolean line_up_renderable_node_data ) { + _line_up_renderable_node_data = line_up_renderable_node_data; + } + + final public void setRightLineUpDomains( final boolean right_align_domains ) { + _right_align_domains = right_align_domains; + } + public final void setShowAnnotationRefSource( final boolean show_annotation_ref_source ) { _show_annotation_ref_source = show_annotation_ref_source; } @@ -132,6 +190,61 @@ final public class Options { _show_domain_labels = show_domain_labels; } + final private void init() { + _default_node_shape = NodeShape.CIRCLE; + _default_node_fill = NodeFill.GRADIENT; + _default_node_shape_size = AptxConstants.DEFAULT_NODE_SHAPE_SIZE_DEFAULT; + _internal_number_are_confidence_for_nh_parsing = false; + _show_scale = false; + _antialias_screen = true; + _antialias_print = true; + _graphics_export_visible_only = false; + _editable = true; + _background_color_gradient = false; + _show_default_node_shapes_internal = false; + _show_default_node_shapes_external = false; + _show_default_node_shapes_for_marked_nodes = false; + _color_all_found_nodes_when_coloring_subtree = false; + _parse_beast_style_extended_nexus_tags= true; + _min_confidence_value = MIN_CONFIDENCE_DEFAULT; + _print_black_and_white = false; + _phylogeny_graphics_type = PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR; + _base_font = new Font( Configuration.getDefaultFontFamilyName(), Font.PLAIN, 10 ); + _match_whole_terms_only = false; + _search_with_regex = false; + _search_case_sensitive = false; + _print_line_width = AptxConstants.PDF_LINE_WIDTH_DEFAULT; + _show_overview = true; + _ov_placement = OVERVIEW_PLACEMENT_TYPE.UPPER_LEFT; + _node_label_direction = NODE_LABEL_DIRECTION.HORIZONTAL; + _inverse_search_result = false; + _scale_bar_length = 0.0; + _number_of_digits_after_comma_for_branch_length_values = AptxConstants.NUMBER_OF_DIGITS_AFTER_COMMA_FOR_BRANCH_LENGTH_VALUES_DEFAULT; + _number_of_digits_after_comma_for_confidence_values = AptxConstants.NUMBER_OF_DIGITS_AFTER_COMMA_FOR_CONFIDENCE_VALUES_DEFAULT; + _nh_parsing_replace_underscores = false; + _taxonomy_extraction = TAXONOMY_EXTRACTION.NO; + _cladogram_type = AptxConstants.CLADOGRAM_TYPE_DEFAULT; + _show_domain_labels = true; + _show_annotation_ref_source = true; + setAbbreviateScientificTaxonNames( false ); + _color_labels_same_as_parent_branch = false; + _show_confidence_stddev = false; + _nh_conversion_support_value_style = NH_CONVERSION_SUPPORT_VALUE_STYLE.NONE; + _ext_desc_data_to_return = NodeDataField.UNKNOWN; + _line_up_renderable_node_data = true; + _right_align_domains = false; + _collapsed_with_average_height = true; + _show_abbreviated_labels_for_collapsed_nodes = true; + } + + final private void setNumberOfDigitsAfterCommaForBranchLength( final short number_of_digits_after_comma_for_branch_length_values ) { + _number_of_digits_after_comma_for_branch_length_values = number_of_digits_after_comma_for_branch_length_values; + } + + final private void setNumberOfDigitsAfterCommaForConfidenceValues( final short number_of_digits_after_comma_for_confidence_values ) { + _number_of_digits_after_comma_for_confidence_values = number_of_digits_after_comma_for_confidence_values; + } + final Font getBaseFont() { return _base_font; } @@ -184,14 +297,6 @@ final public class Options { return _print_line_width; } - final int getPrintSizeX() { - return _print_size_x; - } - - final int getPrintSizeY() { - return _print_size_y; - } - final double getScaleBarLength() { return _scale_bar_length; } @@ -252,10 +357,6 @@ final public class Options { return _match_whole_terms_only; } - final boolean isSearchWithRegex() { - return _search_with_regex; - } - final boolean isPrintBlackAndWhite() { return _print_black_and_white; } @@ -272,6 +373,10 @@ final public class Options { return _search_case_sensitive; } + final boolean isSearchWithRegex() { + return _search_with_regex; + } + boolean isShowConfidenceStddev() { return _show_confidence_stddev; } @@ -336,18 +441,8 @@ final public class Options { _editable = editable; } - final void setGraphicsExportUsingActualSize( final boolean graphics_export_using_actual_size ) { - _graphics_export_using_actual_size = graphics_export_using_actual_size; - if ( !graphics_export_using_actual_size ) { - setGraphicsExportVisibleOnly( false ); - } - } - final void setGraphicsExportVisibleOnly( final boolean graphics_export_visible_only ) { _graphics_export_visible_only = graphics_export_visible_only; - if ( graphics_export_visible_only ) { - setGraphicsExportUsingActualSize( true ); - } } final void setInternalNumberAreConfidenceForNhParsing( final boolean internal_number_are_confidence_for_nh_parsing ) { @@ -362,10 +457,6 @@ final public class Options { _match_whole_terms_only = search_whole_words_only; } - final void setSearchWithRegex( final boolean search_with_regex ) { - _search_with_regex = search_with_regex; - } - final void setMinConfidenceValue( final double min_confidence_value ) { _min_confidence_value = min_confidence_value; } @@ -393,19 +484,7 @@ final public class Options { final void setPrintLineWidth( final float print_line_width ) { _print_line_width = print_line_width; } - - final void setPrintSizeX( final int print_size_x ) { - _print_size_x = print_size_x; - } - - final void setPrintSizeY( final int print_size_y ) { - _print_size_y = print_size_y; - } - - final void setPrintUsingActualSize( final boolean print_using_actual_size ) { - _print_using_actual_size = print_using_actual_size; - } - + final void setReplaceUnderscoresInNhParsing( final boolean nh_parsing_replace_underscores ) { _nh_parsing_replace_underscores = nh_parsing_replace_underscores; } @@ -418,6 +497,10 @@ final public class Options { _search_case_sensitive = search_case_sensitive; } + final void setSearchWithRegex( final boolean search_with_regex ) { + _search_with_regex = search_with_regex; + } + void setShowConfidenceStddev( final boolean show_confidence_stddev ) { _show_confidence_stddev = show_confidence_stddev; } @@ -426,14 +509,14 @@ final public class Options { _show_default_node_shapes_external = show_default_node_shapes_external; } - void setShowDefaultNodeShapesInternal( final boolean show_default_node_shapes_internal ) { - _show_default_node_shapes_internal = show_default_node_shapes_internal; - } - void setShowDefaultNodeShapesForMarkedNodes( final boolean show_default_node_shapes_for_marked_nodes ) { _show_default_node_shapes_for_marked_nodes = show_default_node_shapes_for_marked_nodes; } + void setShowDefaultNodeShapesInternal( final boolean show_default_node_shapes_internal ) { + _show_default_node_shapes_internal = show_default_node_shapes_internal; + } + final void setShowOverview( final boolean show_overview ) { _show_overview = show_overview; } @@ -446,67 +529,6 @@ final public class Options { _taxonomy_extraction = taxonomy_extraction; } - final private void init() { - _default_node_shape = NodeShape.CIRCLE; - _default_node_fill = NodeFill.GRADIENT; - _default_node_shape_size = Constants.DEFAULT_NODE_SHAPE_SIZE_DEFAULT; - _internal_number_are_confidence_for_nh_parsing = false; - _show_scale = false; - _antialias_screen = true; - _antialias_print = true; - _graphics_export_visible_only = false; - _editable = true; - _background_color_gradient = false; - _show_default_node_shapes_internal = false; - _show_default_node_shapes_external = false; - _show_default_node_shapes_for_marked_nodes = false; - if ( AptxUtil.isUsOrCanada() ) { - _print_size_x = Constants.US_LETTER_SIZE_X; - _print_size_y = Constants.US_LETTER_SIZE_Y; - } - else { - _print_size_x = Constants.A4_SIZE_X; - _print_size_y = Constants.A4_SIZE_Y; - } - _min_confidence_value = MIN_CONFIDENCE_DEFAULT; - _print_black_and_white = false; - _print_using_actual_size = true; - _graphics_export_using_actual_size = true; - _phylogeny_graphics_type = PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR; - _base_font = new Font( Configuration.getDefaultFontFamilyName(), Font.PLAIN, 10 ); - _match_whole_terms_only = false; - _search_with_regex = false; - _search_case_sensitive = false; - _print_line_width = Constants.PDF_LINE_WIDTH_DEFAULT; - _show_overview = true; - _ov_placement = OVERVIEW_PLACEMENT_TYPE.UPPER_LEFT; - _node_label_direction = NODE_LABEL_DIRECTION.HORIZONTAL; - _inverse_search_result = false; - _scale_bar_length = 0.0; - _number_of_digits_after_comma_for_branch_length_values = Constants.NUMBER_OF_DIGITS_AFTER_COMMA_FOR_BRANCH_LENGTH_VALUES_DEFAULT; - _number_of_digits_after_comma_for_confidence_values = Constants.NUMBER_OF_DIGITS_AFTER_COMMA_FOR_CONFIDENCE_VALUES_DEFAULT; - _nh_parsing_replace_underscores = false; - _taxonomy_extraction = TAXONOMY_EXTRACTION.NO; - _cladogram_type = Constants.CLADOGRAM_TYPE_DEFAULT; - _show_domain_labels = true; - _show_annotation_ref_source = true; - setAbbreviateScientificTaxonNames( false ); - _color_labels_same_as_parent_branch = false; - _show_confidence_stddev = false; - _nh_conversion_support_value_style = NH_CONVERSION_SUPPORT_VALUE_STYLE.NONE; - _ext_desc_data_to_return = NodeDataField.UNKNOWN; - _line_up_renderable_node_data = true; - _right_align_domains = false; - } - - final private void setNumberOfDigitsAfterCommaForBranchLength( final short number_of_digits_after_comma_for_branch_length_values ) { - _number_of_digits_after_comma_for_branch_length_values = number_of_digits_after_comma_for_branch_length_values; - } - - final private void setNumberOfDigitsAfterCommaForConfidenceValues( final short number_of_digits_after_comma_for_confidence_values ) { - _number_of_digits_after_comma_for_confidence_values = number_of_digits_after_comma_for_confidence_values; - } - public final static Options createInstance( final Configuration configuration ) { final Options instance = createDefaultInstance(); if ( configuration != null ) { @@ -539,12 +561,6 @@ final public class Options { if ( configuration.getMinConfidenceValue() != MIN_CONFIDENCE_DEFAULT ) { instance.setMinConfidenceValue( configuration.getMinConfidenceValue() ); } - if ( configuration.getGraphicsExportX() > 0 ) { - instance.setPrintSizeX( configuration.getGraphicsExportX() ); - } - if ( configuration.getGraphicsExportY() > 0 ) { - instance.setPrintSizeY( configuration.getGraphicsExportY() ); - } if ( configuration.getBaseFontSize() > 0 ) { instance.setBaseFont( instance.getBaseFont().deriveFont( ( float ) configuration.getBaseFontSize() ) ); } @@ -581,53 +597,38 @@ final public class Options { return new Options(); } - public static enum CLADOGRAM_TYPE { - EXT_NODE_SUM_DEP, NON_LINED_UP, TOTAL_NODE_SUM_DEP; + final boolean isColorAllFoundNodesWhenColoringSubtree() { + return _color_all_found_nodes_when_coloring_subtree; } - - public static enum NODE_LABEL_DIRECTION { - HORIZONTAL, RADIAL; + + final void setColorAllFoundNodesWhenColoringSubtree( final boolean color_all_found_nodes_when_coloring_subtree ) { + _color_all_found_nodes_when_coloring_subtree = color_all_found_nodes_when_coloring_subtree; } - public static enum PHYLOGENY_GRAPHICS_TYPE { - CIRCULAR, CONVEX, CURVED, EURO_STYLE, RECTANGULAR, ROUNDED, TRIANGULAR, UNROOTED; + final boolean isParseBeastStyleExtendedNexusTags() { + return _parse_beast_style_extended_nexus_tags; } - static enum OVERVIEW_PLACEMENT_TYPE { - LOWER_LEFT( "lower left" ), - LOWER_RIGHT( "lower right" ), - UPPER_LEFT( "upper left" ), - UPPER_RIGHT( "upper right" ); - - private final String _name; - - private OVERVIEW_PLACEMENT_TYPE( final String name ) { - _name = name; - } - - @Override - public String toString() { - return _name; - } - - public String toTag() { - return toString().replaceAll( " ", "_" ); - } + final void setParseBeastStyleExtendedNexusTags( final boolean parse_beast_style_extended_nexus_tags ) { + _parse_beast_style_extended_nexus_tags = parse_beast_style_extended_nexus_tags; } - - final public boolean isLineUpRendarableNodeData() { - return _line_up_renderable_node_data; + + final boolean isCollapsedWithAverageHeigh() { + return _collapsed_with_average_height; } - final public boolean isRightLineUpDomains() { - return _right_align_domains; + final void setCollapsedWithAverageHeigh( final boolean collapsed_with_average_height ) { + _collapsed_with_average_height = collapsed_with_average_height; } - final public void setLineUpRendarableNodeData( final boolean line_up_renderable_node_data ) { - _line_up_renderable_node_data = line_up_renderable_node_data; + final boolean isShowAbbreviatedLabelsForCollapsedNodes() { + return _show_abbreviated_labels_for_collapsed_nodes; } - - final public void setRightLineUpDomains( final boolean right_align_domains ) { - _right_align_domains = right_align_domains; + + final void setShowAbbreviatedLabelsForCollapsedNodes(final boolean show_abbreviated_labels_for_collapsed_nodes) { + _show_abbreviated_labels_for_collapsed_nodes = show_abbreviated_labels_for_collapsed_nodes; } + + + }