bpp-phyl3 3.0.0
PhylogramPlot.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: The Bio++ Development Group
2//
3// SPDX-License-Identifier: CECILL-2.1
4
5#ifndef BPP_PHYL_GRAPHICS_PHYLOGRAMPLOT_H
6#define BPP_PHYL_GRAPHICS_PHYLOGRAMPLOT_H
7
8
10
11namespace bpp
12{
14 public DrawIBranchEvent
15{
16private:
18
19public:
20 PhylogramDrawBranchEvent(const TreeDrawing* source, GraphicDevice* gd, const INode* node, const Cursor& cursor, short orientation);
21
22public:
23 Cursor getBranchCursor(double position) const;
24};
25
26
34{
35private:
38
39public:
42 {}
43
44 virtual ~PhylogramPlot() {}
45
46 PhylogramPlot* clone() const override { return new PhylogramPlot(*this); }
47
48public:
49 std::string getName() const override { return "Phylogram"; }
50
51 void setTree(const Tree& tree) override;
52
53 double getWidth() const override { return totalDepth_; }
54 double getHeight() const override { return numberOfLeaves_; }
55
56 void treeHasChanged() override
57 {
58 if (hasTree())
59 {
60 tree_->setVoidBranchLengths(0.);
62 numberOfLeaves_ = static_cast<double>(tree_->getNumberOfLeaves());
63 }
64 }
65
66private:
67 void drawDendrogram_(GraphicDevice& gDevice) const override;
68
69 void recursivePlot_(GraphicDevice& gDevice, INode& node, double x, double& y, double hDirection, double vDirection, unsigned int& tipCounter) const;
70};
71} // end of namespace bpp.
72#endif // BPP_PHYL_GRAPHICS_PHYLOGRAMPLOT_H
Basic implementation of dendrogram plots.
const Tree & tree() const override
std::unique_ptr< TreeTemplate< INode > > tree_
bool hasTree() const override
Data structure describing a plotting direction.
Definition: TreeDrawing.h:54
Event class that uses INode object (more efficient than relying on nodes id, but less generic).
The NodeTemplate class.
Definition: NodeTemplate.h:39
Cursor getBranchCursor(double position) const
PhylogramDrawBranchEvent(const TreeDrawing *source, GraphicDevice *gd, const INode *node, const Cursor &cursor, short orientation)
Phylogram representation of trees.
Definition: PhylogramPlot.h:34
void setTree(const Tree &tree) override
void treeHasChanged() override
Method to implement to deal with redrawing when the underlying tree has been modified.
Definition: PhylogramPlot.h:56
virtual ~PhylogramPlot()
Definition: PhylogramPlot.h:44
void recursivePlot_(GraphicDevice &gDevice, INode &node, double x, double &y, double hDirection, double vDirection, unsigned int &tipCounter) const
double getWidth() const override
Definition: PhylogramPlot.h:53
std::string getName() const override
Definition: PhylogramPlot.h:49
void drawDendrogram_(GraphicDevice &gDevice) const override
PhylogramPlot * clone() const override
Definition: PhylogramPlot.h:46
double getHeight() const override
Definition: PhylogramPlot.h:54
Basal interface for tree drawing classes.
Definition: TreeDrawing.h:223
static double getHeight(const Node &node)
Get the height of the subtree defined by node 'node', i.e. the maximum distance between leaves and th...
Interface for phylogenetic tree objects.
Definition: Tree.h:115
Defines the basic types of data flow nodes.