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 
11 namespace bpp
12 {
14  public DrawIBranchEvent
15 {
16 private:
17  double orientation_;
18 
19 public:
20  PhylogramDrawBranchEvent(const TreeDrawing* source, GraphicDevice* gd, const INode* node, const Cursor& cursor, short orientation);
21 
22 public:
23  Cursor getBranchCursor(double position) const;
24 };
25 
26 
34 {
35 private:
36  double totalDepth_;
38 
39 public:
42  {}
43 
44  virtual ~PhylogramPlot() {}
45 
46  PhylogramPlot* clone() const { return new PhylogramPlot(*this); }
47 
48 public:
49  std::string getName() const { return "Phylogram"; }
50 
51  void setTree(const Tree* tree = 0);
52 
53  double getWidth() const { return totalDepth_; }
54  double getHeight() const { return numberOfLeaves_; }
55 
57  {
58  if (hasTree())
59  {
60  getTree_()->setVoidBranchLengths(0.);
62  numberOfLeaves_ = static_cast<double>(getTree_()->getNumberOfLeaves());
63  }
64  }
65 
66 private:
67  void drawDendrogram_(GraphicDevice& gDevice) const;
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.
TreeTemplate< INode > * getTree_()
Data structure describing a plotting direction.
Definition: TreeDrawing.h:53
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
virtual ~PhylogramPlot()
Definition: PhylogramPlot.h:44
void treeHasChanged()
Method to implement to deal with redrawing when the underlying tree has been modified.
Definition: PhylogramPlot.h:56
void recursivePlot_(GraphicDevice &gDevice, INode &node, double x, double &y, double hDirection, double vDirection, unsigned int &tipCounter) const
double getHeight() const
Definition: PhylogramPlot.h:54
void drawDendrogram_(GraphicDevice &gDevice) const
PhylogramPlot * clone() const
Definition: PhylogramPlot.h:46
void setTree(const Tree *tree=0)
std::string getName() const
Definition: PhylogramPlot.h:49
double getWidth() const
Definition: PhylogramPlot.h:53
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.