1 /**********************************************
2 * Copyright (C) 2010 Lukas Laag
3 * This file is part of lib-gwt-svg.
4 *
5 * libgwtsvg is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * libgwtsvg is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with libgwtsvg. If not, see http://www.gnu.org/licenses/
17 **********************************************/
18 /*
19 * Copyright (c) 2004 World Wide Web Consortium,
20 *
21 * (Massachusetts Institute of Technology, European Research Consortium for
22 * Informatics and Mathematics, Keio University). All Rights Reserved. This
23 * work is distributed under the W3C(r) Software License [1] in the hope that
24 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
25 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
26 *
27 * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
28 */
29
30 package org.vectomatic.dom.svg.impl;
31
32 import org.vectomatic.dom.svg.OMSVGAnimatedBoolean;
33 import org.vectomatic.dom.svg.OMSVGAnimatedNumber;
34 import org.vectomatic.dom.svg.OMSVGAnimatedTransformList;
35 import org.vectomatic.dom.svg.OMSVGMatrix;
36 import org.vectomatic.dom.svg.OMSVGPathSegArcAbs;
37 import org.vectomatic.dom.svg.OMSVGPathSegArcRel;
38 import org.vectomatic.dom.svg.OMSVGPathSegClosePath;
39 import org.vectomatic.dom.svg.OMSVGPathSegCurvetoCubicAbs;
40 import org.vectomatic.dom.svg.OMSVGPathSegCurvetoCubicRel;
41 import org.vectomatic.dom.svg.OMSVGPathSegCurvetoCubicSmoothAbs;
42 import org.vectomatic.dom.svg.OMSVGPathSegCurvetoCubicSmoothRel;
43 import org.vectomatic.dom.svg.OMSVGPathSegCurvetoQuadraticAbs;
44 import org.vectomatic.dom.svg.OMSVGPathSegCurvetoQuadraticRel;
45 import org.vectomatic.dom.svg.OMSVGPathSegCurvetoQuadraticSmoothAbs;
46 import org.vectomatic.dom.svg.OMSVGPathSegCurvetoQuadraticSmoothRel;
47 import org.vectomatic.dom.svg.OMSVGPathSegLinetoAbs;
48 import org.vectomatic.dom.svg.OMSVGPathSegLinetoHorizontalAbs;
49 import org.vectomatic.dom.svg.OMSVGPathSegLinetoHorizontalRel;
50 import org.vectomatic.dom.svg.OMSVGPathSegLinetoRel;
51 import org.vectomatic.dom.svg.OMSVGPathSegLinetoVerticalAbs;
52 import org.vectomatic.dom.svg.OMSVGPathSegLinetoVerticalRel;
53 import org.vectomatic.dom.svg.OMSVGPathSegList;
54 import org.vectomatic.dom.svg.OMSVGPathSegMovetoAbs;
55 import org.vectomatic.dom.svg.OMSVGPathSegMovetoRel;
56 import org.vectomatic.dom.svg.OMSVGPoint;
57 import org.vectomatic.dom.svg.OMSVGRect;
58 import org.vectomatic.dom.svg.OMSVGStringList;
59
60 import com.google.gwt.core.client.JavaScriptException;
61
62 /**
63 * The {@link org.vectomatic.dom.svg.impl.SVGPathElement} interface corresponds
64 * to the <a href='http://www.w3.org/TR/SVG11/paths.html#PathElement' title='path
65 * element specification'>path</a> element.
66 */
67 public class SVGPathElement extends SVGElement {
68 protected SVGPathElement() {
69 }
70
71 // Implementation of the svg::SVGPathElement W3C IDL interface
72 /**
73 * Corresponds to attribute {@link org.vectomatic.dom.svg.impl.SVGPathElement#getPathLength()}
74 * on the given <a href='http://www.w3.org/TR/SVG11/paths.html#PathElement'
75 * title='path element specification'>path</a> element.
76 */
77 public final native OMSVGAnimatedNumber getPathLength() /*-{
78 return this.pathLength;
79 }-*/;
80 /**
81 * Returns the user agent's computed value for the total length of the path
82 * using the user agent's distance-along-a-path algorithm, as a distance in
83 * the current user coordinate system.
84 * @return The total length of the path.
85 */
86 public final native float getTotalLength() /*-{
87 return this.getTotalLength();
88 }-*/;
89 /**
90 * Returns the (x,y) coordinate in user space which is <var>distance</var>
91 * units along the path, utilizing the user agent's distance-along-a-path
92 * algorithm.
93 * @param distance The distance along the path, relative to the start of
94 * the path, as a distance in the current user coordinate system.
95 * @return The returned point in user space.
96 */
97 public final native OMSVGPoint getPointAtLength(float distance) /*-{
98 return this.getPointAtLength(distance);
99 }-*/;
100 /**
101 * Returns the index into {@link org.vectomatic.dom.svg.itf.ISVGAnimatedPathData#getPathSegList()}
102 * which is <var>distance</var> units along the path, utilizing the user agent's
103 * distance-along-a-path algorithm.
104 * @param distance The distance along the path, relative to the start of
105 * the path, as a distance in the current user coordinate system.
106 * @return The index of the path segment, where the first path segment is
107 * number 0.
108 */
109 public final native int getPathSegAtLength(float distance) /*-{
110 return this.getPathSegAtLength(distance);
111 }-*/;
112 /**
113 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegClosePath}
114 * object.
115 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegClosePath}
116 * object.
117 */
118 public final native OMSVGPathSegClosePath createSVGPathSegClosePath() /*-{
119 return this.createSVGPathSegClosePath();
120 }-*/;
121 /**
122 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegMovetoAbs}
123 * object.
124 * @param x The absolute X coordinate for the end point of this path segment.
125 * @param y The absolute Y coordinate for the end point of this path segment.
126 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegMovetoAbs}
127 * object.
128 */
129 public final native OMSVGPathSegMovetoAbs createSVGPathSegMovetoAbs(float x, float y) /*-{
130 return this.createSVGPathSegMovetoAbs(x, y);
131 }-*/;
132 /**
133 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegMovetoRel}
134 * object.
135 * @param x The relative X coordinate for the end point of this path segment.
136 * @param y The relative Y coordinate for the end point of this path segment.
137 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegMovetoRel}
138 * object.
139 */
140 public final native OMSVGPathSegMovetoRel createSVGPathSegMovetoRel(float x, float y) /*-{
141 return this.createSVGPathSegMovetoRel(x, y);
142 }-*/;
143 /**
144 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoAbs}
145 * object.
146 * @param x The absolute X coordinate for the end point of this path segment.
147 * @param y The absolute Y coordinate for the end point of this path segment.
148 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoAbs}
149 * object.
150 */
151 public final native OMSVGPathSegLinetoAbs createSVGPathSegLinetoAbs(float x, float y) /*-{
152 return this.createSVGPathSegLinetoAbs(x, y);
153 }-*/;
154 /**
155 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoRel}
156 * object.
157 * @param x The relative X coordinate for the end point of this path segment.
158 * @param y The relative Y coordinate for the end point of this path segment.
159 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoRel}
160 * object.
161 */
162 public final native OMSVGPathSegLinetoRel createSVGPathSegLinetoRel(float x, float y) /*-{
163 return this.createSVGPathSegLinetoRel(x, y);
164 }-*/;
165 /**
166 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoCubicAbs}
167 * object.
168 * @param x The absolute X coordinate for the end point of this path segment.
169 * @param y The absolute Y coordinate for the end point of this path segment.
170 * @param x1 The absolute X coordinate for the first control point.
171 * @param y1 The absolute Y coordinate for the first control point.
172 * @param x2 The absolute X coordinate for the second control point.
173 * @param y2 The absolute Y coordinate for the second control point.
174 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoCubicAbs}
175 * object.
176 */
177 public final native OMSVGPathSegCurvetoCubicAbs createSVGPathSegCurvetoCubicAbs(float x, float y, float x1, float y1, float x2, float y2) /*-{
178 return this.createSVGPathSegCurvetoCubicAbs(x, y, x1, y1, x2, y2);
179 }-*/;
180 /**
181 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoCubicRel}
182 * object.
183 * @param x The relative X coordinate for the end point of this path segment.
184 * @param y The relative Y coordinate for the end point of this path segment.
185 * @param x1 The relative X coordinate for the first control point.
186 * @param y1 The relative Y coordinate for the first control point.
187 * @param x2 The relative X coordinate for the second control point.
188 * @param y2 The relative Y coordinate for the second control point.
189 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoCubicRel}
190 * object.
191 */
192 public final native OMSVGPathSegCurvetoCubicRel createSVGPathSegCurvetoCubicRel(float x, float y, float x1, float y1, float x2, float y2) /*-{
193 return this.createSVGPathSegCurvetoCubicRel(x, y, x1, y1, x2, y2);
194 }-*/;
195 /**
196 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoQuadraticAbs}
197 * object.
198 * @param x The absolute X coordinate for the end point of this path segment.
199 * @param y The absolute Y coordinate for the end point of this path segment.
200 * @param x1 The absolute X coordinate for the first control point.
201 * @param y1 The absolute Y coordinate for the first control point.
202 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoQuadraticAbs}
203 * object.
204 */
205 public final native OMSVGPathSegCurvetoQuadraticAbs createSVGPathSegCurvetoQuadraticAbs(float x, float y, float x1, float y1) /*-{
206 return this.createSVGPathSegCurvetoQuadraticAbs(x, y, x1, y1);
207 }-*/;
208 /**
209 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoQuadraticRel}
210 * object.
211 * @param x The relative X coordinate for the end point of this path segment.
212 * @param y The relative Y coordinate for the end point of this path segment.
213 * @param x1 The relative X coordinate for the first control point.
214 * @param y1 The relative Y coordinate for the first control point.
215 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoQuadraticRel}
216 * object.
217 */
218 public final native OMSVGPathSegCurvetoQuadraticRel createSVGPathSegCurvetoQuadraticRel(float x, float y, float x1, float y1) /*-{
219 return this.createSVGPathSegCurvetoQuadraticRel(x, y, x1, y1);
220 }-*/;
221 /**
222 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegArcAbs}
223 * object.
224 * @param x The absolute X coordinate for the end point of this path segment.
225 * @param y The absolute Y coordinate for the end point of this path segment.
226 * @param r1 The x-axis radius for the ellipse (i.e., r1).
227 * @param r2 The y-axis radius for the ellipse (i.e., r2).
228 * @param angle The rotation angle in degrees for the ellipse's x-axis relative
229 * to the x-axis of the user coordinate system.
230 * @param largeArcFlag The value of the large-arc-flag parameter.
231 * @param sweepFlag The value of the large-arc-flag parameter.
232 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegArcAbs}
233 * object.
234 */
235 public final native OMSVGPathSegArcAbs createSVGPathSegArcAbs(float x, float y, float r1, float r2, float angle, boolean largeArcFlag, boolean sweepFlag) /*-{
236 return this.createSVGPathSegArcAbs(x, y, r1, r2, angle, largeArcFlag, sweepFlag);
237 }-*/;
238 /**
239 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegArcRel}
240 * object.
241 * @param x The relative X coordinate for the end point of this path segment.
242 * @param y The relative Y coordinate for the end point of this path segment.
243 * @param r1 The x-axis radius for the ellipse (i.e., r1).
244 * @param r2 The y-axis radius for the ellipse (i.e., r2).
245 * @param angle The rotation angle in degrees for the ellipse's x-axis relative
246 * to the x-axis of the user coordinate system.
247 * @param largeArcFlag The value of the large-arc-flag parameter.
248 * @param sweepFlag The value of the large-arc-flag parameter.
249 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegArcRel}
250 * object.
251 */
252 public final native OMSVGPathSegArcRel createSVGPathSegArcRel(float x, float y, float r1, float r2, float angle, boolean largeArcFlag, boolean sweepFlag) /*-{
253 return this.createSVGPathSegArcRel(x, y, r1, r2, angle, largeArcFlag, sweepFlag);
254 }-*/;
255 /**
256 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoHorizontalAbs}
257 * object.
258 * @param x The absolute X coordinate for the end point of this path segment.
259 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoHorizontalAbs}
260 * object.
261 */
262 public final native OMSVGPathSegLinetoHorizontalAbs createSVGPathSegLinetoHorizontalAbs(float x) /*-{
263 return this.createSVGPathSegLinetoHorizontalAbs(x);
264 }-*/;
265 /**
266 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoHorizontalRel}
267 * object.
268 * @param x The relative X coordinate for the end point of this path segment.
269 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoHorizontalRel}
270 * object.
271 */
272 public final native OMSVGPathSegLinetoHorizontalRel createSVGPathSegLinetoHorizontalRel(float x) /*-{
273 return this.createSVGPathSegLinetoHorizontalRel(x);
274 }-*/;
275 /**
276 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoVerticalAbs}
277 * object.
278 * @param y The absolute Y coordinate for the end point of this path segment.
279 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoVerticalAbs}
280 * object.
281 */
282 public final native OMSVGPathSegLinetoVerticalAbs createSVGPathSegLinetoVerticalAbs(float y) /*-{
283 return this.createSVGPathSegLinetoVerticalAbs(y);
284 }-*/;
285 /**
286 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoVerticalRel}
287 * object.
288 * @param y The relative Y coordinate for the end point of this path segment.
289 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoVerticalRel}
290 * object.
291 */
292 public final native OMSVGPathSegLinetoVerticalRel createSVGPathSegLinetoVerticalRel(float y) /*-{
293 return this.createSVGPathSegLinetoVerticalRel(y);
294 }-*/;
295 /**
296 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoCubicSmoothAbs}
297 * object.
298 * @param x The absolute X coordinate for the end point of this path segment.
299 * @param y The absolute Y coordinate for the end point of this path segment.
300 * @param x2 The absolute X coordinate for the second control point.
301 * @param y2 The absolute Y coordinate for the second control point.
302 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoCubicSmoothAbs}
303 * object.
304 */
305 public final native OMSVGPathSegCurvetoCubicSmoothAbs createSVGPathSegCurvetoCubicSmoothAbs(float x, float y, float x2, float y2) /*-{
306 return this.createSVGPathSegCurvetoCubicSmoothAbs(x, y, x2, y2);
307 }-*/;
308 /**
309 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoCubicSmoothRel}
310 * object.
311 * @param x The relative X coordinate for the end point of this path segment.
312 * @param y The relative Y coordinate for the end point of this path segment.
313 * @param x2 The relative X coordinate for the second control point.
314 * @param y2 The relative Y coordinate for the second control point.
315 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoCubicSmoothRel}
316 * object.
317 */
318 public final native OMSVGPathSegCurvetoCubicSmoothRel createSVGPathSegCurvetoCubicSmoothRel(float x, float y, float x2, float y2) /*-{
319 return this.createSVGPathSegCurvetoCubicSmoothRel(x, y, x2, y2);
320 }-*/;
321 /**
322 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoQuadraticSmoothAbs}
323 * object.
324 * @param x The absolute X coordinate for the end point of this path segment.
325 * @param y The absolute Y coordinate for the end point of this path segment.
326 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoQuadraticSmoothAbs}
327 * object.
328 */
329 public final native OMSVGPathSegCurvetoQuadraticSmoothAbs createSVGPathSegCurvetoQuadraticSmoothAbs(float x, float y) /*-{
330 return this.createSVGPathSegCurvetoQuadraticSmoothAbs(x, y);
331 }-*/;
332 /**
333 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoQuadraticSmoothRel}
334 * object.
335 * @param x The relative X coordinate for the end point of this path segment.
336 * @param y The relative Y coordinate for the end point of this path segment.
337 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoQuadraticSmoothRel}
338 * object.
339 */
340 public final native OMSVGPathSegCurvetoQuadraticSmoothRel createSVGPathSegCurvetoQuadraticSmoothRel(float x, float y) /*-{
341 return this.createSVGPathSegCurvetoQuadraticSmoothRel(x, y);
342 }-*/;
343
344 // Implementation of the svg::SVGAnimatedPathData W3C IDL interface
345 /**
346 * Provides access to the base (i.e., static) contents of the <span class='attr-name'>'d'</span>
347 * attribute in a form which matches one-for-one with SVG's syntax. Thus,
348 * if the <span class='attr-name'>'d'</span> attribute has an "absolute moveto
349 * (M)" and an "absolute arcto (A)" command, then {@link org.vectomatic.dom.svg.itf.ISVGAnimatedPathData#getPathSegList()}
350 * will have two entries: a SVG_PATHSEG_MOVETO_ABS and a SVG_PATHSEG_ARC_ABS.
351 */
352 public final native OMSVGPathSegList getPathSegList() /*-{
353 return @org.vectomatic.dom.svg.OMNode::convertList(Lcom/google/gwt/core/client/JavaScriptObject;)(this.pathSegList);
354 }-*/;
355 /**
356 * <p>Provides access to the base (i.e., static) contents of the <span class='attr-name'>'d'</span>
357 * attribute in a form where all path data commands are expressed in terms
358 * of the following subset of {@link org.vectomatic.dom.svg.OMSVGPathSeg}
359 * types: SVG_PATHSEG_MOVETO_ABS (M), SVG_PATHSEG_LINETO_ABS (L), SVG_PATHSEG_CURVETO_CUBIC_ABS
360 * (C) and SVG_PATHSEG_CLOSEPATH (z). Thus, if the <span class='attr-name'>'d'</span>
361 * attribute has an "absolute moveto (M)" and an "absolute arcto (A)" command,
362 * then pathSegList will have one SVG_PATHSEG_MOVETO_ABS entry followed by
363 * a series of SVG_PATHSEG_LINETO_ABS entries which approximate the arc. This
364 * alternate representation is available to provide a simpler interface to
365 * developers who would benefit from a more limited set of commands.</p> <p>The
366 * only valid {@link org.vectomatic.dom.svg.OMSVGPathSeg} types are SVG_PATHSEG_MOVETO_ABS
367 * (M), SVG_PATHSEG_LINETO_ABS (L), SVG_PATHSEG_CURVETO_CUBIC_ABS (C) and
368 * SVG_PATHSEG_CLOSEPATH (z).</p>
369 */
370 public final native OMSVGPathSegList getNormalizedPathSegList() /*-{
371 return @org.vectomatic.dom.svg.OMNode::convertList(Lcom/google/gwt/core/client/JavaScriptObject;)(this.normalizedPathSegList);
372 }-*/;
373 /**
374 * Provides access to the current animated contents of the <span class='attr-name'>'d'</span>
375 * attribute in a form which matches one-for-one with SVG's syntax. If the
376 * given attribute or property is being animated, contains the current animated
377 * value of the attribute or property, and both the object itself and its
378 * contents are read only. If the given attribute or property is not currently
379 * being animated, contains the same value as {@link org.vectomatic.dom.svg.itf.ISVGAnimatedPathData#getPathSegList()}.
380 */
381 public final native OMSVGPathSegList getAnimatedPathSegList() /*-{
382 return @org.vectomatic.dom.svg.OMNode::convertList(Lcom/google/gwt/core/client/JavaScriptObject;)(this.animatedPathSegList);
383 }-*/;
384 /**
385 * Provides access to the current animated contents of the <span class='attr-name'>'d'</span>
386 * attribute in a form where all path data commands are expressed in terms
387 * of the following subset of {@link org.vectomatic.dom.svg.OMSVGPathSeg}
388 * types: SVG_PATHSEG_MOVETO_ABS (M), SVG_PATHSEG_LINETO_ABS (L), SVG_PATHSEG_CURVETO_CUBIC_ABS
389 * (C) and SVG_PATHSEG_CLOSEPATH (z). If the given attribute or property is
390 * being animated, contains the current animated value of the attribute or
391 * property, and both the object itself and its contents are read only. If
392 * the given attribute or property is not currently being animated, contains
393 * the same value as {@link org.vectomatic.dom.svg.itf.ISVGAnimatedPathData#getNormalizedPathSegList()}.
394 */
395 public final native OMSVGPathSegList getAnimatedNormalizedPathSegList() /*-{
396 return @org.vectomatic.dom.svg.OMNode::convertList(Lcom/google/gwt/core/client/JavaScriptObject;)(this.animatedNormalizedPathSegList);
397 }-*/;
398
399 // Implementation of the svg::SVGExternalResourcesRequired W3C IDL interface
400 /**
401 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
402 * on the given element. Note that the SVG DOM defines the attribute {@link
403 * org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
404 * as being of type {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean}, whereas
405 * the SVG language definition says that {@link org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
406 * is not animated. Because the SVG language definition states that {@link
407 * org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
408 * cannot be animated, the {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean#getAnimVal()}
409 * will always be the same as the {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean#getBaseVal()}.
410 */
411 public final native OMSVGAnimatedBoolean getExternalResourcesRequired() /*-{
412 return this.externalResourcesRequired;
413 }-*/;
414
415 // Implementation of the svg::SVGLangSpace W3C IDL interface
416 /**
417 * Corresponds to attribute <code>xml:lang</code> on the given element.
418 */
419 public final native String getXmllang() /*-{
420 return this.xmllang;
421 }-*/;
422 /**
423 * Corresponds to attribute <code>xml:lang</code> on the given element.
424 * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an attempt
425 * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only
426 * attribute</a>.
427 */
428 public final native void setXmllang(String value) throws JavaScriptException /*-{
429 this.xmllang = value;
430 }-*/;
431 /**
432 * Corresponds to attribute <code>xml:space</code> on the given element.
433 */
434 public final native String getXmlspace() /*-{
435 return this.xmlspace;
436 }-*/;
437 /**
438 * Corresponds to attribute <code>xml:space</code> on the given element.
439 * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an attempt
440 * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only
441 * attribute</a>.
442 */
443 public final native void setXmlspace(String value) throws JavaScriptException /*-{
444 this.xmlspace = value;
445 }-*/;
446
447 // Implementation of the svg::SVGLocatable W3C IDL interface
448 /**
449 * The element which established the current viewport. Often, the nearest
450 * ancestor <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' title='svg
451 * element specification'>svg</a> element. Null if the current element is
452 * the outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
453 * title='svg element specification'>svg</a> element.
454 */
455 public final native SVGElement getNearestViewportElement() /*-{
456 return this.nearestViewportElement;
457 }-*/;
458 /**
459 * The farthest ancestor <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
460 * title='svg element specification'>svg</a> element. Null if the current
461 * element is the outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
462 * title='svg element specification'>svg</a> element.
463 */
464 public final native SVGElement getFarthestViewportElement() /*-{
465 return this.farthestViewportElement;
466 }-*/;
467 /**
468 * Returns the tight bounding box in current user space (i.e., after application
469 * of the <code>transform</code> attribute, if any) on the geometry of all
470 * contained graphics elements, exclusive of stroking, clipping, masking and
471 * filter effects). Note that getBBox must return the actual bounding box
472 * at the time the method was called, even in case the element has not yet
473 * been rendered.
474 * @return An {@link org.vectomatic.dom.svg.OMSVGRect} object that defines
475 * the bounding box.
476 */
477 public final native OMSVGRect getBBox() /*-{
478 return this.getBBox();
479 }-*/;
480 /**
481 * Returns the transformation matrix from current user units (i.e., after
482 * application of the <code>transform</code> attribute, if any) to the viewport
483 * coordinate system for the {@link org.vectomatic.dom.svg.itf.ISVGLocatable#getNearestViewportElement()}.
484 * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines
485 * the CTM.
486 */
487 public final native OMSVGMatrix getCTM() /*-{
488 return this.getCTM();
489 }-*/;
490 /**
491 * Returns the transformation matrix from current user units (i.e., after
492 * application of the <code>transform</code> attribute, if any) to the parent
493 * user agent's notice of a "pixel". For display devices, ideally this represents
494 * a physical screen pixel. For other devices or environments where physical
495 * pixel sizes are not known, then an algorithm similar to the CSS2 definition
496 * of a "pixel" can be used instead. Note that null is returned if this element
497 * is not hooked into the document tree. This method would have been more
498 * aptly named as <code>getClientCTM</code>, but the name <code>getScreenCTM</code>
499 * is kept for historical reasons.
500 * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines
501 * the given transformation matrix.
502 */
503 public final native OMSVGMatrix getScreenCTM() /*-{
504 return this.getScreenCTM();
505 }-*/;
506 /**
507 * Returns the transformation matrix from the user coordinate system on the
508 * current element (after application of the <code>transform</code> attribute,
509 * if any) to the user coordinate system on parameter <var>element</var> (after
510 * application of its <code>transform</code> attribute, if any).
511 * @param element The target element.
512 * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines
513 * the transformation.
514 * @throws SVGException(SVG_MATRIX_NOT_INVERTABLE) Raised if the currently
515 * defined transformation matrices make it impossible to compute the given
516 * matrix (e.g., because one of the transformations is singular).
517 */
518 public final native OMSVGMatrix getTransformToElement(SVGElement element) throws JavaScriptException /*-{
519 return this.getTransformToElement(element);
520 }-*/;
521
522 // Implementation of the svg::SVGTests W3C IDL interface
523 /**
524 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTests#getRequiredFeatures()}
525 * on the given element.
526 */
527 public final native OMSVGStringList getRequiredFeatures() /*-{
528 return @org.vectomatic.dom.svg.OMNode::convertList(Lcom/google/gwt/core/client/JavaScriptObject;)(this.requiredFeatures);
529 }-*/;
530 /**
531 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTests#getRequiredExtensions()}
532 * on the given element.
533 */
534 public final native OMSVGStringList getRequiredExtensions() /*-{
535 return @org.vectomatic.dom.svg.OMNode::convertList(Lcom/google/gwt/core/client/JavaScriptObject;)(this.requiredExtensions);
536 }-*/;
537 /**
538 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTests#getSystemLanguage()}
539 * on the given element.
540 */
541 public final native OMSVGStringList getSystemLanguage() /*-{
542 return @org.vectomatic.dom.svg.OMNode::convertList(Lcom/google/gwt/core/client/JavaScriptObject;)(this.systemLanguage);
543 }-*/;
544 /**
545 * Returns true if the user agent supports the given extension, specified
546 * by a URI.
547 * @param extension The name of the extension, expressed as a URI.
548 * @return True or false, depending on whether the given extension is supported.
549 */
550 public final native boolean hasExtension(String extension) /*-{
551 return this.hasExtension(extension);
552 }-*/;
553
554 // Implementation of the svg::SVGTransformable W3C IDL interface
555 /**
556 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTransformable#getTransform()}
557 * on the given element.
558 */
559 public final native OMSVGAnimatedTransformList getTransform() /*-{
560 return this.transform;
561 }-*/;
562
563 }