View Javadoc

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.OMSVGAnimatedTransformList;
33  import org.vectomatic.dom.svg.OMSVGMatrix;
34  import org.vectomatic.dom.svg.OMSVGRect;
35  
36  import com.google.gwt.core.client.JavaScriptException;
37  
38  /**
39   * The {@link org.vectomatic.dom.svg.impl.SVGTextElement} interface corresponds
40   * to the <a href='http://www.w3.org/TR/SVG11/text.html#TextElement' title='text
41   * element specification'>text</a> element.
42   */
43  public class SVGTextElement extends SVGTextPositioningElement {
44    protected SVGTextElement() {
45    }
46  
47    // Implementation of the svg::SVGTextElement W3C IDL interface
48  
49    // Implementation of the svg::SVGLocatable W3C IDL interface
50    /**
51     * The element which established the current viewport. Often, the nearest
52     * ancestor <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' title='svg
53     * element specification'>svg</a> element. Null if the current element is
54     * the outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
55     * title='svg element specification'>svg</a> element.
56     */
57    public final native SVGElement getNearestViewportElement() /*-{
58      return this.nearestViewportElement;
59    }-*/;
60    /**
61     * The farthest ancestor <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
62     * title='svg element specification'>svg</a> element. Null if the current
63     * element is the outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
64     * title='svg element specification'>svg</a> element.
65     */
66    public final native SVGElement getFarthestViewportElement() /*-{
67      return this.farthestViewportElement;
68    }-*/;
69    /**
70     * Returns the tight bounding box in current user space (i.e., after application
71     * of the <code>transform</code> attribute, if any) on the geometry of all
72     * contained graphics elements, exclusive of stroking, clipping, masking and
73     * filter effects). Note that getBBox must return the actual bounding box
74     * at the time the method was called, even in case the element has not yet
75     * been rendered.
76     * @return An {@link org.vectomatic.dom.svg.OMSVGRect} object that defines
77     * the bounding box.
78     */
79    public final native OMSVGRect getBBox() /*-{
80      return this.getBBox();
81    }-*/;
82    /**
83     * Returns the transformation matrix from current user units (i.e., after
84     * application of the <code>transform</code> attribute, if any) to the viewport
85     * coordinate system for the {@link org.vectomatic.dom.svg.itf.ISVGLocatable#getNearestViewportElement()}.
86     * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines
87     * the CTM.
88     */
89    public final native OMSVGMatrix getCTM() /*-{
90      return this.getCTM();
91    }-*/;
92    /**
93     * Returns the transformation matrix from current user units (i.e., after
94     * application of the <code>transform</code> attribute, if any) to the parent
95     * user agent's notice of a "pixel". For display devices, ideally this represents
96     * a physical screen pixel. For other devices or environments where physical
97     * pixel sizes are not known, then an algorithm similar to the CSS2 definition
98     * of a "pixel" can be used instead.  Note that null is returned if this element
99     * is not hooked into the document tree. This method would have been more
100    * aptly named as <code>getClientCTM</code>, but the name <code>getScreenCTM</code>
101    * is kept for historical reasons.
102    * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines
103    * the given   transformation matrix.
104    */
105   public final native OMSVGMatrix getScreenCTM() /*-{
106     return this.getScreenCTM();
107   }-*/;
108   /**
109    * Returns the transformation matrix from the user coordinate system on the
110    * current element (after application of the <code>transform</code> attribute,
111    * if any) to the user coordinate system on parameter <var>element</var> (after
112    * application of its <code>transform</code> attribute, if any).
113    * @param element The target element.
114    * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines
115    * the transformation.
116    * @throws SVGException(SVG_MATRIX_NOT_INVERTABLE) Raised if the currently
117    * defined transformation matrices make it impossible to compute the   given
118    * matrix (e.g., because one of the transformations is singular).
119    */
120   public final native OMSVGMatrix getTransformToElement(SVGElement element) throws JavaScriptException /*-{
121     return this.getTransformToElement(element);
122   }-*/;
123 
124   // Implementation of the svg::SVGTransformable W3C IDL interface
125   /**
126    * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTransformable#getTransform()}
127    * on the given element.
128    */
129   public final native OMSVGAnimatedTransformList getTransform() /*-{
130     return this.transform;
131   }-*/;
132 
133 }