|
bpp-phyl3 3.0.0
|
Phylogram representation of trees. More...
#include <Bpp/Phyl/Graphics/PhylogramPlot.h>
Inheritance diagram for bpp::PhylogramPlot:
Collaboration diagram for bpp::PhylogramPlot:Public Member Functions | |
| PhylogramPlot () | |
| virtual | ~PhylogramPlot () |
| PhylogramPlot * | clone () const override |
| std::string | getName () const override |
| void | setTree (const Tree &tree) override |
| double | getWidth () const override |
| double | getHeight () const override |
| void | treeHasChanged () override |
| Method to implement to deal with redrawing when the underlying tree has been modified. More... | |
| 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 override |
| const Tree & | tree () const override |
| const TreeTemplate< INode > & | treeTemplate () const |
| Point2D< double > | getNodePosition (int nodeId) const override |
| Get the position of a node. More... | |
| int | getNodeAt (const Point2D< double > &position) const override |
| 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 (std::shared_ptr< const TreeDrawingSettings > tds) override |
| Global drawing settings. More... | |
| const TreeDrawingSettings & | displaySettings () const override |
| double | getXUnit () const override |
| double | getYUnit () const override |
| void | setXUnit (double xu) override |
| Set the 'horizontal' expansion unit. More... | |
| void | setYUnit (double yu) override |
| Set the 'vertical' expansion unit. More... | |
| void | collapseNode (int nodeId, bool yn) override |
| Properties to draw. More... | |
| bool | isNodeCollapsed (int nodeId) const override |
| void | addTreeDrawingListener (TreeDrawingListener *listener) override |
| Add a drawing listener to this instance. More... | |
| void | removeTreeDrawingListener (TreeDrawingListener *listener) override |
| Remove a drawing listener from this instance. More... | |
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 std::shared_ptr< const TreeDrawingSettings > | DEFAULT_SETTINGS = std::make_shared<const TreeDrawingSettings>() |
Protected Member Functions | |
| 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 |
Protected Attributes | |
| std::unique_ptr< TreeTemplate< INode > > | tree_ |
| double | xUnit_ |
| double | yUnit_ |
| std::shared_ptr< const TreeDrawingSettings > | settings_ |
| std::vector< TreeDrawingListener * > | listeners_ |
Private Member Functions | |
| void | drawDendrogram_ (GraphicDevice &gDevice) const override |
| void | recursivePlot_ (GraphicDevice &gDevice, INode &node, double x, double &y, double hDirection, double vDirection, unsigned int &tipCounter) const |
Private Attributes | |
| double | totalDepth_ |
| double | numberOfLeaves_ |
| short | horOrientation_ |
| short | verOrientation_ |
Phylogram representation of trees.
This representation is for trees with branch lengths.
Definition at line 32 of file PhylogramPlot.h.
|
inline |
Definition at line 40 of file PhylogramPlot.h.
Referenced by clone().
|
inlinevirtual |
Definition at line 44 of file PhylogramPlot.h.
|
inlineoverridevirtualinherited |
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 281 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(), bpp::Point2D< class >::getY(), and bpp::AbstractTreeDrawing::settings_.
Referenced by bpp::AbstractTreeDrawing::getNodeAt().
|
inlineoverridevirtual |
Implements bpp::TreeDrawing.
Definition at line 46 of file PhylogramPlot.h.
References PhylogramPlot().
|
inlineoverridevirtualinherited |
Properties to draw.
Collapsing nodes
Implements bpp::TreeDrawing.
Definition at line 269 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::tree_.
|
inlineoverridevirtualinherited |
Implements bpp::TreeDrawing.
Definition at line 259 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::settings_.
Referenced by bpp::AbstractDendrogramPlot::plot().
|
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(), bpp::Node::hasFather(), bpp::AbstractTreeDrawing::xUnit_, and bpp::AbstractTreeDrawing::yUnit_.
|
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(), bpp::NodeTemplate< NodeInfos >::getInfos(), bpp::AbstractTreeDrawing::xUnit_, and bpp::AbstractTreeDrawing::yUnit_.
|
overrideprivatevirtual |
Implements bpp::AbstractDendrogramPlot.
Definition at line 37 of file PhylogramPlot.cpp.
References bpp::AbstractTreeDrawing::fireAfterTreeEvent_(), bpp::AbstractTreeDrawing::fireBeforeTreeEvent_(), bpp::AbstractDendrogramPlot::getHorizontalOrientation(), bpp::AbstractDendrogramPlot::getVerticalOrientation(), getWidth(), bpp::AbstractTreeDrawing::getXUnit(), bpp::AbstractTreeDrawing::hasTree(), bpp::AbstractDendrogramPlot::ORIENTATION_LEFT_TO_RIGHT, bpp::AbstractDendrogramPlot::ORIENTATION_TOP_TO_BOTTOM, recursivePlot_(), and bpp::AbstractTreeDrawing::tree_.
|
inlineprotectedinherited |
Definition at line 349 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::listeners_.
Referenced by bpp::CladogramPlot::recursivePlot_(), and recursivePlot_().
|
inlineprotectedinherited |
Definition at line 331 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::listeners_.
Referenced by bpp::CladogramPlot::recursivePlot_(), and recursivePlot_().
|
inlineprotectedinherited |
Definition at line 313 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::listeners_.
Referenced by bpp::CladogramPlot::drawDendrogram_(), and drawDendrogram_().
|
inlineprotectedinherited |
Definition at line 340 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::listeners_.
Referenced by bpp::CladogramPlot::recursivePlot_(), and recursivePlot_().
|
inlineprotectedinherited |
Definition at line 322 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::listeners_.
Referenced by bpp::CladogramPlot::recursivePlot_(), and recursivePlot_().
|
inlineprotectedinherited |
Definition at line 304 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::listeners_.
Referenced by bpp::CladogramPlot::drawDendrogram_(), and drawDendrogram_().
|
inlineoverridevirtual |
Implements bpp::TreeDrawing.
Definition at line 54 of file PhylogramPlot.h.
References numberOfLeaves_.
Referenced by recursivePlot_().
|
inlineinherited |
Definition at line 37 of file AbstractDendrogramPlot.h.
References bpp::AbstractDendrogramPlot::horOrientation_.
Referenced by bpp::CladogramPlot::drawDendrogram_(), drawDendrogram_(), bpp::CladogramPlot::recursivePlot_(), and recursivePlot_().
|
inlineoverridevirtual |
Implements bpp::TreeDrawing.
Definition at line 49 of file PhylogramPlot.h.
|
overridevirtualinherited |
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.
References bpp::AbstractTreeDrawing::belongsTo(), and bpp::AbstractTreeDrawing::tree_.
|
overridevirtualinherited |
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(), and bpp::AbstractTreeDrawing::tree_.
|
inlineinherited |
Definition at line 38 of file AbstractDendrogramPlot.h.
References bpp::AbstractDendrogramPlot::verOrientation_.
Referenced by bpp::CladogramPlot::drawDendrogram_(), drawDendrogram_(), bpp::CladogramPlot::recursivePlot_(), and recursivePlot_().
|
inlineoverridevirtual |
Implements bpp::TreeDrawing.
Definition at line 53 of file PhylogramPlot.h.
References totalDepth_.
Referenced by drawDendrogram_().
|
inlineoverridevirtualinherited |
Implements bpp::TreeDrawing.
Definition at line 261 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::xUnit_.
Referenced by bpp::CladogramPlot::drawDendrogram_(), drawDendrogram_(), bpp::CladogramPlot::recursivePlot_(), and recursivePlot_().
|
inlineoverridevirtualinherited |
Implements bpp::TreeDrawing.
Definition at line 263 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::yUnit_.
Referenced by bpp::CladogramPlot::recursivePlot_(), and recursivePlot_().
|
inlineoverridevirtualinherited |
Implements bpp::TreeDrawing.
Definition at line 172 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::tree_.
Referenced by bpp::CladogramPlot::drawDendrogram_(), drawDendrogram_(), bpp::CladogramPlot::setTree(), bpp::AbstractTreeDrawing::tree(), bpp::CladogramPlot::treeHasChanged(), treeHasChanged(), and bpp::AbstractTreeDrawing::treeTemplate().
|
inlineoverridevirtualinherited |
Implements bpp::TreeDrawing.
Definition at line 275 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::tree_.
|
virtualinherited |
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::AbstractTreeDrawing::displaySettings(), bpp::AbstractDendrogramPlot::drawDendrogram_(), and bpp::GraphicDevice::setCurrentPointSize().
|
private |
Definition at line 55 of file PhylogramPlot.cpp.
References bpp::GraphicDevice::drawLine(), bpp::AbstractTreeDrawing::fireAfterBranchEvent_(), bpp::AbstractTreeDrawing::fireAfterNodeEvent_(), bpp::AbstractTreeDrawing::fireBeforeBranchEvent_(), bpp::AbstractTreeDrawing::fireBeforeNodeEvent_(), bpp::Node::getDistanceToFather(), getHeight(), bpp::AbstractDendrogramPlot::getHorizontalOrientation(), bpp::NodeTemplate< NodeInfos >::getInfos(), bpp::Node::getNumberOfSons(), bpp::NodeTemplate< NodeInfos >::getSon(), bpp::AbstractDendrogramPlot::getVerticalOrientation(), bpp::AbstractTreeDrawing::getXUnit(), bpp::AbstractTreeDrawing::getYUnit(), bpp::Node::hasDistanceToFather(), bpp::Node::isLeaf(), bpp::AbstractDendrogramPlot::ORIENTATION_LEFT_TO_RIGHT, bpp::AbstractDendrogramPlot::ORIENTATION_TOP_TO_BOTTOM, recursivePlot_(), bpp::GraphicDevice::TEXT_HORIZONTAL_LEFT, and bpp::GraphicDevice::TEXT_HORIZONTAL_RIGHT.
Referenced by drawDendrogram_(), and recursivePlot_().
|
inlineoverridevirtualinherited |
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 288 of file AbstractTreeDrawing.h.
References bpp::TreeDrawingListener::isAutonomous(), and bpp::AbstractTreeDrawing::listeners_.
|
inlineoverridevirtualinherited |
Global drawing settings.
Implements bpp::TreeDrawing.
Definition at line 253 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::settings_.
|
inlineinherited |
Definition at line 34 of file AbstractDendrogramPlot.h.
References bpp::AbstractDendrogramPlot::horOrientation_.
|
overridevirtual |
| tree | A tree to associate with this drawing. The object will be copied. |
Reimplemented from bpp::AbstractTreeDrawing.
Definition at line 31 of file PhylogramPlot.cpp.
References bpp::AbstractTreeDrawing::setTree(), bpp::AbstractTreeDrawing::tree(), and bpp::AbstractTreeDrawing::tree_.
|
inlineinherited |
Definition at line 35 of file AbstractDendrogramPlot.h.
References bpp::AbstractDendrogramPlot::verOrientation_.
|
inlineoverridevirtualinherited |
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 265 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::xUnit_.
|
inlineoverridevirtualinherited |
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 267 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::yUnit_.
|
inlineoverridevirtualinherited |
Implements bpp::TreeDrawing.
Definition at line 178 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::hasTree(), and bpp::AbstractTreeDrawing::tree_.
Referenced by bpp::AbstractTreeDrawing::setTree(), bpp::CladogramPlot::setTree(), and setTree().
|
inlineoverridevirtual |
Method to implement to deal with redrawing when the underlying tree has been modified.
Implements bpp::AbstractTreeDrawing.
Definition at line 56 of file PhylogramPlot.h.
References bpp::TreeTemplateTools::getHeight(), bpp::AbstractTreeDrawing::hasTree(), numberOfLeaves_, totalDepth_, and bpp::AbstractTreeDrawing::tree_.
|
inlineinherited |
Definition at line 190 of file AbstractTreeDrawing.h.
References bpp::AbstractTreeDrawing::hasTree(), and bpp::AbstractTreeDrawing::tree_.
|
staticinherited |
Definition at line 359 of file AbstractTreeDrawing.h.
|
privateinherited |
Definition at line 25 of file AbstractDendrogramPlot.h.
Referenced by bpp::AbstractDendrogramPlot::getHorizontalOrientation(), and bpp::AbstractDendrogramPlot::setHorizontalOrientation().
|
protectedinherited |
Definition at line 122 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().
|
private |
Definition at line 37 of file PhylogramPlot.h.
Referenced by getHeight(), and treeHasChanged().
|
staticinherited |
Definition at line 49 of file AbstractDendrogramPlot.h.
|
staticinherited |
Definition at line 46 of file AbstractDendrogramPlot.h.
Referenced by bpp::CladogramDrawBranchEvent::CladogramDrawBranchEvent(), bpp::CladogramPlot::drawDendrogram_(), drawDendrogram_(), bpp::PhylogramDrawBranchEvent::PhylogramDrawBranchEvent(), bpp::CladogramPlot::recursivePlot_(), and recursivePlot_().
|
staticinherited |
Definition at line 47 of file AbstractDendrogramPlot.h.
|
staticinherited |
Definition at line 48 of file AbstractDendrogramPlot.h.
Referenced by bpp::CladogramPlot::drawDendrogram_(), drawDendrogram_(), bpp::CladogramPlot::recursivePlot_(), and recursivePlot_().
|
protectedinherited |
Definition at line 121 of file AbstractTreeDrawing.h.
Referenced by bpp::AbstractTreeDrawing::belongsTo(), bpp::AbstractTreeDrawing::displaySettings(), bpp::AbstractTreeDrawing::operator=(), and bpp::AbstractTreeDrawing::setDisplaySettings().
|
private |
Definition at line 36 of file PhylogramPlot.h.
Referenced by getWidth(), and treeHasChanged().
|
protectedinherited |
Definition at line 118 of file AbstractTreeDrawing.h.
Referenced by bpp::AbstractTreeDrawing::collapseNode(), bpp::CladogramPlot::drawDendrogram_(), drawDendrogram_(), bpp::AbstractTreeDrawing::getNodeAt(), bpp::AbstractTreeDrawing::getNodePosition(), bpp::AbstractTreeDrawing::hasTree(), bpp::AbstractTreeDrawing::isNodeCollapsed(), bpp::AbstractTreeDrawing::operator=(), bpp::AbstractTreeDrawing::setTree(), bpp::CladogramPlot::setTree(), setTree(), bpp::AbstractTreeDrawing::tree(), bpp::CladogramPlot::treeHasChanged(), treeHasChanged(), and bpp::AbstractTreeDrawing::treeTemplate().
|
privateinherited |
Definition at line 26 of file AbstractDendrogramPlot.h.
Referenced by bpp::AbstractDendrogramPlot::getVerticalOrientation(), and bpp::AbstractDendrogramPlot::setVerticalOrientation().
|
protectedinherited |
Definition at line 119 of file AbstractTreeDrawing.h.
Referenced by bpp::AbstractTreeDrawing::drawAtBranch(), bpp::AbstractTreeDrawing::drawAtNode(), bpp::AbstractTreeDrawing::getXUnit(), bpp::AbstractTreeDrawing::operator=(), and bpp::AbstractTreeDrawing::setXUnit().
|
protectedinherited |
Definition at line 120 of file AbstractTreeDrawing.h.
Referenced by bpp::AbstractTreeDrawing::drawAtBranch(), bpp::AbstractTreeDrawing::drawAtNode(), bpp::AbstractTreeDrawing::getYUnit(), bpp::AbstractTreeDrawing::operator=(), and bpp::AbstractTreeDrawing::setYUnit().