41 #include "../TreeTemplateTools.h" 42 #include "../TreeTools.h" 44 #include <Bpp/Text/TextTools.h> 45 #include <Bpp/Numeric/Number.h> 58 vector<INode *> nodes = tree_->getNodes();
59 for(
unsigned int i = 0; i < nodes.size(); i++)
61 INode * node = nodes[i];
62 if(node->
getId() == nodeId)
64 return node->
getInfos().getPosition();
73 vector<INode *> nodes = tree_->getNodes();
74 for(
unsigned int i = 0; i < nodes.size(); i++)
76 INode * node = nodes[i];
77 Point2D<double> nodePos = node->
getInfos().getPosition();
78 if(belongsTo(position, nodePos))
88 return (p1.getX() >= p2.getX() - settings_->pointArea && p1.getX() <= p2.getX() + settings_->pointArea
89 && p1.getY() >= p2.getY() - settings_->pointArea && p1.getY() <= p2.getY() + settings_->pointArea);
94 gDevice.drawText(node.
getInfos().getX() + xOffset * xUnit_, node.
getInfos().getY() + yOffset * yUnit_, text, hpos, vpos, angle);
100 gDevice.drawText((node.
getInfos().getX() + node.
getFather()->getInfos().getX()) / 2. + xOffset * xUnit_, node.
getInfos().getY() + yOffset * yUnit_, text, hpos, vpos, angle);
const NodeTemplate< NodeInfos > * getFather() const
Get the father of this node is there is one.
Point2D< double > getNodePosition(int nodeId) const
Get the position of a node.
virtual bool hasFather() const
Tell if this node has a father node.
virtual void drawAtNode(GraphicDevice &gDevice, const INode &node, const std::string &text, double xOffset=0, double yOffset=0, short hpos=GraphicDevice::TEXT_HORIZONTAL_LEFT, short vpos=GraphicDevice::TEXT_VERTICAL_CENTER, double angle=0) const
Draw some text at a particular node position.
virtual int getId() const
Get the node's id.
A set of options to tune the display of a TreeDrawing object.
Exception thrown when something is wrong with a particular node.
virtual void drawAtBranch(GraphicDevice &gDevice, const INode &node, const std::string &text, double xOffset=0, double yOffset=0, short hpos=GraphicDevice::TEXT_HORIZONTAL_LEFT, short vpos=GraphicDevice::TEXT_VERTICAL_CENTER, double angle=0) const
Draw some text at a particular branch position.
bool belongsTo(const Point2D< double > &p1, const Point2D< double > &p2) const
Utilitary function, telling if a point belongs to a specified area.
int getNodeAt(const Point2D< double > &position) const
Get the node corresponding to a position on the device.
virtual const NodeInfos & getInfos() const
static const TreeDrawingSettings DEFAULT_SETTINGS