bpp-phyl  2.2.0
PhylogramPlot.h
Go to the documentation of this file.
1 //
2 // File: PhylogramPlot.h
3 // Created by: Julien Dutheil
4 // Created on: Tue Oct 3 20:52 2006
5 //
6 
7 /*
8 Copyright or © or Copr. CNRS, (November 16, 2004)
9 
10 This software is a computer program whose purpose is to provide
11 graphic components to develop bioinformatics applications.
12 
13 This software is governed by the CeCILL license under French law and
14 abiding by the rules of distribution of free software. You can use,
15 modify and/ or redistribute the software under the terms of the CeCILL
16 license as circulated by CEA, CNRS and INRIA at the following URL
17 "http://www.cecill.info".
18 
19 As a counterpart to the access to the source code and rights to copy,
20 modify and redistribute granted by the license, users are provided only
21 with a limited warranty and the software's author, the holder of the
22 economic rights, and the successive licensors have only limited
23 liability.
24 
25 In this respect, the user's attention is drawn to the risks associated
26 with loading, using, modifying and/or developing or reproducing the
27 software by the user in light of its specific status of free software,
28 that may mean that it is complicated to manipulate, and that also
29 therefore means that it is reserved for developers and experienced
30 professionals having in-depth computer knowledge. Users are therefore
31 encouraged to load and test the software's suitability as regards their
32 requirements in conditions enabling the security of their systems and/or
33 data to be ensured and, more generally, to use and operate it in the
34 same conditions as regards security.
35 
36 The fact that you are presently reading this means that you have had
37 knowledge of the CeCILL license and that you accept its terms.
38 */
39 
40 #ifndef _PHYLOGRAMPLOT_H_
41 #define _PHYLOGRAMPLOT_H_
42 
43 #include "AbstractDendrogramPlot.h"
44 
45 namespace bpp
46 {
47 
49  public DrawIBranchEvent
50 {
51  private:
52  double orientation_;
53 
54  public:
55  PhylogramDrawBranchEvent(const TreeDrawing* source, GraphicDevice* gd, const INode* node, const Cursor& cursor, short orientation);
56 
57  public:
58  Cursor getBranchCursor(double position) const;
59 
60 };
61 
62 
63 
71 {
72  private:
73  double totalDepth_;
75 
76  public:
79  {}
80 
81  virtual ~PhylogramPlot() {}
82 
83  PhylogramPlot* clone() const { return new PhylogramPlot(*this); }
84 
85  public:
86  std::string getName() const { return "Phylogram"; }
87 
88  void setTree(const Tree* tree = 0);
89 
90  double getWidth() const { return totalDepth_; }
91  double getHeight() const { return numberOfLeaves_; }
92 
94  {
95  if (hasTree())
96  {
97  getTree_()->setVoidBranchLengths(0.);
99  numberOfLeaves_ = static_cast<double>(getTree_()->getNumberOfLeaves());
100  }
101  }
102 
103  private:
104  void drawDendrogram_(GraphicDevice& gDevice) const throw (Exception);
105 
106  void recursivePlot_(GraphicDevice& gDevice, INode& node, double x, double& y, double hDirection, double vDirection, unsigned int* tipCounter) const;
107 
108 };
109 
110 } //end of namespace bpp.
111 
112 #endif //_PHYLOGRAMPLOT_H_
113 
Basal interface for tree drawing classes.
Definition: TreeDrawing.h:264
double getHeight() const
Definition: PhylogramPlot.h:91
std::string getName() const
Definition: PhylogramPlot.h:86
Cursor getBranchCursor(double position) const
PhylogramPlot * clone() const
Definition: PhylogramPlot.h:83
Basic implementation of dendrogram plots.
PhylogramDrawBranchEvent(const TreeDrawing *source, GraphicDevice *gd, const INode *node, const Cursor &cursor, short orientation)
double getWidth() const
Definition: PhylogramPlot.h:90
Interface for phylogenetic tree objects.
Definition: Tree.h:148
void recursivePlot_(GraphicDevice &gDevice, INode &node, double x, double &y, double hDirection, double vDirection, unsigned int *tipCounter) const
void treeHasChanged()
Method to implement to deal with redrawing when the underlying tree has been modified.
Definition: PhylogramPlot.h:93
static double getHeight(const Node &node)
Get the height of the subtree defined by node &#39;node&#39;, i.e. the maximum distance between leaves and th...
Event class that uses INode object (more efficient than relying on nodes id, but less generic)...
virtual ~PhylogramPlot()
Definition: PhylogramPlot.h:81
Phylogram representation of trees.
Definition: PhylogramPlot.h:69
TreeTemplate< INode > * getTree_()
void setTree(const Tree *tree=0)
void drawDendrogram_(GraphicDevice &gDevice) const
The NodeTemplate class.
Definition: NodeTemplate.h:73
Data structure describing a plotting direction.
Definition: TreeDrawing.h:87