import org.forester.archaeopteryx.Options.PHYLOGENY_GRAPHICS_TYPE;
import org.forester.io.parsers.nhx.NHXParser.TAXONOMY_EXTRACTION;
import org.forester.phylogeny.data.NodeData.NODE_DATA;
-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.NodeVisualData;
+import org.forester.phylogeny.data.NodeVisualData.NodeFill;
+import org.forester.phylogeny.data.NodeVisualData.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( NodeVisualization.NodeFill.NONE.toString() ) ) {
+ if ( fill_str.equalsIgnoreCase( NodeVisualData.NodeFill.NONE.toString() ) ) {
setDefaultNodeFill( NodeFill.NONE );
}
- else if ( fill_str.equalsIgnoreCase( NodeVisualization.NodeFill.GRADIENT.toString() ) ) {
+ else if ( fill_str.equalsIgnoreCase( NodeVisualData.NodeFill.GRADIENT.toString() ) ) {
setDefaultNodeFill( NodeFill.GRADIENT );
}
- else if ( fill_str.equalsIgnoreCase( NodeVisualization.NodeFill.SOLID.toString() ) ) {
+ else if ( fill_str.equalsIgnoreCase( NodeVisualData.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( NodeVisualization.NodeShape.CIRCLE.toString() ) ) {
+ if ( shape_str.equalsIgnoreCase( NodeVisualData.NodeShape.CIRCLE.toString() ) ) {
setDefaultNodeShape( NodeShape.CIRCLE );
}
- else if ( shape_str.equalsIgnoreCase( NodeVisualization.NodeShape.RECTANGLE.toString() ) ) {
+ else if ( shape_str.equalsIgnoreCase( NodeVisualData.NodeShape.RECTANGLE.toString() ) ) {
setDefaultNodeShape( NodeShape.RECTANGLE );
}
else {
import org.forester.phylogeny.PhylogenyNode;
import org.forester.phylogeny.PhylogenyNode.NH_CONVERSION_SUPPORT_VALUE_STYLE;
import org.forester.phylogeny.data.Annotation;
-import org.forester.phylogeny.data.NodeVisualization.NodeFill;
-import org.forester.phylogeny.data.NodeVisualization.NodeShape;
+
+import org.forester.phylogeny.data.NodeVisualData.NodeFill;
+import org.forester.phylogeny.data.NodeVisualData.NodeShape;
import org.forester.sdi.GSDI;
import org.forester.sdi.GSDIR;
import org.forester.sdi.SDIException;
import org.forester.phylogeny.PhylogenyNode.NH_CONVERSION_SUPPORT_VALUE_STYLE;
import org.forester.phylogeny.data.NodeData;
import org.forester.phylogeny.data.NodeData.NODE_DATA;
-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.NodeVisualData;
+import org.forester.phylogeny.data.NodeVisualData.NodeFill;
+import org.forester.phylogeny.data.NodeVisualData.NodeShape;
import org.forester.util.ForesterUtil;
/*
private CLADOGRAM_TYPE _cladogram_type;
private boolean _color_by_taxonomic_group;
private boolean _color_labels_same_as_parent_branch;
- private NodeVisualization.NodeFill _default_node_fill;
- private NodeVisualization.NodeShape _default_node_shape;
+ private NodeVisualData.NodeFill _default_node_fill;
+ private NodeVisualData.NodeShape _default_node_shape;
private short _default_node_shape_size;
private boolean _editable;
private NODE_DATA _ext_desc_data_to_return;
import org.forester.phylogeny.data.Confidence;
import org.forester.phylogeny.data.Event;
import org.forester.phylogeny.data.NodeData.NODE_DATA;
-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.NodeVisualData;
+import org.forester.phylogeny.data.NodeVisualData.NodeFill;
+import org.forester.phylogeny.data.NodeVisualData.NodeShape;
import org.forester.phylogeny.data.PhylogenyDataUtil;
import org.forester.phylogeny.data.PropertiesMap;
import org.forester.phylogeny.data.Property;
_polygon.lineTo( node.getXcoord() + 1, node.getYcoord() - d );
_polygon.lineTo( node.getXcoord() + 1, node.getYcoord() + d );
_polygon.closePath();
- if ( getOptions().getDefaultNodeFill() == NodeVisualization.NodeFill.SOLID ) {
+ if ( getOptions().getDefaultNodeFill() == NodeVisualData.NodeFill.SOLID ) {
g.setColor( c );
g.fill( _polygon );
}
- else if ( getOptions().getDefaultNodeFill() == NodeVisualization.NodeFill.NONE ) {
+ else if ( getOptions().getDefaultNodeFill() == NodeVisualData.NodeFill.NONE ) {
g.setColor( getBackground() );
g.fill( _polygon );
g.setColor( c );
background,
outline_color );
}
- else if ( getOptions().getDefaultNodeFill() == NodeVisualization.NodeFill.SOLID ) {
+ else if ( getOptions().getDefaultNodeFill() == NodeVisualData.NodeFill.SOLID ) {
g.setColor( outline_color );
drawOvalFilled( x - half_box_size, y - half_box_size, box_size, box_size, g );
}
}
- else if ( getOptions().getDefaultNodeShape() == NodeVisualization.NodeShape.RECTANGLE ) {
- if ( getOptions().getDefaultNodeFill() == NodeVisualization.NodeFill.GRADIENT ) {
+ else if ( getOptions().getDefaultNodeShape() == NodeVisualData.NodeShape.RECTANGLE ) {
+ if ( getOptions().getDefaultNodeFill() == NodeVisualData.NodeFill.GRADIENT ) {
drawRectGradient( x - half_box_size, y - half_box_size, box_size, box_size, g, to_pdf ? Color.WHITE
: outline_color, to_pdf ? outline_color : getBackground(), outline_color );
}
- else if ( getOptions().getDefaultNodeFill() == NodeVisualization.NodeFill.NONE ) {
+ else if ( getOptions().getDefaultNodeFill() == NodeVisualData.NodeFill.NONE ) {
Color background = getBackground();
if ( to_pdf ) {
background = Color.WHITE;
background,
outline_color );
}
- else if ( getOptions().getDefaultNodeFill() == NodeVisualization.NodeFill.SOLID ) {
+ else if ( getOptions().getDefaultNodeFill() == NodeVisualData.NodeFill.SOLID ) {
g.setColor( outline_color );
drawRectFilled( x - half_box_size, y - half_box_size, box_size, box_size, g );
}
private PropertiesMap _properties;
private List<Reference> _references;
private List<Double> _vector;
- private List<NodeVisualization> _node_visualizations;
+ private NodeVisualData _node_visual_data;
public NodeData() {
init();
private void init() {
_node_name = "";
+ _event = null;
+ _sequences= null;
+ _taxonomies= null;
+ _distributions= null;
+ _date= null;
+ _binary_characters= null;
+ _properties= null;
+ _references= null;
+ _vector= null;
+ _node_visual_data= null;
}
public void addDistribution( final Distribution distribution ) {
}
}
}
- 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 ( getNodeVisualData() != null && !getNodeVisualData().isEmpty() ) {
+ new_data.setNodeVisualData( ( NodeVisualData ) getNodeVisualData().copy() );
}
if ( isHasDate() ) {
new_data.setDate( ( Date ) getDate().copy() );
_node_name = node_name;
}
- public void setNodeVisualizations( final List<NodeVisualization> _node_visualizations ) {
- this._node_visualizations = _node_visualizations;
+ public void setNodeVisualData( final NodeVisualData node_visual_data ) {
+ _node_visual_data = node_visual_data;
}
- public List<NodeVisualization> getNodeVisualizations() {
- return _node_visualizations;
+ public NodeVisualData getNodeVisualData() {
+ return _node_visual_data;
}
}
--- /dev/null
+package org.forester.phylogeny.data;\r
+\r
+import java.awt.Color;\r
+import java.io.IOException;\r
+import java.io.Writer;\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
+\r
+import org.forester.phylogeny.data.Property.AppliesTo;\r
+import org.forester.util.ForesterUtil;\r
+\r
+\r
+public final class NodeVisualData implements PhylogenyData {\r
+ \r
+ private static final int DEFAULT_SIZE = -1;\r
+ private static final int DEFAULT_TRANSPARANCY = -1;\r
+ private static final byte DEFAULT_FONT_SIZE = -1;\r
+ private NodeShape _shape;\r
+ private NodeFill _fill_type;\r
+ private Color _border_color;\r
+ private Color _fill_color;\r
+ \r
+ private String _font;\r
+ private FontType _font_type;\r
+ private byte _font_size;\r
+ private Color _font_color;\r
+ \r
+ private float _size;\r
+ private float _transparancy;\r
+\r
+ public NodeVisualData() {\r
+ init();\r
+ }\r
+\r
+ public NodeVisualData( final String font,\r
+ final FontType font_type,\r
+ byte font_size,\r
+ Color font_color,\r
+ final NodeShape shape,\r
+ final NodeFill fill_type,\r
+ final Color border_color,\r
+ final Color fill_color,\r
+ final float size,\r
+ final float transparancy ) {\r
+ setFont( font );\r
+ setFontType(font_type );\r
+ setFontSize( font_size );\r
+ setFontColor( font_color );\r
+ setShape( shape );\r
+ setFillType( fill_type );\r
+ setBorderColor( border_color );\r
+ setFillColor( fill_color );\r
+ setSize( size );\r
+ setTransparancy( transparancy );\r
+ }\r
+\r
+ @Override\r
+ public final StringBuffer asSimpleText() {\r
+ return asText();\r
+ }\r
+\r
+ @Override\r
+ public final StringBuffer asText() {\r
+ final StringBuffer sb = new StringBuffer();\r
+ return sb;\r
+ }\r
+\r
+ @Override\r
+ public final PhylogenyData copy() {\r
+ return new NodeVisualData( ForesterUtil.isEmpty( getFont() ) ? new String( getFont()) : null ,\r
+ getFontType(),\r
+ getFontSize(),\r
+ getFontColor() != null ? new Color( getFontColor().getRed(), getFontColor()\r
+ .getGreen(), getFontColor().getBlue() ) : null, \r
+ getShape(),\r
+ getFillType(),\r
+ getBorderColor() != null ? new Color( getBorderColor().getRed(), getBorderColor()\r
+ .getGreen(), getBorderColor().getBlue() ) : null,\r
+ getFillColor() != null ? new Color( getFillColor().getRed(), getFillColor()\r
+ .getGreen(), getFillColor().getBlue() ) : null,\r
+ getSize(),\r
+ getTransparancy() );\r
+ }\r
+\r
+ public final Color getBorderColor() {\r
+ return _border_color;\r
+ }\r
+\r
+ public final Color getFillColor() {\r
+ return _fill_color;\r
+ }\r
+\r
+ public final NodeFill getFillType() {\r
+ return _fill_type;\r
+ }\r
+\r
+ public final NodeShape getShape() {\r
+ return _shape;\r
+ }\r
+\r
+ public final float getSize() {\r
+ return _size;\r
+ }\r
+\r
+ public final float getTransparancy() {\r
+ return _transparancy;\r
+ }\r
+\r
+ private final void init() {\r
+ setFont( null );\r
+ setFontType( FontType.NORMAL );\r
+ setFontSize( DEFAULT_FONT_SIZE );\r
+ setFontColor( null );\r
+ setShape( NodeShape.DEFAULT );\r
+ setFillType( NodeFill.DEFAULT );\r
+ setBorderColor( null );\r
+ setFillColor( null );\r
+ setSize( DEFAULT_SIZE );\r
+ setTransparancy( DEFAULT_TRANSPARANCY );\r
+ }\r
+\r
+ @Override\r
+ public final boolean isEqual( final PhylogenyData data ) {\r
+ throw new UnsupportedOperationException();\r
+ }\r
+\r
+ public final void setBorderColor( final Color border_color ) {\r
+ _border_color = border_color;\r
+ }\r
+\r
+ public final void setFillColor( final Color fill_color ) {\r
+ _fill_color = fill_color;\r
+ }\r
+\r
+ public final void setFillType( final NodeFill fill_type ) {\r
+ _fill_type = fill_type;\r
+ }\r
+\r
+ public final void setShape( final NodeShape shape ) {\r
+ _shape = shape;\r
+ }\r
+\r
+ public final void setSize( final float size ) {\r
+ _size = size;\r
+ }\r
+\r
+ public final void setTransparancy( final float transparancy ) {\r
+ _transparancy = transparancy;\r
+ }\r
+\r
+ @Override\r
+ public final StringBuffer toNHX() {\r
+ throw new UnsupportedOperationException();\r
+ }\r
+\r
+ @Override\r
+ public final void toPhyloXML( final Writer writer, final int level, final String indentation ) throws IOException {\r
+ throw new UnsupportedOperationException();\r
+ }\r
+\r
+ @Override\r
+ public final String toString() {\r
+ return asText().toString();\r
+ }\r
+\r
+ public enum NodeFill {\r
+ NONE, GRADIENT, SOLID, DEFAULT\r
+ }\r
+\r
+ public enum NodeShape {\r
+ CIRCLE, RECTANGLE, DEFAULT\r
+ }\r
+ \r
+ public enum FontType {\r
+ NORMAL, BOLD, ITALIC, BOLD_ITALIC\r
+ }\r
+\r
+ private final List<Property> toProperties() {\r
+ final List<Property> properties = new ArrayList<Property>();\r
+ properties.add( new Property( SIZE_REF, String.valueOf( getSize() ), "", SIZE_TYPE, AppliesTo.NODE ) );\r
+ properties.add( new Property( SIZE_REF, String.valueOf( getShape() ), "", SIZE_TYPE, AppliesTo.NODE ) );\r
+ properties.add( new Property( SIZE_REF, String.valueOf( getFillType() ), "", SIZE_TYPE, AppliesTo.NODE ) );\r
+ properties.add( new Property( SIZE_REF, String.valueOf( getTransparancy() ), "", SIZE_TYPE, AppliesTo.NODE ) );\r
+ properties.add( new Property( SIZE_REF, String.valueOf( getFillColor() ), "", SIZE_TYPE, AppliesTo.NODE ) );\r
+ properties.add( new Property( SIZE_REF, String.valueOf( getBorderColor() ), "", SIZE_TYPE, AppliesTo.NODE ) );\r
+ return properties;\r
+ }\r
+ public static final String SIZE_REF = "aptx_visualiation:node_sise";\r
+ public static final String SIZE_TYPE = "xsd:decimal";\r
+\r
+ public final boolean isEmpty() {\r
+ return ( ForesterUtil.isEmpty( getFont() ) &&\r
+ getFontType() == FontType.NORMAL && \r
+ getFontSize() == DEFAULT_FONT_SIZE &&\r
+ getFontColor() == null &&\r
+ getShape() == NodeShape.DEFAULT &&\r
+ getFillType() == NodeFill.DEFAULT &&\r
+ getBorderColor() == null &&\r
+ getFillColor() == null &&\r
+ getSize() == DEFAULT_SIZE &&\r
+ getTransparancy() == DEFAULT_TRANSPARANCY );\r
+ }\r
+\r
+ public final String getFont() {\r
+ return _font;\r
+ }\r
+\r
+ public final void setFont( final String font ) {\r
+ if ( !ForesterUtil.isEmpty( font ) ) {\r
+ _font = font;\r
+ }\r
+ else {\r
+ _font = null;\r
+ }\r
+ }\r
+\r
+ public final FontType getFontType() {\r
+ return _font_type;\r
+ }\r
+\r
+ public final void setFontType( FontType font_type ) {\r
+ _font_type = font_type;\r
+ }\r
+\r
+ public final byte getFontSize() {\r
+ return _font_size;\r
+ }\r
+\r
+ public final void setFontSize( byte font_size ) {\r
+ _font_size = font_size;\r
+ }\r
+\r
+ public final Color getFontColor() {\r
+ return _font_color;\r
+ }\r
+\r
+ public final void setFontColor( Color font_color ) {\r
+ _font_color = font_color;\r
+ }\r
+}\r
+++ /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;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.forester.phylogeny.data.Property.AppliesTo;
-
-public class NodeVisualization implements PhylogenyData {
-
- private NodeShape _shape;
- private NodeFill _fill_type;
- private Color _border_color;
- private Color _fill_color;
- private double _size;
- private double _transparancy;
-
- public NodeVisualization() {
- init();
- }
-
- public NodeVisualization( final NodeShape shape,
- final NodeFill fill_type,
- final Color border_color,
- final Color fill_color,
- final double size,
- final double transparancy ) {
- setShape( shape );
- setFillType( fill_type );
- setBorderColor( border_color );
- setFillColor( fill_color );
- setSize( size );
- setTransparancy( transparancy );
- }
-
- @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(),
- getTransparancy() );
- }
-
- 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;
- }
-
- public double getTransparancy() {
- return _transparancy;
- }
-
- private void init() {
- setShape( NodeShape.CIRCLE );
- setFillType( NodeFill.SOLID );
- setBorderColor( null );
- setFillColor( null );
- setSize( 0 );
- setTransparancy( 1 );
- }
-
- @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;
- }
-
- public void setTransparancy( final double transparancy ) {
- _transparancy = transparancy;
- }
-
- @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();
- }
-
- public enum NodeFill {
- NONE, GRADIENT, SOLID
- }
-
- public enum NodeShape {
- CIRCLE, RECTANGLE
- }
-
- private List<Property> toProperties() {
- final List<Property> properties = new ArrayList<Property>();
- properties.add( new Property( SIZE_REF, String.valueOf( getSize() ), "", SIZE_TYPE, AppliesTo.NODE ) );
- properties.add( new Property( SIZE_REF, String.valueOf( getShape() ), "", SIZE_TYPE, AppliesTo.NODE ) );
- properties.add( new Property( SIZE_REF, String.valueOf( getFillType() ), "", SIZE_TYPE, AppliesTo.NODE ) );
- properties.add( new Property( SIZE_REF, String.valueOf( getTransparancy() ), "", SIZE_TYPE, AppliesTo.NODE ) );
- properties.add( new Property( SIZE_REF, String.valueOf( getFillColor() ), "", SIZE_TYPE, AppliesTo.NODE ) );
- properties.add( new Property( SIZE_REF, String.valueOf( getBorderColor() ), "", SIZE_TYPE, AppliesTo.NODE ) );
- return properties;
- }
- public static final String SIZE_REF = "aptx_visualiation:node_sise";
- public static final String SIZE_TYPE = "xsd:decimal";
-}