40 #ifndef _TREEDRAWING_H_ 41 #define _TREEDRAWING_H_ 43 #include <Bpp/Clonable.h> 44 #include <Bpp/Graphics/GraphicDevice.h> 45 #include <Bpp/Graphics/Point2D.h> 46 #include <Bpp/Graphics/Font/Font.h> 56 class TreeDrawingListener;
74 fontLeafNames(
"Courier", Font::STYLE_NORMAL, Font::WEIGHT_NORMAL, 12),
77 fontNodesId(
"Courier", Font::STYLE_NORMAL, Font::WEIGHT_BOLD, 12),
97 Cursor(
double x,
double y,
double angle = 0,
short hpos = GraphicDevice::TEXT_HORIZONTAL_CENTER,
short vpos = GraphicDevice::TEXT_VERTICAL_CENTER) :
106 double addX(
double increment) {
return x_ += increment; }
107 double addY(
double increment) {
return y_ += increment; }
265 public virtual Clonable
271 #ifndef NO_VIRTUAL_COV 279 virtual std::string
getName()
const = 0;
284 virtual bool hasTree()
const = 0;
302 virtual void setXUnit(
double xu) = 0;
310 virtual void setYUnit(
double yu) = 0;
315 virtual double getXUnit()
const = 0;
320 virtual double getYUnit()
const = 0;
325 virtual double getWidth()
const = 0;
337 virtual void plot(GraphicDevice& gDevice)
const throw (Exception) = 0;
402 #endif //_TREEDRAWING_H_ virtual GraphicDevice * getGraphicDevice() const
Basal interface for tree drawing classes.
virtual const Cursor & getCursor() const
DrawBranchEvent(const TreeDrawing *source, GraphicDevice *gd, int nodeId, const Cursor &cursor)
virtual const TreeDrawing * getTreeDrawing() const
virtual int getNodeId() const
virtual void removeTreeDrawingListener(TreeDrawingListener *listener)=0
Remove a drawing listener from this instance.
Cursor(double x, double y, double angle=0, short hpos=GraphicDevice::TEXT_HORIZONTAL_CENTER, short vpos=GraphicDevice::TEXT_VERTICAL_CENTER)
virtual int getNodeAt(const Point2D< double > &position) const =0
Get the node corresponding to a position on the device.
DrawBranchEvent & operator=(const DrawBranchEvent &dne)
virtual bool hasTree() const =0
DrawTreeEvent & operator=(const DrawTreeEvent &dte)
virtual std::string getName() const =0
virtual void setDisplaySettings(const TreeDrawingSettings *tds)=0
Global drawing settings.
virtual GraphicDevice * getGraphicDevice() const
TreeDrawing * clone() const =0
Cursor getTranslation(double x, double y) const
virtual Cursor getBranchCursor(double position) const =0
double addX(double increment)
DrawTreeEvent(const TreeDrawing *source, GraphicDevice *gd)
virtual void setXUnit(double xu)=0
Set the 'horizontal' expansion unit.
virtual double getYUnit() const =0
Interface for phylogenetic tree objects.
virtual const TreeDrawing * getTreeDrawing() const
virtual double getWidth() const =0
DrawNodeEvent(const DrawNodeEvent &dne)
virtual const Cursor & getCursor() const
virtual ~DrawBranchEvent()
virtual bool isNodeCollapsed(int nodeId) const =0
virtual void setTree(const Tree *tree)=0
A set of options to tune the display of a TreeDrawing object.
Exception thrown when something is wrong with a particular node.
Event class used by TreeDrawing classes.
virtual Point2D< double > getNodePosition(int nodeId) const =0
Get the position of a node.
virtual double getHeight() const =0
Interface allowing to capture drawing events.
virtual const TreeDrawing * getTreeDrawing() const
virtual double getXUnit() const =0
DrawNodeEvent(const TreeDrawing *source, GraphicDevice *gd, int nodeId, const Cursor &cursor)
DrawNodeEvent & operator=(const DrawNodeEvent &dne)
Event class used by TreeDrawing classes.
virtual void addTreeDrawingListener(TreeDrawingListener *listener)=0
Add a drawing listener to this instance.
virtual GraphicDevice * getGraphicDevice() const
virtual void plot(GraphicDevice &gDevice) const =0
Plot the tree onto the specified device.
DrawBranchEvent(const DrawBranchEvent &dne)
virtual void setYUnit(double yu)=0
Set the 'vertical' expansion unit.
virtual const Tree * getTree() const =0
double addY(double increment)
virtual const TreeDrawingSettings & getDisplaySettings() const =0
virtual int getNodeId() const
virtual void collapseNode(int nodeId, bool yn)=0
Properties to draw.
Data structure describing a plotting direction.
DrawTreeEvent(const DrawTreeEvent &dne)
Event class used by TreeDrawing classes.