36 namespace Gecode {
namespace Gist {
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());
84 (
n->getParent(
na)->getStatus() ==
STOP ||
85 n->getParent(
na)->getStatus() ==
UNSTOP) )
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();
108 int alt =
n->getAlternative(
na);
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);
136 switch (
n->getStatus()) {
147 painter.drawConvexPolygon(points, 4);
178 painter.drawConvexPolygon(points, 8);
193 painter.setPen(Qt::SolidLine);
195 if (
n->hasOpenChildren()) {
196 QLinearGradient gradient(myx-
nodeWidth,myy,
198 if (
n->hasSolvedChildren()) {
199 gradient.setColorAt(0,
white);
200 gradient.setColorAt(1,
green);
201 }
else if (
n->hasFailedChildren()) {
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);
210 if (
n->hasSolvedChildren())
211 painter.setBrush(QBrush(
green));
213 painter.setBrush(QBrush(
red));
216 QPointF points[3] = {QPointF(myx,myy),
220 painter.drawConvexPolygon(points, 3);
222 switch (
n->getStatus()) {
225 if (
n->isCurrentBest(curBest)) {
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));
245 painter.setBrush(
n->getStatus() ==
STOP ?
264 painter.drawConvexPolygon(points, 8);
268 painter.setBrush(
n->childrenLayoutIsDone() ? QBrush(
blue) :
273 painter.setBrush(Qt::white);
279 if (copies && (
n->hasCopy() && !
n->hasWorkingSpace())) {
280 painter.setBrush(Qt::darkRed);
281 painter.drawEllipse(myx, myy, 10.0, 10.0);
284 if (copies &&
n->hasWorkingSpace()) {
285 painter.setBrush(Qt::darkYellow);
286 painter.drawEllipse(myx, myy + 10.0, 10.0, 10.0);
289 if (
n->isBookmarked()) {
290 painter.setBrush(Qt::black);
291 painter.drawEllipse(myx-10-0, myy, 10.0, 10.0);
int n
Number of negative literals for node type.
Node * x
Pointer to corresponding Boolean expression node.
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.
Gecode Interactive Search Tool
QString getLabel(T *n) const
Get label of node n.
A cursor that can be run over a tree.
const Node::NodeAllocator & na
The node allocator.
VisualNode * node(void)
Return current node.
VisualNode * startNode(void)
Return start node.
Node class that supports visual layout
void path(Home home, int offset, const IntVarArgs &x, IntVar s, IntVar e, IntPropLevel ipl)
Post propagator such that x forms a Hamiltonian path.
Post propagator for SetVar SetOpType SetVar y
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