bpp-phyl  2.2.0
bpp::TreeDrawing Class Referenceabstract

Basal interface for tree drawing classes. More...

#include <Bpp/Phyl/Graphics/TreeDrawing.h>

+ Inheritance diagram for bpp::TreeDrawing:
+ Collaboration diagram for bpp::TreeDrawing:

Public Member Functions

 TreeDrawing ()
 
virtual ~TreeDrawing ()
 
TreeDrawingclone () const =0
 
virtual std::string getName () const =0
 
virtual bool hasTree () const =0
 
virtual const TreegetTree () const =0
 
virtual void setTree (const Tree *tree)=0
 
virtual void setXUnit (double xu)=0
 Set the 'horizontal' expansion unit. More...
 
virtual void setYUnit (double yu)=0
 Set the 'vertical' expansion unit. More...
 
virtual double getXUnit () const =0
 
virtual double getYUnit () const =0
 
virtual double getWidth () const =0
 
virtual double getHeight () const =0
 
virtual void plot (GraphicDevice &gDevice) const =0 throw (Exception)
 Plot the tree onto the specified device. More...
 
virtual Point2D< double > getNodePosition (int nodeId) const =0 throw (NodeNotFoundException)
 Get the position of a node. More...
 
virtual int getNodeAt (const Point2D< double > &position) const =0 throw (NodeNotFoundException)
 Get the node corresponding to a position on the device. More...
 
virtual void addTreeDrawingListener (TreeDrawingListener *listener)=0
 Add a drawing listener to this instance. More...
 
virtual void removeTreeDrawingListener (TreeDrawingListener *listener)=0
 Remove a drawing listener from this instance. More...
 
virtual void collapseNode (int nodeId, bool yn)=0 throw (NodeNotFoundException, Exception)
 Properties to draw. More...
 
virtual bool isNodeCollapsed (int nodeId) const =0 throw (NodeNotFoundException, Exception)
 
virtual void setDisplaySettings (const TreeDrawingSettings *tds)=0
 Global drawing settings. More...
 
virtual const TreeDrawingSettingsgetDisplaySettings () const =0
 

Detailed Description

Basal interface for tree drawing classes.

Basicly, a TreeDrawing object draw a graph of the tree and compute the coordinates of each node on the graph. These coordinates may be retrieved by dedicated functions. The drawing is performed on a GraphicDevice object.

The TreeDrwing class is in charge of the tree reprensentation, and offer tools to retireve the coordinates of nodes. Using these functions to plot annotation may turn to be unefficient however, particularly for large trees, as they involve a search on the whole tree. For easier tuning of the drawing extensions, the interface defines the drawProperty, getSupportedDrawableProperties and isDrawable methods. These methods can be used to add features to the plot. Adding new features can then be performed by subclassing an existing algorithm and adding support for more properties.

The TreeDrawing interface do not implies that the implementation works on a copy of the tree. It takes a constant pointer toward the tree to plot. Depending on the implementation however, the inheriting class may chose to store a copy of the tree for convenience. Refer to the documentation of the specific implementation you are using for details.

Definition at line 264 of file TreeDrawing.h.

Constructor & Destructor Documentation

◆ TreeDrawing()

bpp::TreeDrawing::TreeDrawing ( )
inline

Definition at line 268 of file TreeDrawing.h.

◆ ~TreeDrawing()

virtual bpp::TreeDrawing::~TreeDrawing ( )
inlinevirtual

Definition at line 269 of file TreeDrawing.h.

Member Function Documentation

◆ addTreeDrawingListener()

virtual void bpp::TreeDrawing::addTreeDrawingListener ( TreeDrawingListener listener)
pure virtual

Add a drawing listener to this instance.

Parameters
listenera pointer toward an object implementing the TreeDrawingListener interface. This object will then be owned by the class and copied and deleted if/when needed, unless it is autonomous.
See also
TreeDrawingListener

Implemented in bpp::AbstractTreeDrawing.

◆ clone()

TreeDrawing* bpp::TreeDrawing::clone ( ) const
pure virtual

Implemented in bpp::CladogramPlot, and bpp::PhylogramPlot.

◆ collapseNode()

virtual void bpp::TreeDrawing::collapseNode ( int  nodeId,
bool  yn 
)
throw (NodeNotFoundException,
Exception
)
pure virtual

Properties to draw.

Collapsing nodes

Implemented in bpp::AbstractTreeDrawing.

◆ getDisplaySettings()

virtual const TreeDrawingSettings& bpp::TreeDrawing::getDisplaySettings ( ) const
pure virtual

