bpp-phyl3
3.0.0
|
Basic implementation of dendrogram plots. More...
#include <Bpp/Phyl/Graphics/AbstractDendrogramPlot.h>
Public Member Functions | |
AbstractDendrogramPlot () | |
void | setHorizontalOrientation (short orientation) |
void | setVerticalOrientation (short orientation) |
short | getHorizontalOrientation () const |
short | getVerticalOrientation () const |
void | plot (GraphicDevice &gDevice) const |
Plot the tree onto the specified device. More... | |
bool | hasTree () const |
const TreeTemplate< INode > * | getTree () const |
void | setTree (const Tree *tree) |
Point2D< double > | getNodePosition (int nodeId) const |
Get the position of a node. More... | |
int | getNodeAt (const Point2D< double > &position) const |
Get the node corresponding to a position on the device. More... | |
bool | belongsTo (const Point2D< double > &p1, const Point2D< double > &p2) const |
Utilitary function, telling if a point belongs to a specified area. More... | |
virtual void | drawAtNode (GraphicDevice &gDevice, const INode &node, const std::string &text, double xOffset=0, double yOffset=0, short hpos=GraphicDevice::TEXT_HORIZONTAL_LEFT, short vpos=GraphicDevice::TEXT_VERTICAL_CENTER, double angle=0) const |
Draw some text at a particular node position. More... | |
virtual void | drawAtBranch (GraphicDevice &gDevice, const INode &node, const std::string &text, double xOffset=0, double yOffset=0, short hpos=GraphicDevice::TEXT_HORIZONTAL_LEFT, short vpos=GraphicDevice::TEXT_VERTICAL_CENTER, double angle=0) const |
Draw some text at a particular branch position. More... | |
void | setDisplaySettings (const TreeDrawingSettings *tds) |
Global drawing settings. More... | |
const TreeDrawingSettings & | getDisplaySettings () const |
double | getXUnit () const |
double | getYUnit () const |
void | setXUnit (double xu) |
Set the 'horizontal' expansion unit. More... | |
void | setYUnit (double yu) |
Set the 'vertical' expansion unit. More... | |
void | collapseNode (int nodeId, bool yn) |
Properties to draw. More... | |
bool | isNodeCollapsed (int nodeId) const |
void | addTreeDrawingListener (TreeDrawingListener *listener) |
Add a drawing listener to this instance. More... | |
void | removeTreeDrawingListener (TreeDrawingListener *listener) |
Remove a drawing listener from this instance. More... | |
virtual void | treeHasChanged ()=0 |
Method to implement to deal with redrawing when the underlying tree has been modified. More... | |
TreeDrawing * | clone () const =0 |
virtual std::string | getName () const =0 |
virtual double | getWidth () const =0 |
virtual double | getHeight () const =0 |
Static Public Attributes | |
static short | ORIENTATION_LEFT_TO_RIGHT = 1 |
static short | ORIENTATION_RIGHT_TO_LEFT = 2 |
static short | ORIENTATION_TOP_TO_BOTTOM = 3 |
static short | ORIENTATION_BOTTOM_TO_TOP = 4 |
static const TreeDrawingSettings | DEFAULT_SETTINGS |
Protected Member Functions | |
virtual void | drawDendrogram_ (GraphicDevice &gDevice) const =0 |
TreeTemplate< INode > * | getTree_ () |
const TreeTemplate< INode > * | getTree_ () const |
void | fireBeforeTreeEvent_ (const DrawTreeEvent &event) const |
void | fireAfterTreeEvent_ (const DrawTreeEvent &event) const |
void | fireBeforeNodeEvent_ (const DrawINodeEvent &event) const |
void | fireAfterNodeEvent_ (const DrawINodeEvent &event) const |
void | fireBeforeBranchEvent_ (const DrawIBranchEvent &event) const |
void | fireAfterBranchEvent_ (const DrawIBranchEvent &event) const |
Private Attributes | |
short | horOrientation_ |
short | verOrientation_ |
std::unique_ptr< TreeTemplate< INode > > | tree_ |
double | xUnit_ |
double | yUnit_ |
const TreeDrawingSettings * | settings_ |
std::vector< TreeDrawingListener * > | listeners_ |
Basic implementation of dendrogram plots.
Dendrograms are oriented plots, with all the leaves on one side of the plot, and the root node at the opposite side. This implementation offers to option for plotting form left to right or right to left. This will affect the direction of plot annotations. The drawing can always be transformed using the regular translation/rotation operation on the GraphicDevice.
Definition at line 21 of file AbstractDendrogramPlot.h.
|
inline |
Definition at line 29 of file AbstractDendrogramPlot.h.
|
inlinevirtualinherited |
Add a drawing listener to this instance.
listener | a 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. |
Implements bpp::TreeDrawing.
Definition at line 262 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::listeners_.
|
inherited |
Utilitary function, telling if a point belongs to a specified area.
This method is used internally to get a node coordinates.
p1 | Point to look for. |
p2 | Second point defining the center of the area. |
Definition at line 47 of file AbstractTreeDrawing.cpp.
References bpp::Point2D< class >::getX(), and bpp::Point2D< class >::getY().
|
pure virtualinherited |
Implements bpp::Clonable.
Implemented in bpp::PhylogramPlot, and bpp::CladogramPlot.
|
inlinevirtualinherited |
Properties to draw.
Collapsing nodes
Implements bpp::TreeDrawing.
Definition at line 250 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::tree_.
|
virtualinherited |
Draw some text at a particular branch position.
gDevice | The GraphicDevice object on which to draw. |
node | The node of interest. |
text | The text to draw. |
xOffset | Horizontal offset. |
yOffset | Vertical offset. |
hpos | The way the text should be aligned horizontally (see GraphicDevice). |
vpos | The way the text should be aligned vertically (see GraphicDevice). |
angle | The rotation value of the text. |
Definition at line 58 of file AbstractTreeDrawing.cpp.
References bpp::GraphicDevice::drawText(), bpp::NodeTemplate< NodeInfos >::getFather(), bpp::NodeTemplate< NodeInfos >::getInfos(), and bpp::Node::hasFather().
|
virtualinherited |
Draw some text at a particular node position.
gDevice | The GraphicDevice object on which to draw. |
node | The node of interest. |
text | The text to draw. |
xOffset | Horizontal offset. |
yOffset | Vertical offset. |
hpos | The way the text should be aligned horizontally (see GraphicDevice). |
vpos | The way the text should be aligned vertically (see GraphicDevice). |
angle | The rotation value of the text. |
Definition at line 53 of file AbstractTreeDrawing.cpp.
References bpp::GraphicDevice::drawText(), and bpp::NodeTemplate< NodeInfos >::getInfos().
|
protectedpure virtual |
Implemented in bpp::PhylogramPlot, and bpp::CladogramPlot.
|
inlineprotectedinherited |
Definition at line 333 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::listeners_.
Referenced by bpp::CladogramPlot::recursivePlot_(), and bpp::PhylogramPlot::recursivePlot_().
|
inlineprotectedinherited |
Definition at line 315 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::listeners_.
Referenced by bpp::CladogramPlot::recursivePlot_(), and bpp::PhylogramPlot::recursivePlot_().
|
inlineprotectedinherited |
Definition at line 297 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::listeners_.
Referenced by bpp::CladogramPlot::drawDendrogram_(), and bpp::PhylogramPlot::drawDendrogram_().
|
inlineprotectedinherited |
Definition at line 324 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::listeners_.
Referenced by bpp::CladogramPlot::recursivePlot_(), and bpp::PhylogramPlot::recursivePlot_().
|
inlineprotectedinherited |
Definition at line 306 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::listeners_.
Referenced by bpp::CladogramPlot::recursivePlot_(), and bpp::PhylogramPlot::recursivePlot_().
|
inlineprotectedinherited |
Definition at line 288 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::listeners_.
Referenced by bpp::CladogramPlot::drawDendrogram_(), and bpp::PhylogramPlot::drawDendrogram_().
|
inlinevirtualinherited |
Implements bpp::TreeDrawing.
Definition at line 240 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::settings_.
|
pure virtualinherited |
Implemented in bpp::PhylogramPlot, and bpp::CladogramPlot.
|
inline |
Definition at line 37 of file AbstractDendrogramPlot.h.
References horOrientation_.
Referenced by bpp::CladogramPlot::drawDendrogram_(), bpp::PhylogramPlot::drawDendrogram_(), bpp::CladogramPlot::recursivePlot_(), and bpp::PhylogramPlot::recursivePlot_().
|
pure virtualinherited |
Implemented in bpp::PhylogramPlot, and bpp::CladogramPlot.
|
virtualinherited |
Get the node corresponding to a position on the device.
position | A position in the coordinates system of the last GraphicDevice used. |
NodeNotFoundException | If the node does not correspond to a node in the tree. |
Implements bpp::TreeDrawing.
Definition at line 33 of file AbstractTreeDrawing.cpp.
|
virtualinherited |
Get the position of a node.
nodeId | The identifier of the node. |
NodeNotFoundException | If the node does not correspond to a node in the tree. |
Implements bpp::TreeDrawing.
Definition at line 20 of file AbstractTreeDrawing.cpp.
References bpp::TextTools::toString().
|
inlinevirtualinherited |
Implements bpp::TreeDrawing.
Definition at line 175 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::tree_.
|
inlineprotectedinherited |
Definition at line 285 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::tree_.
Referenced by bpp::CladogramPlot::drawDendrogram_(), bpp::PhylogramPlot::drawDendrogram_(), bpp::CladogramPlot::setTree(), bpp::PhylogramPlot::setTree(), bpp::CladogramPlot::treeHasChanged(), and bpp::PhylogramPlot::treeHasChanged().
|
inlineprotectedinherited |
Definition at line 286 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::tree_.
|
inline |
Definition at line 38 of file AbstractDendrogramPlot.h.
References verOrientation_.
Referenced by bpp::CladogramPlot::drawDendrogram_(), bpp::PhylogramPlot::drawDendrogram_(), bpp::CladogramPlot::recursivePlot_(), and bpp::PhylogramPlot::recursivePlot_().
|
pure virtualinherited |
Implemented in bpp::PhylogramPlot, and bpp::CladogramPlot.
|
inlinevirtualinherited |
Implements bpp::TreeDrawing.
Definition at line 242 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::xUnit_.
Referenced by bpp::CladogramPlot::drawDendrogram_(), bpp::PhylogramPlot::drawDendrogram_(), bpp::CladogramPlot::recursivePlot_(), and bpp::PhylogramPlot::recursivePlot_().
|
inlinevirtualinherited |
Implements bpp::TreeDrawing.
Definition at line 244 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::yUnit_.
Referenced by bpp::CladogramPlot::recursivePlot_(), and bpp::PhylogramPlot::recursivePlot_().
|
inlinevirtualinherited |
Implements bpp::TreeDrawing.
Definition at line 173 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::tree_.
Referenced by bpp::CladogramPlot::drawDendrogram_(), bpp::PhylogramPlot::drawDendrogram_(), bpp::CladogramPlot::setTree(), bpp::CladogramPlot::treeHasChanged(), and bpp::PhylogramPlot::treeHasChanged().
|
inlinevirtualinherited |
Implements bpp::TreeDrawing.
Definition at line 256 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::tree_.
|
virtual |
Plot the tree onto the specified device.
gDevice | An object implementing the GraphicDevice interface. |
Implements bpp::TreeDrawing.
Definition at line 15 of file AbstractDendrogramPlot.cpp.
References bpp::GraphicDevice::setCurrentPointSize().
|
inlinevirtualinherited |
Remove a drawing listener from this instance.
listener | a pointer toward an object implementing the TreeDrawingListener interface. If the listener is autonomous, it will be deleted. |
Implements bpp::TreeDrawing.
Definition at line 269 of file AbstractTreeDrawing.h.
References bpp::TreeDrawingListener::isAutonomous(), and bpp::AbstractTreeDrawing::listeners_.
|
inlinevirtualinherited |
Global drawing settings.
Implements bpp::TreeDrawing.
Definition at line 234 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::settings_.
|
inline |
Definition at line 34 of file AbstractDendrogramPlot.h.
References horOrientation_.
|
inlinevirtualinherited |
tree | A pointer toward the tree to associate with this drawing. |
Implements bpp::TreeDrawing.
Reimplemented in bpp::PhylogramPlot, and bpp::CladogramPlot.
Definition at line 177 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::tree_, and bpp::AbstractTreeDrawing::treeHasChanged().
Referenced by bpp::CladogramPlot::setTree(), and bpp::PhylogramPlot::setTree().
|
inline |
Definition at line 35 of file AbstractDendrogramPlot.h.
References verOrientation_.
|
inlinevirtualinherited |
Set the 'horizontal' expansion unit.
The effect of this expansion factor depends on the implementation of the interface.
xu | The horizontal unit length. |
Implements bpp::TreeDrawing.
Definition at line 246 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::xUnit_.
|
inlinevirtualinherited |
Set the 'vertical' expansion unit.
The effect of this expansion factor depends on the implementation of the interface.
yu | The vertical unit length. |
Implements bpp::TreeDrawing.
Definition at line 248 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::yUnit_.
|
pure virtualinherited |
Method to implement to deal with redrawing when the underlying tree has been modified.
Implemented in bpp::PhylogramPlot, and bpp::CladogramPlot.
Referenced by bpp::AbstractTreeDrawing::setTree().
|
staticinherited |
Definition at line 343 of file AbstractTreeDrawing.h.
|
private |
Definition at line 25 of file AbstractDendrogramPlot.h.
Referenced by getHorizontalOrientation(), and setHorizontalOrientation().
|
privateinherited |
Definition at line 123 of file AbstractTreeDrawing.h.
Referenced by bpp::AbstractTreeDrawing::AbstractTreeDrawing(), bpp::AbstractTreeDrawing::addTreeDrawingListener(), bpp::AbstractTreeDrawing::fireAfterBranchEvent_(), bpp::AbstractTreeDrawing::fireAfterNodeEvent_(), bpp::AbstractTreeDrawing::fireAfterTreeEvent_(), bpp::AbstractTreeDrawing::fireBeforeBranchEvent_(), bpp::AbstractTreeDrawing::fireBeforeNodeEvent_(), bpp::AbstractTreeDrawing::fireBeforeTreeEvent_(), bpp::AbstractTreeDrawing::operator=(), bpp::AbstractTreeDrawing::removeTreeDrawingListener(), and bpp::AbstractTreeDrawing::~AbstractTreeDrawing().
|
static |
Definition at line 49 of file AbstractDendrogramPlot.h.
|
static |
Definition at line 46 of file AbstractDendrogramPlot.h.
Referenced by bpp::CladogramDrawBranchEvent::CladogramDrawBranchEvent(), bpp::CladogramPlot::drawDendrogram_(), bpp::PhylogramPlot::drawDendrogram_(), bpp::PhylogramDrawBranchEvent::PhylogramDrawBranchEvent(), bpp::CladogramPlot::recursivePlot_(), and bpp::PhylogramPlot::recursivePlot_().
|
static |
Definition at line 47 of file AbstractDendrogramPlot.h.
|
static |
Definition at line 48 of file AbstractDendrogramPlot.h.
Referenced by bpp::CladogramPlot::drawDendrogram_(), bpp::PhylogramPlot::drawDendrogram_(), bpp::CladogramPlot::recursivePlot_(), and bpp::PhylogramPlot::recursivePlot_().
|
privateinherited |
Definition at line 122 of file AbstractTreeDrawing.h.
Referenced by bpp::AbstractTreeDrawing::getDisplaySettings(), bpp::AbstractTreeDrawing::operator=(), and bpp::AbstractTreeDrawing::setDisplaySettings().
|
privateinherited |
Definition at line 119 of file AbstractTreeDrawing.h.
Referenced by bpp::AbstractTreeDrawing::collapseNode(), bpp::AbstractTreeDrawing::getTree(), bpp::AbstractTreeDrawing::getTree_(), bpp::AbstractTreeDrawing::hasTree(), bpp::AbstractTreeDrawing::isNodeCollapsed(), bpp::AbstractTreeDrawing::operator=(), and bpp::AbstractTreeDrawing::setTree().
|
private |
Definition at line 26 of file AbstractDendrogramPlot.h.
Referenced by getVerticalOrientation(), and setVerticalOrientation().
|
privateinherited |
Definition at line 120 of file AbstractTreeDrawing.h.
Referenced by bpp::AbstractTreeDrawing::getXUnit(), bpp::AbstractTreeDrawing::operator=(), and bpp::AbstractTreeDrawing::setXUnit().
|
privateinherited |
Definition at line 121 of file AbstractTreeDrawing.h.
Referenced by bpp::AbstractTreeDrawing::getYUnit(), bpp::AbstractTreeDrawing::operator=(), and bpp::AbstractTreeDrawing::setYUnit().