main page
modules
namespaces
classes
files
Gecode home
Generated on Sat May 25 2013 18:00:35 for Gecode by
doxygen
1.8.3.1
gecode
gist
visualnode.hh
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: 2010-09-03 11:25:49 +0200 (Fri, 03 Sep 2010) $ by $Author: tack $
11
* $Revision: 11387 $
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
38
#ifndef GECODE_GIST_VISUALNODE_HH
39
#define GECODE_GIST_VISUALNODE_HH
40
41
#include <
gecode/gist/spacenode.hh
>
42
#include <
gecode/kernel.hh
>
43
#include <string>
44
45
namespace
Gecode {
namespace
Gist {
46
48
class
Layout
{
49
public
:
50
static
const
int
dist_y
= 38;
51
static
const
int
extent
= 20;
52
static
const
int
minimalSeparation
= 10;
53
};
54
56
class
BoundingBox
{
57
public
:
59
int
left
;
61
int
right
;
63
BoundingBox
(
void
) {}
64
};
65
67
class
Extent
{
68
public
:
70
int
l
;
72
int
r
;
74
Extent
(
void
);
76
Extent
(
int
l0,
int
r0);
78
Extent
(
int
width);
79
81
void
extend
(
int
deltaL,
int
deltaR);
83
void
move
(
int
delta);
84
};
85
87
class
Shape
{
88
private
:
90
int
_depth;
92
BoundingBox
bb;
94
Extent
shape[1];
96
Shape
(
const
Shape
&);
98
Shape
& operator =(
const
Shape
&);
100
Shape
(
void
);
101
public
:
103
static
Shape
*
allocate
(
int
d
);
104
// Destruct
105
static
void
deallocate
(
Shape
*);
106
108
static
Shape
*
leaf
;
110
static
Shape
*
hidden
;
111
113
int
depth
(
void
)
const
;
115
void
setDepth
(
int
d);
117
void
computeBoundingBox
(
void
);
119
const
Extent
&
operator []
(
int
i
)
const
;
121
Extent
&
operator []
(
int
i
);
123
bool
getExtentAtDepth
(
int
depth
,
Extent
& extent);
125
const
BoundingBox
&
getBoundingBox
(
void
)
const
;
126
};
127
129
class
VisualNode
:
public
SpaceNode
{
130
protected
:
132
enum
VisualNodeFlags
{
133
DIRTY
=
SpaceNode::LASTBIT
+1,
134
CHILDRENLAYOUTDONE
,
135
HIDDEN
,
136
MARKED
,
137
ONPATH
,
138
BOOKMARKED
139
};
140
142
int
offset
;
144
Shape
*
shape
;
145
147
bool
containsCoordinateAtDepth
(
int
x
,
int
depth);
148
public
:
150
VisualNode
(
int
p
);
152
VisualNode
(
Space
* root);
153
155
bool
isHidden
(
void
);
157
void
setHidden
(
bool
h);
159
void
setStop
(
bool
h);
161
void
dirtyUp
(
const
NodeAllocator
& na);
163
void
layout
(
const
NodeAllocator
& na);
165
int
getOffset
(
void
);
167
void
setOffset
(
int
n
);
169
bool
isDirty
(
void
);
171
void
setDirty
(
bool
d
);
173
bool
childrenLayoutIsDone
(
void
);
175
void
setChildrenLayoutDone
(
bool
d
);
177
bool
isMarked
(
void
);
179
void
setMarked
(
bool
m);
181
bool
isBookmarked
(
void
);
183
void
setBookmarked
(
bool
m);
185
void
pathUp
(
const
NodeAllocator
& na);
187
void
unPathUp
(
const
NodeAllocator
& na);
189
bool
isOnPath
(
void
);
191
int
getPathAlternative
(
const
NodeAllocator
& na);
193
void
setOnPath
(
bool
onPath0);
194
196
void
toggleHidden
(
const
NodeAllocator
& na);
198
void
hideFailed
(
const
NodeAllocator
& na,
bool
onlyDirty=
false
);
200
void
unhideAll
(
const
NodeAllocator
& na);
202
void
toggleStop
(
const
NodeAllocator
& na);
204
void
unstopAll
(
const
NodeAllocator
& na);
205
207
Shape
*
getShape
(
void
);
209
void
setShape
(
Shape
* s);
211
void
computeShape
(
const
NodeAllocator
& na,
VisualNode
* root);
213
BoundingBox
getBoundingBox
(
void
);
215
void
changedStatus
(
const
NodeAllocator
& na);
217
VisualNode
*
findNode
(
const
NodeAllocator
& na,
int
x
,
int
y);
218
220
std::string
toolTip
(
BestNode
* curBest,
int
c_d
,
int
a_d
);
221
223
size_t
size
(
void
)
const
;
224
226
void
dispose
(
void
);
227
};
228
229
}}
230
231
#include <
gecode/gist/node.hpp
>
232
#include <
gecode/gist/spacenode.hpp
>
233
#include <
gecode/gist/visualnode.hpp
>
234
235
#endif
236
237
// STATISTICS: gist-any