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.OMSVGAnimatedTransformList; 34 import org.vectomatic.dom.svg.OMSVGMatrix; 35 import org.vectomatic.dom.svg.OMSVGPointList; 36 import org.vectomatic.dom.svg.OMSVGRect; 37 import org.vectomatic.dom.svg.OMSVGStringList; 38 39 import com.google.gwt.core.client.JavaScriptException; 40 41 /** 42 * The {@link org.vectomatic.dom.svg.impl.SVGPolygonElement} interface corresponds 43 * to the <a href='http://www.w3.org/TR/SVG11/shapes.html#PolygonElement' 44 * title='polygon element specification'>polygon</a> element. 45 */ 46 public class SVGPolygonElement extends SVGElement { 47 protected SVGPolygonElement() { 48 } 49 50 // Implementation of the svg::SVGPolygonElement W3C IDL interface 51 52 // Implementation of the svg::SVGAnimatedPoints W3C IDL interface 53 /** 54 * Provides access to the base (i.e., static) contents of the <span class='attr-name'>'points'</span> 55 * attribute. 56 */ 57 public final native OMSVGPointList getPoints() /*-{ 58 return @org.vectomatic.dom.svg.OMNode::convertList(Lcom/google/gwt/core/client/JavaScriptObject;)(this.points); 59 }-*/; 60 /** 61 * Provides access to the current animated contents of the <span class='attr-name'>'points'</span> 62 * attribute. If the given attribute or property is being animated, contains 63 * the current animated value of the attribute or property. If the given attribute 64 * or property is not currently being animated, contains the same value as 65 * {@link org.vectomatic.dom.svg.itf.ISVGAnimatedPoints#getPoints()}. 66 */ 67 public final native OMSVGPointList getAnimatedPoints() /*-{ 68 return @org.vectomatic.dom.svg.OMNode::convertList(Lcom/google/gwt/core/client/JavaScriptObject;)(this.animatedPoints); 69 }-*/; 70 71 // Implementation of the svg::SVGExternalResourcesRequired W3C IDL interface 72 /** 73 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()} 74 * on the given element. Note that the SVG DOM defines the attribute {@link 75 * org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()} 76 * as being of type {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean}, whereas 77 * the SVG language definition says that {@link org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()} 78 * is not animated. Because the SVG language definition states that {@link 79 * org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()} 80 * cannot be animated, the {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean#getAnimVal()} 81 * will always be the same as the {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean#getBaseVal()}. 82 */ 83 public final native OMSVGAnimatedBoolean getExternalResourcesRequired() /*-{ 84 return this.externalResourcesRequired; 85 }-*/; 86 87 // Implementation of the svg::SVGLangSpace W3C IDL interface 88 /** 89 * Corresponds to attribute <code>xml:lang</code> on the given element. 90 */ 91 public final native String getXmllang() /*-{ 92 return this.xmllang; 93 }-*/; 94 /** 95 * Corresponds to attribute <code>xml:lang</code> on the given element. 96 * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an attempt 97 * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only 98 * attribute</a>. 99 */ 100 public final native void setXmllang(String value) throws JavaScriptException /*-{ 101 this.xmllang = value; 102 }-*/; 103 /** 104 * Corresponds to attribute <code>xml:space</code> on the given element. 105 */ 106 public final native String getXmlspace() /*-{ 107 return this.xmlspace; 108 }-*/; 109 /** 110 * Corresponds to attribute <code>xml:space</code> on the given element. 111 * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an attempt 112 * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only 113 * attribute</a>. 114 */ 115 public final native void setXmlspace(String value) throws JavaScriptException /*-{ 116 this.xmlspace = value; 117 }-*/; 118 119 // Implementation of the svg::SVGLocatable W3C IDL interface 120 /** 121 * The element which established the current viewport. Often, the nearest 122 * ancestor <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' title='svg 123 * element specification'>svg</a> element. Null if the current element is 124 * the outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 125 * title='svg element specification'>svg</a> element. 126 */ 127 public final native SVGElement getNearestViewportElement() /*-{ 128 return this.nearestViewportElement; 129 }-*/; 130 /** 131 * The farthest ancestor <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 132 * title='svg element specification'>svg</a> element. Null if the current 133 * element is the outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 134 * title='svg element specification'>svg</a> element. 135 */ 136 public final native SVGElement getFarthestViewportElement() /*-{ 137 return this.farthestViewportElement; 138 }-*/; 139 /** 140 * Returns the tight bounding box in current user space (i.e., after application 141 * of the <code>transform</code> attribute, if any) on the geometry of all 142 * contained graphics elements, exclusive of stroking, clipping, masking and 143 * filter effects). Note that getBBox must return the actual bounding box 144 * at the time the method was called, even in case the element has not yet 145 * been rendered. 146 * @return An {@link org.vectomatic.dom.svg.OMSVGRect} object that defines 147 * the bounding box. 148 */ 149 public final native OMSVGRect getBBox() /*-{ 150 return this.getBBox(); 151 }-*/; 152 /** 153 * Returns the transformation matrix from current user units (i.e., after 154 * application of the <code>transform</code> attribute, if any) to the viewport 155 * coordinate system for the {@link org.vectomatic.dom.svg.itf.ISVGLocatable#getNearestViewportElement()}. 156 * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines 157 * the CTM. 158 */ 159 public final native OMSVGMatrix getCTM() /*-{ 160 return this.getCTM(); 161 }-*/; 162 /** 163 * Returns the transformation matrix from current user units (i.e., after 164 * application of the <code>transform</code> attribute, if any) to the parent 165 * user agent's notice of a "pixel". For display devices, ideally this represents 166 * a physical screen pixel. For other devices or environments where physical 167 * pixel sizes are not known, then an algorithm similar to the CSS2 definition 168 * of a "pixel" can be used instead. Note that null is returned if this element 169 * is not hooked into the document tree. This method would have been more 170 * aptly named as <code>getClientCTM</code>, but the name <code>getScreenCTM</code> 171 * is kept for historical reasons. 172 * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines 173 * the given transformation matrix. 174 */ 175 public final native OMSVGMatrix getScreenCTM() /*-{ 176 return this.getScreenCTM(); 177 }-*/; 178 /** 179 * Returns the transformation matrix from the user coordinate system on the 180 * current element (after application of the <code>transform</code> attribute, 181 * if any) to the user coordinate system on parameter <var>element</var> (after 182 * application of its <code>transform</code> attribute, if any). 183 * @param element The target element. 184 * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines 185 * the transformation. 186 * @throws SVGException(SVG_MATRIX_NOT_INVERTABLE) Raised if the currently 187 * defined transformation matrices make it impossible to compute the given 188 * matrix (e.g., because one of the transformations is singular). 189 */ 190 public final native OMSVGMatrix getTransformToElement(SVGElement element) throws JavaScriptException /*-{ 191 return this.getTransformToElement(element); 192 }-*/; 193 194 // Implementation of the svg::SVGTests W3C IDL interface 195 /** 196 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTests#getRequiredFeatures()} 197 * on the given element. 198 */ 199 public final native OMSVGStringList getRequiredFeatures() /*-{ 200 return @org.vectomatic.dom.svg.OMNode::convertList(Lcom/google/gwt/core/client/JavaScriptObject;)(this.requiredFeatures); 201 }-*/; 202 /** 203 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTests#getRequiredExtensions()} 204 * on the given element. 205 */ 206 public final native OMSVGStringList getRequiredExtensions() /*-{ 207 return @org.vectomatic.dom.svg.OMNode::convertList(Lcom/google/gwt/core/client/JavaScriptObject;)(this.requiredExtensions); 208 }-*/; 209 /** 210 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTests#getSystemLanguage()} 211 * on the given element. 212 */ 213 public final native OMSVGStringList getSystemLanguage() /*-{ 214 return @org.vectomatic.dom.svg.OMNode::convertList(Lcom/google/gwt/core/client/JavaScriptObject;)(this.systemLanguage); 215 }-*/; 216 /** 217 * Returns true if the user agent supports the given extension, specified 218 * by a URI. 219 * @param extension The name of the extension, expressed as a URI. 220 * @return True or false, depending on whether the given extension is supported. 221 */ 222 public final native boolean hasExtension(String extension) /*-{ 223 return this.hasExtension(extension); 224 }-*/; 225 226 // Implementation of the svg::SVGTransformable W3C IDL interface 227 /** 228 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTransformable#getTransform()} 229 * on the given element. 230 */ 231 public final native OMSVGAnimatedTransformList getTransform() /*-{ 232 return this.transform; 233 }-*/; 234 235 }