74 const QRect& clippingRect0,
bool showCopies)
76 clippingRect(clippingRect0), curBest(curBest0),
77 x(0.0),
y(0.0), copies(showCopies) {
78 QPen pen = painter.pen();
86 double parentX = x -
static_cast<double>(
n->getOffset());
89 (
n->getParent(
na)->getStatus() ==
STOP ||
90 n->getParent(
na)->getStatus() ==
UNSTOP) )
101 painter.setPen(Qt::red);
103 painter.setPen(Qt::black);
107 path.moveTo(myx,myy);
108 path.lineTo(parentX,parentY);
109 painter.drawPath(
path);
111 QFontMetrics fm = painter.fontMetrics();
112 QString label =
na.getLabel(
n);
113 int alt =
n->getAlternative(
na);
114 int n_alt =
n->getParent(
na)->getNumberOfChildren();
115 int tw = fm.width(label);
117 if (alt==0 && n_alt > 1) {
119 }
else if (alt==n_alt-1 && n_alt > 1) {
124 painter.drawText(QPointF(lx,myy-2),label);
129 painter.setBrush(Qt::gray);
130 painter.setPen(Qt::NoPen);
138 painter.drawConvexPolygon(points, 3);
141 switch (
n->getStatus()) {
152 painter.drawConvexPolygon(points, 4);
183 painter.drawConvexPolygon(points, 8);
198 painter.setPen(Qt::SolidLine);
200 if (
n->hasOpenChildren()) {
201 QLinearGradient gradient(myx-
nodeWidth,myy,
203 if (
n->hasSolvedChildren()) {
204 gradient.setColorAt(0,
white);
205 gradient.setColorAt(1,
green);
206 }
else if (
n->hasFailedChildren()) {
207 gradient.setColorAt(0,
white);
208 gradient.setColorAt(1,
red);
210 gradient.setColorAt(0,
white);
211 gradient.setColorAt(1, QColor(0,0,0));
213 painter.setBrush(gradient);
215 if (
n->hasSolvedChildren())
216 painter.setBrush(QBrush(
green));
218 painter.setBrush(QBrush(
red));
221 QPointF points[3] = {QPointF(myx,myy),
225 painter.drawConvexPolygon(points, 3);
227 switch (
n->getStatus()) {
230 if (
n->isCurrentBest(curBest)) {
231 painter.setBrush(QBrush(
orange));
233 painter.setBrush(QBrush(
green));
235 QPointF points[4] = {QPointF(myx,myy),
240 painter.drawConvexPolygon(points, 4);
244 painter.setBrush(QBrush(
red));
250 painter.setBrush(
n->getStatus() ==
STOP ?
269 painter.drawConvexPolygon(points, 8);
273 painter.setBrush(
n->childrenLayoutIsDone() ? QBrush(
blue) :
278 painter.setBrush(Qt::white);
284 if (copies && (
n->hasCopy() && !
n->hasWorkingSpace())) {
285 painter.setBrush(Qt::darkRed);
286 painter.drawEllipse(myx, myy, 10.0, 10.0);
289 if (copies &&
n->hasWorkingSpace()) {
290 painter.setBrush(Qt::darkYellow);
291 painter.drawEllipse(myx, myy + 10.0, 10.0, 10.0);
294 if (
n->isBookmarked()) {
295 painter.setBrush(Qt::black);
296 painter.drawEllipse(myx-10-0, myy, 10.0, 10.0);
Node representing stop point.
static const QColor lightRed
The color for expanded failed nodes.
static const QColor white
White color.
Static reference to the currently best space.
Node representing a branch.
DrawingCursor(VisualNode *root, const VisualNode::NodeAllocator &na, BestNode *curBest0, QPainter &painter0, const QRect &clippingRect0, bool showCopies)
Constructor.
void path(Home home, int offset, const IntVarArgs &x, IntVar s, IntVar e, IntPropLevel ipl)
Post propagator such that x forms a Hamiltonian path.
Node representing failure.
const double quarterNodeWidth
static const QColor green
The color for solved nodes.
Node that has not been explored yet.
static const QColor blue
The color for choice nodes.
int n
Number of negative literals for node type.
static const QColor lightGreen
The color for expanded solved nodes.
const VisualNode ::NodeAllocator & na
The node allocator.
Node representing a solution.
const double quarterFailedWidthF
const double shadowOffset
Gecode Interactive Search Tool
VisualNode * startNode(void)
Return start node.
const double halfFailedWidth
static const QColor red
The color for failed nodes.
static const QColor orange
The color for the best solution.
void processCurrentNode(void)
Draw the node.
Post propagator for SetVar SetOpType SetVar y
A cursor that can be run over a tree.
Node class that supports visual layout
Post propagator for SetVar x
VisualNode * node(void)
Return current node.
Gecode toplevel namespace
const double halfNodeWidth
static const QColor lightBlue
The color for expanded choice nodes.
Node representing ignored stop point.