Generated on Sat Feb 7 2015 02:01:18 for Gecode by doxygen 1.8.9.1
nodewidget.cpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Guido Tack <tack@gecode.org>
5  *
6  * Copyright:
7  * Guido Tack, 2006
8  *
9  * Last modified:
10  * $Date: 2009-05-13 11:04:40 +0200 (Wed, 13 May 2009) $ by $Author: schulte $
11  * $Revision: 9083 $
12  *
13  * This file is part of Gecode, the generic constraint
14  * development environment:
15  * http://www.gecode.org
16  *
17  * Permission is hereby granted, free of charge, to any person obtaining
18  * a copy of this software and associated documentation files (the
19  * "Software"), to deal in the Software without restriction, including
20  * without limitation the rights to use, copy, modify, merge, publish,
21  * distribute, sublicense, and/or sell copies of the Software, and to
22  * permit persons to whom the Software is furnished to do so, subject to
23  * the following conditions:
24  *
25  * The above copyright notice and this permission notice shall be
26  * included in all copies or substantial portions of the Software.
27  *
28  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35  *
36  */
37 
40 
41 namespace Gecode { namespace Gist {
42 
44  setMinimumSize(22,22);
45  setMaximumSize(22,22);
46  }
47 
48  void NodeWidget::paintEvent(QPaintEvent*) {
49  QPainter painter(this);
50  painter.setRenderHint(QPainter::Antialiasing);
51  int hw= width()/2;
52  int myx = hw+2; int myy = 2;
53  switch (status) {
54  case SOLVED:
55  {
56  QPoint points[4] = {QPoint(myx,myy),
57  QPoint(myx+8,myy+8),
58  QPoint(myx,myy+16),
59  QPoint(myx-8,myy+8)
60  };
61  painter.setBrush(QBrush(DrawingCursor::green));
62  painter.drawConvexPolygon(points, 4);
63  }
64  break;
65  case FAILED:
66  {
67  painter.setBrush(QBrush(DrawingCursor::red));
68  painter.drawRect(myx-6, myy+2, 12, 12);
69  }
70  break;
71  case BRANCH:
72  {
73  painter.setBrush(QBrush(DrawingCursor::blue));
74  painter.drawEllipse(myx-8, myy, 16, 16);
75  }
76  break;
77  case UNDETERMINED:
78  {
79  painter.setBrush(QBrush(Qt::white));
80  painter.drawEllipse(myx-8, myy, 16, 16);
81  }
82  break;
83  default:
84  break;
85  }
86  }
87 
88 }}
89 
90 // STATISTICS: gist-any
Node representing a branch.
Definition: spacenode.hh:51
void paintEvent(QPaintEvent *)
Definition: nodewidget.cpp:48
NodeStatus
Status of nodes in the search tree.
Definition: spacenode.hh:48
Node representing failure.
Definition: spacenode.hh:50
static const QColor green
The color for solved nodes.
Node that has not been explored yet.
Definition: spacenode.hh:52
static const QColor blue
The color for choice nodes.
Node representing a solution.
Definition: spacenode.hh:49
static const QColor red
The color for failed nodes.
NodeWidget(NodeStatus s)
Definition: nodewidget.cpp:43
Gecode toplevel namespace