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