41 #include "../TreeTemplateTools.h" 58 if (
getINode()->hasDistanceToFather())
77 fireBeforeTreeEvent_(treeEvent);
78 unsigned int* tipCounter =
new unsigned int(0);
80 recursivePlot_(gDevice, *const_cast<INode*>(getTree_()->getRootNode()),
81 getHorizontalOrientation() == ORIENTATION_LEFT_TO_RIGHT ? 0 : getWidth() * getXUnit(),
83 getHorizontalOrientation() == ORIENTATION_LEFT_TO_RIGHT ? 1. : -1.,
84 getVerticalOrientation() == ORIENTATION_TOP_TO_BOTTOM ? 1. : -1.,
86 fireAfterTreeEvent_(treeEvent);
94 auto_ptr<Cursor> cursor;
95 auto_ptr<DrawINodeEvent> nodeEvent;
96 auto_ptr<DrawIBranchEvent> branchEvent;
102 cursor.reset(
new Cursor(x2, y, 0, hpos));
103 nodeEvent.reset(
new DrawINodeEvent(
this, &gDevice, &node, *cursor));
106 else if (node.
getInfos().isCollapsed())
110 cursor.reset(
new Cursor(x2, y, 0, hpos));
111 nodeEvent.reset(
new DrawINodeEvent(
this, &gDevice, &node, *cursor));
117 double miny = 1000000;
123 if(yson < miny) miny = yson;
124 if(yson > maxy) maxy = yson;
126 y = (maxy + miny) / 2.;
127 cursor.reset(
new Cursor(x2, y, 0, hpos));
128 nodeEvent.reset(
new DrawINodeEvent(
this, &gDevice, &node, *cursor));
130 gDevice.drawLine(x2, miny, x2, maxy);
135 nodeEvent.reset(
new DrawINodeEvent(
this, &gDevice, &node, *cursor));
141 gDevice.drawLine(x, y, x2, y);
Basal interface for tree drawing classes.
void setTree(const Tree *tree)
const NodeTemplate< NodeInfos > * getSon(size_t i) const
void setTree(const Tree *tree=0)
Cursor getBranchCursor(double position) const
short getHorizontalOrientation() const
Event class that uses INode object (more efficient than relying on nodes id, but less generic)...
Cursor getTranslation(double x, double y) const
void fireAfterNodeEvent_(const DrawINodeEvent &event) const
Interface for phylogenetic tree objects.
virtual bool isLeaf() const
virtual const Cursor & getCursor() const
void fireBeforeBranchEvent_(const DrawIBranchEvent &event) const
void fireAfterBranchEvent_(const DrawIBranchEvent &event) const
CladogramDrawBranchEvent(const TreeDrawing *source, GraphicDevice *gd, const INode *node, double length_, const Cursor &cursor, short orientation)
void fireBeforeNodeEvent_(const DrawINodeEvent &event) const
static short ORIENTATION_LEFT_TO_RIGHT
Event class that uses INode object (more efficient than relying on nodes id, but less generic)...
static short ORIENTATION_TOP_TO_BOTTOM
void drawDendrogram_(GraphicDevice &gDevice) const
const INode * getINode() const
virtual size_t getNumberOfSons() const
short getVerticalOrientation() const
TreeTemplate< INode > * getTree_()
virtual const NodeInfos & getInfos() const
Data structure describing a plotting direction.
void recursivePlot_(GraphicDevice &gDevice, INode &node, double x, double &y, double hDirection, double vDirection, unsigned int *tipCounter) const
Event class used by TreeDrawing classes.