8 #include "../Tree/TreeTemplateTools.h"
9 #include "../Tree/TreeTools.h"
22 vector<INode*> nodes = tree_->getNodes();
23 for (
INode* node : nodes)
25 if (node->getId() == nodeId)
27 return node->getInfos().getPosition();
35 vector<INode*> nodes = tree_->getNodes();
36 for (
INode* node : nodes)
39 if (belongsTo(position, nodePos))
49 return p1.
getX() >= p2.
getX() - settings_->pointArea && p1.
getX() <= p2.
getX() + settings_->pointArea
50 && p1.
getY() >= p2.
getY() - settings_->pointArea && p1.
getY() <= p2.
getY() + settings_->pointArea;
55 gDevice.
drawText(node.
getInfos().getX() + xOffset * xUnit_, node.
getInfos().getY() + yOffset * yUnit_, text, hpos, vpos, angle);
62 gDevice.
drawText((node.
getInfos().getX() + node.
getFather()->getInfos().getX()) / 2. + xOffset * xUnit_, node.
getInfos().getY() + yOffset * yUnit_, text, hpos, vpos, angle);
Point2D< double > getNodePosition(int nodeId) const
Get the position of a node.
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 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.
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.
static const TreeDrawingSettings DEFAULT_SETTINGS
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
Exception thrown when something is wrong with a particular node.
const NodeTemplate< NodeInfos > * getFather() const
Get the father of this node is there is one.
virtual const NodeInfos & getInfos() const
virtual bool hasFather() const
Tell if this node has a father node.
A set of options to tune the display of a TreeDrawing object.
std::string toString(T t)
Defines the basic types of data flow nodes.