52 void NodesIdTreeDrawingListener::afterDrawNode(
const DrawNodeEvent& event)
54 GraphicDevice* gd =
event.getGraphicDevice();
55 Cursor cursor =
event.getCursor();
56 Font fontBck = gd->getCurrentFont();
58 gd->setCurrentFont(settings_->fontNodesId);
59 string name =
"#" + TextTools::toString(event.
getNodeId());
61 gd->setCurrentFont(fontBck);
64 void LeafNamesTreeDrawingListener::afterDrawNode(
const DrawNodeEvent& event)
73 Cursor cursor =
event.getCursor();
74 Font fontBck = gd->getCurrentFont();
76 gd->setCurrentFont(settings_->fontLeafNames);
79 gd->setCurrentFont(fontBck);
88 GraphicDevice* gd =
event.getGraphicDevice();
89 Cursor cursor =
event.getCursor();
90 Font fontBck = gd->getCurrentFont();
92 gd->setCurrentFont(settings_->fontLeafNames);
95 gd->setCurrentFont(fontBck);
109 Cursor cursor =
event.getBranchCursor(0.5);
110 Font fontBck = gd->getCurrentFont();
112 gd->setCurrentFont(settings_->fontBranchLengths);
113 gd->drawText(cursor.
getX(), cursor.
getY(),
115 GraphicDevice::TEXT_HORIZONTAL_CENTER, GraphicDevice::TEXT_VERTICAL_BOTTOM, cursor.
getAngle());
116 gd->setCurrentFont(fontBck);
119 catch (std::bad_cast& e)
125 GraphicDevice* gd =
event.getGraphicDevice();
126 Cursor cursor =
event.getBranchCursor(0.5);
127 Font fontBck = gd->getCurrentFont();
129 gd->setCurrentFont(settings_->fontLeafNames);
130 gd->drawText(cursor.
getX(), cursor.
getY(),
132 GraphicDevice::TEXT_HORIZONTAL_CENTER, GraphicDevice::TEXT_VERTICAL_BOTTOM, cursor.
getAngle());
133 gd->setCurrentFont(fontBck);
138 void BootstrapValuesTreeDrawingListener::afterDrawBranch(
const DrawBranchEvent& event)
147 GraphicDevice* gd =
event.getGraphicDevice();
148 Cursor cursor =
event.getCursor();
149 Font fontBck = gd->getCurrentFont();
151 gd->setCurrentFont(settings_->fontBranchLengths);
152 gd->drawText(cursor.
getX(), cursor.
getY(),
153 TextTools::toString(
dynamic_cast<const Number<double> *
>(b)->getValue()),
154 cursor.
getHPos(), GraphicDevice::TEXT_VERTICAL_CENTER, cursor.
getAngle());
155 gd->setCurrentFont(fontBck);
158 catch (std::bad_cast& e)
165 GraphicDevice* gd =
event.getGraphicDevice();
166 Cursor cursor =
event.getCursor();
167 Font fontBck = gd->getCurrentFont();
169 gd->setCurrentFont(settings_->fontLeafNames);
170 gd->drawText(cursor.
getX(), cursor.
getY(),
171 TextTools::toString(
dynamic_cast<const Number<double> *
>(b)->getValue()),
172 cursor.
getHPos(), GraphicDevice::TEXT_VERTICAL_CENTER, cursor.
getAngle());
173 gd->setCurrentFont(fontBck);
178 void LabelInnerNodesTreeDrawingListener::afterDrawNode(
const DrawNodeEvent& event)
187 Cursor cursor =
event.getCursor();
195 catch(std::bad_cast& e)
201 GraphicDevice* gd =
event.getGraphicDevice();
202 Cursor cursor =
event.getCursor();
212 void LabelCollapsedNodesTreeDrawingListener::afterDrawNode(
const DrawNodeEvent& event)
221 Cursor cursor =
event.getCursor();
222 size_t size = TreeTemplateTools::getNumberOfLeaves(*eventC.
getINode());
226 text +=
"(" + TextTools::toString(size) +
" leaves)";
230 catch(std::bad_cast& e)
236 GraphicDevice* gd =
event.getGraphicDevice();
237 Cursor cursor =
event.getCursor();
238 size_t size = TreeTools::getNumberOfLeaves(*td->
getTree(),
event.getNodeId());
242 text +=
"(" + TextTools::toString(size) +
" leaves)";
Basal interface for tree drawing classes.
virtual int getNodeId() const
virtual std::string getName() const
Get the name associated to this node, if there is one, otherwise throw a NodeException.
virtual bool hasName() const
Tell is this node has a name.
virtual Clonable * getBranchProperty(const std::string &name)
Event class that uses INode object (more efficient than relying on nodes id, but less generic)...
virtual bool hasDistanceToFather() const
Tell is this node has a distance to the father.
virtual bool isLeaf() const
virtual double getDistanceToFather() const
Get the distance to the father node is there is one, otherwise throw a NodeException.
virtual bool isLeaf(int nodeId) const =0
virtual bool isNodeCollapsed(int nodeId) const =0
virtual bool hasBranchProperty(int nodeId, const std::string &name) const =0
Event class used by TreeDrawing classes.
virtual double getDistanceToFather(int nodeId) const =0
Event class used by TreeDrawing classes.
virtual bool hasNodeName(int nodeId) const =0
virtual GraphicDevice * getGraphicDevice() const
virtual bool hasDistanceToFather(int nodeId) const =0
virtual const Tree * getTree() const =0
virtual Clonable * getBranchProperty(int nodeId, const std::string &name)=0
virtual int getNodeId() const
virtual const NodeInfos & getInfos() const
virtual bool hasBranchProperty(const std::string &name) const
const INode * getINode() const
Data structure describing a plotting direction.
virtual std::string getNodeName(int nodeId) const =0