|
bpp-phyl3 3.0.0
|
Partial implementation of the TreeDrawing interface. More...
#include <Bpp/Phyl/Graphics/AbstractTreeDrawing.h>
Inheritance diagram for bpp::AbstractTreeDrawing:
Collaboration diagram for bpp::AbstractTreeDrawing:Public Member Functions | |
| AbstractTreeDrawing () | |
| AbstractTreeDrawing (const AbstractTreeDrawing &atd) | |
| AbstractTreeDrawing & | operator= (const AbstractTreeDrawing &atd) |
| virtual | ~AbstractTreeDrawing () |
| bool | hasTree () const override |
| const Tree & | tree () const override |
| const TreeTemplate< INode > & | treeTemplate () const |
| void | setTree (const Tree &tree) override |
| 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... | |
| 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 |
| virtual void | plot (GraphicDevice &gDevice) const =0 |
| Plot the tree onto the specified device. More... | |
Static Public Attributes | |
| 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_ |
Partial implementation of the TreeDrawing interface.
This basic implementation uses a dedicated NodeInfo structure in combination with the NodeTemplate class. This structures stores the current coordinates of all nodes, so that it is easy to annotate the tree drawing.
Definition at line 114 of file AbstractTreeDrawing.h.
|
inline |
Definition at line 125 of file AbstractTreeDrawing.h.
|
inline |
Definition at line 127 of file AbstractTreeDrawing.h.
References listeners_.
|
inlinevirtual |
Definition at line 162 of file AbstractTreeDrawing.h.
References listeners_.
|
inlineoverridevirtual |
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 listeners_.
| bool AbstractTreeDrawing::belongsTo | ( | const Point2D< double > & | p1, |
| const Point2D< double > & | p2 | ||
| ) | const |
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 settings_.
Referenced by getNodeAt().
|
pure virtualinherited |
Implements bpp::Clonable.
Implemented in bpp::CladogramPlot, and bpp::PhylogramPlot.
|
inlineoverridevirtual |
Properties to draw.
Collapsing nodes
Implements bpp::TreeDrawing.
Definition at line 269 of file AbstractTreeDrawing.h.
References tree_.
|
inlineoverridevirtual |
Implements bpp::TreeDrawing.
Definition at line 259 of file AbstractTreeDrawing.h.
References settings_.
Referenced by bpp::AbstractDendrogramPlot::plot().
|
virtual |
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(), xUnit_, and yUnit_.
|
virtual |
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(), xUnit_, and yUnit_.
|
inlineprotected |
Definition at line 349 of file AbstractTreeDrawing.h.
References listeners_.
Referenced by bpp::CladogramPlot::recursivePlot_(), and bpp::PhylogramPlot::recursivePlot_().
|
inlineprotected |
Definition at line 331 of file AbstractTreeDrawing.h.
References listeners_.
Referenced by bpp::CladogramPlot::recursivePlot_(), and bpp::PhylogramPlot::recursivePlot_().
|
inlineprotected |
Definition at line 313 of file AbstractTreeDrawing.h.
References listeners_.
Referenced by bpp::CladogramPlot::drawDendrogram_(), and bpp::PhylogramPlot::drawDendrogram_().
|
inlineprotected |
Definition at line 340 of file AbstractTreeDrawing.h.
References listeners_.
Referenced by bpp::CladogramPlot::recursivePlot_(), and bpp::PhylogramPlot::recursivePlot_().
|
inlineprotected |
Definition at line 322 of file AbstractTreeDrawing.h.
References listeners_.
Referenced by bpp::CladogramPlot::recursivePlot_(), and bpp::PhylogramPlot::recursivePlot_().
|
inlineprotected |
Definition at line 304 of file AbstractTreeDrawing.h.
References listeners_.
Referenced by bpp::CladogramPlot::drawDendrogram_(), and bpp::PhylogramPlot::drawDendrogram_().
|
pure virtualinherited |
Implemented in bpp::CladogramPlot, and bpp::PhylogramPlot.
|
pure virtualinherited |
Implemented in bpp::CladogramPlot, and bpp::PhylogramPlot.
|
overridevirtual |
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 belongsTo(), and tree_.
|
overridevirtual |
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 tree_.
|
pure virtualinherited |
Implemented in bpp::CladogramPlot, and bpp::PhylogramPlot.
|
inlineoverridevirtual |
Implements bpp::TreeDrawing.
Definition at line 261 of file AbstractTreeDrawing.h.
References xUnit_.
Referenced by bpp::CladogramPlot::drawDendrogram_(), bpp::PhylogramPlot::drawDendrogram_(), bpp::CladogramPlot::recursivePlot_(), and bpp::PhylogramPlot::recursivePlot_().
|
inlineoverridevirtual |
Implements bpp::TreeDrawing.
Definition at line 263 of file AbstractTreeDrawing.h.
References yUnit_.
Referenced by bpp::CladogramPlot::recursivePlot_(), and bpp::PhylogramPlot::recursivePlot_().
|
inlineoverridevirtual |
Implements bpp::TreeDrawing.
Definition at line 172 of file AbstractTreeDrawing.h.
References tree_.
Referenced by bpp::CladogramPlot::drawDendrogram_(), bpp::PhylogramPlot::drawDendrogram_(), bpp::CladogramPlot::setTree(), tree(), bpp::CladogramPlot::treeHasChanged(), bpp::PhylogramPlot::treeHasChanged(), and treeTemplate().
|
inlineoverridevirtual |
Implements bpp::TreeDrawing.
Definition at line 275 of file AbstractTreeDrawing.h.
References tree_.
|
inline |
Definition at line 143 of file AbstractTreeDrawing.h.
References listeners_, settings_, tree_, xUnit_, and yUnit_.
|
pure virtualinherited |
Plot the tree onto the specified device.
| gDevice | An object implementing the GraphicDevice interface. |
Implemented in bpp::AbstractDendrogramPlot.
|
inlineoverridevirtual |
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 listeners_.
|
inlineoverridevirtual |
Global drawing settings.
Implements bpp::TreeDrawing.
Definition at line 253 of file AbstractTreeDrawing.h.
References settings_.
|
inlineoverridevirtual |
| tree | A tree to associate with this drawing. The object will be copied. |
Implements bpp::TreeDrawing.
Reimplemented in bpp::CladogramPlot, and bpp::PhylogramPlot.
Definition at line 202 of file AbstractTreeDrawing.h.
References tree(), tree_, and treeHasChanged().
Referenced by bpp::CladogramPlot::setTree(), and bpp::PhylogramPlot::setTree().
|
inlineoverridevirtual |
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 xUnit_.
|
inlineoverridevirtual |
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 yUnit_.
|
inlineoverridevirtual |
Implements bpp::TreeDrawing.
Definition at line 178 of file AbstractTreeDrawing.h.
References hasTree(), and tree_.
Referenced by setTree(), bpp::CladogramPlot::setTree(), and bpp::PhylogramPlot::setTree().
|
pure virtual |
Method to implement to deal with redrawing when the underlying tree has been modified.
Implemented in bpp::CladogramPlot, and bpp::PhylogramPlot.
Referenced by setTree().
|
inline |
Definition at line 190 of file AbstractTreeDrawing.h.
|
static |
Definition at line 359 of file AbstractTreeDrawing.h.
|
protected |
Definition at line 122 of file AbstractTreeDrawing.h.
Referenced by AbstractTreeDrawing(), addTreeDrawingListener(), fireAfterBranchEvent_(), fireAfterNodeEvent_(), fireAfterTreeEvent_(), fireBeforeBranchEvent_(), fireBeforeNodeEvent_(), fireBeforeTreeEvent_(), operator=(), removeTreeDrawingListener(), and ~AbstractTreeDrawing().
|
protected |
Definition at line 121 of file AbstractTreeDrawing.h.
Referenced by belongsTo(), displaySettings(), operator=(), and setDisplaySettings().
|
protected |
Definition at line 118 of file AbstractTreeDrawing.h.
Referenced by collapseNode(), bpp::CladogramPlot::drawDendrogram_(), bpp::PhylogramPlot::drawDendrogram_(), getNodeAt(), getNodePosition(), hasTree(), isNodeCollapsed(), operator=(), setTree(), bpp::CladogramPlot::setTree(), bpp::PhylogramPlot::setTree(), tree(), bpp::CladogramPlot::treeHasChanged(), bpp::PhylogramPlot::treeHasChanged(), and treeTemplate().
|
protected |
Definition at line 119 of file AbstractTreeDrawing.h.
Referenced by drawAtBranch(), drawAtNode(), getXUnit(), operator=(), and setXUnit().
|
protected |
Definition at line 120 of file AbstractTreeDrawing.h.
Referenced by drawAtBranch(), drawAtNode(), getYUnit(), operator=(), and setYUnit().