0022785: Draw Harness - add possibility to remove a text drawn by the command vdrawtext
[occt.git] / tests / bugs / vis / bug24389
CommitLineData
fe83e1ea 1puts "============"
2puts "CR24389"
3puts "============"
4puts ""
5#######################################################################
6# Invalid hilight of AIS dimension line in local selection
7#######################################################################
8
9# ----------------------------------------------#
10# Check highlight of length dimension elements #
11# ----------------------------------------------#
12
13vinit View1
14vtop
15
16set anImage1 $imagedir/${casename}_1.png
17set anImage2 $imagedir/${casename}_2.png
18set anImage3 $imagedir/${casename}_3.png
19
20# length
21
22vpoint len_p1 0 0 0
23vpoint len_p2 40 0 0
24verase len_p1 len_p2
25
0499eb06 26vdimension len1 -length -text 3d -plane xoy -flyout 20 -arrow external -label left -shapes len_p1 len_p2
27vdimension len2 -length -text 3d -plane xoy -flyout -20 -arrow external -label right -shapes len_p1 len_p2
fe83e1ea 28
29vpoint len_p3 0 20 0
30vpoint len_p4 40 20 0
31verase len_p3 len_p4
32
0499eb06 33vdimension len3 -length -text 3d -plane xoy -flyout 20 -arrow internal -label hcenter -shapes len_p3 len_p4
fe83e1ea 34
35# diameter
36
37vpoint diam_p1 90 0 0
38vpoint diam_p2 120 0 0
39vpoint diam_p3 105 -15 0
40verase diam_p1 diam_p2 diam_p3
41vcircle diam_c1 diam_p1 diam_p2 diam_p3 0
0499eb06 42vdimension diam1 -diameter -text 3d -plane xoy -arrow external -label left -shapes diam_c1
fe83e1ea 43
44vpoint diam_p4 90 40 0
45vpoint diam_p5 120 40 0
46vpoint diam_p6 105 25 0
47verase diam_p4 diam_p5 diam_p6
48vcircle diam_c2 diam_p4 diam_p5 diam_p6 0
0499eb06 49vdimension diam2 -diameter -text 3d -plane xoy -arrow external -label right -shapes diam_c2
fe83e1ea 50
51vpoint diam_p7 80 -40 0
52vpoint diam_p8 120 -40 0
53vpoint diam_p9 100 -60 0
54verase diam_p7 diam_p8 diam_p9
55vcircle diam_c3 diam_p7 diam_p8 diam_p9 0
0499eb06 56vdimension diam3 -diameter -text 3d -plane xoy -arrow external -label hcenter -flyout 30 -shapes diam_c3
fe83e1ea 57
58# radius
59
60vpoint rad_p1 140 -5 0
61vpoint rad_p2 180 -45 0
62vpoint rad_p3 220 -5 0
63verase rad_p1 rad_p2 rad_p3
64vcircle rad_c1 rad_p1 rad_p2 rad_p3 0
0499eb06 65vdimension rad1 -radius -text 3d -plane xoy -arrow internal -label hcenter -flyout 0 -shapes rad_c1
fe83e1ea 66
67vpoint rad_p4 180 -70 0
68vpoint rad_p5 160 -90 0
69vpoint rad_p6 140 -70 0
70verase rad_p4 rad_p5 rad_p6
71vcircle rad_c2 rad_p4 rad_p5 rad_p6 0
0499eb06 72vdimension rad2 -radius -text 3d -plane xoy -arrow external -label left -shapes rad_c2
fe83e1ea 73
74# angles
75
76vpoint ang_p1 0 -50 0
77vpoint ang_p2 25 -75 0
78vpoint ang_p3 0 -100 0
79verase ang_p1 ang_p2 ang_p3
0499eb06 80vdimension ang1 -angle -text 3d -plane xoy -arrow internal -label hcenter -flyout 35 -shapes ang_p1 ang_p2 ang_p3
fe83e1ea 81
82vpoint ang_p4 0 -120 0
83vpoint ang_p5 30 -80 0
84vpoint ang_p6 30 -120 0
85verase ang_p4 ang_p5 ang_p6
0499eb06 86vdimension ang2 -angle -text 3d -plane xoy -arrow external -label left -flyout 55 -shapes ang_p4 ang_p5 ang_p6
fe83e1ea 87
88vpoint ang_p8 55 -120 0
89vpoint ang_p9 55 -80 0
90vpoint ang_p10 95 -120 0
91verase ang_p8 ang_p9 ang_p10
0499eb06 92vdimension ang3 -angle -text 3d -plane xoy -arrow external -label right -flyout 55 -shapes ang_p8 ang_p9 ang_p10
fe83e1ea 93
fe83e1ea 94vpoint fit1 -75 0 0
95vpoint fit2 235 0 0
96vfit
97
98# ----------------------------------------------------------------------------- #
99# Verify picking in neutral and local selections #
100# ----------------------------------------------------------------------------- #
101
102proc check_picking { pick check name } {
103 for {set i 0} {$i < [llength $pick]} {incr i} {
104
105 set pick_x [lindex [lindex $pick $i] 0]
106 set pick_y [lindex [lindex $pick $i] 1]
107 set check_x [lindex $check 0]
108 set check_y [lindex $check 1]
109
110 vmoveto $pick_x $pick_y
111 set res [checkcolor $check_x $check_y 0 1 1]
112
113 if { $res != 1 } {
114 puts "Error : Highlighting of $name at pick coordinates ($pick_x, $pick_y) check coordinates ($check_x, $check_y)"
115 }
116 }
117}
118
119proc check_cross_picking { pick object name } {
120
709e97a0 121 vselmode 0 1
fe83e1ea 122
123 for {set i 1} {$i < 3} {incr i} {
124
125 vselmode $object $i 1
126
127 for {set j 1} {$j < 3} {incr j} {
128
129 set pick_idx_i [expr "[llength $pick] - 2 + $i - 1"]
130 set pick_idx_j [expr "[llength $pick] - 2 + $j - 1"]
131
132 set pick_x [lindex [lindex $pick $pick_idx_i] 0]
133 set pick_y [lindex [lindex $pick $pick_idx_i] 1]
134 set check_x [lindex [lindex $pick $pick_idx_j] 0]
135 set check_y [lindex [lindex $pick $pick_idx_j] 1]
136
137 vmoveto $pick_x $pick_y
138
139 if {$i == $j} {
140 set res [checkcolor $check_x $check_y 0 1 1]
141 if { $res != 1 } {
142 puts "Error : No local hilighting of $name at pick coordinates ($pick_x, $pick_y) check coordinates ($check_x, $check_y)"
143 }
144 } else {
145 set res [checkcolor $check_x $check_y 0 0 0]
146 if { $res != 1 } {
147 puts "Error : Unwanted hilighting of $name at pick coordinates ($pick_x, $pick_y) check coordinates ($check_x, $check_y)"
148 }
149 }
150 }
151 vselmode $object $i 0
152 }
709e97a0 153 vselmode 0 1
fe83e1ea 154}
155
156# pick coord { [flyout], dimension line, text }
157
158# check sensitives "len1"
159set pick_coord { { 99 133 } { 106 124 } { 76 131 } }
160set check_coord { 125 124 }
161check_picking $pick_coord $check_coord "length dimension (len1)"
162check_cross_picking $pick_coord len1 "length dimension (len1)"
163
164# check sensitives "len2"
165set pick_coord { { 99 167 } { 127 176 } { 185 183 } }
166set check_coord { 112 176 }
167check_picking $pick_coord $check_coord "length dimension (len2)"
168check_cross_picking $pick_coord len2 "length dimension (len2)"
169
170# check sensitives "len3"
171set pick_coord { { 99 114 } { 110 98 } { 131 105 } }
172set check_coord { 152 109 }
173check_picking $pick_coord $check_coord "length dimension (len3)"
174check_cross_picking $pick_coord len3 "length dimension (len3)"
175
176# check sensitives "diam1"
177set pick_coord { { 247 150 } { 194 157 } }
178set check_coord { 236 150 }
179check_picking $pick_coord $check_coord "diameter dimension (diam1)"
180check_cross_picking $pick_coord diam1 "diameter dimension (diam1)"
181
182# check sensitives "diam2"
183set pick_coord { { 221 98 } { 305 105 } }
184set check_coord { 238 98 }
185check_picking $pick_coord $check_coord "diameter dimension (diam2)"
186check_cross_picking $pick_coord diam2 "diameter dimension (diam2)"
187
188# check sensitives "diam3"
189set pick_coord { { 204 225 } { 268 242 } { 243 249 } }
190set check_coord { 204 233 }
191check_picking $pick_coord $check_coord "diameter dimension (diam3)"
192check_cross_picking $pick_coord diam3 "diameter dimension (diam3)"
193
194# check sensitives "rad1"
f751596e 195set pick_coord { { 287 157 } { 326 164 } }
fe83e1ea 196set check_coord { 287 157 }
197check_picking $pick_coord $check_coord "radius dimension (rad1)"
198check_cross_picking $pick_coord rad1 "radius dimension (rad1)"
199
200# check sensitives "rad2"
201set pick_coord { { 320 242 } { 383 249 } }
202set check_coord { 340 242 }
203check_picking $pick_coord $check_coord "radius dimension (rad2)"
204check_cross_picking $pick_coord rad2 "radius dimension (rad2)"
205
206# check sensitives "ang1"
207set pick_coord { { 112 268 } { 96 220 } { 80 250 } }
208set check_coord { 96 220 }
209check_picking $pick_coord $check_coord "angle dimension (ang1)"
210check_cross_picking $pick_coord ang1 "angle dimension (ang1)"
211
212# check sensitives "ang2"
213set pick_coord { { 139 301 } { 152 327 } { 65 297 } }
214set check_coord { 108 320 }
215check_picking $pick_coord $check_coord "angle dimension (ang2)"
216check_cross_picking $pick_coord ang2 "angle dimension (ang2)"
217
218# check sensitives "ang3"
219set pick_coord { { 171 304 } { 199 321 } { 252 285 } }
220set check_coord { 191 324 }
221check_picking $pick_coord $check_coord "angle dimension (ang3)"
222check_cross_picking $pick_coord ang3 "angle dimension (ang3)"
223
224# --------------------------------------------------- #
225# Dump selected images #
226# --------------------------------------------------- #
227
228set xmin -500
229set xmax 500
230set ymin -500
231set ymax 500
232set shift 0
233
709e97a0 234vselmode 0 1
fe83e1ea 235vselect $xmin $ymin $xmax $ymax $shift
236vdump $anImage1
237
238vselect 0 0 0 0 0
239vselmode 1 1
240vselect $xmin $ymin $xmax $ymax $shift
241vdump $anImage2
242
243vselect 0 0 0 0 0
709e97a0 244vselmode 0 1
fe83e1ea 245vselmode 2 1
246vselect $xmin $ymin $xmax $ymax $shift
247vdump $anImage3