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.itf; 31 32 import org.vectomatic.dom.svg.OMSVGElement; 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 * Interface {@link org.vectomatic.dom.svg.itf.ISVGLocatable} is for all elements 40 * which either have a <code>transform</code> attribute or don't have a <code>transform</code> 41 * attribute but whose content can have a bounding box in current user space. 42 */ 43 public interface ISVGLocatable { 44 /** 45 * The element which established the current viewport. Often, the nearest 46 * ancestor <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' title='svg 47 * element specification'>svg</a> element. Null if the current element is 48 * the outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 49 * title='svg element specification'>svg</a> element. 50 */ 51 public OMSVGElement getNearestViewportElement(); 52 /** 53 * The farthest ancestor <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 54 * title='svg element specification'>svg</a> element. Null if the current 55 * element is the outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 56 * title='svg element specification'>svg</a> element. 57 */ 58 public OMSVGElement getFarthestViewportElement(); 59 /** 60 * Returns the tight bounding box in current user space (i.e., after application 61 * of the <code>transform</code> attribute, if any) on the geometry of all 62 * contained graphics elements, exclusive of stroking, clipping, masking and 63 * filter effects). Note that getBBox must return the actual bounding box 64 * at the time the method was called, even in case the element has not yet 65 * been rendered. 66 * @return An {@link org.vectomatic.dom.svg.OMSVGRect} object that defines 67 * the bounding box. 68 */ 69 public OMSVGRect getBBox(); 70 /** 71 * Returns the transformation matrix from current user units (i.e., after 72 * application of the <code>transform</code> attribute, if any) to the viewport 73 * coordinate system for the {@link org.vectomatic.dom.svg.itf.ISVGLocatable#getNearestViewportElement()}. 74 * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines 75 * the CTM. 76 */ 77 public OMSVGMatrix getCTM(); 78 /** 79 * Returns the transformation matrix from current user units (i.e., after 80 * application of the <code>transform</code> attribute, if any) to the parent 81 * user agent's notice of a "pixel". For display devices, ideally this represents 82 * a physical screen pixel. For other devices or environments where physical 83 * pixel sizes are not known, then an algorithm similar to the CSS2 definition 84 * of a "pixel" can be used instead. Note that null is returned if this element 85 * is not hooked into the document tree. This method would have been more 86 * aptly named as <code>getClientCTM</code>, but the name <code>getScreenCTM</code> 87 * is kept for historical reasons. 88 * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines 89 * the given transformation matrix. 90 */ 91 public OMSVGMatrix getScreenCTM(); 92 /** 93 * Returns the transformation matrix from the user coordinate system on the 94 * current element (after application of the <code>transform</code> attribute, 95 * if any) to the user coordinate system on parameter <var>element</var> (after 96 * application of its <code>transform</code> attribute, if any). 97 * @param element The target element. 98 * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines 99 * the transformation. 100 * @throws SVGException(SVG_MATRIX_NOT_INVERTABLE) Raised if the currently 101 * defined transformation matrices make it impossible to compute the given 102 * matrix (e.g., because one of the transformations is singular). 103 */ 104 public OMSVGMatrix getTransformToElement(OMSVGElement element) throws JavaScriptException; 105 }