import org.forester.archaeopteryx.Options.CLADOGRAM_TYPE;
import org.forester.archaeopteryx.Options.NODE_LABEL_DIRECTION;
-import org.forester.archaeopteryx.Options.NodeFill;
-import org.forester.archaeopteryx.Options.NodeShape;
import org.forester.archaeopteryx.Options.OVERVIEW_PLACEMENT_TYPE;
import org.forester.archaeopteryx.Options.PHYLOGENY_GRAPHICS_TYPE;
+import org.forester.phylogeny.data.NodeVisualization;
+import org.forester.phylogeny.data.NodeVisualization.NodeFill;
+import org.forester.phylogeny.data.NodeVisualization.NodeShape;
import org.forester.util.ForesterUtil;
public final class Configuration {
}
else if ( key.equals( "default_node_fill" ) ) {
final String fill_str = ( ( String ) st.nextElement() ).trim();
- if ( fill_str.equalsIgnoreCase( Options.NodeFill.NONE.toString() ) ) {
+ if ( fill_str.equalsIgnoreCase( NodeVisualization.NodeFill.NONE.toString() ) ) {
setDefaultNodeFill( NodeFill.NONE );
}
- else if ( fill_str.equalsIgnoreCase( Options.NodeFill.GRADIENT.toString() ) ) {
+ else if ( fill_str.equalsIgnoreCase( NodeVisualization.NodeFill.GRADIENT.toString() ) ) {
setDefaultNodeFill( NodeFill.GRADIENT );
}
- else if ( fill_str.equalsIgnoreCase( Options.NodeFill.SOLID.toString() ) ) {
+ else if ( fill_str.equalsIgnoreCase( NodeVisualization.NodeFill.SOLID.toString() ) ) {
setDefaultNodeFill( NodeFill.SOLID );
}
else {
}
else if ( key.equals( "default_node_shape" ) ) {
final String shape_str = ( ( String ) st.nextElement() ).trim();
- if ( shape_str.equalsIgnoreCase( Options.NodeShape.CIRCLE.toString() ) ) {
+ if ( shape_str.equalsIgnoreCase( NodeVisualization.NodeShape.CIRCLE.toString() ) ) {
setDefaultNodeShape( NodeShape.CIRCLE );
}
- else if ( shape_str.equalsIgnoreCase( Options.NodeShape.RECTANGLE.toString() ) ) {
+ else if ( shape_str.equalsIgnoreCase( NodeVisualization.NodeShape.RECTANGLE.toString() ) ) {
setDefaultNodeShape( NodeShape.RECTANGLE );
}
else {
import org.forester.archaeopteryx.Options.NODE_LABEL_DIRECTION;
import org.forester.archaeopteryx.Options.PHYLOGENY_GRAPHICS_TYPE;
import org.forester.phylogeny.Phylogeny;
+import org.forester.phylogeny.data.NodeVisualization.NodeFill;
+import org.forester.phylogeny.data.NodeVisualization.NodeShape;
import org.forester.util.ForesterConstants;
import org.forester.util.ForesterUtil;
static void cycleNodeFill( final Options op, final TreePanel tree_panel ) {
switch ( op.getDefaultNodeFill() ) {
case GRADIENT:
- op.setDefaultNodeFill( Options.NodeFill.SOLID );
+ op.setDefaultNodeFill( NodeFill.SOLID );
break;
case NONE:
- op.setDefaultNodeFill( Options.NodeFill.GRADIENT );
+ op.setDefaultNodeFill( NodeFill.GRADIENT );
break;
case SOLID:
- op.setDefaultNodeFill( Options.NodeFill.NONE );
+ op.setDefaultNodeFill( 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 );
+ op.setDefaultNodeShape( NodeShape.RECTANGLE );
break;
case RECTANGLE:
- op.setDefaultNodeShape( Options.NodeShape.CIRCLE );
+ op.setDefaultNodeShape( NodeShape.CIRCLE );
break;
default:
throw new RuntimeException( "unknown shape: " + op.getDefaultNodeShape() );
import java.awt.Font;
+import org.forester.phylogeny.data.NodeVisualization;
+import org.forester.phylogeny.data.NodeVisualization.NodeFill;
+import org.forester.phylogeny.data.NodeVisualization.NodeShape;
import org.forester.util.ForesterUtil;
/*
*/
final public class Options {
- static final double MIN_CONFIDENCE_DEFAULT = 0.0;
- private boolean _show_branch_length_values;
- private boolean _internal_number_are_confidence_for_nh_parsing;
- private boolean _show_scale;
- private boolean _show_overview;
- private boolean _antialias_screen;
- private boolean _antialias_print;
- private boolean _graphics_export_visible_only;
- private int _print_size_x;
- private int _print_size_y;
- private double _min_confidence_value;
- private boolean _print_black_and_white;
- private boolean _print_using_actual_size;
- private boolean _graphics_export_using_actual_size;
- private PHYLOGENY_GRAPHICS_TYPE _phylogeny_graphics_type;
- private CLADOGRAM_TYPE _cladogram_type;
- private OVERVIEW_PLACEMENT_TYPE _ov_placement;
- private NODE_LABEL_DIRECTION _node_label_direction;
- private Font _base_font;
- private boolean _match_whole_terms_only;
- private boolean _search_case_sensitive;
- private float _print_line_width;
- private boolean _inverse_search_result;
- private double _scale_bar_length;
- private short _number_of_digits_after_comma_for_confidence_values;
- private short _number_of_digits_after_comma_for_branch_length_values;
- private boolean _nh_parsing_replace_underscores;
- private boolean _nh_parsing_extract_pfam_taxonomy_codes;
- private boolean _editable;
- private boolean _background_color_gradient;
- private boolean _show_domain_labels;
- private boolean _color_labels_same_as_parent_branch;
- private boolean _abbreviate_scientific_names;
- private NodeShape _default_node_shape;
- private NodeFill _default_node_fill;
- private short _default_node_shape_size;
- private boolean _taxonomy_colorize_node_shapes;
- private boolean _show_default_node_shapes;
+ static final double MIN_CONFIDENCE_DEFAULT = 0.0;
+ private boolean _show_branch_length_values;
+ private boolean _internal_number_are_confidence_for_nh_parsing;
+ private boolean _show_scale;
+ private boolean _show_overview;
+ private boolean _antialias_screen;
+ private boolean _antialias_print;
+ private boolean _graphics_export_visible_only;
+ private int _print_size_x;
+ private int _print_size_y;
+ private double _min_confidence_value;
+ private boolean _print_black_and_white;
+ private boolean _print_using_actual_size;
+ private boolean _graphics_export_using_actual_size;
+ private PHYLOGENY_GRAPHICS_TYPE _phylogeny_graphics_type;
+ private CLADOGRAM_TYPE _cladogram_type;
+ private OVERVIEW_PLACEMENT_TYPE _ov_placement;
+ private NODE_LABEL_DIRECTION _node_label_direction;
+ private Font _base_font;
+ private boolean _match_whole_terms_only;
+ private boolean _search_case_sensitive;
+ private float _print_line_width;
+ private boolean _inverse_search_result;
+ private double _scale_bar_length;
+ private short _number_of_digits_after_comma_for_confidence_values;
+ private short _number_of_digits_after_comma_for_branch_length_values;
+ private boolean _nh_parsing_replace_underscores;
+ private boolean _nh_parsing_extract_pfam_taxonomy_codes;
+ private boolean _editable;
+ private boolean _background_color_gradient;
+ private boolean _show_domain_labels;
+ private boolean _color_labels_same_as_parent_branch;
+ private boolean _abbreviate_scientific_names;
+ private NodeVisualization.NodeShape _default_node_shape;
+ private NodeVisualization.NodeFill _default_node_fill;
+ private short _default_node_shape_size;
+ private boolean _taxonomy_colorize_node_shapes;
+ private boolean _show_default_node_shapes;
private Options() {
init();
HORIZONTAL, RADIAL;
}
- enum NodeFill {
- NONE, GRADIENT, SOLID
- }
-
- enum NodeShape {
- CIRCLE, RECTANGLE
- }
-
static enum OVERVIEW_PLACEMENT_TYPE {
UPPER_LEFT( "upper left" ),
UPPER_RIGHT( "upper right" ),
import org.forester.archaeopteryx.ControlPanel.NodeClickAction;
import org.forester.archaeopteryx.Options.CLADOGRAM_TYPE;
import org.forester.archaeopteryx.Options.NODE_LABEL_DIRECTION;
-import org.forester.archaeopteryx.Options.NodeFill;
-import org.forester.archaeopteryx.Options.NodeShape;
import org.forester.archaeopteryx.Options.PHYLOGENY_GRAPHICS_TYPE;
import org.forester.archaeopteryx.phylogeny.data.RenderableDomainArchitecture;
import org.forester.archaeopteryx.phylogeny.data.RenderableVector;
import org.forester.phylogeny.data.BranchColor;
import org.forester.phylogeny.data.Confidence;
import org.forester.phylogeny.data.Event;
+import org.forester.phylogeny.data.NodeVisualization;
+import org.forester.phylogeny.data.NodeVisualization.NodeFill;
+import org.forester.phylogeny.data.NodeVisualization.NodeShape;
import org.forester.phylogeny.data.PhylogenyData;
import org.forester.phylogeny.data.PropertiesMap;
import org.forester.phylogeny.data.Property;
ForesterUtil.roundToInt( node.getYcoord() - d ) );
_polygon.addPoint( ForesterUtil.roundToInt( node.getXcoord() + box_size ),
ForesterUtil.roundToInt( node.getYcoord() + d ) );
- if ( getOptions().getDefaultNodeFill() == NodeFill.SOLID ) {
+ if ( getOptions().getDefaultNodeFill() == NodeVisualization.NodeFill.SOLID ) {
g.setColor( c );
g.fillPolygon( _polygon );
}
- else if ( getOptions().getDefaultNodeFill() == NodeFill.NONE ) {
+ else if ( getOptions().getDefaultNodeFill() == NodeVisualization.NodeFill.NONE ) {
g.setColor( getBackground() );
g.fillPolygon( _polygon );
g.setColor( c );
background,
outline_color );
}
- else if ( getOptions().getDefaultNodeFill() == NodeFill.SOLID ) {
+ else if ( getOptions().getDefaultNodeFill() == NodeVisualization.NodeFill.SOLID ) {
g.setColor( outline_color );
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 ) {
+ else if ( getOptions().getDefaultNodeShape() == NodeVisualization.NodeShape.RECTANGLE ) {
+ if ( getOptions().getDefaultNodeFill() == NodeVisualization.NodeFill.GRADIENT ) {
drawRectGradient( x - half_box_size,
y - half_box_size,
box_size,
to_pdf ? outline_color : getBackground(),
outline_color );
}
- else if ( getOptions().getDefaultNodeFill() == NodeFill.NONE ) {
+ else if ( getOptions().getDefaultNodeFill() == NodeVisualization.NodeFill.NONE ) {
Color background = getBackground();
if ( to_pdf ) {
background = Color.WHITE;
background,
outline_color );
}
- else if ( getOptions().getDefaultNodeFill() == NodeFill.SOLID ) {
+ else if ( getOptions().getDefaultNodeFill() == NodeVisualization.NodeFill.SOLID ) {
g.setColor( outline_color );
drawRectFilled( x - half_box_size, y - half_box_size, box_size, box_size, g );
}
else if ( type.equals( PO_STR ) ) {
_type = Type.PO;
}
+ else if ( type.equals( SABIO_RK_STR ) ) {
+ _type = Type.SABIO_RK;
+ }
else {
throw new IllegalArgumentException( "unknown GO xref type: " + type );
}
public static final String CORUM_STR = "CORUM";
public static final String UNIPATHWAY_STR = "UniPathway";
public static final String PO_STR = "PO";
+ public static final String SABIO_RK_STR = "SABIO-RK";
public Type getType();
NIF_SUBCELLULAR,
CORUM,
UNIPATHWAY,
- PO;
+ PO,
+ SABIO_RK;
}
}
public class NodeData implements PhylogenyData {
- private String _node_name;
- private Event _event;
- private List<Sequence> _sequences;
- private Identifier _node_identifier;
- private List<Taxonomy> _taxonomies;
- private List<Distribution> _distributions;
- private Date _date;
- private BinaryCharacters _binary_characters;
- private PropertiesMap _properties;
- private List<Reference> _references;
- private List<Double> _vector;
+ private String _node_name;
+ private Event _event;
+ private List<Sequence> _sequences;
+ private Identifier _node_identifier;
+ private List<Taxonomy> _taxonomies;
+ private List<Distribution> _distributions;
+ private Date _date;
+ private BinaryCharacters _binary_characters;
+ private PropertiesMap _properties;
+ private List<Reference> _references;
+ private List<Double> _vector;
+ private List<NodeVisualization> _node_visualizations;
public NodeData() {
init();
}
}
}
+ if ( ( getNodeVisualizations() != null ) && ( getNodeVisualizations().size() > 0 ) ) {
+ new_data.setNodeVisualizations( new ArrayList<NodeVisualization>() );
+ for( final NodeVisualization v : getNodeVisualizations() ) {
+ if ( v != null ) {
+ new_data.getNodeVisualizations().add( ( NodeVisualization ) v.copy() );
+ }
+ }
+ }
if ( isHasDate() ) {
new_data.setDate( ( Date ) getDate().copy() );
}
public void setNodeName( final String node_name ) {
_node_name = node_name;
}
+
+ public void setNodeVisualizations( final List<NodeVisualization> _node_visualizations ) {
+ this._node_visualizations = _node_visualizations;
+ }
+
+ public List<NodeVisualization> getNodeVisualizations() {
+ return _node_visualizations;
+ }
}
--- /dev/null
+// $Id:
+// FORESTER -- software libraries and applications
+// for evolutionary biology research and applications.
+//
+// Copyright (C) 2008-2009 Christian M. Zmasek
+// Copyright (C) 2008-2009 Burnham Institute for Medical Research
+// All rights reserved
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+//
+// Contact: phylosoft @ gmail . com
+// WWW: www.phylosoft.org
+
+package org.forester.phylogeny.data;
+
+import java.awt.Color;
+import java.io.IOException;
+import java.io.Writer;
+
+public class NodeVisualization implements PhylogenyData {
+
+ public enum NodeFill {
+ NONE, GRADIENT, SOLID
+ }
+
+ public enum NodeShape {
+ CIRCLE, RECTANGLE
+ }
+ private NodeShape _shape;
+ private NodeFill _fill_type;
+ private Color _border_color;
+ private Color _fill_color;
+ private double _size;
+
+ public NodeVisualization() {
+ _shape = NodeShape.CIRCLE;
+ _fill_type = NodeFill.SOLID;
+ _border_color = null;
+ _fill_color = null;
+ _size = 0;
+ }
+
+ public NodeVisualization( final NodeShape shape,
+ final NodeFill fill_type,
+ final Color border_color,
+ final Color fill_color,
+ final double size ) {
+ _shape = shape;
+ _fill_type = fill_type;
+ _border_color = border_color;
+ _fill_color = fill_color;
+ _size = size;
+ }
+
+ @Override
+ public StringBuffer asSimpleText() {
+ return asText();
+ }
+
+ @Override
+ public StringBuffer asText() {
+ final StringBuffer sb = new StringBuffer();
+ return sb;
+ }
+
+ @Override
+ public PhylogenyData copy() {
+ return new NodeVisualization( getShape(),
+ getFillType(),
+ getBorderColor() != null ? new Color( getBorderColor().getRed(), getBorderColor()
+ .getGreen(), getBorderColor().getBlue() ) : null,
+ getFillColor() != null ? new Color( getFillColor().getRed(), getFillColor()
+ .getGreen(), getFillColor().getBlue() ) : null,
+ getSize() );
+ }
+
+ public Color getBorderColor() {
+ return _border_color;
+ }
+
+ public Color getFillColor() {
+ return _fill_color;
+ }
+
+ public NodeFill getFillType() {
+ return _fill_type;
+ }
+
+ public NodeShape getShape() {
+ return _shape;
+ }
+
+ public double getSize() {
+ return _size;
+ }
+
+ @Override
+ public boolean isEqual( final PhylogenyData data ) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setBorderColor( final Color border_color ) {
+ _border_color = border_color;
+ }
+
+ public void setFillColor( final Color fill_color ) {
+ _fill_color = fill_color;
+ }
+
+ public void setFillType( final NodeFill fill_type ) {
+ _fill_type = fill_type;
+ }
+
+ public void setShape( final NodeShape shape ) {
+ _shape = shape;
+ }
+
+ public void setSize( final double size ) {
+ _size = size;
+ }
+
+ @Override
+ public StringBuffer toNHX() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void toPhyloXML( final Writer writer, final int level, final String indentation ) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public String toString() {
+ return asText().toString();
+ }
+}