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.itf;
31  
32  import org.vectomatic.dom.svg.OMSVGPathSegList;
33  
34    /**
35     * <p>The SVGAnimatedPathData interface supports elements which have a <span
36     * class='attr-name'>'d'</span> attribute which holds SVG path data, and supports
37     * the ability to animate that attribute.</p> <p>The {@link org.vectomatic.dom.svg.itf.ISVGAnimatedPathData}
38     * interface provides two lists to access and modify the base (i.e., static)
39     * contents of the <span class='attr-name'>'d'</span> attribute:</p> <ul>
40     * <li>DOM attribute {@link org.vectomatic.dom.svg.itf.ISVGAnimatedPathData#getPathSegList()}
41     * provides access to the static/base   contents of the <span class='attr-name'>'d'</span>
42     * attribute in a form which matches one-for-one   with SVG's syntax.</li>
43     * <li>DOM attribute {@link org.vectomatic.dom.svg.itf.ISVGAnimatedPathData#getNormalizedPathSegList()}
44     * provides normalized access   to the static/base contents of the <span class='attr-name'>'d'</span>
45     * attribute where all path   data commands are expressed in terms of the
46     * following subset of   {@link org.vectomatic.dom.svg.OMSVGPathSeg} types:
47     * SVG_PATHSEG_MOVETO_ABS (M),   SVG_PATHSEG_LINETO_ABS (L),   SVG_PATHSEG_CURVETO_CUBIC_ABS
48     * (C) and   SVG_PATHSEG_CLOSEPATH (z).</li> </ul> <p>and two lists to access
49     * the current animated values of the <span class='attr-name'>'d'</span> attribute:</p>
50     * <ul>   <li>DOM attribute {@link org.vectomatic.dom.svg.itf.ISVGAnimatedPathData#getAnimatedPathSegList()}
51     * provides access to the current   animated contents of the <span class='attr-name'>'d'</span>
52     * attribute in a form which matches   one-for-one with SVG's syntax.</li>
53     * <li>DOM attribute {@link org.vectomatic.dom.svg.itf.ISVGAnimatedPathData#getAnimatedNormalizedPathSegList()}
54     * provides   normalized access to the current animated contents of the <span
55     * class='attr-name'>'d'</span>   attribute where all path data commands are
56     * expressed in terms of the   following subset of {@link org.vectomatic.dom.svg.OMSVGPathSeg}
57     * types:   SVG_PATHSEG_MOVETO_ABS (M),   SVG_PATHSEG_LINETO_ABS (L),   SVG_PATHSEG_CURVETO_CUBIC_ABS
58     * (C) and   SVG_PATHSEG_CLOSEPATH (z).</li> </ul> <p>Each of the two lists
59     * are always kept synchronized. Modifications to one list will immediately
60     * cause the corresponding list to be modified. Modifications to {@link org.vectomatic.dom.svg.itf.ISVGAnimatedPathData#getNormalizedPathSegList()}
61     * might cause entries in {@link org.vectomatic.dom.svg.itf.ISVGAnimatedPathData#getPathSegList()}
62     * to be broken into a set of normalized path segments.</p> <p>Additionally,
63     * the <code>path/d</code> attribute on the <a href='http://www.w3.org/TR/SVG11/paths.html#PathElement'
64     * title='path element specification'>path</a> element accessed via the XML
65     * DOM (e.g., using the <code>getAttribute()</code> method call) will reflect
66     * any changes made to {@link org.vectomatic.dom.svg.itf.ISVGAnimatedPathData#getPathSegList()}
67     * or {@link org.vectomatic.dom.svg.itf.ISVGAnimatedPathData#getNormalizedPathSegList()}.</p>
68     */
69  public interface ISVGAnimatedPathData {
70    /**
71     * Provides access to the base (i.e., static) contents of the <span class='attr-name'>'d'</span>
72     * attribute in a form which matches one-for-one with SVG's syntax. Thus,
73     * if the <span class='attr-name'>'d'</span> attribute has an "absolute moveto
74     * (M)" and an "absolute arcto (A)" command, then {@link org.vectomatic.dom.svg.itf.ISVGAnimatedPathData#getPathSegList()}
75     * will have two entries: a SVG_PATHSEG_MOVETO_ABS and a SVG_PATHSEG_ARC_ABS.
76     */
77    public OMSVGPathSegList getPathSegList();
78    /**
79     * <p>Provides access to the base (i.e., static) contents of the <span class='attr-name'>'d'</span>
80     * attribute in a form where all path data commands are expressed in terms
81     * of the following subset of {@link org.vectomatic.dom.svg.OMSVGPathSeg}
82     * types: SVG_PATHSEG_MOVETO_ABS (M), SVG_PATHSEG_LINETO_ABS (L), SVG_PATHSEG_CURVETO_CUBIC_ABS
83     * (C) and SVG_PATHSEG_CLOSEPATH (z). Thus, if the <span class='attr-name'>'d'</span>
84     * attribute has an "absolute moveto (M)" and an "absolute arcto (A)" command,
85     * then pathSegList will have one SVG_PATHSEG_MOVETO_ABS entry followed by
86     * a series of SVG_PATHSEG_LINETO_ABS entries which approximate the arc. This
87     * alternate representation is available to provide a simpler interface to
88     * developers who would benefit from a more limited set of commands.</p> <p>The
89     * only valid {@link org.vectomatic.dom.svg.OMSVGPathSeg} types are SVG_PATHSEG_MOVETO_ABS
90     * (M), SVG_PATHSEG_LINETO_ABS (L), SVG_PATHSEG_CURVETO_CUBIC_ABS (C) and
91     * SVG_PATHSEG_CLOSEPATH (z).</p>
92     */
93    public OMSVGPathSegList getNormalizedPathSegList();
94    /**
95     * Provides access to the current animated contents of the <span class='attr-name'>'d'</span>
96     * attribute in a form which matches one-for-one with SVG's syntax. If the
97     * given attribute or property is being animated, contains the current animated
98     * value of the attribute or property, and both the object itself and its
99     * contents are read only. If the given attribute or property is not currently
100    * being animated, contains the same value as {@link org.vectomatic.dom.svg.itf.ISVGAnimatedPathData#getPathSegList()}.
101    */
102   public OMSVGPathSegList getAnimatedPathSegList();
103   /**
104    * Provides access to the current animated contents of the <span class='attr-name'>'d'</span>
105    * attribute in a form where all path data commands are expressed in terms
106    * of the following subset of {@link org.vectomatic.dom.svg.OMSVGPathSeg}
107    * types: SVG_PATHSEG_MOVETO_ABS (M), SVG_PATHSEG_LINETO_ABS (L), SVG_PATHSEG_CURVETO_CUBIC_ABS
108    * (C) and SVG_PATHSEG_CLOSEPATH (z). If the given attribute or property is
109    * being animated, contains the current animated value of the attribute or
110    * property, and both the object itself and its contents are read only. If
111    * the given attribute or property is not currently being animated, contains
112    * the same value as {@link org.vectomatic.dom.svg.itf.ISVGAnimatedPathData#getNormalizedPathSegList()}.
113    */
114   public OMSVGPathSegList getAnimatedNormalizedPathSegList();
115 }