2 // FORESTER -- software libraries and applications
3 // for evolutionary biology research and applications.
5 // Copyright (C) 2008-2009 Christian M. Zmasek
6 // Copyright (C) 2008-2009 Burnham Institute for Medical Research
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU Lesser General Public
11 // License as published by the Free Software Foundation; either
12 // version 2.1 of the License, or (at your option) any later version.
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // Lesser General Public License for more details.
19 // You should have received a copy of the GNU Lesser General Public
20 // License along with this library; if not, write to the Free Software
21 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 // Contact: phylosoft @ gmail . com
24 // WWW: www.phylosoft.org
26 package org.forester.phylogeny.data;
28 import java.awt.Color;
29 import java.io.IOException;
30 import java.io.Writer;
32 public class NodeVisualization implements PhylogenyData {
34 public enum NodeFill {
38 public enum NodeShape {
41 private NodeShape _shape;
42 private NodeFill _fill_type;
43 private Color _border_color;
44 private Color _fill_color;
47 public NodeVisualization() {
48 _shape = NodeShape.CIRCLE;
49 _fill_type = NodeFill.SOLID;
55 public NodeVisualization( final NodeShape shape,
56 final NodeFill fill_type,
57 final Color border_color,
58 final Color fill_color,
61 _fill_type = fill_type;
62 _border_color = border_color;
63 _fill_color = fill_color;
68 public StringBuffer asSimpleText() {
73 public StringBuffer asText() {
74 final StringBuffer sb = new StringBuffer();
79 public PhylogenyData copy() {
80 return new NodeVisualization( getShape(),
82 getBorderColor() != null ? new Color( getBorderColor().getRed(), getBorderColor()
83 .getGreen(), getBorderColor().getBlue() ) : null,
84 getFillColor() != null ? new Color( getFillColor().getRed(), getFillColor()
85 .getGreen(), getFillColor().getBlue() ) : null,
89 public Color getBorderColor() {
93 public Color getFillColor() {
97 public NodeFill getFillType() {
101 public NodeShape getShape() {
105 public double getSize() {
110 public boolean isEqual( final PhylogenyData data ) {
111 throw new UnsupportedOperationException();
114 public void setBorderColor( final Color border_color ) {
115 _border_color = border_color;
118 public void setFillColor( final Color fill_color ) {
119 _fill_color = fill_color;
122 public void setFillType( final NodeFill fill_type ) {
123 _fill_type = fill_type;
126 public void setShape( final NodeShape shape ) {
130 public void setSize( final double size ) {
135 public StringBuffer toNHX() {
136 throw new UnsupportedOperationException();
140 public void toPhyloXML( final Writer writer, final int level, final String indentation ) throws IOException {
141 throw new UnsupportedOperationException();
145 public String toString() {
146 return asText().toString();