Implemented in bpp::AbstractTreeDrawing.

◆ getHeight()

virtual double bpp::TreeDrawing::getHeight ( ) const
pure virtual
Returns
The total height of the drawing, in Y units.

Implemented in bpp::CladogramPlot, and bpp::PhylogramPlot.

◆ getName()

virtual std::string bpp::TreeDrawing::getName ( ) const
pure virtual
Returns
A string describing this drawing algorithm.

Implemented in bpp::CladogramPlot, and bpp::PhylogramPlot.

◆ getNodeAt()

virtual int bpp::TreeDrawing::getNodeAt ( const Point2D< double > &  position) const
throw (NodeNotFoundException
)
pure virtual

Get the node corresponding to a position on the device.

Parameters
positionA position in the coordinates system of the last GraphicDevice used.
Returns
The corresponding node identifier if available.
Exceptions
NodeNotFoundExceptionIf the node does not correspond to a node in the tree.

Implemented in bpp::AbstractTreeDrawing.

◆ getNodePosition()

virtual Point2D<double> bpp::TreeDrawing::getNodePosition ( int  nodeId) const
throw (NodeNotFoundException
)
pure virtual

Get the position of a node.

Parameters
nodeIdThe identifier of the node.
Returns
The localization of the node using the coordinate system of the last GraphicDevice used.
Exceptions
NodeNotFoundExceptionIf the node does not correspond to a node in the tree.

Implemented in bpp::AbstractTreeDrawing.

◆ getTree()

◆ getWidth()

virtual double bpp::TreeDrawing::getWidth ( ) const
pure virtual
Returns
The total width of the drawing, in X units.

Implemented in bpp::CladogramPlot, and bpp::PhylogramPlot.

◆ getXUnit()

virtual double bpp::TreeDrawing::getXUnit ( ) const
pure virtual
Returns
The horizontal unit length.

Implemented in bpp::AbstractTreeDrawing.

Referenced by bpp::PhylogramDrawBranchEvent::getBranchCursor().

◆ getYUnit()

virtual double bpp::TreeDrawing::getYUnit ( ) const
pure virtual
Returns
The vertical unit length.

Implemented in bpp::AbstractTreeDrawing.

◆ hasTree()

virtual bool bpp::TreeDrawing::hasTree ( ) const
pure virtual
Returns
'True' if a tree is attached to this instance.

Implemented in bpp::AbstractTreeDrawing.

◆ isNodeCollapsed()

virtual bool bpp::TreeDrawing::isNodeCollapsed ( int  nodeId) const
throw (NodeNotFoundException,
Exception
)
pure virtual

◆ plot()

virtual void bpp::TreeDrawing::plot ( GraphicDevice &  gDevice) const
throw (Exception
)
pure virtual

Plot the tree onto the specified device.

Parameters
gDeviceAn object implementing the GraphicDevice interface.

Implemented in bpp::AbstractDendrogramPlot.

◆ removeTreeDrawingListener()

virtual void bpp::TreeDrawing::removeTreeDrawingListener ( TreeDrawingListener listener)
pure virtual

Remove a drawing listener from this instance.

Parameters
listenera pointer toward an object implementing the TreeDrawingListener interface. If the listener is autonomous, it will be deleted.

Implemented in bpp::AbstractTreeDrawing.

◆ setDisplaySettings()

virtual void bpp::TreeDrawing::setDisplaySettings ( const TreeDrawingSettings tds)
pure virtual

Global drawing settings.

Implemented in bpp::AbstractTreeDrawing.

◆ setTree()

virtual void bpp::TreeDrawing::setTree ( const Tree tree)
pure virtual
Parameters
treeA pointer toward the tree to associate with this drawing.

Implemented in bpp::AbstractTreeDrawing, bpp::CladogramPlot, and bpp::PhylogramPlot.

◆ setXUnit()

virtual void bpp::TreeDrawing::setXUnit ( double  xu)
pure virtual

Set the 'horizontal' expansion unit.

The effect of this expansion factor depends on the implementation of the interface.

Parameters
xuThe horizontal unit length.

Implemented in bpp::AbstractTreeDrawing.

◆ setYUnit()

virtual void bpp::TreeDrawing::setYUnit ( double  yu)
pure virtual

Set the 'vertical' expansion unit.

The effect of this expansion factor depends on the implementation of the interface.

Parameters
yuThe vertical unit length.

Implemented in bpp::AbstractTreeDrawing.


The documentation for this class was generated from the following file: