/*
* TreeLayout.java
*
* Copyright (C) 2006-2014 Andrew Rambaut
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package figtree.treeviewer.treelayouts;
import jebl.evolution.trees.RootedTree;
import java.awt.*;
import java.awt.geom.Point2D;
/**
* @author Andrew Rambaut
* @version $Id$
*
* $HeadURL$
*
* $LastChangedBy$
* $LastChangedDate$
* $LastChangedRevision$
*/
public interface TreeLayout {
public enum AxisType {
CONTINUOUS,
DISCRETE
}
void layout(RootedTree tree, TreeLayoutCache cache);
/**
* Add a listener for this layout
*
* @param listener
*/
void addTreeLayoutListener(TreeLayoutListener listener);
/**
* Remove a listener from this layout
*
* @param listener
*/
void removeTreeLayoutListener(TreeLayoutListener listener);
/**
* Return whether the x axis is continuous or discrete
*
* @return the axis type
*/
AxisType getXAxisType();
/**
* Return whether the y axis is continuous or discrete
*
* @return the axis type
*/
AxisType getYAxisType();
/**
* Return whether this layout displays a root branch
* @return showing root branch?
*/
boolean isShowingRootBranch();
double getRootLength();
void setRootLength(double rootLength);
/**
* Return whether this layout is showing a branch colouring
* @return showing colouring?
*/
boolean isShowingColouring();
void setFishEye(double fishEye);
void setPointOfInterest(double x, double y);
/**
* Return whether the two axis scales should be maintained
* relative to each other
*
* @return a boolean
*/
boolean maintainAspectRatio();
double getHeightOfPoint(Point2D point);
/**
* Return a line that defines a particular height. Some layouts
* won't be able to produce this and may throw an UnsupportedOperationException.
*
* @param height
* @return the line
*/
Shape getAxisLine(double height);
/**
* Return a shape that defines a particular height interval. Some layouts
* won't be able to produce this and may throw an UnsupportedOperationException.
*
* @param height1
* @param height2
* @return the area
*/
Shape getHeightArea(double height1, double height2);
String getBranchColouringAttributeName();
void setBranchColouringAttributeName(String colouringAttributeName);
String getCartoonAttributeName();
void setCartoonAttributeName(String cartoonAttributeName);
String getCollapsedAttributeName();
void setCollapsedAttributeName(String collapsedAttributeName);
String getHilightAttributeName();
void setHilightAttributeName(String hilightAttributeName);
}