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#if QT_VERSION >= 0x060000
111 int tw = fm.horizontalAdvance(label);
113 int tw = fm.width(label);
116 if (alt==0 && n_alt > 1) {
118 }
else if (alt==n_alt-1 && n_alt > 1) {
123 painter.drawText(QPointF(lx,myy-2),label);
128 painter.setBrush(Qt::gray);
129 painter.setPen(Qt::NoPen);
137 painter.drawConvexPolygon(points, 3);
151 painter.drawConvexPolygon(points, 4);
182 painter.drawConvexPolygon(points, 8);
197 painter.setPen(Qt::SolidLine);
200 QLinearGradient gradient(myx-
nodeWidth,myy,
203 gradient.setColorAt(0,
white);
204 gradient.setColorAt(1,
green);
206 gradient.setColorAt(0,
white);
207 gradient.setColorAt(1,
red);
209 gradient.setColorAt(0,
white);
210 gradient.setColorAt(1, QColor(0,0,0));
212 painter.setBrush(gradient);
215 painter.setBrush(QBrush(
green));
217 painter.setBrush(QBrush(
red));
220 QPointF points[3] = {QPointF(myx,myy),
224 painter.drawConvexPolygon(points, 3);
230 painter.setBrush(QBrush(
orange));
232 painter.setBrush(QBrush(
green));
234 QPointF points[4] = {QPointF(myx,myy),
239 painter.drawConvexPolygon(points, 4);
243 painter.setBrush(QBrush(
red));
268 painter.drawConvexPolygon(points, 8);
277 painter.setBrush(Qt::white);
284 painter.setBrush(Qt::darkRed);
285 painter.drawEllipse(myx, myy, 10.0, 10.0);
289 painter.setBrush(Qt::darkYellow);
290 painter.drawEllipse(myx, myy + 10.0, 10.0, 10.0);
294 painter.setBrush(Qt::black);
295 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.