Added: xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMMetadataElement.java URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMMetadataElement.java?rev=1647590&view=auto ============================================================================== --- xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMMetadataElement.java (added) +++ xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMMetadataElement.java Tue Dec 23 15:10:45 2014 @@ -0,0 +1,62 @@ +/* + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + */ +package org.apache.batik.anim.dom; + +import org.apache.batik.dom.AbstractDocument; +import org.w3c.dom.Node; +import org.w3c.dom.svg.SVGMetadataElement; + +/** + * This class implements {@link org.w3c.dom.svg.SVGMetadataElement}. + * + * @author <a href="mailto:[email protected]">Stephane Hillion</a> + * @version $Id$ + */ +public class SVGOMMetadataElement + extends SVGOMElement + implements SVGMetadataElement { + /** + * Creates a new SVGOMMetadataElement object. + */ + protected SVGOMMetadataElement() { + } + + /** + * Creates a new SVGOMMetadataElement object. + * @param prefix The namespace prefix. + * @param owner The owner document. + */ + public SVGOMMetadataElement(String prefix, AbstractDocument owner) { + super(prefix, owner); + } + + /** + * <b>DOM</b>: Implements {@link org.w3c.dom.Node#getLocalName()}. + */ + public String getLocalName() { + return SVG_METADATA_TAG; + } + + /** + * Returns a new uninitialized instance of this object's class. + */ + protected Node newNode() { + return new SVGOMMetadataElement(); + } +}
Added: xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMMissingGlyphElement.java URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMMissingGlyphElement.java?rev=1647590&view=auto ============================================================================== --- xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMMissingGlyphElement.java (added) +++ xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMMissingGlyphElement.java Tue Dec 23 15:10:45 2014 @@ -0,0 +1,91 @@ +/* + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + */ +package org.apache.batik.anim.dom; + +import org.apache.batik.dom.AbstractDocument; +import org.w3c.dom.Node; +import org.w3c.dom.svg.SVGMissingGlyphElement; + +/** + * This class implements {@link SVGMissingGlyphElement}. + * + * @author <a href="mailto:[email protected]">Stephane Hillion</a> + * @version $Id$ + */ +public class SVGOMMissingGlyphElement + extends SVGStylableElement + implements SVGMissingGlyphElement { + +// /** +// * Table mapping XML attribute names to TraitInformation objects. +// */ +// protected static DoublyIndexedTable xmlTraitInformation; +// static { +// DoublyIndexedTable t = new DoublyIndexedTable(SVGStylableElement.xmlTraitInformation); +// t.put(XLINK_NAMESPACE_URI, XLINK_HREF_ATTRIBUTE, +// new TraitInformation(false, SVGTypes.TYPE_URI)); +// t.put(null, SVG_D_ATTRIBUTE, +// new TraitInformation(false, SVGTypes.TYPE_PATH_DATA)); +// t.put(null, SVG_HORIZ_ADV_X_ATTRIBUTE, +// new TraitInformation(false, SVGTypes.TYPE_NUMBER)); +// t.put(null, SVG_VERT_ORIGIN_X_ATTRIBUTE, +// new TraitInformation(false, SVGTypes.TYPE_NUMBER)); +// t.put(null, SVG_VERT_ORIGIN_Y_ATTRIBUTE, +// new TraitInformation(false, SVGTypes.TYPE_NUMBER)); +// t.put(null, SVG_VERT_ADV_Y_ATTRIBUTE, +// new TraitInformation(false, SVGTypes.TYPE_NUMBER)); +// xmlTraitInformation = t; +// } + + /** + * Creates a new SVGOMMissingGlyphElement object. + */ + protected SVGOMMissingGlyphElement() { + } + + /** + * Creates a new SVGOMMissingGlyphElement object. + * @param prefix The namespace prefix. + * @param owner The owner document. + */ + public SVGOMMissingGlyphElement(String prefix, AbstractDocument owner) { + super(prefix, owner); + } + + /** + * <b>DOM</b>: Implements {@link Node#getLocalName()}. + */ + public String getLocalName() { + return SVG_MISSING_GLYPH_TAG; + } + + /** + * Returns a new uninitialized instance of this object's class. + */ + protected Node newNode() { + return new SVGOMMissingGlyphElement(); + } + +// /** +// * Returns the table of TraitInformation objects for this element. +// */ +// protected DoublyIndexedTable getTraitInformationTable() { +// return xmlTraitInformation; +// } +} Added: xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMMultiImageElement.java URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMMultiImageElement.java?rev=1647590&view=auto ============================================================================== --- xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMMultiImageElement.java (added) +++ xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMMultiImageElement.java Tue Dec 23 15:10:45 2014 @@ -0,0 +1,78 @@ +/* + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + */ +package org.apache.batik.anim.dom; + +import org.apache.batik.dom.AbstractDocument; +import org.apache.batik.util.SVG12Constants; + +import org.w3c.dom.Node; + +/** + * This class implements a multiImage extension to SVG. + * + * The 'multiImage' element is similar to the 'image' element (supports + * all the same attributes and properties) except. + * <ol> + * <li>It has two addtional attributes: 'pixel-width' and + * 'pixel-height' which are the maximum width and height of the + * image referenced by the xlink:href attribute.</li> + * <li>It can contain a child element 'subImage' which has + * two attributes, pixel-width, pixel-height. + * It holds SVG content to be rendered.</li> + * <li>It can contain a child element 'subImageRef' which has only + * three attributes, pixel-width, pixel-height and xlink:href. + * The image displayed is the smallest image such that + * pixel-width and pixel-height are greater than or equal to the + * required image size for display.</li> + * </ol> + * + * @author <a href="mailto:[email protected]">Thomas DeWeese</a> + * @version $Id$ */ +public class SVGOMMultiImageElement + extends SVGStylableElement { + + /** + * Creates a new SVG MultiImageElement object. + */ + protected SVGOMMultiImageElement() { + } + + /** + * Creates a new SVG MultiImageElement object. + * @param prefix The namespace prefix. + * @param owner The owner document. + */ + public SVGOMMultiImageElement(String prefix, AbstractDocument owner) { + super(prefix, owner); + } + + /** + * <b>DOM</b>: Implements {@link org.w3c.dom.Node#getLocalName()}. + */ + public String getLocalName() { + return SVG12Constants.SVG_MULTI_IMAGE_TAG; + } + + /** + * Returns a new uninitialized instance of this object's class. + */ + protected Node newNode() { + return new SVGOMMultiImageElement(); + } +} Added: xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMPathElement.java URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMPathElement.java?rev=1647590&view=auto ============================================================================== --- xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMPathElement.java (added) +++ xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMPathElement.java Tue Dec 23 15:10:45 2014 @@ -0,0 +1,944 @@ +/* + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + */ +package org.apache.batik.anim.dom; + +import org.apache.batik.dom.AbstractDocument; +import org.apache.batik.dom.svg.SVGPathSegConstants; +import org.apache.batik.util.DoublyIndexedTable; +import org.apache.batik.util.SVGTypes; + +import org.w3c.dom.Node; +import org.w3c.dom.svg.SVGAnimatedNumber; +import org.w3c.dom.svg.SVGPathElement; +import org.w3c.dom.svg.SVGPathSeg; +import org.w3c.dom.svg.SVGPathSegArcAbs; +import org.w3c.dom.svg.SVGPathSegArcRel; +import org.w3c.dom.svg.SVGPathSegClosePath; +import org.w3c.dom.svg.SVGPathSegCurvetoCubicAbs; +import org.w3c.dom.svg.SVGPathSegCurvetoCubicRel; +import org.w3c.dom.svg.SVGPathSegCurvetoCubicSmoothAbs; +import org.w3c.dom.svg.SVGPathSegCurvetoCubicSmoothRel; +import org.w3c.dom.svg.SVGPathSegCurvetoQuadraticAbs; +import org.w3c.dom.svg.SVGPathSegCurvetoQuadraticRel; +import org.w3c.dom.svg.SVGPathSegCurvetoQuadraticSmoothAbs; +import org.w3c.dom.svg.SVGPathSegCurvetoQuadraticSmoothRel; +import org.w3c.dom.svg.SVGPathSegLinetoAbs; +import org.w3c.dom.svg.SVGPathSegLinetoHorizontalAbs; +import org.w3c.dom.svg.SVGPathSegLinetoHorizontalRel; +import org.w3c.dom.svg.SVGPathSegLinetoRel; +import org.w3c.dom.svg.SVGPathSegLinetoVerticalAbs; +import org.w3c.dom.svg.SVGPathSegLinetoVerticalRel; +import org.w3c.dom.svg.SVGPathSegList; +import org.w3c.dom.svg.SVGPathSegMovetoAbs; +import org.w3c.dom.svg.SVGPathSegMovetoRel; +import org.w3c.dom.svg.SVGPoint; + +/** + * This class implements {@link SVGPathElement}. + * + * @author <a href="mailto:[email protected]">Stephane Hillion</a> + * @version $Id$ + */ +public class SVGOMPathElement + extends SVGGraphicsElement + implements SVGPathElement, + SVGPathSegConstants { + + /** + * Table mapping XML attribute names to TraitInformation objects. + */ + protected static DoublyIndexedTable xmlTraitInformation; + static { + DoublyIndexedTable t = + new DoublyIndexedTable(SVGGraphicsElement.xmlTraitInformation); + t.put(null, SVG_D_ATTRIBUTE, + new TraitInformation(true, SVGTypes.TYPE_PATH_DATA)); + t.put(null, SVG_PATH_LENGTH_ATTRIBUTE, + new TraitInformation(true, SVGTypes.TYPE_NUMBER)); + xmlTraitInformation = t; + } + + /** + * The 'd' attribute value. + */ + protected SVGOMAnimatedPathData d; + + /** + * Creates a new SVGOMPathElement object. + */ + protected SVGOMPathElement() { + } + + /** + * Creates a new SVGOMPathElement object. + * @param prefix The namespace prefix. + * @param owner The owner document. + */ + public SVGOMPathElement(String prefix, AbstractDocument owner) { + super(prefix, owner); + initializeLiveAttributes(); + } + + /** + * Initializes all live attributes for this element. + */ + protected void initializeAllLiveAttributes() { + super.initializeAllLiveAttributes(); + initializeLiveAttributes(); + } + + /** + * Initializes the live attribute values of this element. + */ + private void initializeLiveAttributes() { + d = createLiveAnimatedPathData(null, SVG_D_ATTRIBUTE, ""); + } + + /** + * <b>DOM</b>: Implements {@link org.w3c.dom.Node#getLocalName()}. + */ + public String getLocalName() { + return SVG_PATH_TAG; + } + + /** + * <b>DOM</b>: Implements {@link SVGPathElement#getPathLength()}. + */ + public SVGAnimatedNumber getPathLength() { + throw new UnsupportedOperationException + ("SVGPathElement.getPathLength is not implemented"); // XXX + } + + /** + * <b>DOM</b>: Implements {@link SVGPathElement#getTotalLength()}. + */ + public float getTotalLength() { + return SVGPathSupport.getTotalLength(this); + } + + /** + * <b>DOM</b>: Implements {@link SVGPathElement#getPointAtLength(float)}. + */ + public SVGPoint getPointAtLength(float distance) { + return SVGPathSupport.getPointAtLength(this, distance); + } + + /** + * <b>DOM</b>: Implements {@link SVGPathElement#getPathSegAtLength(float)}. + */ + public int getPathSegAtLength(float distance) { + return SVGPathSupport.getPathSegAtLength(this, distance); + } + + /** + * Returns the {@link SVGOMAnimatedPathData} object that manages the + * path data for this element. + */ + public SVGOMAnimatedPathData getAnimatedPathData() { + return d; + } + + /** + * <b>DOM</b>: Implements {@link SVGPathElement#getPathSegList()}. + */ + public SVGPathSegList getPathSegList() { + return d.getPathSegList(); + } + + /** + * <b>DOM</b>: Implements {@link SVGPathElement#getNormalizedPathSegList()}. + */ + public SVGPathSegList getNormalizedPathSegList() { + return d.getNormalizedPathSegList(); + } + + /** + * <b>DOM</b>: Implements {@link SVGPathElement#getAnimatedPathSegList()}. + */ + public SVGPathSegList getAnimatedPathSegList() { + return d.getAnimatedPathSegList(); + } + + /** + * <b>DOM</b>: Implements {@link + * SVGPathElement#getAnimatedNormalizedPathSegList()}. + */ + public SVGPathSegList getAnimatedNormalizedPathSegList() { + return d.getAnimatedNormalizedPathSegList(); + } + + // Factory methods ///////////////////////////////////////////////////// + + /** + * <b>DOM</b>: Implements {@link SVGPathElement#createSVGPathSegClosePath()}. + */ + public SVGPathSegClosePath createSVGPathSegClosePath() { + return new SVGPathSegClosePath(){ + public short getPathSegType(){ + return SVGPathSeg.PATHSEG_CLOSEPATH; + } + public String getPathSegTypeAsLetter(){ + return PATHSEG_CLOSEPATH_LETTER; + } + }; + } + + /** + * <b>DOM</b>: Implements {@link + * SVGPathElement#createSVGPathSegMovetoAbs(float,float)}. + */ + public SVGPathSegMovetoAbs createSVGPathSegMovetoAbs(final float x_value, final float y_value) { + return new SVGPathSegMovetoAbs(){ + protected float x = x_value; + protected float y = y_value; + + public short getPathSegType(){ + return SVGPathSeg.PATHSEG_MOVETO_ABS; + } + public String getPathSegTypeAsLetter(){ + return PATHSEG_MOVETO_ABS_LETTER; + } + public float getX(){ + return x; + } + public void setX(float x){ + this.x = x; + } + public float getY(){ + return y; + } + public void setY(float y){ + this.y = y; + } + }; + } + + /** + * <b>DOM</b>: Implements {@link + * SVGPathElement#createSVGPathSegMovetoRel(float,float)}. + */ + public SVGPathSegMovetoRel createSVGPathSegMovetoRel(final float x_value, final float y_value) { + return new SVGPathSegMovetoRel(){ + protected float x = x_value; + protected float y = y_value; + + public short getPathSegType(){ + return SVGPathSeg.PATHSEG_MOVETO_REL; + } + public String getPathSegTypeAsLetter(){ + return PATHSEG_MOVETO_REL_LETTER; + } + public float getX(){ + return x; + } + public void setX(float x){ + this.x = x; + } + public float getY(){ + return y; + } + public void setY(float y){ + this.y = y; + } + }; + } + + /** + * <b>DOM</b>: Implements {@link + * SVGPathElement#createSVGPathSegLinetoAbs(float,float)}. + */ + public SVGPathSegLinetoAbs createSVGPathSegLinetoAbs(final float x_value, final float y_value) { + return new SVGPathSegLinetoAbs(){ + protected float x = x_value; + protected float y = y_value; + + public short getPathSegType(){ + return SVGPathSeg.PATHSEG_LINETO_ABS; + } + public String getPathSegTypeAsLetter(){ + return PATHSEG_LINETO_ABS_LETTER; + } + public float getX(){ + return x; + } + public void setX(float x){ + this.x = x; + } + public float getY(){ + return y; + } + public void setY(float y){ + this.y = y; + } + }; + } + + /** + * <b>DOM</b>: Implements {@link + * SVGPathElement#createSVGPathSegLinetoRel(float,float)}. + */ + public SVGPathSegLinetoRel createSVGPathSegLinetoRel(final float x_value, final float y_value) { + return new SVGPathSegLinetoRel(){ + protected float x = x_value; + protected float y = y_value; + + public short getPathSegType(){ + return SVGPathSeg.PATHSEG_LINETO_REL; + } + public String getPathSegTypeAsLetter(){ + return PATHSEG_LINETO_REL_LETTER; + } + public float getX(){ + return x; + } + public void setX(float x){ + this.x = x; + } + public float getY(){ + return y; + } + public void setY(float y){ + this.y = y; + } + }; + } + + /** + * <b>DOM</b>: Implements {@link + * SVGPathElement#createSVGPathSegLinetoHorizontalAbs(float)}. + */ + public SVGPathSegLinetoHorizontalAbs createSVGPathSegLinetoHorizontalAbs(final float x_value) { + return new SVGPathSegLinetoHorizontalAbs(){ + protected float x = x_value; + + public short getPathSegType(){ + return SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS; + } + public String getPathSegTypeAsLetter(){ + return PATHSEG_LINETO_HORIZONTAL_ABS_LETTER; + } + public float getX(){ + return x; + } + public void setX(float x){ + this.x = x; + } + }; + } + + /** + * <b>DOM</b>: Implements {@link + * SVGPathElement#createSVGPathSegLinetoHorizontalRel(float)}. + */ + public SVGPathSegLinetoHorizontalRel createSVGPathSegLinetoHorizontalRel(final float x_value) { + return new SVGPathSegLinetoHorizontalRel(){ + protected float x = x_value; + + public short getPathSegType(){ + return SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL; + } + public String getPathSegTypeAsLetter(){ + return PATHSEG_LINETO_HORIZONTAL_REL_LETTER; + } + public float getX(){ + return x; + } + public void setX(float x){ + this.x = x; + } + }; + } + + /** + * <b>DOM</b>: Implements {@link + * SVGPathElement#createSVGPathSegLinetoVerticalAbs(float)}. + */ + public SVGPathSegLinetoVerticalAbs createSVGPathSegLinetoVerticalAbs(final float y_value) { + return new SVGPathSegLinetoVerticalAbs(){ + protected float y = y_value; + + public short getPathSegType(){ + return SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS; + } + public String getPathSegTypeAsLetter(){ + return PATHSEG_LINETO_VERTICAL_ABS_LETTER; + } + public float getY(){ + return y; + } + public void setY(float y){ + this.y = y; + } + }; + } + + /** + * <b>DOM</b>: Implements {@link + * SVGPathElement#createSVGPathSegLinetoVerticalRel(float)}. + */ + public SVGPathSegLinetoVerticalRel createSVGPathSegLinetoVerticalRel(final float y_value) { + return new SVGPathSegLinetoVerticalRel(){ + protected float y = y_value; + + public short getPathSegType(){ + return SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL; + } + public String getPathSegTypeAsLetter(){ + return PATHSEG_LINETO_VERTICAL_REL_LETTER; + } + public float getY(){ + return y; + } + public void setY(float y){ + this.y = y; + } + }; + } + + /** + * <b>DOM</b>: Implements {@link + * SVGPathElement#createSVGPathSegCurvetoCubicAbs(float,float,float,float,float,float)}. + */ + public SVGPathSegCurvetoCubicAbs createSVGPathSegCurvetoCubicAbs + (final float x_value, final float y_value, + final float x1_value, final float y1_value, + final float x2_value, final float y2_value) { + return new SVGPathSegCurvetoCubicAbs(){ + protected float x = x_value; + protected float y = y_value; + protected float x1 = x1_value; + protected float y1 = y1_value; + protected float x2 = x2_value; + protected float y2 = y2_value; + + public short getPathSegType(){ + return SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS; + } + public String getPathSegTypeAsLetter(){ + return PATHSEG_CURVETO_CUBIC_ABS_LETTER; + } + public float getX(){ + return x; + } + public void setX(float x){ + this.x = x; + } + public float getY(){ + return y; + } + public void setY(float y){ + this.y = y; + } + public float getX1(){ + return x1; + } + public void setX1(float x1){ + this.x1 = x1; + } + public float getY1(){ + return y1; + } + public void setY1(float y1){ + this.y1 = y1; + } + public float getX2(){ + return x2; + } + public void setX2(float x2){ + this.x2 = x2; + } + public float getY2(){ + return y2; + } + public void setY2(float y2){ + this.y2 = y2; + } + }; + } + + /** + * <b>DOM</b>: Implements {@link + * SVGPathElement#createSVGPathSegCurvetoCubicRel(float,float,float,float,float,float)}. + */ + public SVGPathSegCurvetoCubicRel createSVGPathSegCurvetoCubicRel + (final float x_value, final float y_value, + final float x1_value, final float y1_value, + final float x2_value, final float y2_value) { + return new SVGPathSegCurvetoCubicRel(){ + protected float x = x_value; + protected float y = y_value; + protected float x1 = x1_value; + protected float y1 = y1_value; + protected float x2 = x2_value; + protected float y2 = y2_value; + + public short getPathSegType(){ + return SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL; + } + public String getPathSegTypeAsLetter(){ + return PATHSEG_CURVETO_CUBIC_REL_LETTER; + } + public float getX(){ + return x; + } + public void setX(float x){ + this.x = x; + } + public float getY(){ + return y; + } + public void setY(float y){ + this.y = y; + } + public float getX1(){ + return x1; + } + public void setX1(float x1){ + this.x1 = x1; + } + public float getY1(){ + return y1; + } + public void setY1(float y1){ + this.y1 = y1; + } + public float getX2(){ + return x2; + } + public void setX2(float x2){ + this.x2 = x2; + } + public float getY2(){ + return y2; + } + public void setY2(float y2){ + this.y2 = y2; + } + }; + } + + /** + * <b>DOM</b>: Implements {@link + * SVGPathElement#createSVGPathSegCurvetoQuadraticAbs(float,float,float,float)}. + */ + public SVGPathSegCurvetoQuadraticAbs createSVGPathSegCurvetoQuadraticAbs + (final float x_value, final float y_value, + final float x1_value, final float y1_value) { + return new SVGPathSegCurvetoQuadraticAbs(){ + protected float x = x_value; + protected float y = y_value; + protected float x1 = x1_value; + protected float y1 = y1_value; + + public short getPathSegType(){ + return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS; + } + public String getPathSegTypeAsLetter(){ + return PATHSEG_CURVETO_QUADRATIC_ABS_LETTER; + } + public float getX(){ + return x; + } + public void setX(float x){ + this.x = x; + } + public float getY(){ + return y; + } + public void setY(float y){ + this.y = y; + } + public float getX1(){ + return x1; + } + public void setX1(float x1){ + this.x1 = x1; + } + public float getY1(){ + return y1; + } + public void setY1(float y1){ + this.y1 = y1; + } + }; + } + + /** + * <b>DOM</b>: Implements {@link + * SVGPathElement#createSVGPathSegCurvetoQuadraticRel(float,float,float,float)}. + */ + public SVGPathSegCurvetoQuadraticRel createSVGPathSegCurvetoQuadraticRel + (final float x_value, final float y_value, + final float x1_value, final float y1_value) { + return new SVGPathSegCurvetoQuadraticRel(){ + protected float x = x_value; + protected float y = y_value; + protected float x1 = x1_value; + protected float y1 = y1_value; + + public short getPathSegType(){ + return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL; + } + public String getPathSegTypeAsLetter(){ + return PATHSEG_CURVETO_QUADRATIC_REL_LETTER; + } + public float getX(){ + return x; + } + public void setX(float x){ + this.x = x; + } + public float getY(){ + return y; + } + public void setY(float y){ + this.y = y; + } + public float getX1(){ + return x1; + } + public void setX1(float x1){ + this.x1 = x1; + } + public float getY1(){ + return y1; + } + public void setY1(float y1){ + this.y1 = y1; + } + }; + } + + /** + * <b>DOM</b>: Implements {@link + * SVGPathElement#createSVGPathSegCurvetoCubicSmoothAbs(float,float,float,float)}. + */ + public SVGPathSegCurvetoCubicSmoothAbs + createSVGPathSegCurvetoCubicSmoothAbs + (final float x_value, final float y_value, + final float x2_value, final float y2_value) { + return new SVGPathSegCurvetoCubicSmoothAbs(){ + protected float x = x_value; + protected float y = y_value; + protected float x2 = x2_value; + protected float y2 = y2_value; + + public short getPathSegType(){ + return SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS; + } + public String getPathSegTypeAsLetter(){ + return PATHSEG_CURVETO_CUBIC_SMOOTH_ABS_LETTER; + } + public float getX(){ + return x; + } + public void setX(float x){ + this.x = x; + } + public float getY(){ + return y; + } + public void setY(float y){ + this.y = y; + } + public float getX2(){ + return x2; + } + public void setX2(float x2){ + this.x2 = x2; + } + public float getY2(){ + return y2; + } + public void setY2(float y2){ + this.y2 = y2; + } + }; + } + + /** + * <b>DOM</b>: Implements {@link + * SVGPathElement#createSVGPathSegCurvetoCubicSmoothRel(float,float,float,float)}. + */ + public SVGPathSegCurvetoCubicSmoothRel + createSVGPathSegCurvetoCubicSmoothRel + (final float x_value, final float y_value, + final float x2_value, final float y2_value) { + return new SVGPathSegCurvetoCubicSmoothRel(){ + protected float x = x_value; + protected float y = y_value; + protected float x2 = x2_value; + protected float y2 = y2_value; + + public short getPathSegType(){ + return SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL; + } + public String getPathSegTypeAsLetter(){ + return PATHSEG_CURVETO_CUBIC_SMOOTH_REL_LETTER; + } + public float getX(){ + return x; + } + public void setX(float x){ + this.x = x; + } + public float getY(){ + return y; + } + public void setY(float y){ + this.y = y; + } + public float getX2(){ + return x2; + } + public void setX2(float x2){ + this.x2 = x2; + } + public float getY2(){ + return y2; + } + public void setY2(float y2){ + this.y2 = y2; + } + }; + } + + /** + * <b>DOM</b>: Implements {@link + * SVGPathElement#createSVGPathSegCurvetoQuadraticSmoothAbs(float,float)}. + */ + public SVGPathSegCurvetoQuadraticSmoothAbs + createSVGPathSegCurvetoQuadraticSmoothAbs + (final float x_value, final float y_value) { + return new SVGPathSegCurvetoQuadraticSmoothAbs(){ + protected float x = x_value; + protected float y = y_value; + + public short getPathSegType(){ + return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS; + } + public String getPathSegTypeAsLetter(){ + return PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS_LETTER; + } + public float getX(){ + return x; + } + public void setX(float x){ + this.x = x; + } + public float getY(){ + return y; + } + public void setY(float y){ + this.y = y; + } + }; + + } + + /** + * <b>DOM</b>: Implements {@link + * SVGPathElement#createSVGPathSegCurvetoQuadraticSmoothRel(float,float)}. + */ + public SVGPathSegCurvetoQuadraticSmoothRel + createSVGPathSegCurvetoQuadraticSmoothRel + (final float x_value, final float y_value) { + return new SVGPathSegCurvetoQuadraticSmoothRel(){ + protected float x = x_value; + protected float y = y_value; + + public short getPathSegType(){ + return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL; + } + public String getPathSegTypeAsLetter(){ + return PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL_LETTER; + } + public float getX(){ + return x; + } + public void setX(float x){ + this.x = x; + } + public float getY(){ + return y; + } + public void setY(float y){ + this.y = y; + } + }; + } + + /** + * <b>DOM</b>: Implements {@link + * SVGPathElement#createSVGPathSegArcAbs(float,float,float,float,float,boolean,boolean)}. + */ + public SVGPathSegArcAbs createSVGPathSegArcAbs + (final float x_value, final float y_value, + final float r1_value, final float r2_value, + final float angle_value, + final boolean largeArcFlag_value, + final boolean sweepFlag_value) { + return new SVGPathSegArcAbs(){ + protected float x = x_value; + protected float y = y_value; + protected float r1 = r1_value; + protected float r2 = r2_value; + protected float angle = angle_value; + protected boolean largeArcFlag = largeArcFlag_value; + protected boolean sweepFlag = sweepFlag_value; + + public short getPathSegType(){ + return SVGPathSeg.PATHSEG_ARC_ABS; + } + public String getPathSegTypeAsLetter(){ + return PATHSEG_ARC_ABS_LETTER; + } + public float getX(){ + return x; + } + public void setX(float x){ + this.x = x; + } + public float getY(){ + return y; + } + public void setY(float y){ + this.y = y; + } + public float getR1(){ + return r1; + } + public void setR1(float r1){ + this.r1 = r1; + } + public float getR2(){ + return r2; + } + public void setR2(float r2){ + this.r2 = r2; + } + public float getAngle(){ + return angle; + } + public void setAngle(float angle){ + this.angle = angle; + } + public boolean getLargeArcFlag(){ + return largeArcFlag; + } + public void setLargeArcFlag(boolean largeArcFlag){ + this.largeArcFlag = largeArcFlag; + } + public boolean getSweepFlag(){ + return sweepFlag; + } + public void setSweepFlag(boolean sweepFlag){ + this.sweepFlag = sweepFlag; + } + + + }; + } + + /** + * <b>DOM</b>: Implements {@link + * SVGPathElement#createSVGPathSegArcRel(float,float,float,float,float,boolean,boolean)}. + */ + public SVGPathSegArcRel createSVGPathSegArcRel + (final float x_value, final float y_value, + final float r1_value, final float r2_value, + final float angle_value, + final boolean largeArcFlag_value, + final boolean sweepFlag_value) { + return new SVGPathSegArcRel(){ + protected float x = x_value; + protected float y = y_value; + protected float r1 = r1_value; + protected float r2 = r2_value; + protected float angle = angle_value; + protected boolean largeArcFlag = largeArcFlag_value; + protected boolean sweepFlag = sweepFlag_value; + + public short getPathSegType(){ + return SVGPathSeg.PATHSEG_ARC_REL; + } + public String getPathSegTypeAsLetter(){ + return PATHSEG_ARC_REL_LETTER; + } + public float getX(){ + return x; + } + public void setX(float x){ + this.x = x; + } + public float getY(){ + return y; + } + public void setY(float y){ + this.y = y; + } + public float getR1(){ + return r1; + } + public void setR1(float r1){ + this.r1 = r1; + } + public float getR2(){ + return r2; + } + public void setR2(float r2){ + this.r2 = r2; + } + public float getAngle(){ + return angle; + } + public void setAngle(float angle){ + this.angle = angle; + } + public boolean getLargeArcFlag(){ + return largeArcFlag; + } + public void setLargeArcFlag(boolean largeArcFlag){ + this.largeArcFlag = largeArcFlag; + } + public boolean getSweepFlag(){ + return sweepFlag; + } + public void setSweepFlag(boolean sweepFlag){ + this.sweepFlag = sweepFlag; + } + + + }; + } + + /** + * Returns a new uninitialized instance of this object's class. + */ + protected Node newNode() { + return new SVGOMPathElement(); + } + + /** + * Returns the table of TraitInformation objects for this element. + */ + protected DoublyIndexedTable getTraitInformationTable() { + return xmlTraitInformation; + } +} Added: xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMPatternElement.java URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMPatternElement.java?rev=1647590&view=auto ============================================================================== --- xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMPatternElement.java (added) +++ xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMPatternElement.java Tue Dec 23 15:10:45 2014 @@ -0,0 +1,394 @@ +/* + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + */ +package org.apache.batik.anim.dom; + +import org.apache.batik.dom.AbstractDocument; +import org.apache.batik.dom.svg.SVGTestsSupport; +import org.apache.batik.dom.util.XLinkSupport; +import org.apache.batik.dom.util.XMLSupport; +import org.apache.batik.util.DoublyIndexedTable; +import org.apache.batik.util.SVGTypes; + +import org.w3c.dom.Node; +import org.w3c.dom.svg.SVGAnimatedBoolean; +import org.w3c.dom.svg.SVGAnimatedEnumeration; +import org.w3c.dom.svg.SVGAnimatedLength; +import org.w3c.dom.svg.SVGAnimatedPreserveAspectRatio; +import org.w3c.dom.svg.SVGAnimatedRect; +import org.w3c.dom.svg.SVGAnimatedString; +import org.w3c.dom.svg.SVGAnimatedTransformList; +import org.w3c.dom.svg.SVGPatternElement; +import org.w3c.dom.svg.SVGStringList; + +/** + * This class implements {@link org.w3c.dom.svg.SVGStopElement}. + * + * @author <a href="mailto:[email protected]">Stephane Hillion</a> + * @version $Id$ + */ +public class SVGOMPatternElement + extends SVGStylableElement + implements SVGPatternElement { + + /** + * Table mapping XML attribute names to TraitInformation objects. + */ + protected static DoublyIndexedTable xmlTraitInformation; + static { + DoublyIndexedTable t = + new DoublyIndexedTable(SVGStylableElement.xmlTraitInformation); + t.put(null, SVG_X_ATTRIBUTE, + new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_WIDTH)); + t.put(null, SVG_Y_ATTRIBUTE, + new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_HEIGHT)); + t.put(null, SVG_WIDTH_ATTRIBUTE, + new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_WIDTH)); + t.put(null, SVG_HEIGHT_ATTRIBUTE, + new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_HEIGHT)); + t.put(null, SVG_PATTERN_UNITS_ATTRIBUTE, + new TraitInformation(true, SVGTypes.TYPE_IDENT)); + t.put(null, SVG_PATTERN_CONTENT_UNITS_ATTRIBUTE, + new TraitInformation(true, SVGTypes.TYPE_IDENT)); + t.put(null, SVG_PATTERN_TRANSFORM_ATTRIBUTE, + new TraitInformation(true, SVGTypes.TYPE_TRANSFORM_LIST)); + t.put(null, SVG_VIEW_BOX_ATTRIBUTE, + new TraitInformation(true, SVGTypes.TYPE_NUMBER_LIST)); + t.put(null, SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, + new TraitInformation(true, SVGTypes.TYPE_PRESERVE_ASPECT_RATIO_VALUE)); + t.put(null, SVG_EXTERNAL_RESOURCES_REQUIRED_ATTRIBUTE, + new TraitInformation(true, SVGTypes.TYPE_BOOLEAN)); + xmlTraitInformation = t; + } + + /** + * The attribute initializer. + */ + protected static final AttributeInitializer attributeInitializer; + static { + attributeInitializer = new AttributeInitializer(5); + attributeInitializer.addAttribute(null, null, + SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, + "xMidYMid meet"); + attributeInitializer.addAttribute(XMLSupport.XMLNS_NAMESPACE_URI, + null, "xmlns:xlink", + XLinkSupport.XLINK_NAMESPACE_URI); + attributeInitializer.addAttribute(XLinkSupport.XLINK_NAMESPACE_URI, + "xlink", "type", "simple"); + attributeInitializer.addAttribute(XLinkSupport.XLINK_NAMESPACE_URI, + "xlink", "show", "other"); + attributeInitializer.addAttribute(XLinkSupport.XLINK_NAMESPACE_URI, + "xlink", "actuate", "onLoad"); + } + + /** + * The units values. + */ + protected static final String[] UNITS_VALUES = { + "", + SVG_USER_SPACE_ON_USE_VALUE, + SVG_OBJECT_BOUNDING_BOX_VALUE + }; + + /** + * The 'x' attribute value. + */ + protected SVGOMAnimatedLength x; + + /** + * The 'y' attribute value. + */ + protected SVGOMAnimatedLength y; + + /** + * The 'width' attribute value. + */ + protected SVGOMAnimatedLength width; + + /** + * The 'height' attribute value. + */ + protected SVGOMAnimatedLength height; + + /** + * The 'patternUnits' attribute value. + */ + protected SVGOMAnimatedEnumeration patternUnits; + + /** + * The 'patternContentUnits' attribute value. + */ + protected SVGOMAnimatedEnumeration patternContentUnits; + + /** + * The 'xlink:href' attribute value. + */ + protected SVGOMAnimatedString href; + + /** + * The 'externalResourcesRequired' attribute value. + */ + protected SVGOMAnimatedBoolean externalResourcesRequired; + + /** + * The 'preserveAspectRatio' attribute value. + */ + protected SVGOMAnimatedPreserveAspectRatio preserveAspectRatio; + + /** + * Creates a new SVGOMPatternElement object. + */ + protected SVGOMPatternElement() { + } + + /** + * Creates a new SVGOMPatternElement object. + * @param prefix The namespace prefix. + * @param owner The owner document. + */ + public SVGOMPatternElement(String prefix, + AbstractDocument owner) { + super(prefix, owner); + initializeLiveAttributes(); + } + + /** + * Initializes all live attributes for this element. + */ + protected void initializeAllLiveAttributes() { + super.initializeAllLiveAttributes(); + initializeLiveAttributes(); + } + + /** + * Initializes the live attribute values of this element. + */ + private void initializeLiveAttributes() { + x = createLiveAnimatedLength + (null, SVG_X_ATTRIBUTE, SVG_PATTERN_X_DEFAULT_VALUE, + SVGOMAnimatedLength.HORIZONTAL_LENGTH, false); + y = createLiveAnimatedLength + (null, SVG_Y_ATTRIBUTE, SVG_PATTERN_Y_DEFAULT_VALUE, + SVGOMAnimatedLength.VERTICAL_LENGTH, false); + width = + createLiveAnimatedLength + (null, SVG_WIDTH_ATTRIBUTE, SVG_PATTERN_WIDTH_DEFAULT_VALUE, + SVGOMAnimatedLength.HORIZONTAL_LENGTH, true); + height = + createLiveAnimatedLength + (null, SVG_HEIGHT_ATTRIBUTE, SVG_PATTERN_WIDTH_DEFAULT_VALUE, + SVGOMAnimatedLength.VERTICAL_LENGTH, true); + patternUnits = + createLiveAnimatedEnumeration + (null, SVG_PATTERN_UNITS_ATTRIBUTE, UNITS_VALUES, (short) 2); + patternContentUnits = + createLiveAnimatedEnumeration + (null, SVG_PATTERN_CONTENT_UNITS_ATTRIBUTE, UNITS_VALUES, + (short) 1); + href = + createLiveAnimatedString(XLINK_NAMESPACE_URI, XLINK_HREF_ATTRIBUTE); + externalResourcesRequired = + createLiveAnimatedBoolean + (null, SVG_EXTERNAL_RESOURCES_REQUIRED_ATTRIBUTE, false); + preserveAspectRatio = createLiveAnimatedPreserveAspectRatio(); + } + + /** + * <b>DOM</b>: Implements {@link org.w3c.dom.Node#getLocalName()}. + */ + public String getLocalName() { + return SVG_PATTERN_TAG; + } + + /** + * To implement {@link SVGPatternElement#getPatternTransform()}. + */ + public SVGAnimatedTransformList getPatternTransform() { + throw new UnsupportedOperationException + ("SVGPatternElement.getPatternTransform is not implemented"); // XXX + } + + /** + * <b>DOM</b>: Implements {@link SVGPatternElement#getPatternUnits()}. + */ + public SVGAnimatedEnumeration getPatternUnits() { + return patternUnits; + } + + /** + * <b>DOM</b>: Implements {@link + * SVGPatternElement#getPatternContentUnits()}. + */ + public SVGAnimatedEnumeration getPatternContentUnits() { + return patternContentUnits; + } + + /** + * <b>DOM</b>: Implements {@link SVGPatternElement#getX()}. + */ + public SVGAnimatedLength getX() { + return x; + } + + /** + * <b>DOM</b>: Implements {@link SVGPatternElement#getY()}. + */ + public SVGAnimatedLength getY() { + return y; + } + + /** + * <b>DOM</b>: Implements {@link SVGPatternElement#getWidth()}. + */ + public SVGAnimatedLength getWidth() { + return width; + } + + /** + * <b>DOM</b>: Implements {@link + * org.w3c.dom.svg.SVGPatternElement#getHeight()}. + */ + public SVGAnimatedLength getHeight() { + return height; + } + + /** + * Returns the table of TraitInformation objects for this element. + */ + protected DoublyIndexedTable getTraitInformationTable() { + return xmlTraitInformation; + } + + // XLink support ////////////////////////////////////////////////////// + + /** + * <b>DOM</b>: Implements {@link + * org.w3c.dom.svg.SVGURIReference#getHref()}. + */ + public SVGAnimatedString getHref() { + return href; + } + + // SVGFitToViewBox support //////////////////////////////////////////// + + /** + * <b>DOM</b>: Implements {@link + * org.w3c.dom.svg.SVGFitToViewBox#getViewBox()}. + */ + public SVGAnimatedRect getViewBox() { + throw new UnsupportedOperationException + ("SVGFitToViewBox.getViewBox is not implemented"); // XXX + } + + /** + * <b>DOM</b>: Implements {@link + * org.w3c.dom.svg.SVGFitToViewBox#getPreserveAspectRatio()}. + */ + public SVGAnimatedPreserveAspectRatio getPreserveAspectRatio() { + return preserveAspectRatio; + } + + // SVGExternalResourcesRequired support ///////////////////////////// + + /** + * <b>DOM</b>: Implements {@link + * org.w3c.dom.svg.SVGExternalResourcesRequired#getExternalResourcesRequired()}. + */ + public SVGAnimatedBoolean getExternalResourcesRequired() { + return externalResourcesRequired; + } + + // SVGLangSpace support ////////////////////////////////////////////////// + + /** + * <b>DOM</b>: Returns the xml:lang attribute value. + */ + public String getXMLlang() { + return XMLSupport.getXMLLang(this); + } + + /** + * <b>DOM</b>: Sets the xml:lang attribute value. + */ + public void setXMLlang(String lang) { + setAttributeNS(XML_NAMESPACE_URI, XML_LANG_QNAME, lang); + } + + /** + * <b>DOM</b>: Returns the xml:space attribute value. + */ + public String getXMLspace() { + return XMLSupport.getXMLSpace(this); + } + + /** + * <b>DOM</b>: Sets the xml:space attribute value. + */ + public void setXMLspace(String space) { + setAttributeNS(XML_NAMESPACE_URI, XML_SPACE_QNAME, space); + } + + // SVGTests support /////////////////////////////////////////////////// + + /** + * <b>DOM</b>: Implements {@link + * org.w3c.dom.svg.SVGTests#getRequiredFeatures()}. + */ + public SVGStringList getRequiredFeatures() { + return SVGTestsSupport.getRequiredFeatures(this); + } + + /** + * <b>DOM</b>: Implements {@link + * org.w3c.dom.svg.SVGTests#getRequiredExtensions()}. + */ + public SVGStringList getRequiredExtensions() { + return SVGTestsSupport.getRequiredExtensions(this); + } + + /** + * <b>DOM</b>: Implements {@link + * org.w3c.dom.svg.SVGTests#getSystemLanguage()}. + */ + public SVGStringList getSystemLanguage() { + return SVGTestsSupport.getSystemLanguage(this); + } + + /** + * <b>DOM</b>: Implements {@link + * org.w3c.dom.svg.SVGTests#hasExtension(String)}. + */ + public boolean hasExtension(String extension) { + return SVGTestsSupport.hasExtension(this, extension); + } + + /** + * Returns the AttributeInitializer for this element type. + * @return null if this element has no attribute with a default value. + */ + protected AttributeInitializer getAttributeInitializer() { + return attributeInitializer; + } + + /** + * Returns a new uninitialized instance of this object's class. + */ + protected Node newNode() { + return new SVGOMPatternElement(); + } +} Added: xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMPolygonElement.java URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMPolygonElement.java?rev=1647590&view=auto ============================================================================== --- xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMPolygonElement.java (added) +++ xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMPolygonElement.java Tue Dec 23 15:10:45 2014 @@ -0,0 +1,64 @@ +/* + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + */ +package org.apache.batik.anim.dom; + +import org.apache.batik.dom.AbstractDocument; + +import org.w3c.dom.Node; +import org.w3c.dom.svg.SVGPolygonElement; + +/** + * This class implements {@link SVGPolygonElement}. + * + * @author <a href="mailto:[email protected]">Stephane Hillion</a> + * @version $Id$ + */ +public class SVGOMPolygonElement + extends SVGPointShapeElement + implements SVGPolygonElement { + + /** + * Creates a new SVGOMPolygonElement object. + */ + protected SVGOMPolygonElement() { + } + + /** + * Creates a new SVGOMPolygonElement object. + * @param prefix The namespace prefix. + * @param owner The owner document. + */ + public SVGOMPolygonElement(String prefix, AbstractDocument owner) { + super(prefix, owner); + } + + /** + * <b>DOM</b>: Implements {@link Node#getLocalName()}. + */ + public String getLocalName() { + return SVG_POLYGON_TAG; + } + + /** + * Returns a new uninitialized instance of this object's class. + */ + protected Node newNode() { + return new SVGOMPolygonElement(); + } +} Added: xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMPolylineElement.java URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMPolylineElement.java?rev=1647590&view=auto ============================================================================== --- xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMPolylineElement.java (added) +++ xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMPolylineElement.java Tue Dec 23 15:10:45 2014 @@ -0,0 +1,64 @@ +/* + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + */ +package org.apache.batik.anim.dom; + +import org.apache.batik.dom.AbstractDocument; + +import org.w3c.dom.Node; +import org.w3c.dom.svg.SVGPolylineElement; + +/** + * This class implements {@link SVGPolylineElement}. + * + * @author <a href="mailto:[email protected]">Stephane Hillion</a> + * @version $Id$ + */ +public class SVGOMPolylineElement + extends SVGPointShapeElement + implements SVGPolylineElement { + + /** + * Creates a new SVGOMPolylineElement object. + */ + protected SVGOMPolylineElement() { + } + + /** + * Creates a new SVGOMPolylineElement object. + * @param prefix The namespace prefix. + * @param owner The owner document. + */ + public SVGOMPolylineElement(String prefix, AbstractDocument owner) { + super(prefix, owner); + } + + /** + * <b>DOM</b>: Implements {@link Node#getLocalName()}. + */ + public String getLocalName() { + return SVG_POLYLINE_TAG; + } + + /** + * Returns a new uninitialized instance of this object's class. + */ + protected Node newNode() { + return new SVGOMPolylineElement(); + } +} Added: xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMRadialGradientElement.java URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMRadialGradientElement.java?rev=1647590&view=auto ============================================================================== --- xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMRadialGradientElement.java (added) +++ xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMRadialGradientElement.java Tue Dec 23 15:10:45 2014 @@ -0,0 +1,213 @@ +/* + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + */ +package org.apache.batik.anim.dom; + +import org.apache.batik.dom.AbstractDocument; +import org.apache.batik.util.DoublyIndexedTable; +import org.apache.batik.util.SVGTypes; + +import org.w3c.dom.Attr; +import org.w3c.dom.Node; +import org.w3c.dom.svg.SVGAnimatedLength; +import org.w3c.dom.svg.SVGRadialGradientElement; + +/** + * This class implements {@link SVGRadialGradientElement}. + * + * @author <a href="mailto:[email protected]">Stephane Hillion</a> + * @version $Id$ + */ +public class SVGOMRadialGradientElement + extends SVGOMGradientElement + implements SVGRadialGradientElement { + + /** + * Table mapping XML attribute names to TraitInformation objects. + */ + protected static DoublyIndexedTable xmlTraitInformation; + static { + DoublyIndexedTable t = + new DoublyIndexedTable(SVGOMGradientElement.xmlTraitInformation); + t.put(null, SVG_CX_ATTRIBUTE, + new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_WIDTH)); + t.put(null, SVG_CY_ATTRIBUTE, + new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_HEIGHT)); + t.put(null, SVG_FX_ATTRIBUTE, + new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_WIDTH)); + t.put(null, SVG_FY_ATTRIBUTE, + new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_HEIGHT)); + t.put(null, SVG_R_ATTRIBUTE, + new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_SIZE)); + xmlTraitInformation = t; + } + + /** + * The 'cx' attribute value. + */ + protected SVGOMAnimatedLength cx; + + /** + * The 'cy' attribute value. + */ + protected SVGOMAnimatedLength cy; + + /** + * The 'fx' attribute value. + */ + protected AbstractSVGAnimatedLength fx; + + /** + * The 'fy' attribute value. + */ + protected AbstractSVGAnimatedLength fy; + + /** + * The 'r' attribute value. + */ + protected SVGOMAnimatedLength r; + + /** + * Creates a new SVGOMRadialGradientElement object. + */ + protected SVGOMRadialGradientElement() { + } + + /** + * Creates a new SVGOMRadialGradientElement object. + * @param prefix The namespace prefix. + * @param owner The owner document. + */ + public SVGOMRadialGradientElement(String prefix, AbstractDocument owner) { + super(prefix, owner); + initializeLiveAttributes(); + } + + /** + * Initializes all live attributes for this element. + */ + protected void initializeAllLiveAttributes() { + super.initializeAllLiveAttributes(); + initializeLiveAttributes(); + } + + /** + * Initializes the live attribute values of this element. + */ + private void initializeLiveAttributes() { + cx = createLiveAnimatedLength + (null, SVG_CX_ATTRIBUTE, SVG_RADIAL_GRADIENT_CX_DEFAULT_VALUE, + SVGOMAnimatedLength.HORIZONTAL_LENGTH, false); + cy = createLiveAnimatedLength + (null, SVG_CY_ATTRIBUTE, SVG_RADIAL_GRADIENT_CY_DEFAULT_VALUE, + SVGOMAnimatedLength.VERTICAL_LENGTH, false); + r = createLiveAnimatedLength + (null, SVG_R_ATTRIBUTE, SVG_RADIAL_GRADIENT_R_DEFAULT_VALUE, + SVGOMAnimatedLength.OTHER_LENGTH, false); + fx = new AbstractSVGAnimatedLength + (this, null, SVG_FX_ATTRIBUTE, + SVGOMAnimatedLength.HORIZONTAL_LENGTH, false) { + protected String getDefaultValue() { + Attr attr = getAttributeNodeNS(null, SVG_CX_ATTRIBUTE); + if (attr == null) { + return SVG_RADIAL_GRADIENT_CX_DEFAULT_VALUE; + } + return attr.getValue(); + } + }; + fy = new AbstractSVGAnimatedLength + (this, null, SVG_FY_ATTRIBUTE, + SVGOMAnimatedLength.VERTICAL_LENGTH, false) { + protected String getDefaultValue() { + Attr attr = getAttributeNodeNS(null, SVG_CY_ATTRIBUTE); + if (attr == null) { + return SVG_RADIAL_GRADIENT_CY_DEFAULT_VALUE; + } + return attr.getValue(); + } + }; + + liveAttributeValues.put(null, SVG_FX_ATTRIBUTE, fx); + liveAttributeValues.put(null, SVG_FY_ATTRIBUTE, fy); + AnimatedAttributeListener l = + ((SVGOMDocument) ownerDocument).getAnimatedAttributeListener(); + fx.addAnimatedAttributeListener(l); + fy.addAnimatedAttributeListener(l); + } + + /** + * <b>DOM</b>: Implements {@link Node#getLocalName()}. + */ + public String getLocalName() { + return SVG_RADIAL_GRADIENT_TAG; + } + + /** + * <b>DOM</b>: Implements {@link + * org.w3c.dom.svg.SVGRadialGradientElement#getCx()}. + */ + public SVGAnimatedLength getCx() { + return cx; + } + + /** + * <b>DOM</b>: Implements {@link + * org.w3c.dom.svg.SVGRadialGradientElement#getCy()}. + */ + public SVGAnimatedLength getCy() { + return cy; + } + + /** + * <b>DOM</b>: Implements {@link + * org.w3c.dom.svg.SVGRadialGradientElement#getR()}. + */ + public SVGAnimatedLength getR() { + return r; + } + + /** + * <b>DOM</b>: Implements {@link + * org.w3c.dom.svg.SVGRadialGradientElement#getFx()}. + */ + public SVGAnimatedLength getFx() { + return fx; + } + + /** + * <b>DOM</b>: Implements {@link + * org.w3c.dom.svg.SVGRadialGradientElement#getFy()}. + */ + public SVGAnimatedLength getFy() { + return fy; + } + + /** + * Returns a new uninitialized instance of this object's class. + */ + protected Node newNode() { + return new SVGOMRadialGradientElement(); + } + + /** + * Returns the table of TraitInformation objects for this element. + */ + protected DoublyIndexedTable getTraitInformationTable() { + return xmlTraitInformation; + } +} Added: xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMRectElement.java URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMRectElement.java?rev=1647590&view=auto ============================================================================== --- xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMRectElement.java (added) +++ xmlgraphics/batik/branches/submodules_cyclic_deps/sources/org/apache/batik/anim/dom/SVGOMRectElement.java Tue Dec 23 15:10:45 2014 @@ -0,0 +1,273 @@ +/* + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + */ +package org.apache.batik.anim.dom; + +import org.apache.batik.anim.values.AnimatableValue; +import org.apache.batik.dom.AbstractDocument; +import org.apache.batik.util.DoublyIndexedTable; +import org.apache.batik.util.SVGTypes; + +import org.w3c.dom.Attr; +import org.w3c.dom.Node; +import org.w3c.dom.svg.SVGAnimatedLength; +import org.w3c.dom.svg.SVGRectElement; + +/** + * This class implements {@link SVGRectElement}. + * + * @author <a href="mailto:[email protected]">Stephane Hillion</a> + * @version $Id$ + */ +public class SVGOMRectElement + extends SVGGraphicsElement + implements SVGRectElement { + + /** + * Table mapping XML attribute names to TraitInformation objects. + */ + protected static DoublyIndexedTable xmlTraitInformation; + static { + DoublyIndexedTable t = + new DoublyIndexedTable(SVGGraphicsElement.xmlTraitInformation); + t.put(null, SVG_X_ATTRIBUTE, + new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_WIDTH)); + t.put(null, SVG_Y_ATTRIBUTE, + new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_HEIGHT)); + t.put(null, SVG_RX_ATTRIBUTE, + new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_WIDTH)); + t.put(null, SVG_RY_ATTRIBUTE, + new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_HEIGHT)); + t.put(null, SVG_WIDTH_ATTRIBUTE, + new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_WIDTH)); + t.put(null, SVG_HEIGHT_ATTRIBUTE, + new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_HEIGHT)); + xmlTraitInformation = t; + } + + /** + * The 'x' attribute value. + */ + protected SVGOMAnimatedLength x; + + /** + * The 'y' attribute value. + */ + protected SVGOMAnimatedLength y; + + /** + * The 'rx' attribute value. + */ + protected AbstractSVGAnimatedLength rx; + + /** + * The 'ry' attribute value. + */ + protected AbstractSVGAnimatedLength ry; + + /** + * The 'width' attribute value. + */ + protected SVGOMAnimatedLength width; + + /** + * The 'height' attribute value. + */ + protected SVGOMAnimatedLength height; + + /** + * Creates a new SVGOMRectElement object. + */ + protected SVGOMRectElement() { + } + + /** + * Creates a new SVGOMRectElement object. + * @param prefix The namespace prefix. + * @param owner The owner document. + */ + public SVGOMRectElement(String prefix, AbstractDocument owner) { + super(prefix, owner); + initializeLiveAttributes(); + } + + /** + * Initializes all live attributes for this element. + */ + protected void initializeAllLiveAttributes() { + super.initializeAllLiveAttributes(); + initializeLiveAttributes(); + } + + /** + * Initializes the live attribute values of this element. + */ + private void initializeLiveAttributes() { + x = createLiveAnimatedLength + (null, SVG_X_ATTRIBUTE, SVG_RECT_X_DEFAULT_VALUE, + SVGOMAnimatedLength.HORIZONTAL_LENGTH, false); + y = createLiveAnimatedLength + (null, SVG_Y_ATTRIBUTE, SVG_RECT_Y_DEFAULT_VALUE, + SVGOMAnimatedLength.VERTICAL_LENGTH, false); + width = + createLiveAnimatedLength + (null, SVG_WIDTH_ATTRIBUTE, null, + SVGOMAnimatedLength.HORIZONTAL_LENGTH, true); + height = + createLiveAnimatedLength + (null, SVG_HEIGHT_ATTRIBUTE, null, + SVGOMAnimatedLength.VERTICAL_LENGTH, true); + rx = new AbstractSVGAnimatedLength + (this, null, SVG_RX_ATTRIBUTE, + SVGOMAnimatedLength.HORIZONTAL_LENGTH, true) { + protected String getDefaultValue() { + Attr attr = getAttributeNodeNS(null, SVG_RY_ATTRIBUTE); + if (attr == null) { + return "0"; + } + return attr.getValue(); + } + protected void attrChanged() { + super.attrChanged(); + AbstractSVGAnimatedLength ry = + (AbstractSVGAnimatedLength) getRy(); + if (isSpecified() && !ry.isSpecified()) { + ry.attrChanged(); + } + } + }; + ry = new AbstractSVGAnimatedLength + (this, null, SVG_RY_ATTRIBUTE, + SVGOMAnimatedLength.VERTICAL_LENGTH, true) { + protected String getDefaultValue() { + Attr attr = getAttributeNodeNS(null, SVG_RX_ATTRIBUTE); + if (attr == null) { + return "0"; + } + return attr.getValue(); + } + protected void attrChanged() { + super.attrChanged(); + AbstractSVGAnimatedLength rx = + (AbstractSVGAnimatedLength) getRx(); + if (isSpecified() && !rx.isSpecified()) { + rx.attrChanged(); + } + } + }; + + liveAttributeValues.put(null, SVG_RX_ATTRIBUTE, rx); + liveAttributeValues.put(null, SVG_RY_ATTRIBUTE, ry); + AnimatedAttributeListener l = + ((SVGOMDocument) ownerDocument).getAnimatedAttributeListener(); + rx.addAnimatedAttributeListener(l); + ry.addAnimatedAttributeListener(l); + } + + /** + * <b>DOM</b>: Implements {@link Node#getLocalName()}. + */ + public String getLocalName() { + return SVG_RECT_TAG; + } + + /** + * <b>DOM</b>: Implements {@link SVGRectElement#getX()}. + */ + public SVGAnimatedLength getX() { + return x; + } + + /** + * <b>DOM</b>: Implements {@link SVGRectElement#getY()}. + */ + public SVGAnimatedLength getY() { + return y; + } + + /** + * <b>DOM</b>: Implements {@link SVGRectElement#getWidth()}. + */ + public SVGAnimatedLength getWidth() { + return width; + } + + /** + * <b>DOM</b>: Implements {@link SVGRectElement#getHeight()}. + */ + public SVGAnimatedLength getHeight() { + return height; + } + + /** + * <b>DOM</b>: Implements {@link SVGRectElement#getRx()}. + */ + public SVGAnimatedLength getRx() { + return rx; + } + + /** + * <b>DOM</b>: Implements {@link SVGRectElement#getRy()}. + */ + public SVGAnimatedLength getRy() { + return ry; + } + + /** + * Returns a new uninitialized instance of this object's class. + */ + protected Node newNode() { + return new SVGOMRectElement(); + } + + /** + * Returns the table of TraitInformation objects for this element. + */ + protected DoublyIndexedTable getTraitInformationTable() { + return xmlTraitInformation; + } + + // AnimationTarget /////////////////////////////////////////////////////// + + /** + * Updates an attribute value in this target. + */ + public void updateAttributeValue(String ns, String ln, + AnimatableValue val) { + if (ns == null) { + if (ln.equals(SVG_RX_ATTRIBUTE)) { + super.updateAttributeValue(ns, ln, val); + AbstractSVGAnimatedLength ry = + (AbstractSVGAnimatedLength) getRy(); + if (!ry.isSpecified()) { + super.updateAttributeValue(ns, SVG_RY_ATTRIBUTE, val); + } + return; + } else if (ln.equals(SVG_RY_ATTRIBUTE)) { + super.updateAttributeValue(ns, ln, val); + AbstractSVGAnimatedLength rx = + (AbstractSVGAnimatedLength) getRx(); + if (!rx.isSpecified()) { + super.updateAttributeValue(ns, SVG_RX_ATTRIBUTE, val); + } + return; + } + } + super.updateAttributeValue(ns, ln, val); + } +}
