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