bpp-phyl3  3.0.0
TreeDrawingListener.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_TREEDRAWINGLISTENER_H
6 #define BPP_PHYL_GRAPHICS_TREEDRAWINGLISTENER_H
7 
8 #include <Bpp/Clonable.h>
9 
10 #include "TreeDrawing.h"
11 
12 namespace bpp
13 {
21  public virtual Clonable
22 {
23 public:
24  TreeDrawingListener* clone() const = 0;
25 
26  virtual void beforeDrawTree(const DrawTreeEvent& event) = 0;
27  virtual void afterDrawTree(const DrawTreeEvent& event) = 0;
28  virtual void beforeDrawNode(const DrawNodeEvent& event) = 0;
29  virtual void afterDrawNode(const DrawNodeEvent& event) = 0;
30  virtual void beforeDrawBranch(const DrawBranchEvent& event) = 0;
31  virtual void afterDrawBranch(const DrawBranchEvent& event) = 0;
32 
37  virtual bool isAutonomous() const = 0;
38 
39  virtual bool isEnabled() const = 0;
40  virtual void enable(bool tf) = 0;
41 };
42 
43 
48  public virtual TreeDrawingListener
49 {
50 private:
52  bool enabled_;
53 
54 public:
55  TreeDrawingListenerAdapter(bool autonomous) : autonomous_(autonomous), enabled_(true) {}
56 
57 public:
58  void beforeDrawTree(const DrawTreeEvent& event) {}
59  void afterDrawTree(const DrawTreeEvent& event) {}
60  void beforeDrawNode(const DrawNodeEvent& event) {}
61  void afterDrawNode(const DrawNodeEvent& event) {}
62  void beforeDrawBranch(const DrawBranchEvent& event) {}
63  void afterDrawBranch(const DrawBranchEvent& event) {}
64  bool isAutonomous() const { return autonomous_; }
65  bool isEnabled() const { return enabled_; }
66  void enable(bool tf) { enabled_ = tf; }
67 };
68 
69 
75 {
76 private:
78 
79 public:
80  NodesIdTreeDrawingListener(const TreeDrawingSettings* settings, bool autonomous = false) :
81  TreeDrawingListenerAdapter(autonomous),
82  settings_(settings)
83  {}
84 
87  settings_(lntdl.settings_) {}
88 
90  {
91  TreeDrawingListenerAdapter::operator=(lntdl);
92  settings_ = lntdl.settings_;
93  return *this;
94  }
95 
97 
98 public:
99  void afterDrawNode(const DrawNodeEvent& event);
100 };
101 
102 
108 {
109 private:
111 
112 public:
113  LeafNamesTreeDrawingListener(const TreeDrawingSettings* settings, bool autonomous = false) :
114  TreeDrawingListenerAdapter(autonomous),
115  settings_(settings)
116  {}
117 
120  settings_(lntdl.settings_)
121  {}
122 
124  {
125  TreeDrawingListenerAdapter::operator=(lntdl);
126  settings_ = lntdl.settings_;
127  return *this;
128  }
129 
131 
132 public:
133  void afterDrawNode(const DrawNodeEvent& event);
134 };
135 
136 
146 {
147 private:
149 
150 public:
151  BranchLengthsTreeDrawingListener(const TreeDrawingSettings* settings, bool autonomous = false) :
152  TreeDrawingListenerAdapter(autonomous),
153  settings_(settings)
154  {}
155 
158  settings_(lntdl.settings_)
159  {}
160 
162  {
163  TreeDrawingListenerAdapter::operator=(lntdl);
164  settings_ = lntdl.settings_;
165  return *this;
166  }
167 
169 
170 public:
171  void afterDrawBranch(const DrawBranchEvent& event);
172 };
173 
174 
184 {
185 private:
187 
188 public:
189  BootstrapValuesTreeDrawingListener(const TreeDrawingSettings* settings, bool autonomous = false) :
190  TreeDrawingListenerAdapter(autonomous),
191  settings_(settings)
192  {}
193 
196  settings_(lntdl.settings_) {}
197 
199  {
200  TreeDrawingListenerAdapter::operator=(lntdl);
201  settings_ = lntdl.settings_;
202  return *this;
203  }
204 
206 
207 public:
208  void afterDrawBranch(const DrawBranchEvent& event);
209 };
210 
211 
221 {
222 public:
223  LabelInnerNodesTreeDrawingListener(bool autonomous = false) :
224  TreeDrawingListenerAdapter(autonomous) {}
225 
227 
228 public:
229  void afterDrawNode(const DrawNodeEvent& event);
230 };
231 
232 
240 {
241 public:
242  LabelCollapsedNodesTreeDrawingListener(bool autonomous = false) :
243  TreeDrawingListenerAdapter(autonomous) {}
244 
246 
247 public:
248  void afterDrawNode(const DrawNodeEvent& event);
249 };
250 } // end of namespace bpp
251 #endif // BPP_PHYL_GRAPHICS_TREEDRAWINGLISTENER_H
A TreeDrawingListener implementation that write the bootstrap values of inner nodes.
BootstrapValuesTreeDrawingListener(const BootstrapValuesTreeDrawingListener &lntdl)
BootstrapValuesTreeDrawingListener & operator=(const BootstrapValuesTreeDrawingListener &lntdl)
BootstrapValuesTreeDrawingListener(const TreeDrawingSettings *settings, bool autonomous=false)
BootstrapValuesTreeDrawingListener * clone() const
void afterDrawBranch(const DrawBranchEvent &event)
A TreeDrawingListener implementation that write the branch lengths of inner nodes.
BranchLengthsTreeDrawingListener(const BranchLengthsTreeDrawingListener &lntdl)
BranchLengthsTreeDrawingListener(const TreeDrawingSettings *settings, bool autonomous=false)
void afterDrawBranch(const DrawBranchEvent &event)
BranchLengthsTreeDrawingListener * clone() const
BranchLengthsTreeDrawingListener & operator=(const BranchLengthsTreeDrawingListener &lntdl)
const TreeDrawingSettings * settings_
Event class used by TreeDrawing classes.
Definition: TreeDrawing.h:127
Event class used by TreeDrawing classes.
Definition: TreeDrawing.h:88
Event class used by TreeDrawing classes.
Definition: TreeDrawing.h:171
A TreeDrawingListener implementation that label the collapsed nodes.
LabelCollapsedNodesTreeDrawingListener(bool autonomous=false)
LabelCollapsedNodesTreeDrawingListener * clone() const
void afterDrawNode(const DrawNodeEvent &event)
A TreeDrawingListener implementation that write the names of inner nodes.
void afterDrawNode(const DrawNodeEvent &event)
LabelInnerNodesTreeDrawingListener * clone() const
LabelInnerNodesTreeDrawingListener(bool autonomous=false)
A TreeDrawingListener implementation that write leaf names.
LeafNamesTreeDrawingListener * clone() const
LeafNamesTreeDrawingListener & operator=(const LeafNamesTreeDrawingListener &lntdl)
void afterDrawNode(const DrawNodeEvent &event)
const TreeDrawingSettings * settings_
LeafNamesTreeDrawingListener(const TreeDrawingSettings *settings, bool autonomous=false)
LeafNamesTreeDrawingListener(const LeafNamesTreeDrawingListener &lntdl)
A TreeDrawingListener implementation that writes nodes id.
NodesIdTreeDrawingListener & operator=(const NodesIdTreeDrawingListener &lntdl)
NodesIdTreeDrawingListener(const NodesIdTreeDrawingListener &lntdl)
void afterDrawNode(const DrawNodeEvent &event)
NodesIdTreeDrawingListener * clone() const
const TreeDrawingSettings * settings_
NodesIdTreeDrawingListener(const TreeDrawingSettings *settings, bool autonomous=false)
An empty implementation of the TreeDrawingListener interface.
void beforeDrawTree(const DrawTreeEvent &event)
bool isAutonomous() const
Tells if the listener is autonomous. If so, it will never be hard-copied or deleted.
void afterDrawBranch(const DrawBranchEvent &event)
void afterDrawNode(const DrawNodeEvent &event)
void beforeDrawNode(const DrawNodeEvent &event)
void beforeDrawBranch(const DrawBranchEvent &event)
void afterDrawTree(const DrawTreeEvent &event)
Interface allowing to capture drawing events.
virtual bool isEnabled() const =0
TreeDrawingListener * clone() const =0
virtual void afterDrawBranch(const DrawBranchEvent &event)=0
virtual void beforeDrawTree(const DrawTreeEvent &event)=0
virtual void afterDrawTree(const DrawTreeEvent &event)=0
virtual void beforeDrawNode(const DrawNodeEvent &event)=0
virtual bool isAutonomous() const =0
Tells if the listener is autonomous. If so, it will never be hard-copied or deleted.
virtual void beforeDrawBranch(const DrawBranchEvent &event)=0
virtual void afterDrawNode(const DrawNodeEvent &event)=0
virtual void enable(bool tf)=0
A set of options to tune the display of a TreeDrawing object.
Definition: TreeDrawing.h:27
Defines the basic types of data flow nodes.