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
12namespace bpp
13{
21 public virtual Clonable
22{
23public:
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{
50private:
53
54public:
55 TreeDrawingListenerAdapter(bool autonomous) : autonomous_(autonomous), enabled_(true) {}
56
57public:
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{
76private:
78
79public:
80 NodesIdTreeDrawingListener(const TreeDrawingSettings* settings, bool autonomous = false) :
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
98public:
99 void afterDrawNode(const DrawNodeEvent& event);
100};
101
102
108{
109private:
111
112public:
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
132public:
133 void afterDrawNode(const DrawNodeEvent& event);
134};
135
136
146{
147private:
149
150public:
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
170public:
171 void afterDrawBranch(const DrawBranchEvent& event);
172};
173
174
184{
185private:
187
188public:
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
207public:
208 void afterDrawBranch(const DrawBranchEvent& event);
209};
210
211
221{
222public:
223 LabelInnerNodesTreeDrawingListener(bool autonomous = false) :
224 TreeDrawingListenerAdapter(autonomous) {}
225
227
228public:
229 void afterDrawNode(const DrawNodeEvent& event);
230};
231
232
240{
241public:
242 LabelCollapsedNodesTreeDrawingListener(bool autonomous = false) :
243 TreeDrawingListenerAdapter(autonomous) {}
244
246
247public:
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 * clone() const
BranchLengthsTreeDrawingListener(const BranchLengthsTreeDrawingListener &lntdl)
BranchLengthsTreeDrawingListener(const TreeDrawingSettings *settings, bool autonomous=false)
void afterDrawBranch(const DrawBranchEvent &event)
const TreeDrawingSettings * settings_
BranchLengthsTreeDrawingListener & operator=(const BranchLengthsTreeDrawingListener &lntdl)
Event class used by TreeDrawing classes.
Definition: TreeDrawing.h:128
Event class used by TreeDrawing classes.
Definition: TreeDrawing.h:89
Event class used by TreeDrawing classes.
Definition: TreeDrawing.h:172
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.
LabelInnerNodesTreeDrawingListener * clone() const
void afterDrawNode(const DrawNodeEvent &event)
LabelInnerNodesTreeDrawingListener(bool autonomous=false)
A TreeDrawingListener implementation that write leaf names.
LeafNamesTreeDrawingListener & operator=(const LeafNamesTreeDrawingListener &lntdl)
LeafNamesTreeDrawingListener * clone() const
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(const NodesIdTreeDrawingListener &lntdl)
void afterDrawNode(const DrawNodeEvent &event)
const TreeDrawingSettings * settings_
NodesIdTreeDrawingListener(const TreeDrawingSettings *settings, bool autonomous=false)
NodesIdTreeDrawingListener * clone() const
NodesIdTreeDrawingListener & operator=(const NodesIdTreeDrawingListener &lntdl)
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
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
TreeDrawingListener * clone() const =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:28
Defines the basic types of data flow nodes.