17 void NodesIdTreeDrawingListener::afterDrawNode(
const DrawNodeEvent& event)
20 Cursor cursor =
event.getCursor();
24 string name =
"#" + TextTools::toString(event.
getNodeId());
29 void LeafNamesTreeDrawingListener::afterDrawNode(
const DrawNodeEvent& event)
38 Cursor cursor =
event.getCursor();
54 Cursor cursor =
event.getCursor();
65 void BranchLengthsTreeDrawingListener::afterDrawBranch(
const DrawBranchEvent& event)
74 Cursor cursor =
event.getBranchCursor(0.5);
80 GraphicDevice::TEXT_HORIZONTAL_CENTER, GraphicDevice::TEXT_VERTICAL_BOTTOM, cursor.
getAngle());
84 catch (std::bad_cast& e)
91 Cursor cursor =
event.getBranchCursor(0.5);
97 GraphicDevice::TEXT_HORIZONTAL_CENTER, GraphicDevice::TEXT_VERTICAL_BOTTOM, cursor.
getAngle());
103 void BootstrapValuesTreeDrawingListener::afterDrawBranch(
const DrawBranchEvent& event)
113 Cursor cursor =
event.getCursor();
118 TextTools::toString(
dynamic_cast<const Number<double>*
>(b)->getValue()),
119 cursor.
getHPos(), GraphicDevice::TEXT_VERTICAL_CENTER, cursor.
getAngle());
123 catch (std::bad_cast& e)
131 Cursor cursor =
event.getCursor();
136 TextTools::toString(
dynamic_cast<const Number<double>*
>(b)->getValue()),
137 cursor.
getHPos(), GraphicDevice::TEXT_VERTICAL_CENTER, cursor.
getAngle());
143 void LabelInnerNodesTreeDrawingListener::afterDrawNode(
const DrawNodeEvent& event)
152 Cursor cursor =
event.getCursor();
160 catch (std::bad_cast& e)
167 Cursor cursor =
event.getCursor();
177 void LabelCollapsedNodesTreeDrawingListener::afterDrawNode(
const DrawNodeEvent& event)
186 Cursor cursor =
event.getCursor();
187 size_t size = TreeTemplateTools::getNumberOfLeaves(*eventC.
getINode());
191 text +=
"(" + TextTools::toString(size) +
" leaves)";
195 catch (std::bad_cast& e)
202 Cursor cursor =
event.getCursor();
203 size_t size = TreeTools::getNumberOfLeaves(*td->
getTree(), event.
getNodeId());
207 text +=
"(" + TextTools::toString(size) +
" leaves)";
Data structure describing a plotting direction.
Event class used by TreeDrawing classes.
virtual int getNodeId() const
Event class that uses INode object (more efficient than relying on nodes id, but less generic).
const INode * getINode() const
Event class used by TreeDrawing classes.
virtual int getNodeId() const
virtual void setCurrentFont(const Font &font)=0
virtual void drawText(double x, double y, const std::string &text, short hpos=TEXT_HORIZONTAL_LEFT, short vpos=TEXT_VERTICAL_BOTTOM, double angle=0)=0
virtual const Font & getCurrentFont() const=0
virtual const NodeInfos & getInfos() const
virtual std::string getName() const
Get the name associated to this node, if there is one, otherwise throw a NodeException.
virtual bool hasBranchProperty(const std::string &name) const
virtual bool hasDistanceToFather() const
Tell is this node has a distance to the father.
virtual bool isLeaf() const
virtual Clonable * getBranchProperty(const std::string &name)
virtual bool hasName() const
Tell is this node has a name.
virtual double getDistanceToFather() const
Get the distance to the father node is there is one, otherwise throw a NodeException.
Basal interface for tree drawing classes.
virtual bool isNodeCollapsed(int nodeId) const =0
virtual const Tree * getTree() const =0
virtual std::string getNodeName(int nodeId) const =0
virtual Clonable * getBranchProperty(int nodeId, const std::string &name)=0
virtual bool isLeaf(int nodeId) const =0
virtual bool hasDistanceToFather(int nodeId) const =0
virtual bool hasNodeName(int nodeId) const =0
virtual double getDistanceToFather(int nodeId) const =0
virtual bool hasBranchProperty(int nodeId, const std::string &name) const =0
Defines the basic types of data flow nodes.