Debian Codegraph @

samples/tests/spec/scripting/intersectionList2.svg

raw
1 <?xml version="1.0" standalone="no"?>
2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000802//EN"
3 "http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.dtd">
4
5 <!--
6
7 Licensed to the Apache Software Foundation (ASF) under one or more
8 contributor license agreements. See the NOTICE file distributed with
9 this work for additional information regarding copyright ownership.
10 The ASF licenses this file to You under the Apache License, Version 2.0
11 (the "License"); you may not use this file except in compliance with
12 the License. You may obtain a copy of the License at
13
14 http://www.apache.org/licenses/LICENSE-2.0
15
16 Unless required by applicable law or agreed to in writing, software
17 distributed under the License is distributed on an "AS IS" BASIS,
18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 See the License for the specific language governing permissions and
20 limitations under the License.
21
22 -->
23
24 <!-- ====================================================================== -->
25 <!-- Testing the getIntersectionList interface on the svg:svg element. -->
26 <!-- -->
27 <!-- @author [email protected] -->
28 <!-- @version $Id$ -->
29 <!-- ====================================================================== -->
30
31 <?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>
32
33 <svg id="body" width="450" height="500" viewBox="0 0 450 500"
34 onload="onLoad()"
35 xmlns="http://www.w3.org/2000/svg"
36 xmlns:xlink="http://www.w3.org/1999/xlink" >
37
38 <title>Test of getIntersectionList interface</title>
39 <text x="50%" y="40" class="title">Test of getIntersectionList interface</text>
40
41 <script type="text/ecmascript"><![CDATA[
42 var svgns = "http://www.w3.org/2000/svg";
43 var root;
44 var rect;
45 function onLoad() {
46 root = document.getRootElement();
47 rect = root.createSVGRect();
48 doCheck("painted");
49 doCheck("fill");
50 doCheck("stroke");
51 doCheck("all");
52 doCheck("none");
53 doCheck("visible");
54 doCheck("visiblePainted");
55 doCheck("visibleFill");
56 doCheck("visibleStroke");
57 }
58
59 function setRect(r, x, y, w, h) {
60 r.x = x;
61 r.y = y;
62 r.width = w;
63 r.height = h;
64 }
65
66 function doCheck2(svg, rect, base) {
67 var elem = root.getElementById(base);
68 var lstE = root.getElementById(base+"-lst");
69 var chkE = root.getElementById(base+"-chk");
70
71 var lst = svg.getIntersectionList(rect, null);
72 if ((lst.getLength() != 0) && (lst.item(0) == elem))
73 lstE.setAttribute("fill", "gold");
74 else lstE.setAttribute("fill", "crimson");
75
76 if (svg.checkIntersection(elem, rect))
77 chkE.setAttribute("fill", "gold");
78 else chkE.setAttribute("fill", "crimson");
79 }
80
81 function doCheck(name) {
82 var svg = root.getElementById(name);
83 setRect(rect, 110, 10, 40, 40);
84 doCheck2(svg, rect, "path-"+name);
85 setRect(rect, 180, 10, 55, 40);
86 doCheck2(svg, rect, "simple-"+name);
87 setRect(rect, 285, 10, 30, 40);
88 doCheck2(svg, rect, "complex-"+name);
89 }
90
91 ]]></script>
92
93 <g id="test-content" >
94 <g pointer-events="painted" transform="translate(0,40)">
95 <rect x="5" y="5" width="440" height="50" fill="#DDD" stroke="#000"/>
96 <line x1="105" y1="5" x2="105" y2="55" stroke="#000" />
97 <line x1="175" y1="5" x2="175" y2="55" stroke="#000" />
98 <line x1="255" y1="5" x2="255" y2="55" stroke="#000" />
99 <line x1="345" y1="5" x2="345" y2="55" stroke="#000" />
100 <text x="25" y="35">Painted</text>
101
102 <svg id="painted" fill="black" font-size="16"
103 font-weight="bold" text-anchor="middle">
104 <path id="path-painted" stroke="black" fill="white"
105 d="M115,45 c 0,-15 15,-30 30-30 v30z"/>
106 <text id="simple-painted" x="210" y="36">simple</text>
107 <text x="295" y="36" pointer-events="none">c<tspan fill="blue"
108 >om<tspan id="complex-painted" font-style="italic" pointer-events="painted"
109 >pl</tspan>e</tspan>x</text>
110 </svg>
111 <rect id="path-painted-lst" x="160" y="15" width="10" height="10"
112 stroke-width="1" stroke="#000" fill="#888"/>
113 <rect id="path-painted-chk" x="160" y="35" width="10" height="10"
114 stroke-width="1" stroke="#000" fill="#888"/>
115
116 <rect id="simple-painted-lst" x="240" y="15" width="10" height="10"
117 stroke-width="1" stroke="#000" fill="#888"/>
118 <rect id="simple-painted-chk" x="240" y="35" width="10" height="10"
119 stroke-width="1" stroke="#000" fill="#888"/>
120
121 <rect id="complex-painted-lst" x="330" y="15" width="10" height="10"
122 stroke-width="1" stroke="#000" fill="#888"/>
123 <rect id="complex-painted-chk" x="330" y="35" width="10" height="10"
124 stroke-width="1" stroke="#000" fill="#888"/>
125 </g>
126
127 <g pointer-events="fill" transform="translate(0, 90)">
128 <rect x="5" y="5" width="440" height="50" fill="#EEE" stroke="#000"/>
129 <line x1="105" y1="5" x2="105" y2="55" stroke="#000" />
130 <line x1="175" y1="5" x2="175" y2="55" stroke="#000" />
131 <line x1="255" y1="5" x2="255" y2="55" stroke="#000" />
132 <line x1="345" y1="5" x2="345" y2="55" stroke="#000" />
133 <text x="25" y="35">Fill</text>
134
135 <svg id="fill" fill="black" font-size="16"
136 font-weight="bold" text-anchor="middle">
137 <path id="path-fill" stroke="black" fill="white"
138 d="M115,45 c 0,-15 15,-30 30-30 v30z"/>
139 <text id="simple-fill" x="210" y="36">simple</text>
140 <text x="295" y="36" pointer-events="none">c<tspan fill="blue"
141 >om<tspan id="complex-fill" font-style="italic" pointer-events="fill"
142 >pl</tspan>e</tspan>x</text>
143 </svg>
144 <rect id="path-fill-lst" x="160" y="15" width="10" height="10"
145 stroke-width="1" stroke="#000" fill="#888"/>
146 <rect id="path-fill-chk" x="160" y="35" width="10" height="10"
147 stroke-width="1" stroke="#000" fill="#888"/>
148
149 <rect id="simple-fill-lst" x="240" y="15" width="10" height="10"
150 stroke-width="1" stroke="#000" fill="#888"/>
151 <rect id="simple-fill-chk" x="240" y="35" width="10" height="10"
152 stroke-width="1" stroke="#000" fill="#888"/>
153
154 <rect id="complex-fill-lst" x="330" y="15" width="10" height="10"
155 stroke-width="1" stroke="#000" fill="#888"/>
156 <rect id="complex-fill-chk" x="330" y="35" width="10" height="10"
157 stroke-width="1" stroke="#000" fill="#888"/>
158 </g>
159
160 <g pointer-events="stroke" transform="translate(0,140)">
161 <rect x="5" y="5" width="440" height="50" fill="#DDD" stroke="#000"/>
162 <line x1="105" y1="5" x2="105" y2="55" stroke="#000" />
163 <line x1="175" y1="5" x2="175" y2="55" stroke="#000" />
164 <line x1="255" y1="5" x2="255" y2="55" stroke="#000" />
165 <line x1="345" y1="5" x2="345" y2="55" stroke="#000" />
166 <text x="25" y="35">Stroke</text>
167
168 <svg id="stroke" fill="black" font-size="16"
169 font-weight="bold" text-anchor="middle">
170 <path id="path-stroke" stroke="black" fill="white"
171 d="M115,45 c 0,-15 15,-30 30-30 v30z"/>
172 <text id="simple-stroke" x="210" y="36">simple</text>
173 <text x="295" y="36" pointer-events="none">c<tspan fill="blue"
174 >om<tspan id="complex-stroke" font-style="italic" pointer-events="stroke"
175 >pl</tspan>e</tspan>x</text>
176 </svg>
177 <rect id="path-stroke-lst" x="160" y="15" width="10" height="10"
178 stroke-width="1" stroke="#000" fill="#888"/>
179 <rect id="path-stroke-chk" x="160" y="35" width="10" height="10"
180 stroke-width="1" stroke="#000" fill="#888"/>
181
182 <rect id="simple-stroke-lst" x="240" y="15" width="10" height="10"
183 stroke-width="1" stroke="#000" fill="#888"/>
184 <rect id="simple-stroke-chk" x="240" y="35" width="10" height="10"
185 stroke-width="1" stroke="#000" fill="#888"/>
186
187 <rect id="complex-stroke-lst" x="330" y="15" width="10" height="10"
188 stroke-width="1" stroke="#000" fill="#888"/>
189 <rect id="complex-stroke-chk" x="330" y="35" width="10" height="10"
190 stroke-width="1" stroke="#000" fill="#888"/>
191 </g>
192
193 <g pointer-events="all" transform="translate(0,190)">
194 <rect x="5" y="5" width="440" height="50" fill="#EEE" stroke="#000"/>
195 <line x1="105" y1="5" x2="105" y2="55" stroke="#000" />
196 <line x1="175" y1="5" x2="175" y2="55" stroke="#000" />
197 <line x1="255" y1="5" x2="255" y2="55" stroke="#000" />
198 <line x1="345" y1="5" x2="345" y2="55" stroke="#000" />
199 <text x="25" y="35">All</text>
200
201 <svg id="all" fill="black" font-size="16"
202 font-weight="bold" text-anchor="middle">
203 <path id="path-all" stroke="black" fill="white"
204 d="M115,45 c 0,-15 15,-30 30-30 v30z"/>
205 <text id="simple-all" x="210" y="36">simple</text>
206 <text x="295" y="36" pointer-events="none">c<tspan fill="blue"
207 >om<tspan id="complex-all" font-style="italic" pointer-events="all"
208 >pl</tspan>e</tspan>x</text>
209 </svg>
210 <rect id="path-all-lst" x="160" y="15" width="10" height="10"
211 stroke-width="1" stroke="#000" fill="#888"/>
212 <rect id="path-all-chk" x="160" y="35" width="10" height="10"
213 stroke-width="1" stroke="#000" fill="#888"/>
214
215 <rect id="simple-all-lst" x="240" y="15" width="10" height="10"
216 stroke-width="1" stroke="#000" fill="#888"/>
217 <rect id="simple-all-chk" x="240" y="35" width="10" height="10"
218 stroke-width="1" stroke="#000" fill="#888"/>
219
220 <rect id="complex-all-lst" x="330" y="15" width="10" height="10"
221 stroke-width="1" stroke="#000" fill="#888"/>
222 <rect id="complex-all-chk" x="330" y="35" width="10" height="10"
223 stroke-width="1" stroke="#000" fill="#888"/>
224 </g>
225
226 <g pointer-events="none" transform="translate(0,240)">
227 <rect x="5" y="5" width="440" height="50" fill="#DDD" stroke="#000"/>
228 <line x1="105" y1="5" x2="105" y2="55" stroke="#000" />
229 <line x1="175" y1="5" x2="175" y2="55" stroke="#000" />
230 <line x1="255" y1="5" x2="255" y2="55" stroke="#000" />
231 <line x1="345" y1="5" x2="345" y2="55" stroke="#000" />
232 <text x="25" y="35">None</text>
233
234 <svg id="none" fill="black" font-size="16"
235 font-weight="bold" text-anchor="middle">
236 <path id="path-none" stroke="black" fill="white"
237 d="M115,45 c 0,-15 15,-30 30-30 v30z"/>
238 <text id="simple-none" x="210" y="36">simple</text>
239 <text x="295" y="36" pointer-events="none">c<tspan fill="blue"
240 >om<tspan id="complex-none" font-style="italic" pointer-events="none"
241 >pl</tspan>e</tspan>x</text>
242 </svg>
243 <rect id="path-none-lst" x="160" y="15" width="10" height="10"
244 stroke-width="1" stroke="#000" fill="#888"/>
245 <rect id="path-none-chk" x="160" y="35" width="10" height="10"
246 stroke-width="1" stroke="#000" fill="#888"/>
247
248 <rect id="simple-none-lst" x="240" y="15" width="10" height="10"
249 stroke-width="1" stroke="#000" fill="#888"/>
250 <rect id="simple-none-chk" x="240" y="35" width="10" height="10"
251 stroke-width="1" stroke="#000" fill="#888"/>
252
253 <rect id="complex-none-lst" x="330" y="15" width="10" height="10"
254 stroke-width="1" stroke="#000" fill="#888"/>
255 <rect id="complex-none-chk" x="330" y="35" width="10" height="10"
256 stroke-width="1" stroke="#000" fill="#888"/>
257 </g>
258
259 <g pointer-events="visible" transform="translate(0,290)">
260 <rect x="5" y="5" width="440" height="50" fill="#EEE" stroke="#000"/>
261 <line x1="105" y1="5" x2="105" y2="55" stroke="#000" />
262 <line x1="175" y1="5" x2="175" y2="55" stroke="#000" />
263 <line x1="255" y1="5" x2="255" y2="55" stroke="#000" />
264 <line x1="345" y1="5" x2="345" y2="55" stroke="#000" />
265 <text x="25" y="35">Visible</text>
266
267 <svg id="visible" fill="black" font-size="16"
268 font-weight="bold" text-anchor="middle">
269 <path id="path-visible" stroke="black" fill="white"
270 d="M115,45 c 0,-15 15,-30 30-30 v30z"/>
271 <text id="simple-visible" x="210" y="36">simple</text>
272 <text x="295" y="36" pointer-events="none">c<tspan fill="blue"
273 >om<tspan id="complex-visible" font-style="italic" pointer-events="visible"
274 >pl</tspan>e</tspan>x</text>
275 </svg>
276 <rect id="path-visible-lst" x="160" y="15" width="10" height="10"
277 stroke-width="1" stroke="#000" fill="#888"/>
278 <rect id="path-visible-chk" x="160" y="35" width="10" height="10"
279 stroke-width="1" stroke="#000" fill="#888"/>
280
281 <rect id="simple-visible-lst" x="240" y="15" width="10" height="10"
282 stroke-width="1" stroke="#000" fill="#888"/>
283 <rect id="simple-visible-chk" x="240" y="35" width="10" height="10"
284 stroke-width="1" stroke="#000" fill="#888"/>
285
286 <rect id="complex-visible-lst" x="330" y="15" width="10" height="10"
287 stroke-width="1" stroke="#000" fill="#888"/>
288 <rect id="complex-visible-chk" x="330" y="35" width="10" height="10"
289 stroke-width="1" stroke="#000" fill="#888"/>
290 </g>
291
292 <g pointer-events="visiblePainted"
293 transform="translate(0,340)">
294 <rect x="5" y="5" width="440" height="50" fill="#DDD" stroke="#000"/>
295 <line x1="105" y1="5" x2="105" y2="55" stroke="#000" />
296 <line x1="175" y1="5" x2="175" y2="55" stroke="#000" />
297 <line x1="255" y1="5" x2="255" y2="55" stroke="#000" />
298 <line x1="345" y1="5" x2="345" y2="55" stroke="#000" />
299 <text x="25" y="35">VisiblePainted</text>
300
301 <svg id="visiblePainted" fill="black" font-size="16"
302 font-weight="bold" text-anchor="middle">
303 <path id="path-visiblePainted" stroke="black" fill="white"
304 d="M115,45 c 0,-15 15,-30 30-30 v30z"/>
305 <text id="simple-visiblePainted" x="210" y="36">simple</text>
306 <text x="295" y="36" pointer-events="none">c<tspan fill="blue"
307 >om<tspan id="complex-visiblePainted" font-style="italic" pointer-events="visiblePainted"
308 >pl</tspan>e</tspan>x</text>
309 </svg>
310 <rect id="path-visiblePainted-lst" x="160" y="15" width="10" height="10"
311 stroke-width="1" stroke="#000" fill="#888"/>
312 <rect id="path-visiblePainted-chk" x="160" y="35" width="10" height="10"
313 stroke-width="1" stroke="#000" fill="#888"/>
314
315 <rect id="simple-visiblePainted-lst" x="240" y="15" width="10" height="10"
316 stroke-width="1" stroke="#000" fill="#888"/>
317 <rect id="simple-visiblePainted-chk" x="240" y="35" width="10" height="10"
318 stroke-width="1" stroke="#000" fill="#888"/>
319
320 <rect id="complex-visiblePainted-lst" x="330" y="15" width="10" height="10"
321 stroke-width="1" stroke="#000" fill="#888"/>
322 <rect id="complex-visiblePainted-chk" x="330" y="35" width="10" height="10"
323 stroke-width="1" stroke="#000" fill="#888"/>
324 </g>
325
326 <g pointer-events="visibleFill"
327 transform="translate(0,390)">
328 <rect x="5" y="5" width="440" height="50" fill="#EEE" stroke="#000"/>
329 <line x1="105" y1="5" x2="105" y2="55" stroke="#000" />
330 <line x1="175" y1="5" x2="175" y2="55" stroke="#000" />
331 <line x1="255" y1="5" x2="255" y2="55" stroke="#000" />
332 <line x1="345" y1="5" x2="345" y2="55" stroke="#000" />
333 <text x="25" y="35">VisibleFill</text>
334
335 <svg id="visibleFill" fill="black" font-size="16"
336 font-weight="bold" text-anchor="middle">
337 <path id="path-visibleFill" stroke="black" fill="white"
338 d="M115,45 c 0,-15 15,-30 30-30 v30z"/>
339 <text id="simple-visibleFill" x="210" y="36">simple</text>
340 <text x="295" y="36" pointer-events="none">c<tspan fill="blue"
341 >om<tspan id="complex-visibleFill" font-style="italic" pointer-events="visibleFill"
342 >pl</tspan>e</tspan>x</text>
343 </svg>
344 <rect id="path-visibleFill-lst" x="160" y="15" width="10" height="10"
345 stroke-width="1" stroke="#000" fill="#888"/>
346 <rect id="path-visibleFill-chk" x="160" y="35" width="10" height="10"
347 stroke-width="1" stroke="#000" fill="#888"/>
348
349 <rect id="simple-visibleFill-lst" x="240" y="15" width="10" height="10"
350 stroke-width="1" stroke="#000" fill="#888"/>
351 <rect id="simple-visibleFill-chk" x="240" y="35" width="10" height="10"
352 stroke-width="1" stroke="#000" fill="#888"/>
353
354 <rect id="complex-visibleFill-lst" x="330" y="15" width="10" height="10"
355 stroke-width="1" stroke="#000" fill="#888"/>
356 <rect id="complex-visibleFill-chk" x="330" y="35" width="10" height="10"
357 stroke-width="1" stroke="#000" fill="#888"/>
358 </g>
359
360 <g pointer-events="visibleStroke"
361 transform="translate(0,440)">
362 <rect x="5" y="5" width="440" height="50" fill="#DDD" stroke="#000"/>
363 <line x1="105" y1="5" x2="105" y2="55" stroke="#000" />
364 <line x1="175" y1="5" x2="175" y2="55" stroke="#000" />
365 <line x1="255" y1="5" x2="255" y2="55" stroke="#000" />
366 <line x1="345" y1="5" x2="345" y2="55" stroke="#000" />
367 <text x="25" y="35">VisibleStroke</text>
368
369 <svg id="visibleStroke" fill="black" font-size="16"
370 font-weight="bold" text-anchor="middle">
371 <path id="path-visibleStroke" stroke="black" fill="white"
372 d="M115,45 c 0,-15 15,-30 30-30 v30z"/>
373 <text id="simple-visibleStroke" x="210" y="36">simple</text>
374 <text x="295" y="36" pointer-events="none">c<tspan fill="blue"
375 >om<tspan id="complex-visibleStroke" font-style="italic" pointer-events="visibleStroke"
376 >pl</tspan>e</tspan>x</text>
377 </svg>
378 <rect id="path-visibleStroke-lst" x="160" y="15" width="10" height="10"
379 stroke-width="1" stroke="#000" fill="#888"/>
380 <rect id="path-visibleStroke-chk" x="160" y="35" width="10" height="10"
381 stroke-width="1" stroke="#000" fill="#888"/>
382
383 <rect id="simple-visibleStroke-lst" x="240" y="15" width="10" height="10"
384 stroke-width="1" stroke="#000" fill="#888"/>
385 <rect id="simple-visibleStroke-chk" x="240" y="35" width="10" height="10"
386 stroke-width="1" stroke="#000" fill="#888"/>
387
388 <rect id="complex-visibleStroke-lst" x="330" y="15" width="10" height="10"
389 stroke-width="1" stroke="#000" fill="#888"/>
390 <rect id="complex-visibleStroke-chk" x="330" y="35" width="10" height="10"
391 stroke-width="1" stroke="#000" fill="#888"/>
392 </g>
393 </g>
394 </svg>