69 const QRect& clippingRect0,
bool showCopies)
71 clippingRect(clippingRect0), curBest(curBest0),
72 x(0.0), y(0.0), copies(showCopies) {
73 QPen pen = painter.pen();
81 double parentX = x -
static_cast<double>(n->
getOffset());
96 painter.setPen(Qt::red);
98 painter.setPen(Qt::black);
102 path.moveTo(myx,myy);
103 path.lineTo(parentX,parentY);
104 painter.drawPath(
path);
106 QFontMetrics fm = painter.fontMetrics();
107 QString label =
na.getLabel(n);
109 int n_alt = n->
getParent(
na)->getNumberOfChildren();
110 int tw = fm.width(label);
112 if (alt==0 && n_alt > 1) {
114 }
else if (alt==n_alt-1 && n_alt > 1) {
119 painter.drawText(QPointF(lx,myy-2),label);
124 painter.setBrush(Qt::gray);
125 painter.setPen(Qt::NoPen);
133 painter.drawConvexPolygon(points, 3);
147 painter.drawConvexPolygon(points, 4);
178 painter.drawConvexPolygon(points, 8);
193 painter.setPen(Qt::SolidLine);
196 QLinearGradient gradient(myx-
nodeWidth,myy,
199 gradient.setColorAt(0,
white);
200 gradient.setColorAt(1,
green);
202 gradient.setColorAt(0,
white);
203 gradient.setColorAt(1,
red);
205 gradient.setColorAt(0,
white);
206 gradient.setColorAt(1, QColor(0,0,0));
208 painter.setBrush(gradient);
211 painter.setBrush(QBrush(
green));
213 painter.setBrush(QBrush(
red));
216 QPointF points[3] = {QPointF(myx,myy),
220 painter.drawConvexPolygon(points, 3);
226 painter.setBrush(QBrush(
orange));
228 painter.setBrush(QBrush(
green));
230 QPointF points[4] = {QPointF(myx,myy),
235 painter.drawConvexPolygon(points, 4);
239 painter.setBrush(QBrush(
red));
264 painter.drawConvexPolygon(points, 8);
273 painter.setBrush(Qt::white);
280 painter.setBrush(Qt::darkRed);
281 painter.drawEllipse(myx, myy, 10.0, 10.0);
285 painter.setBrush(Qt::darkYellow);
286 painter.drawEllipse(myx, myy + 10.0, 10.0, 10.0);
290 painter.setBrush(Qt::black);
291 painter.drawEllipse(myx-10-0, myy, 10.0, 10.0);
Static reference to the currently best space.
static const QColor red
The color for failed nodes.
void processCurrentNode(void)
Draw the node.
static const QColor blue
The color for choice nodes.
static const QColor green
The color for solved nodes.
static const QColor white
White color.
static const QColor lightBlue
The color for expanded choice nodes.
DrawingCursor(VisualNode *root, const VisualNode::NodeAllocator &na, BestNode *curBest0, QPainter &painter0, const QRect &clippingRect0, bool showCopies)
Constructor.
static const QColor lightRed
The color for expanded failed nodes.
static const QColor lightGreen
The color for expanded solved nodes.
static const QColor orange
The color for the best solution.
const VisualNode::NodeAllocator & na
NodeCursor(VisualNode *theNode, const typename VisualNode::NodeAllocator &na)
VisualNode * startNode(void)
NodeAllocatorBase< VisualNode > NodeAllocator
int getParent(void) const
Return the parent.
bool isRoot(void) const
Check if this node is the root of a tree.
bool hasCopy(void)
Return whether the node has a copy.
bool hasWorkingSpace(void)
Return whether the node has a working space.
bool isCurrentBest(BestNode *curBest)
Return whether this node is the currently best solution.
bool hasFailedChildren(void)
Return whether the subtree of this node has any failed children.
bool hasSolvedChildren(void)
Return whether the subtree of this node has any solved children.
int getAlternative(const NodeAllocator &na) const
Return alternative number of this node.
NodeStatus getStatus(void) const
Return current status of the node.
bool hasOpenChildren(void)
Return whether the subtree of this node has any open children.
Node class that supports visual layout
int getOffset(void)
Return offset off this node from its parent.
bool isBookmarked(void)
Return whether node is bookmarked.
bool isHidden(void)
Return if node is hidden.
bool isMarked(void)
Return whether node is marked.
bool childrenLayoutIsDone(void)
Return whether the layout of the node's children has been completed.
bool isOnPath(void)
Return whether node is on the path.
The Gecode Interactive Search Tool.
const double shadowOffset
const double halfNodeWidth
@ UNDETERMINED
Node that has not been explored yet.
@ UNSTOP
Node representing ignored stop point.
@ FAILED
Node representing failure.
@ STOP
Node representing stop point.
@ SOLVED
Node representing a solution.
@ BRANCH
Node representing a branch.
const double halfFailedWidth
const double quarterFailedWidthF
Gecode toplevel namespace
void path(Home home, const IntVarArgs &x, IntVar s, IntVar e, IntPropLevel ipl=IPL_DEF)
Post propagator such that x forms a Hamiltonian path.