<name>transform</name>
<use-generic ispropclass="true">SVGTransform</use-generic>
</property>
+ <property>
+ <name>gradientTransform</name>
+ <use-generic ispropclass="true">SVGTransform</use-generic>
+ </property>
<property>
<name>d</name>
<use-generic ispropclass="true">SVGD</use-generic>
<default>pad</default>
</property>
<property>
- <name>gradientUnits</name>
- <class-name>GradientUnits</class-name>
+ <name>gradientUnits</name>
+ <use-generic>GenericUnits</use-generic>
+ </property>
+ <property>
+ <name>patternUnits</name>
+ <use-generic>GenericUnits</use-generic>
+ </property>
+ <property>
+ <name>patternContentUnits</name>
+ <use-generic>GenericUnits</use-generic>
+ </property>
+ <property>
+ <name>clipPathUnits</name>
+ <use-generic>GenericUnits</use-generic>
+ </property>
+ <property type="generic">
+ <name>GenericUnits</name>
+ <class-name>GenericUnits</class-name>
<inherited>false</inherited>
<datatype>Enum</datatype>
<enumeration>
<value const="USER_SPACE_ON_USE">userSpaceOnUse</value>
- <value const="USER_SPACE">userSpace</value>
<value const="OBJECT_BOUNDING_BOX">objectBoundingBox</value>
</enumeration>
- <default>userSpace</default>
+ <default>userSpaceOnUse</default>
</property>
<property>
<name>viewBox</name>
<datatype>String</datatype>
<default></default>
</property>
- <property>
- <name>gradientTransform</name>
- <class-name>GradientTransform</class-name>
- <inherited>false</inherited>
- <datatype>String</datatype>
- <default></default>
- </property>
</generic-property-list>
<element-property-list>
* modified Nov 14,2000 Mike Crowe <crowe@psilongbeach.com>
*/
public class TransformData {
- SVGAnimatedTransformList trans;
+ SVGAnimatedTransformListImpl trans;
/**
* set the TransformData given a particular String specifying TransformData and units
-/*-- $Id$ --
+/*-- $Id$ --
============================================================================
The Apache Software License, Version 1.1
============================================================================
-
+
Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
-
+
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
-
+
4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
-
+
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
-
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
-
+
*/
package org.apache.fop.dom.svg;
* Graphic objects include rectangles, lines and text
*
*/
-public abstract class GraphicElement extends SVGElementImpl implements SVGTransformable, SVGLangSpace, SVGTests, EventTarget {
- protected SVGList reqFeatures;
- protected SVGList reqExtensions;
- protected SVGList sysLanguage;
- SVGAnimatedTransformList transform;
- String xmlspace = "default";
-
- public SVGElement getNearestViewportElement()
- {
- Node node = getParentNode();
- while(node != null) {
- if(node instanceof SVGGElement) {
- return (SVGElement)node;
- } else if(node instanceof SVGSVGElement) {
- return (SVGElement)node;
- }
- node = getParentNode();
- }
- return null;
- }
-
- public SVGElement getFarthestViewportElement()
- {
- Node node = getParentNode();
- SVGElement viewport = null;
- while(node != null) {
- if(node instanceof SVGGElement) {
- viewport = (SVGElement)node;
- } else if(node instanceof SVGSVGElement) {
- viewport = (SVGElement)node;
- }
- node = getParentNode();
- }
- return viewport;
- }
-
- public SVGAnimatedTransformList getTransform()
- {
- if(transform != null) {
- return transform;
- }
- SVGTransformList stl = new SVGTransformListImpl();
- SVGTransform transform = new SVGTransformImpl();
- stl.appendItem(transform);
- SVGAnimatedTransformList atl = new SVGAnimatedTransformListImpl();
- atl.setBaseVal(stl);
- return atl;
- }
-
- public void setTransform(SVGAnimatedTransformList transform)
- {
- this.transform = transform;
- }
-
- public SVGRect getBBox()
- {
- return null;
- }
-
- /**
- * Returns the transformation matrix from current user units (i.e., after
- * application of the transform attribute) to the viewport coordinate system
- * for the nearestViewportElement.
- */
- public SVGMatrix getCTM()
- {
- return transform.getBaseVal().consolidate().getMatrix();
- }
-
- /**
- * Returns the transformation matrix from current user units (i.e., after
- * application of the transform attribute) to the parent user agent's notice
- * of a "pixel". For display devices, ideally this represents a physical
- * screen pixel. For other devices or environments where physical pixel sizes
- * are not known, then an algorithm similar to the CSS2 definition of a "pixel"
- * can be used instead.
- * This is the matrix that converts from the user space to the position
- * on the screen.
- */
- public SVGMatrix getScreenCTM()
- {
- if(transform == null) {
- return new SVGMatrixImpl();
- }
- Node node = getParentNode();
- SVGMatrix matrix = null;
- if(node != null && node instanceof SVGTransformable) {
- matrix = ((SVGTransformable)node).getScreenCTM();
- }
- if(matrix != null) {
- matrix = transform.getBaseVal().consolidate().getMatrix().multiply(matrix);
- } else {
- matrix = transform.getBaseVal().consolidate().getMatrix();
- }
- return matrix;
- }
-
- public SVGMatrix getTransformToElement(SVGElement element)
- throws SVGException
- {
- return null;
- }
-
- public String getXMLlang()
- {
- return null;
- }
-
- public void setXMLlang(String xmllang)
- {
- }
-
- public String getXMLspace()
- {
- return xmlspace;
- }
-
- public void setXMLspace(String xmlspace)
- {
- this.xmlspace = xmlspace;
- }
-
- public SVGList getRequiredFeatures( )
- {
- return reqFeatures;
- }
-
- public void setRequiredFeatures( SVGList requiredFeatures )
- throws DOMException
- {
- reqFeatures = requiredFeatures;
- }
-
- public SVGList getRequiredExtensions( )
- {
- return reqExtensions;
- }
-
- public void setRequiredExtensions( SVGList requiredExtensions )
- throws DOMException
- {
- reqExtensions = requiredExtensions;
- }
-
- public boolean hasExtension ( String extension )
- {
- return false;
- }
-
- public SVGList getSystemLanguage()
- {
- return sysLanguage;
- }
-
- public void setSystemLanguage(SVGList systemLanguage)
- {
- sysLanguage = systemLanguage;
- }
-
- public void addEventListener(String type,
- EventListener listener,
- boolean useCapture)
- {
- }
-
- public void removeEventListener(String type,
- EventListener listener,
- boolean useCapture)
- {
- }
-
- public boolean dispatchEvent(Event evt)
-// throws EventException
- {
- return false;
- }
-
- /**
- * Convenience method for implementations of SVGTransformable
- * that have children that represents the bounding box
- */
- protected SVGRect getChildrenBBox()
- {
- float minX = 10000000; // a big number
- float maxX = -10000000; // a low number
- float minY = 10000000; // a big number
- float maxY = -10000000; // a low number
- NodeList nl = getChildNodes();
- // can width and height be negative??
- for(int count = 0; count < nl.getLength(); count++) {
- Node n = nl.item(count);
- if(n instanceof SVGTransformable) {
- SVGRect r = ((SVGTransformable)n).getBBox();
- if(r != null) {
- if(minX > r.getX())
- minX = r.getX();
- if(minY > r.getY())
- minY = r.getY();
- if(maxX < r.getX() + r.getWidth())
- maxX = r.getX() + r.getWidth();
- if(maxY > r.getY() + r.getHeight())
- maxY = r.getY() + r.getHeight();
- }
- }
- }
- SVGRect rect = new SVGRectImpl();
- rect.setX(minX);
- rect.setY(minY);
- rect.setWidth(maxX - minX);
- rect.setHeight(maxY - minY);
- return rect;
- }
+public abstract class GraphicElement extends SVGElementImpl implements SVGTransformable,
+SVGLangSpace, SVGTests, EventTarget {
+ protected SVGStringList reqFeatures;
+ protected SVGStringList reqExtensions;
+ protected SVGStringList sysLanguage;
+ SVGAnimatedTransformList transform;
+ String xmlspace = "default";
+
+ public SVGElement getNearestViewportElement() {
+ Node node = getParentNode();
+ while (node != null) {
+ if (node instanceof SVGGElement) {
+ return (SVGElement) node;
+ } else if (node instanceof SVGSVGElement) {
+ return (SVGElement) node;
+ }
+ node = getParentNode();
+ }
+ return null;
+ }
+
+ public SVGElement getFarthestViewportElement() {
+ Node node = getParentNode();
+ SVGElement viewport = null;
+ while (node != null) {
+ if (node instanceof SVGGElement) {
+ viewport = (SVGElement) node;
+ } else if (node instanceof SVGSVGElement) {
+ viewport = (SVGElement) node;
+ }
+ node = getParentNode();
+ }
+ return viewport;
+ }
+
+ public SVGAnimatedTransformList getTransform() {
+ if (transform != null) {
+ return transform;
+ }
+ SVGTransformList stl = new SVGTransformListImpl();
+ SVGTransform transform = new SVGTransformImpl();
+ stl.appendItem(transform);
+ SVGAnimatedTransformListImpl atl =
+ new SVGAnimatedTransformListImpl();
+ atl.setBaseVal(stl);
+ return atl;
+ }
+
+ public void setTransform(SVGAnimatedTransformList transform) {
+ this.transform = transform;
+ }
+
+ public SVGRect getBBox() {
+ return null;
+ }
+
+ /**
+ * Returns the transformation matrix from current user units (i.e., after
+ * application of the transform attribute) to the viewport coordinate system
+ * for the nearestViewportElement.
+ */
+ public SVGMatrix getCTM() {
+ return transform.getBaseVal().consolidate().getMatrix();
+ }
+
+ /**
+ * Returns the transformation matrix from current user units (i.e., after
+ * application of the transform attribute) to the parent user agent's notice
+ * of a "pixel". For display devices, ideally this represents a physical
+ * screen pixel. For other devices or environments where physical pixel sizes
+ * are not known, then an algorithm similar to the CSS2 definition of a "pixel"
+ * can be used instead.
+ * This is the matrix that converts from the user space to the position
+ * on the screen.
+ */
+ public SVGMatrix getScreenCTM() {
+ if (transform == null) {
+ return new SVGMatrixImpl();
+ }
+ Node node = getParentNode();
+ SVGMatrix matrix = null;
+ if (node != null && node instanceof SVGTransformable) {
+ matrix = ((SVGTransformable) node).getScreenCTM();
+ }
+ if (matrix != null) {
+ matrix = transform.getBaseVal().consolidate().getMatrix().
+ multiply(matrix);
+ } else {
+ matrix = transform.getBaseVal().consolidate().getMatrix();
+ }
+ return matrix;
+ }
+
+ public SVGMatrix getTransformToElement(SVGElement element)
+ throws SVGException {
+ return null;
+ }
+
+ public String getXMLlang() {
+ return null;
+ }
+
+ public void setXMLlang(String xmllang) {
+ }
+
+ public String getXMLspace() {
+ return xmlspace;
+ }
+
+ public void setXMLspace(String xmlspace) {
+ this.xmlspace = xmlspace;
+ }
+
+ public SVGStringList getRequiredFeatures() {
+ return reqFeatures;
+ }
+
+ public void setRequiredFeatures(SVGStringList requiredFeatures)
+ throws DOMException {
+ reqFeatures = requiredFeatures;
+ }
+
+ public SVGStringList getRequiredExtensions() {
+ return reqExtensions;
+ }
+
+ public void setRequiredExtensions(SVGStringList requiredExtensions)
+ throws DOMException {
+ reqExtensions = requiredExtensions;
+ }
+
+ public boolean hasExtension (String extension) {
+ return false;
+ }
+
+ public SVGStringList getSystemLanguage() {
+ return sysLanguage;
+ }
+
+ public void setSystemLanguage(SVGStringList systemLanguage) {
+ sysLanguage = systemLanguage;
+ }
+
+ public void addEventListener(String type, EventListener listener,
+ boolean useCapture) {
+ }
+
+ public void removeEventListener(String type,
+ EventListener listener, boolean useCapture) {
+ }
+
+ public boolean dispatchEvent(Event evt)// throws EventException
+ {
+ return false;
+ }
+
+ /**
+ * Convenience method for implementations of SVGTransformable
+ * that have children that represents the bounding box
+ */
+ protected SVGRect getChildrenBBox() {
+ float minX = 10000000; // a big number
+ float maxX = -10000000; // a low number
+ float minY = 10000000; // a big number
+ float maxY = -10000000; // a low number
+ NodeList nl = getChildNodes();
+ // can width and height be negative??
+ for (int count = 0; count < nl.getLength(); count++) {
+ Node n = nl.item(count);
+ if (n instanceof SVGTransformable) {
+ SVGRect r = ((SVGTransformable) n).getBBox();
+ if (r != null) {
+ if (minX > r.getX())
+ minX = r.getX();
+ if (minY > r.getY())
+ minY = r.getY();
+ if (maxX < r.getX() + r.getWidth())
+ maxX = r.getX() + r.getWidth();
+ if (maxY > r.getY() + r.getHeight())
+ maxY = r.getY() + r.getHeight();
+ }
+ }
+ }
+ SVGRect rect = new SVGRectImpl();
+ rect.setX(minX);
+ rect.setY(minY);
+ rect.setWidth(maxX - minX);
+ rect.setHeight(maxY - minY);
+ return rect;
+ }
}
*/
public class SVGGradientElementImpl extends SVGURIReferenceImpl implements SVGGradientElement {
/*
- SVG_SPREADMETHOD_UNKNOWN;
- SVG_SPREADMETHOD_PAD;
- SVG_SPREADMETHOD_REFLECT;
- SVG_SPREADMETHOD_REPEAT;
+ SVG_SPREADMETHOD_UNKNOWN;
+ SVG_SPREADMETHOD_PAD;
+ SVG_SPREADMETHOD_REFLECT;
+ SVG_SPREADMETHOD_REPEAT;
*/
SVGAnimatedEnumeration spreadMethod =
new SVGAnimatedEnumerationImpl(SVG_SPREADMETHOD_UNKNOWN);
SVGAnimatedEnumeration units =
new SVGAnimatedEnumerationImpl(SVG_UNIT_TYPE_UNKNOWN);
-
+ SVGAnimatedTransformList gradientTransform;
public SVGGradientElementImpl() {
}
}
public SVGAnimatedTransformList getGradientTransform() {
- return null;
+ return gradientTransform;
}
public void setGradientTransform(
SVGAnimatedTransformList gradientTransform) {
+ this.gradientTransform = gradientTransform;
}
public SVGAnimatedEnumeration getSpreadMethod() {
-/*-- $Id$ --
+/*-- $Id$ --
============================================================================
The Apache Software License, Version 1.1
============================================================================
-
+
Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
-
+
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
-
+
4. The names "Fop" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
-
+
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
-
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
-
+
*/
package org.apache.fop.dom.svg;
import java.util.*;
import org.w3c.dom.svg.*;
+import org.w3c.dom.*;
/**
* a length quantity in XSL
*/
public class SVGLengthListImpl extends SVGListImpl implements SVGLengthList {
- protected float fontsize = 12;
-
- public void setValueAsString( String valueAsString )
- {
- convert(valueAsString);
- }
-
- /**
- * set the length given a particular String specifying length and units
- */
- public SVGLengthListImpl (String len) {
- convert(len);
- }
-
- public SVGLengthListImpl () {
- }
-
- /**
- * set the length given a particular String specifying length and units,
- * and the font-size (necessary for an em)
- */
- public SVGLengthListImpl (String len, int fontsize)
- {
- this.fontsize = fontsize;
- convert(len);
- }
-
- protected void convert(String len)
- {
- int l = len.length();
-
- if (l == 0) {
-// MessageHandler.errorln("WARNING: empty length");
- } else {
- // could be an array of points, as in for svg:text
- int pos;
- pos = len.trim().indexOf(" ");
- if(pos != -1) {
- StringTokenizer st = new StringTokenizer(len.trim());
- while(st.hasMoreTokens()) {
- String val = st.nextToken();
- float dvalue = getFloatValue(val, val.length());
- float intValue = dvalue;
- appendItem(new Float(intValue));
- }
- } else {
- float dvalue = getFloatValue(len, l);
- appendItem(new Float(dvalue));
- }
- }
- }
-
- protected float getFloatValue(String len, int l)
- {
- int assumed_resolution = 1; // points/pixel
-
- float dvalue;
- try {
- if(len.endsWith("in")) {
- dvalue = Float.valueOf(len.substring(0,(l-2))).floatValue();
- dvalue = dvalue * 72;
- } else if(len.endsWith("cm")) {
- dvalue = Float.valueOf(len.substring(0,(l-2))).floatValue();
- dvalue = dvalue * 28.35f;
- } else if(len.endsWith("mm")) {
- dvalue = Float.valueOf(len.substring(0,(l-2))).floatValue();
- dvalue = dvalue * 2.84f;
- } else if(len.endsWith("pt")) {
- dvalue = Float.valueOf(len.substring(0,(l-2))).floatValue();
- dvalue = dvalue;
- } else if(len.endsWith("pc")) {
- dvalue = Float.valueOf(len.substring(0,(l-2))).floatValue();
- dvalue = dvalue * 12;
- } else if(len.endsWith("em")) {
- dvalue = Float.valueOf(len.substring(0,(l-2))).floatValue();
- dvalue = dvalue * fontsize;
- } else if(len.endsWith("px")) {
- dvalue = Float.valueOf(len.substring(0,(l-2))).floatValue();
- dvalue = dvalue * assumed_resolution;
- } else if(len.endsWith("%")) {
- dvalue = Float.valueOf(len.substring(0,(l-1))).floatValue() / 100f; //??
- } else {
- dvalue = Float.valueOf(len).floatValue();
- }
- } catch (Exception e) {
- dvalue = 0;
- MessageHandler.errorln("ERROR: unknown length units in " + len);
- }
- return dvalue;
- }
+ protected float fontsize = 12;
+
+ public void setValueAsString(String valueAsString) {
+ convert(valueAsString);
+ }
+
+ /**
+ * set the length given a particular String specifying length and units
+ */
+ public SVGLengthListImpl (String len) {
+ convert(len);
+ }
+
+ public SVGLengthListImpl () {
+ }
+
+ /**
+ * set the length given a particular String specifying length and units,
+ * and the font-size (necessary for an em)
+ */
+ public SVGLengthListImpl (String len, int fontsize) {
+ this.fontsize = fontsize;
+ convert(len);
+ }
+
+ protected void convert(String len) {
+ int l = len.length();
+
+ if (l == 0) {
+ // MessageHandler.errorln("WARNING: empty length");
+ } else {
+ // could be an array of points, as in for svg:text
+ int pos;
+ pos = len.trim().indexOf(" ");
+ if (pos != -1) {
+ StringTokenizer st = new StringTokenizer(len.trim());
+ while (st.hasMoreTokens()) {
+ String val = st.nextToken();
+ float dvalue = getFloatValue(val, val.length());
+ float intValue = dvalue;
+ SVGLengthImpl impl = new SVGLengthImpl();
+ impl.setValue(intValue);
+ appendItem(impl);
+ }
+ } else {
+ float dvalue = getFloatValue(len, l);
+ SVGLengthImpl impl = new SVGLengthImpl();
+ impl.setValue(dvalue);
+ appendItem(impl);
+ }
+ }
+ }
+
+ protected float getFloatValue(String len, int l) {
+ int assumed_resolution = 1; // points/pixel
+
+ float dvalue;
+ try {
+ if (len.endsWith("in")) {
+ dvalue = Float.valueOf(
+ len.substring(0, (l - 2))).floatValue();
+ dvalue = dvalue * 72;
+ } else if (len.endsWith("cm")) {
+ dvalue = Float.valueOf(
+ len.substring(0, (l - 2))).floatValue();
+ dvalue = dvalue * 28.35f;
+ } else if (len.endsWith("mm")) {
+ dvalue = Float.valueOf(
+ len.substring(0, (l - 2))).floatValue();
+ dvalue = dvalue * 2.84f;
+ } else if (len.endsWith("pt")) {
+ dvalue = Float.valueOf(
+ len.substring(0, (l - 2))).floatValue();
+ dvalue = dvalue;
+ } else if (len.endsWith("pc")) {
+ dvalue = Float.valueOf(
+ len.substring(0, (l - 2))).floatValue();
+ dvalue = dvalue * 12;
+ } else if (len.endsWith("em")) {
+ dvalue = Float.valueOf(
+ len.substring(0, (l - 2))).floatValue();
+ dvalue = dvalue * fontsize;
+ } else if (len.endsWith("px")) {
+ dvalue = Float.valueOf(
+ len.substring(0, (l - 2))).floatValue();
+ dvalue = dvalue * assumed_resolution;
+ } else if (len.endsWith("%")) {
+ dvalue = Float.valueOf(
+ len.substring(0, (l - 1))).floatValue() / 100f; //??
+ } else {
+ dvalue = Float.valueOf(len).floatValue();
+ }
+ } catch (Exception e) {
+ dvalue = 0;
+ MessageHandler.errorln("ERROR: unknown length units in " + len);
+ }
+ return dvalue;
+ }
+
+ public SVGLength initialize (SVGLength newItem) throws SVGException {
+ return null;
+ }
+
+ public SVGLength createItem() {
+ return new SVGLengthImpl();
+ }
+
+ public SVGLength getItem(int index) throws DOMException {
+ Object obj = list.elementAt(index);
+ return (SVGLength) obj;
+ }
+
+ public SVGLength removeItem(int index) throws DOMException {
+ Object obj = list.elementAt(index);
+ list.removeElementAt(index);
+ return (SVGLength) obj;
+ }
+
+ public SVGLength appendItem(SVGLength newItem) throws SVGException {
+ list.addElement(newItem);
+ return null;
+ }
+
+ public SVGLength replaceItem(SVGLength newItem,
+ int index) throws DOMException, SVGException {
+ return null;
+ }
+
+ public SVGLength insertItemBefore(SVGLength newItem,
+ int index) throws SVGException {
+ return null;
+ }
}
-/*-- $Id$ --
+/*-- $Id$ --
============================================================================
The Apache Software License, Version 1.1
============================================================================
-
+
Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
-
+
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
-
+
4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
-
+
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
-
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
-
+
*/
package org.apache.fop.dom.svg;
/**
*
*/
-public class SVGListImpl implements SVGList {
- Vector list = new Vector();
-
- public int getNumberOfItems( )
- {
- return list.size();
- }
-
- public void clear()
- {
- list.removeAllElements();
- }
-
- public Object initialize ( Object newItem )
- throws SVGException
- {
- return null;
- }
-
- public Object createItem()
- {
- return null;
- }
-
- public Object getItem(int index)
- throws DOMException
- {
- Object obj = list.elementAt(index);
- return obj;
- }
-
- public Object insertItemBefore(Object newItem, int index)
- throws SVGException
- {
- return null;
- }
-
- public Object replaceItem(Object newItem, int index)
- throws DOMException, SVGException
- {
- return null;
- }
-
- public Object removeItem(int index)
- throws DOMException
- {
- Object obj = list.elementAt(index);
- list.removeElementAt(index);
- return obj;
- }
-
- public Object appendItem(Object newItem)
- throws SVGException
- {
- list.addElement(newItem);
- return null;
- }
-
- public String toString()
- {
- return list.toString();
- }
+public class SVGListImpl {
+ Vector list = new Vector();
+
+ public int getNumberOfItems() {
+ return list.size();
+ }
+
+ public void clear() {
+ list.removeAllElements();
+ }
+
+ /* public Object initialize ( Object newItem )
+ throws SVGException
+ {
+ return null;
+ }
+
+ public Object createItem()
+ {
+ return null;
+ }
+
+ public Object getItem(int index)
+ throws DOMException
+ {
+ Object obj = list.elementAt(index);
+ return obj;
+ }
+
+ public Object insertItemBefore(Object newItem, int index)
+ throws SVGException
+ {
+ return null;
+ }
+
+ public Object replaceItem(Object newItem, int index)
+ throws DOMException, SVGException
+ {
+ return null;
+ }
+
+ public Object removeItem(int index)
+ throws DOMException
+ {
+ Object obj = list.elementAt(index);
+ list.removeElementAt(index);
+ return obj;
+ }
+
+ public Object appendItem(Object newItem)
+ throws SVGException
+ {
+ list.addElement(newItem);
+ return null;
+ }*/
+
+ public String toString() {
+ return list.toString();
+ }
}
-/*-- $Id$ --
+/*-- $Id$ --
============================================================================
The Apache Software License, Version 1.1
============================================================================
-
+
Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
-
+
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
-
+
4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
-
+
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
-
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
-
+
*/
package org.apache.fop.dom.svg;
*/
public class SVGPathElementImpl extends GraphicElement implements SVGPathElement {
- public Vector pathElements;
-
- /**
- * construct a line graphic
- */
- public SVGPathElementImpl(Vector v)
- {
- this.pathElements = v;
- }
-
- public SVGAnimatedNumber getPathLength()
- {
- return null;
- }
-
- public SVGRect getBBox()
- {
- float minX = 10000000; // a big number
- float maxX = -10000000; // a low number
- float minY = 10000000; // a big number
- float maxY = -10000000; // a low number
- // the bounds of a path is always within the end points and
- // the control points, so adjust the min and max to be these extremes
- for(Enumeration e = pathElements.elements(); e.hasMoreElements(); ) {
- SVGPathSegImpl pc = (SVGPathSegImpl)e.nextElement();
- float[] vals = pc.getValues();
- switch(pc.getPathSegType()) {
- case SVGPathSeg.PATHSEG_MOVETO_ABS:
- break;
- case SVGPathSeg.PATHSEG_MOVETO_REL:
- break;
- case SVGPathSeg.PATHSEG_LINETO_ABS:
- break;
- case SVGPathSeg.PATHSEG_LINETO_REL:
- break;
- case SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS:
- break;
- case SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL:
- break;
- case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS:
- break;
- case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL:
- break;
- case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:
- break;
- case SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL:
- break;
- case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:
- break;
- case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL:
- break;
- case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS:
- break;
- case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL:
- break;
- case SVGPathSeg.PATHSEG_ARC_ABS:
- break;
- case SVGPathSeg.PATHSEG_ARC_REL:
- break;
- case SVGPathSeg.PATHSEG_CLOSEPATH:
- break;
- }
- }
- SVGRect rect = new SVGRectImpl();
- rect.setX(minX);
- rect.setY(minY);
- rect.setWidth(maxX - minX);
- rect.setHeight(maxY - minY);
- return rect;
- }
-
- public void setPathLength( SVGAnimatedNumber length )
- {
- }
-
- public SVGList getPathSegList()
- {
- return null;
- }
-
- public SVGList getNormalizedPathSegList()
- {
- return null;
- }
-
- public float getTotalLength()
- {
- return 0;
- }
-
- public SVGPoint getPointAtLength(float distance)
- throws SVGException
- {
- return null;
- }
-
- public int getPathSegAtLength(float distance)
- throws SVGException
- {
- return 0;
- }
-
- public short getPathSegType( )
- {
- return 0;
- }
-
- public String getPathSegTypeAsLetter( )
- {
- return null;
- }
-
- public SVGPathSegClosePath createSVGPathSegClosePath ( )
- {
- return null;
- }
-
- public SVGPathSegMovetoAbs createSVGPathSegMovetoAbs ( float x, float y )
- {
- return null;
- }
-
- public SVGPathSegMovetoRel createSVGPathSegMovetoRel ( float x, float y )
- {
- return null;
- }
-
- public SVGPathSegLinetoAbs createSVGPathSegLinetoAbs ( float x, float y )
- {
- return null;
- }
-
- public SVGPathSegLinetoRel createSVGPathSegLinetoRel ( float x, float y )
- {
- return null;
- }
-
- public SVGPathSegCurvetoCubicAbs createSVGPathSegCurvetoCubicAbs ( float x, float y, float x1, float y1, float x2, float y2 )
- {
- return null;
- }
-
- public SVGPathSegCurvetoCubicRel createSVGPathSegCurvetoCubicRel ( float x, float y, float x1, float y1, float x2, float y2 )
- {
- return null;
- }
-
- public SVGPathSegCurvetoQuadraticAbs createSVGPathSegCurvetoQuadraticAbs ( float x, float y, float x1, float y1 )
- {
- return null;
- }
-
- public SVGPathSegCurvetoQuadraticRel createSVGPathSegCurvetoQuadraticRel ( float x, float y, float x1, float y1 )
- {
- return null;
- }
-
- public SVGPathSegArcAbs createSVGPathSegArcAbs ( float x, float y, float r1, float r2, float angle, boolean largeArcFlag, boolean sweepFlag )
- {
- return null;
- }
-
- public SVGPathSegArcRel createSVGPathSegArcRel ( float x, float y, float r1, float r2, float angle, boolean largeArcFlag, boolean sweepFlag )
- {
- return null;
- }
-
- public SVGPathSegLinetoHorizontalAbs createSVGPathSegLinetoHorizontalAbs ( float x )
- {
- return null;
- }
-
- public SVGPathSegLinetoHorizontalRel createSVGPathSegLinetoHorizontalRel ( float x )
- {
- return null;
- }
-
- public SVGPathSegLinetoVerticalAbs createSVGPathSegLinetoVerticalAbs ( float y )
- {
- return null;
- }
-
- public SVGPathSegLinetoVerticalRel createSVGPathSegLinetoVerticalRel ( float y )
- {
- return null;
- }
-
- public SVGPathSegCurvetoCubicSmoothAbs createSVGPathSegCurvetoCubicSmoothAbs ( float x, float y, float x2, float y2 )
- {
- return null;
- }
-
- public SVGPathSegCurvetoCubicSmoothRel createSVGPathSegCurvetoCubicSmoothRel ( float x, float y, float x2, float y2 )
- {
- return null;
- }
-
- public SVGPathSegCurvetoQuadraticSmoothAbs createSVGPathSegCurvetoQuadraticSmoothAbs ( float x, float y )
- {
- return null;
- }
-
- public SVGPathSegCurvetoQuadraticSmoothRel createSVGPathSegCurvetoQuadraticSmoothRel ( float x, float y )
- {
- return null;
- }
-
- public SVGList getAnimatedPathSegList( )
- {
- return null;
- }
-
- public SVGList getAnimatedNormalizedPathSegList( )
- {
- return null;
- }
+ public Vector pathElements;
+
+ /**
+ * construct a line graphic
+ */
+ public SVGPathElementImpl(Vector v) {
+ this.pathElements = v;
+ }
+
+ public SVGAnimatedNumber getPathLength() {
+ return null;
+ }
+
+ public SVGRect getBBox() {
+ float minX = 10000000; // a big number
+ float maxX = -10000000; // a low number
+ float minY = 10000000; // a big number
+ float maxY = -10000000; // a low number
+ // the bounds of a path is always within the end points and
+ // the control points, so adjust the min and max to be these extremes
+ float lastx = 0;
+ float lasty = 0;
+ float lastmovex = 0;
+ float lastmovey = 0;
+ float[] cxs;
+ float tempx;
+ float tempy;
+ float lastcx = 0;
+ float lastcy = 0;
+ for (Enumeration e = pathElements.elements();
+ e.hasMoreElements();) {
+ SVGPathSegImpl pc = (SVGPathSegImpl) e.nextElement();
+ float[] vals = pc.getValues();
+ switch (pc.getPathSegType()) {
+ case SVGPathSeg.PATHSEG_MOVETO_ABS:
+ lastx = vals[0];
+ lasty = vals[1];
+ break;
+ case SVGPathSeg.PATHSEG_MOVETO_REL:
+ break;
+ case SVGPathSeg.PATHSEG_LINETO_ABS:
+ lastx = vals[0];
+ lasty = vals[1];
+ break;
+ case SVGPathSeg.PATHSEG_LINETO_REL:
+ lastx += vals[0];
+ lasty += vals[1];
+ break;
+ case SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS:
+ lasty = vals[0];
+ break;
+ case SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL:
+ lasty += vals[0];
+ break;
+ case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS:
+ lastx = vals[0];
+ break;
+ case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL:
+ lastx += vals[0];
+ break;
+ case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:
+ lastx = vals[4];
+ lasty = vals[5];
+ lastcx = vals[2];
+ lastcy = vals[3];
+ break;
+ case SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL:
+ break;
+ case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:
+ break;
+ case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL:
+ break;
+ case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS:
+ break;
+ case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL:
+ break;
+ case SVGPathSeg.PATHSEG_ARC_ABS:
+ break;
+ case SVGPathSeg.PATHSEG_ARC_REL:
+ break;
+ case SVGPathSeg.PATHSEG_CLOSEPATH:
+ break;
+ }
+ if (lastx < minX) {
+ minX = lastx;
+ }
+ if (lastx > maxX) {
+ maxX = lastx;
+ }
+ if (lasty < minY) {
+ minY = lasty;
+ }
+ if (lasty > minX) {
+ maxY = lasty;
+ }
+ }
+ SVGRect rect = new SVGRectImpl();
+ rect.setX(minX);
+ rect.setY(minY);
+ rect.setWidth(maxX - minX);
+ rect.setHeight(maxY - minY);
+ return rect;
+ }
+
+ public void setPathLength(SVGAnimatedNumber length) {
+ }
+
+ public SVGPathSegList getPathSegList() {
+ return null;
+ }
+
+ public SVGPathSegList getNormalizedPathSegList() {
+ return null;
+ }
+
+ public float getTotalLength() {
+ return 0;
+ }
+
+ public SVGPoint getPointAtLength(float distance) throws SVGException {
+ return null;
+ }
+
+ public int getPathSegAtLength(float distance) throws SVGException {
+ return 0;
+ }
+
+ public short getPathSegType() {
+ return 0;
+ }
+
+ public String getPathSegTypeAsLetter() {
+ return null;
+ }
+
+ public SVGPathSegClosePath createSVGPathSegClosePath () {
+ return null;
+ }
+
+ public SVGPathSegMovetoAbs createSVGPathSegMovetoAbs (float x,
+ float y) {
+ return null;
+ }
+
+ public SVGPathSegMovetoRel createSVGPathSegMovetoRel (float x,
+ float y) {
+ return null;
+ }
+
+ public SVGPathSegLinetoAbs createSVGPathSegLinetoAbs (float x,
+ float y) {
+ return null;
+ }
+
+ public SVGPathSegLinetoRel createSVGPathSegLinetoRel (float x,
+ float y) {
+ return null;
+ }
+
+ public SVGPathSegCurvetoCubicAbs createSVGPathSegCurvetoCubicAbs (
+ float x, float y, float x1, float y1, float x2, float y2) {
+ return null;
+ }
+
+ public SVGPathSegCurvetoCubicRel createSVGPathSegCurvetoCubicRel (
+ float x, float y, float x1, float y1, float x2, float y2) {
+ return null;
+ }
+
+ public SVGPathSegCurvetoQuadraticAbs createSVGPathSegCurvetoQuadraticAbs (
+ float x, float y, float x1, float y1) {
+ return null;
+ }
+
+ public SVGPathSegCurvetoQuadraticRel createSVGPathSegCurvetoQuadraticRel (
+ float x, float y, float x1, float y1) {
+ return null;
+ }
+
+ public SVGPathSegArcAbs createSVGPathSegArcAbs (float x, float y,
+ float r1, float r2, float angle, boolean largeArcFlag,
+ boolean sweepFlag) {
+ return null;
+ }
+
+ public SVGPathSegArcRel createSVGPathSegArcRel (float x, float y,
+ float r1, float r2, float angle, boolean largeArcFlag,
+ boolean sweepFlag) {
+ return null;
+ }
+
+ public SVGPathSegLinetoHorizontalAbs createSVGPathSegLinetoHorizontalAbs (
+ float x) {
+ return null;
+ }
+
+ public SVGPathSegLinetoHorizontalRel createSVGPathSegLinetoHorizontalRel (
+ float x) {
+ return null;
+ }
+
+ public SVGPathSegLinetoVerticalAbs createSVGPathSegLinetoVerticalAbs (
+ float y) {
+ return null;
+ }
+
+ public SVGPathSegLinetoVerticalRel createSVGPathSegLinetoVerticalRel (
+ float y) {
+ return null;
+ }
+
+ public SVGPathSegCurvetoCubicSmoothAbs createSVGPathSegCurvetoCubicSmoothAbs (
+ float x, float y, float x2, float y2) {
+ return null;
+ }
+
+ public SVGPathSegCurvetoCubicSmoothRel createSVGPathSegCurvetoCubicSmoothRel (
+ float x, float y, float x2, float y2) {
+ return null;
+ }
+
+ public SVGPathSegCurvetoQuadraticSmoothAbs createSVGPathSegCurvetoQuadraticSmoothAbs (
+ float x, float y) {
+ return null;
+ }
+
+ public SVGPathSegCurvetoQuadraticSmoothRel createSVGPathSegCurvetoQuadraticSmoothRel (
+ float x, float y) {
+ return null;
+ }
+
+ public SVGPathSegList getAnimatedPathSegList() {
+ return null;
+ }
+
+ public SVGPathSegList getAnimatedNormalizedPathSegList() {
+ return null;
+ }
}
-/*-- $Id$ --
+/*-- $Id$ --
============================================================================
The Apache Software License, Version 1.1
============================================================================
-
+
Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
-
+
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
-
+
4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
-
+
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
-
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
-
+
*/
package org.apache.fop.dom.svg;
*/
public class SVGPolygonElementImpl extends GraphicElement implements SVGPolygonElement {
- public Vector points;
-
- public SVGPolygonElementImpl(Vector p)
- {
- this.points = p;
- }
-
- public SVGList getPoints( )
- {
- return null;
- }
-
- public SVGList getAnimatedPoints( )
- {
- return null;
- }
-
- public SVGRect getBBox()
- {
- float minX = 10000000; // a big number
- float maxX = -10000000; // a low number
- float minY = 10000000; // a big number
- float maxY = -10000000; // a low number
- for(Enumeration e = points.elements(); e.hasMoreElements(); ) {
- e.nextElement();
- }
- SVGRect rect = new SVGRectImpl();
- rect.setX(minX);
- rect.setY(minY);
- rect.setWidth(maxX - minX);
- rect.setHeight(maxY - minY);
- return rect;
- }
-
- public String getTagName()
- {
- return "polygon";
- }
+ public Vector points;
+
+ public SVGPolygonElementImpl(Vector p) {
+ this.points = p;
+ }
+
+ public SVGPointList getPoints() {
+ return null;
+ }
+
+ public SVGPointList getAnimatedPoints() {
+ return null;
+ }
+
+ public SVGRect getBBox() {
+ float minX = 10000000; // a big number
+ float maxX = -10000000; // a low number
+ float minY = 10000000; // a big number
+ float maxY = -10000000; // a low number
+ for (Enumeration e = points.elements(); e.hasMoreElements();) {
+ e.nextElement();
+ }
+ SVGRect rect = new SVGRectImpl();
+ rect.setX(minX);
+ rect.setY(minY);
+ rect.setWidth(maxX - minX);
+ rect.setHeight(maxY - minY);
+ return rect;
+ }
+
+ public String getTagName() {
+ return "polygon";
+ }
}
-/*-- $Id$ --
+/*-- $Id$ --
============================================================================
The Apache Software License, Version 1.1
============================================================================
-
+
Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
-
+
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
-
+
4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
-
+
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
-
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
-
+
*/
package org.apache.fop.dom.svg;
*/
public class SVGPolylineElementImpl extends GraphicElement implements SVGPolylineElement {
- public Vector points;
-
- public SVGPolylineElementImpl(Vector p)
- {
- this.points = p;
- }
-
- public SVGList getPoints()
- {
- return null;
- }
+ public Vector points;
- public SVGList getAnimatedPoints( )
- {
- return null;
- }
+ public SVGPolylineElementImpl(Vector p) {
+ this.points = p;
+ }
-/* public SVGAnimatedBoolean getExternalResourcesRequired( )
- {
- return null;
- }
+ public SVGPointList getPoints() {
+ return null;
+ }
- public void setExternalResourcesRequired( SVGAnimatedBoolean externalResourcesRequired )
- {
- }*/
+ public SVGPointList getAnimatedPoints() {
+ return null;
+ }
}
-/*-- $Id$ --
+/*-- $Id$ --
============================================================================
The Apache Software License, Version 1.1
============================================================================
-
+
Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
-
+
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
-
+
4. The names "Fop" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
-
+
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
-
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
-
+
*/
package org.apache.fop.dom.svg;
*
*/
public class SVGSVGElementImpl extends GraphicElement implements SVGSVGElement {
- SVGAnimatedLength x;
- SVGAnimatedLength y;
- SVGAnimatedLength width;
- SVGAnimatedLength height;
-
- public SVGSVGElementImpl()
- {
- }
-
- public SVGAnimatedLength getX( )
- {
- return x;
- }
-
- public SVGAnimatedLength getY( )
- {
- return y;
- }
-
- public SVGAnimatedLength getWidth( )
- {
- return width;
- }
-
- public SVGAnimatedLength getHeight( )
- {
- return height;
- }
-
- public void setWidth(SVGAnimatedLength w)
- {
- width = w;
- }
-
- public void setHeight(SVGAnimatedLength h)
- {
- height = h;
- }
-
- public void setX(SVGAnimatedLength x)
- {
- this.x = x;
- }
-
- public void setY(SVGAnimatedLength y)
- {
- this.y = y;
- }
-
- public SVGRect getViewport( )
- {
- return null;
- }
-
- public SVGRect getBBox()
- {
+ SVGAnimatedLength x;
+ SVGAnimatedLength y;
+ SVGAnimatedLength width;
+ SVGAnimatedLength height;
+
+ public SVGSVGElementImpl() {
+ }
+
+ public SVGAnimatedLength getX() {
+ return x;
+ }
+
+ public SVGAnimatedLength getY() {
+ return y;
+ }
+
+ public SVGAnimatedLength getWidth() {
+ return width;
+ }
+
+ public SVGAnimatedLength getHeight() {
+ return height;
+ }
+
+ public void setWidth(SVGAnimatedLength w) {
+ width = w;
+ }
+
+ public void setHeight(SVGAnimatedLength h) {
+ height = h;
+ }
+
+ public void setX(SVGAnimatedLength x) {
+ this.x = x;
+ }
+
+ public void setY(SVGAnimatedLength y) {
+ this.y = y;
+ }
+
+ public SVGRect getViewport() {
+ return null;
+ }
+
+ public SVGRect getBBox() {
return getChildrenBBox();
}
- public String getContentScriptType( )
- {
- return null;
- }
-
- public void setContentScriptType( String contentScriptType )
- {
- }
-
- public String getContentStyleType( )
- {
- return null;
- }
-
- public void setContentStyleType( String contentStyleType )
- {
- }
-
-/* public CSSValue getPresentationAttribute ( String name )
- {
- CSSStyleDeclaration style;
- style = getStyle();
- CSSValue val;
- val = style.getPropertyCSSValue(name);
- if(val == null) {
- // get "style" element style for this
- }
- if(val == null) {
- // get element parents style
- Node par = getParentNode();
- if(par instanceof SVGStylable) {
- val = ((SVGStylable)par).getPresentationAttribute(name);
- }
- }
- return val;
- }*/
-
- public SVGPoint getCurrentTranslate( )
- {
- return null;
- }
-
- public void setCurrentTranslate( SVGPoint currentTranslate )
- {
- }
-
- public SVGViewSpec getCurrentView( )
- {
- return null;
- }
-
- public void deSelectAll()
- {
- }
-
- public NodeList getIntersectionList ( SVGRect rect, SVGElement referenceElement )
- {
- return null;
- }
-
- public NodeList getEnclosureList ( SVGRect rect, SVGElement referenceElement )
- {
- return null;
- }
-
- public boolean checkIntersection ( SVGElement element, SVGRect rect )
- {
- return false;
- }
-
- public boolean checkEnclosure ( SVGElement element, SVGRect rect )
- {
- return false;
- }
-
- public float getPixelUnitToMillimeterX( )
- {
- return 0;
- }
-
- public float getPixelUnitToMillimeterY( )
- {
- return 0;
- }
-
- public float getScreenPixelToMillimeterX( )
- {
- return 0;
- }
-
- public float getScreenPixelToMillimeterY( )
- {
- return 0;
- }
-
- public boolean getUseCurrentView( )
- {
- return true;
- }
-
- public void setUseCurrentView( boolean useCurrentView )
- {
- }
-
- public float getCurrentScale( )
- {
- return 0;
- }
-
- public void setCurrentScale( float currentScale )
- {
- }
-
- public int suspendRedraw ( int max_wait_milliseconds )
- {
- return 0;
- }
-
- public void unsuspendRedraw ( int suspend_handle_id )
- {
- }
-
- public void unsuspendRedrawAll ( )
- {
- }
-
- public void forceRedraw ( )
- {
- }
-
- public void pauseAnimations ( )
- {
- }
-
- public void unpauseAnimations ( )
- {
- }
-
- public boolean animationsPaused ()
- {
- return true;
- }
-
- public float getCurrentTime()
- {
- return 0;
- }
-
- public void setCurrentTime ( float seconds )
- {
- }
-
- public SVGLength createSVGLength ( )
- {
- return new SVGLengthImpl();
- }
-
- public SVGAngle createSVGAngle ( )
- {
- return new SVGAngleImpl();
- }
-
- public SVGPoint createSVGPoint ( )
- {
- return null;
- }
-
- public SVGMatrix createSVGMatrix ( )
- {
- return new SVGMatrixImpl();
- }
-
- public SVGRect createSVGRect ( )
- {
- return new SVGRectImpl();
- }
-
- public SVGTransform createSVGTransform ( )
- {
- return new SVGTransformImpl();
- }
-
- public SVGTransform createSVGTransformFromMatrix ( SVGMatrix matrix )
- {
- SVGTransform trans = new SVGTransformImpl();
- trans.setMatrix(matrix);
- return trans;
- }
-
- public RGBColor createRGBColor ( )
- {
- return null;
- }
-
- public SVGICCColor createSVGICCColor ( )
- {
- return null;
- }
-
- public Element getElementById ( String elementId )
- {
- return null;
- }
-
- public short getZoomAndPan( )
- {
- return 0;
- }
-
- public void setZoomAndPan( short zoomAndPan )
- {
- }
-
- public SVGAnimatedRect getViewBox()
- {
- return null;
- }
-
- public SVGAnimatedPreserveAspectRatio getPreserveAspectRatio( )
- {
- return null;
- }
-
- public CSSStyleDeclaration getComputedStyle(Element el, String str)
- {
- return null;
- }
-
- public CSSStyleDeclaration getOverrideStyle(Element el, String str)
- {
- return null;
- }
-
- public StyleSheetList getStyleSheets()
- {
- NodeList nl = getElementsByTagName("style");
- Vector shs = new Vector();
- for(int count = 0; count < nl.getLength(); count++) {
- Node el = (Node)nl.item(count);
- SVGStyleElementImpl sse = (SVGStyleElementImpl)el;
- StyleSheet sheet = sse.getStyleSheet();
- shs.addElement(sheet);
- }
- return new StyleSheetListImpl(shs);
- }
-
- public Event createEvent(String str)
- {
- return null;
- }
-
- public DocumentView getDocument()
- {
- return null;
- }
-
- public Node appendChild(Node newChild)
- throws DOMException
- {
- Node nChild = super.appendChild(newChild);
- if(newChild instanceof SVGElementImpl) {
- SVGElementImpl ele = (SVGElementImpl)newChild;
- ele.setOwnerSVG(this);
- }
- setOwnerSVG(this);
- return nChild;
- }
-
- public void setOwnerSVG(SVGSVGElement owner)
- {
- ownerSvg = owner;
- NodeList nl = getChildNodes();
- for(int count = 0; count < nl.getLength(); count++) {
- Node n = nl.item(count);
- if(n instanceof SVGElementImpl) {
- ((SVGElementImpl)n).setOwnerSVG(this);
- }
- }
- }
+ public String getContentScriptType() {
+ return null;
+ }
+
+ public void setContentScriptType(String contentScriptType) {
+ }
+
+ public String getContentStyleType() {
+ return null;
+ }
+
+ public void setContentStyleType(String contentStyleType) {
+ }
+
+ /* public CSSValue getPresentationAttribute ( String name )
+ {
+ CSSStyleDeclaration style;
+ style = getStyle();
+ CSSValue val;
+ val = style.getPropertyCSSValue(name);
+ if(val == null) {
+ // get "style" element style for this
+ }
+ if(val == null) {
+ // get element parents style
+ Node par = getParentNode();
+ if(par instanceof SVGStylable) {
+ val = ((SVGStylable)par).getPresentationAttribute(name);
+ }
+ }
+ return val;
+ }*/
+
+ public SVGPoint getCurrentTranslate() {
+ return null;
+ }
+
+ public void setCurrentTranslate(SVGPoint currentTranslate) {
+ }
+
+ public SVGViewSpec getCurrentView() {
+ return null;
+ }
+
+ public void deSelectAll() {
+ }
+
+ public NodeList getIntersectionList (SVGRect rect,
+ SVGElement referenceElement) {
+ return null;
+ }
+
+ public NodeList getEnclosureList (SVGRect rect,
+ SVGElement referenceElement) {
+ return null;
+ }
+
+ public boolean checkIntersection (SVGElement element, SVGRect rect) {
+ return false;
+ }
+
+ public boolean checkEnclosure (SVGElement element, SVGRect rect) {
+ return false;
+ }
+
+ public float getPixelUnitToMillimeterX() {
+ return 0;
+ }
+
+ public float getPixelUnitToMillimeterY() {
+ return 0;
+ }
+
+ public float getScreenPixelToMillimeterX() {
+ return 0;
+ }
+
+ public float getScreenPixelToMillimeterY() {
+ return 0;
+ }
+
+ public boolean getUseCurrentView() {
+ return true;
+ }
+
+ public void setUseCurrentView(boolean useCurrentView) {
+ }
+
+ public float getCurrentScale() {
+ return 0;
+ }
+
+ public void setCurrentScale(float currentScale) {
+ }
+
+ public int suspendRedraw (int max_wait_milliseconds) {
+ return 0;
+ }
+
+ public void unsuspendRedraw (int suspend_handle_id) {
+ }
+
+ public void unsuspendRedrawAll () {
+ }
+
+ public void forceRedraw () {
+ }
+
+ public void pauseAnimations () {
+ }
+
+ public void unpauseAnimations () {
+ }
+
+ public boolean animationsPaused () {
+ return true;
+ }
+
+ public float getCurrentTime() {
+ return 0;
+ }
+
+ public void setCurrentTime (float seconds) {
+ }
+
+ public SVGLength createSVGLength () {
+ return new SVGLengthImpl();
+ }
+
+ public SVGAngle createSVGAngle () {
+ return new SVGAngleImpl();
+ }
+
+ public SVGPoint createSVGPoint () {
+ return null;
+ }
+
+ public SVGMatrix createSVGMatrix () {
+ return new SVGMatrixImpl();
+ }
+
+ public SVGRect createSVGRect () {
+ return new SVGRectImpl();
+ }
+
+ public SVGTransform createSVGTransform () {
+ return new SVGTransformImpl();
+ }
+
+ public SVGTransform createSVGTransformFromMatrix (SVGMatrix matrix) {
+ SVGTransform trans = new SVGTransformImpl();
+ trans.setMatrix(matrix);
+ return trans;
+ }
+
+ public RGBColor createRGBColor () {
+ return null;
+ }
+
+ public SVGICCColor createSVGICCColor () {
+ return null;
+ }
+
+ public Element getElementById (String elementId) {
+ return null;
+ }
+
+ public short getZoomAndPan() {
+ return 0;
+ }
+
+ public void setZoomAndPan(short zoomAndPan) {
+ }
+
+ public SVGAnimatedRect getViewBox() {
+ return null;
+ }
+
+ public SVGAnimatedPreserveAspectRatio getPreserveAspectRatio() {
+ return null;
+ }
+
+ public CSSStyleDeclaration getComputedStyle(Element el, String str) {
+ return null;
+ }
+
+ public CSSStyleDeclaration getOverrideStyle(Element el, String str) {
+ return null;
+ }
+
+ public StyleSheetList getStyleSheets() {
+ NodeList nl = getElementsByTagName("style");
+ Vector shs = new Vector();
+ for (int count = 0; count < nl.getLength(); count++) {
+ Node el = (Node) nl.item(count);
+ SVGStyleElementImpl sse = (SVGStyleElementImpl) el;
+ StyleSheet sheet = sse.getStyleSheet();
+ shs.addElement(sheet);
+ }
+ return new StyleSheetListImpl(shs);
+ }
+
+ public Event createEvent(String str) {
+ return null;
+ }
+
+ public SVGNumber createSVGNumber () {
+ return null;//new SVGNumberImpl();
+ }
+
+ public String createSVGString () {
+ return new String();
+ }
+
+ public DocumentView getDocument() {
+ return null;
+ }
+
+ public Node appendChild(Node newChild) throws DOMException {
+ Node nChild = super.appendChild(newChild);
+ if (newChild instanceof SVGElementImpl) {
+ SVGElementImpl ele = (SVGElementImpl) newChild;
+ ele.setOwnerSVG(this);
+ }
+ setOwnerSVG(this);
+ return nChild;
+ }
+
+ public void setOwnerSVG(SVGSVGElement owner) {
+ ownerSvg = owner;
+ NodeList nl = getChildNodes();
+ for (int count = 0; count < nl.getLength(); count++) {
+ Node n = nl.item(count);
+ if (n instanceof SVGElementImpl) {
+ ((SVGElementImpl) n).setOwnerSVG(this);
+ }
+ }
+ }
}
--- /dev/null
+/*-- $Id$ --
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
+ endorse or promote products derived from this software without prior
+ written permission. For written permission, please contact
+ apache@apache.org.
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation and was originally created by
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ Software Foundation, please see <http://www.apache.org/>.
+
+ */
+
+package org.apache.fop.dom.svg;
+
+import org.apache.fop.dom.svg.*;
+import org.w3c.dom.svg.*;
+import org.w3c.dom.*;
+
+import java.util.*;
+
+/**
+ *
+ */
+public class SVGStringListImpl extends SVGListImpl implements SVGStringList {
+ public SVGStringListImpl(String str) {
+ parseString(str);
+ }
+
+ void parseString(String str) {
+ StringTokenizer st = new StringTokenizer(str, ", \n\r\t:;");
+ while (st.hasMoreTokens()) {
+ String item = st.nextToken();
+ appendItem(item);
+ }
+ }
+
+ public String initialize (String newItem) throws SVGException {
+ return null;
+ }
+
+ public String createItem() {
+ return new String();
+ }
+
+ public String getItem(int index) throws DOMException {
+ Object obj = list.elementAt(index);
+ return (String) obj;
+ }
+
+ public String removeItem(int index) throws DOMException {
+ Object obj = list.elementAt(index);
+ list.removeElementAt(index);
+ return (String) obj;
+ }
+
+ public String appendItem(String newItem) throws SVGException {
+ list.addElement(newItem);
+ return null;
+ }
+
+ public String replaceItem(String newItem,
+ int index) throws DOMException, SVGException {
+ return null;
+ }
+
+ public String insertItemBefore(String newItem,
+ int index) throws SVGException {
+ return null;
+ }
+}
-/*-- $Id$ --
+/*-- $Id$ --
============================================================================
The Apache Software License, Version 1.1
============================================================================
-
+
Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
-
+
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
-
+
4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
-
+
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
-
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
-
+
*/
package org.apache.fop.dom.svg;
*
*/
public class SVGTSpanElementImpl extends SVGTextContentElementImpl implements SVGTSpanElement {
- public String str;
- public int dx = 0;
- public int dy = 0;
- public SVGAnimatedLengthList xlist = null;
- public SVGAnimatedLengthList ylist = null;
- public SVGAnimatedLengthList dxlist = null;
- public SVGAnimatedLengthList dylist = null;
-
- /**
- *
- */
- public SVGTSpanElementImpl()
- {
- }
-
- public SVGAnimatedLengthList getX( )
- {
- return xlist;
- }
-
- public SVGAnimatedLengthList getY( )
- {
- return ylist;
- }
-
- public SVGAnimatedLengthList getDx( )
- {
- return dxlist;
- }
-
- public SVGAnimatedLengthList getDy( )
- {
- return dylist;
- }
-
- public SVGAnimatedTextRotate getRotate( )
- {
- return null;
- }
+ public String str;
+ public int dx = 0;
+ public int dy = 0;
+ public SVGAnimatedLengthList xlist = null;
+ public SVGAnimatedLengthList ylist = null;
+ public SVGAnimatedLengthList dxlist = null;
+ public SVGAnimatedLengthList dylist = null;
+
+ /**
+ *
+ */
+ public SVGTSpanElementImpl() {
+ }
+
+ public SVGAnimatedLengthList getX() {
+ return xlist;
+ }
+
+ public SVGAnimatedLengthList getY() {
+ return ylist;
+ }
+
+ public SVGAnimatedLengthList getDx() {
+ return dxlist;
+ }
+
+ public SVGAnimatedLengthList getDy() {
+ return dylist;
+ }
+
+ public SVGAnimatedNumberList getRotate() {
+ return null;
+ }
}
-/*-- $Id$ --
+/*-- $Id$ --
============================================================================
The Apache Software License, Version 1.1
============================================================================
-
+
Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
-
+
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
-
+
4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
-
+
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
-
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
-
+
*/
package org.apache.fop.dom.svg;
* Transform List
*/
public class SVGTransformListImpl extends SVGListImpl implements SVGTransformList {
- public SVGTransform createSVGTransformFromMatrix ( SVGMatrix matrix )
- throws SVGException
- {
- SVGTransform st = new SVGTransformImpl();
- st.setMatrix(matrix);
- return st;
- }
-
- public SVGTransform consolidate()
- {
- SVGMatrix matrix = new SVGMatrixImpl();
- for(int count = 0; count < getNumberOfItems(); count++) {
- SVGMatrix mat = ((SVGTransform)getItem(count)).getMatrix();
- matrix = matrix.multiply(mat);
- }
- SVGTransform trans = new SVGTransformImpl();
- trans.setMatrix(matrix);
- return trans;
- }
-
- public Object createItem()
- {
- return new SVGTransformImpl();
- }
+ public SVGTransform createSVGTransformFromMatrix (SVGMatrix matrix)
+ throws SVGException {
+ SVGTransform st = new SVGTransformImpl();
+ st.setMatrix(matrix);
+ return st;
+ }
+
+ public SVGTransform consolidate() {
+ SVGMatrix matrix = new SVGMatrixImpl();
+ for (int count = 0; count < getNumberOfItems(); count++) {
+ SVGMatrix mat = ((SVGTransform) getItem(count)).getMatrix();
+ matrix = matrix.multiply(mat);
+ }
+ SVGTransform trans = new SVGTransformImpl();
+ trans.setMatrix(matrix);
+ return trans;
+ }
+
+ public SVGTransform initialize (SVGTransform newItem)
+ throws SVGException {
+ return null;
+ }
+
+ public SVGTransform createItem() {
+ return new SVGTransformImpl();
+ }
+
+ public SVGTransform getItem(int index) throws DOMException {
+ Object obj = list.elementAt(index);
+ return (SVGTransform) obj;
+ }
+
+ public SVGTransform removeItem(int index) throws DOMException {
+ Object obj = list.elementAt(index);
+ list.removeElementAt(index);
+ return (SVGTransform) obj;
+ }
+
+ public SVGTransform appendItem(SVGTransform newItem)
+ throws SVGException {
+ list.addElement(newItem);
+ return null;
+ }
+
+ public SVGTransform replaceItem(SVGTransform newItem,
+ int index) throws DOMException, SVGException {
+ return null;
+ }
+
+ public SVGTransform insertItemBefore(SVGTransform newItem,
+ int index) throws SVGException {
+ return null;
+ }
}
*/
protected void handleSwitchElement(int posx, int posy,
SVGSwitchElement ael) {
- SVGList relist = ael.getRequiredExtensions();
- SVGList rflist = ael.getRequiredFeatures();
- SVGList sllist = ael.getSystemLanguage();
+ SVGStringList relist = ael.getRequiredExtensions();
+ SVGStringList rflist = ael.getRequiredFeatures();
+ SVGStringList sllist = ael.getSystemLanguage();
NodeList nl = ael.getChildNodes();
choices:
for (int count = 0; count < nl.getLength(); count++) {
// test data
if (n instanceof GraphicElement) {
GraphicElement graphic = (GraphicElement) n;
- SVGList grelist = graphic.getRequiredExtensions();
+ SVGStringList grelist = graphic.getRequiredExtensions();
// if null it evaluates to true
if (grelist != null) {
if (grelist.getNumberOfItems() == 0) {
}
}
}
- SVGList grflist = graphic.getRequiredFeatures();
+ SVGStringList grflist = graphic.getRequiredFeatures();
if (grflist != null) {
if (grflist.getNumberOfItems() == 0) {
if ((rflist != null) &&
}
}
}
- SVGList gsllist = graphic.getSystemLanguage();
+ SVGStringList gsllist = graphic.getSystemLanguage();
if (gsllist != null) {
if (gsllist.getNumberOfItems() == 0) {
if ((sllist != null) &&
doDrawing(di);
}
+ /**
+ * Calculate the last control point for a bezier curve.
+ * This is used to find the last control point for a curve where
+ * only the first control point is specified.
+ * The control point is a reflection of the first control point
+ * which results in an even smooth curve. The curve is symmetrical.
+ */
protected float[] calculateLastControl(float x1, float y1, float x2, float y2, float relx, float rely)
{
float vals[] = new float[2];
SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 0);
ay2 = new SVGAnimatedLengthImpl(length);
}
+ SVGAnimatedTransformList an = linear.getGradientTransform();
+ SVGMatrix transform = null;
+ if(an != null)
+ transform = an.getBaseVal().consolidate().getMatrix();
+ System.out.println("gt: " + transform);
Vector theCoords = null;
if (gradUnits == SVGUnitTypes.SVG_UNIT_TYPE_UNKNOWN)
gradUnits = linear.getGradientUnits().getBaseVal();
xpos = currentX;
ypos = currentY;
if (ylist.getNumberOfItems() > charPos) {
- ypos = baseY + ((Float) ylist.getItem(charPos)).
- floatValue();
+ ypos = baseY + (ylist.getItem(charPos)).
+ getValue();
}
if (dylist.getNumberOfItems() > charPos) {
- ypos = ypos + ((Float) dylist.getItem(charPos)).
- floatValue();
+ ypos = ypos + (dylist.getItem(charPos)).
+ getValue();
}
if (xlist.getNumberOfItems() > charPos) {
- xpos = baseX + ((Float) xlist.getItem(charPos)).
- floatValue();
+ xpos = baseX + (xlist.getItem(charPos)).
+ getValue();
}
if (dxlist.getNumberOfItems() > charPos) {
- xpos = xpos + ((Float) dxlist.getItem(charPos)).
- floatValue();
+ xpos = xpos + (dxlist.getItem(charPos)).
+ getValue();
}
if (ch > 127) {
pdf = pdf.append(transstr +
-/*-- $Id$ --
+/*-- $Id$ --
============================================================================
The Apache Software License, Version 1.1
============================================================================
-
+
Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
-
+
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
-
+
4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
-
+
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
-
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
-
+
*/
package org.apache.fop.svg;
import org.apache.fop.layout.Area;
import org.apache.fop.layout.FontState;
import org.apache.fop.apps.FOPException;
+import org.apache.fop.fo.properties.*;
import org.apache.fop.dom.svg.*;
import org.apache.fop.dom.svg.SVGArea;
import org.w3c.dom.svg.SVGElement;
+import org.w3c.dom.svg.*;
/**
* class representing svg:ClipPath pseudo flow object.
*/
public class ClipPath extends SVGObj {
- /**
- * inner class for making ClipPath objects.
- */
- public static class Maker extends FObj.Maker {
-
- /**
- * make a ClipPath object.
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- *
- * @return the ClipPath object
- */
- public FObj make(FObj parent, PropertyList propertyList) throws FOPException
- {
- return new ClipPath(parent, propertyList);
- }
- }
-
- /**
- * returns the maker for this object.
- *
- * @return the maker for ClipPath objects
- */
- public static FObj.Maker maker() {
- return new ClipPath.Maker();
- }
-
- /**
- * constructs a ClipPath object (called by Maker).
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- */
- protected ClipPath(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
- this.name = "svg:clipPath";
- }
-
- SVGClipPathElementImpl clippath = new SVGClipPathElementImpl();
-
- protected void addChild(FONode child) {
- super.addChild(child);
- if(child instanceof GraphicsCreator) {
- GraphicsCreator gc = (GraphicsCreator)child;
- SVGElement graph = gc.createGraphic();
- clippath.addElement(graph);
-// graph.setParent(clippath);
- } else {
- // error
- }
- }
-
- public SVGElement createGraphic()
- {
- clippath.setStyle(((SVGStyle)this.properties.get("style")).getStyle());
- clippath.setId(this.properties.get("id").getString());
- return clippath;
- }
+ /**
+ * inner class for making ClipPath objects.
+ */
+ public static class Maker extends FObj.Maker {
+
+ /**
+ * make a ClipPath object.
+ *
+ * @param parent the parent formatting object
+ * @param propertyList the explicit properties of this object
+ *
+ * @return the ClipPath object
+ */
+ public FObj make(FObj parent,
+ PropertyList propertyList) throws FOPException {
+ return new ClipPath(parent, propertyList);
+ }
+ }
+
+ /**
+ * returns the maker for this object.
+ *
+ * @return the maker for ClipPath objects
+ */
+ public static FObj.Maker maker() {
+ return new ClipPath.Maker();
+ }
+
+ /**
+ * constructs a ClipPath object (called by Maker).
+ *
+ * @param parent the parent formatting object
+ * @param propertyList the explicit properties of this object
+ */
+ protected ClipPath(FObj parent, PropertyList propertyList) {
+ super(parent, propertyList);
+ this.name = "svg:clipPath";
+ }
+
+ SVGClipPathElementImpl clippath = new SVGClipPathElementImpl();
+
+ protected void addChild(FONode child) {
+ super.addChild(child);
+ if (child instanceof GraphicsCreator) {
+ GraphicsCreator gc = (GraphicsCreator) child;
+ SVGElement graph = gc.createGraphic();
+ clippath.addElement(graph);
+ // graph.setParent(clippath);
+ } else {
+ // error
+ }
+ }
+
+ public SVGElement createGraphic() {
+ clippath.setStyle(
+ ((SVGStyle) this.properties.get("style")).getStyle());
+ clippath.setId(this.properties.get("id").getString());
+ switch ((this.properties.get("clipPathUnits")).getEnum()) {
+ case GenericUnits.Enums.USER_SPACE_ON_USE:
+ clippath.setClipPathUnits( new SVGAnimatedEnumerationImpl(
+ SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE));
+ break;
+ case GenericUnits.Enums.OBJECT_BOUNDING_BOX:
+ clippath.setClipPathUnits( new SVGAnimatedEnumerationImpl(
+ SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX));
+ break;
+ }
+ return clippath;
+ }
}
linear.setTransform(
((SVGTransform) this.properties.get("transform")).
getTransform());
+ linear.setGradientTransform(
+ ((SVGTransform) this.properties.get("gradientTransform")).
+ getTransform());
linear.setId(this.properties.get("id").getString());
String rf = this.properties.get("xlink:href").getString();
linear.setHref(new SVGAnimatedStringImpl(rf));
break;
}
switch ((this.properties.get("gradientUnits")).getEnum()) {
- case GradientUnits.USER_SPACE:
- linear.setGradientUnits( new SVGAnimatedEnumerationImpl(
- SVGUnitTypes.SVG_UNIT_TYPE_USERSPACE));
- break;
- case GradientUnits.USER_SPACE_ON_USE:
+ case GenericUnits.Enums.USER_SPACE_ON_USE:
linear.setGradientUnits( new SVGAnimatedEnumerationImpl(
SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE));
break;
- case GradientUnits.OBJECT_BOUNDING_BOX:
+ case GenericUnits.Enums.OBJECT_BOUNDING_BOX:
linear.setGradientUnits( new SVGAnimatedEnumerationImpl(
SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX));
break;
-/*-- $Id$ --
+/*-- $Id$ --
============================================================================
The Apache Software License, Version 1.1
============================================================================
-
+
Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
-
+
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
-
+
4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
-
+
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
-
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
-
+
*/
package org.apache.fop.svg;
*/
public class Pattern extends SVGObj {
- /**
- * inner class for making Pattern objects.
- */
- public static class Maker extends FObj.Maker {
-
- /**
- * make a Pattern object.
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- *
- * @return the Pattern object
- */
- public FObj make(FObj parent, PropertyList propertyList) throws FOPException
- {
- return new Pattern(parent, propertyList);
- }
- }
-
- /**
- * returns the maker for this object.
- *
- * @return the maker for Pattern objects
- */
- public static FObj.Maker maker() {
- return new Pattern.Maker();
- }
-
- /**
- * constructs a Pattern object (called by Maker).
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- */
- protected Pattern(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
- this.name = "svg:pattern";
- }
+ /**
+ * inner class for making Pattern objects.
+ */
+ public static class Maker extends FObj.Maker {
+
+ /**
+ * make a Pattern object.
+ *
+ * @param parent the parent formatting object
+ * @param propertyList the explicit properties of this object
+ *
+ * @return the Pattern object
+ */
+ public FObj make(FObj parent,
+ PropertyList propertyList) throws FOPException {
+ return new Pattern(parent, propertyList);
+ }
+ }
+
+ /**
+ * returns the maker for this object.
+ *
+ * @return the maker for Pattern objects
+ */
+ public static FObj.Maker maker() {
+ return new Pattern.Maker();
+ }
+
+ /**
+ * constructs a Pattern object (called by Maker).
+ *
+ * @param parent the parent formatting object
+ * @param propertyList the explicit properties of this object
+ */
+ protected Pattern(FObj parent, PropertyList propertyList) {
+ super(parent, propertyList);
+ this.name = "svg:pattern";
+ }
public SVGElement createGraphic() {
- SVGPatternElementImpl pattern = new SVGPatternElementImpl();
+ SVGPatternElementImpl pattern = new SVGPatternElementImpl();
String rf = this.properties.get("xlink:href").getString();
pattern.setHref(new SVGAnimatedStringImpl(rf));
SVGLength width =
SVGLength height =
((SVGLengthProperty) this.properties.get("height")).
getSVGLength();
- SVGLength x =
- ((SVGLengthProperty) this.properties.get("x")).
- getSVGLength();
+ SVGLength x = ((SVGLengthProperty) this.properties.get("x")).
+ getSVGLength();
SVGLength y = ((SVGLengthProperty) this.properties.get("y")).
- getSVGLength();
+ getSVGLength();
pattern.setX(x == null ? null : new SVGAnimatedLengthImpl(x));
pattern.setY(y == null ? null : new SVGAnimatedLengthImpl(y));
- pattern.setWidth(width == null ? null : new SVGAnimatedLengthImpl(width));
- pattern.setHeight(height == null ? null : new SVGAnimatedLengthImpl(height));
- pattern.setPatternTransform(((SVGTransform) this.properties.get("transform")).
+ pattern.setWidth(width == null ? null :
+ new SVGAnimatedLengthImpl(width));
+ pattern.setHeight(height == null ? null :
+ new SVGAnimatedLengthImpl(height));
+ pattern.setPatternTransform(
+ ((SVGTransform) this.properties.get("transform")).
getTransform());
pattern.setId(this.properties.get("id").getString());
- int numChildren = this.children.size();
- for (int i = 0; i < numChildren; i++) {
- FONode child = (FONode) children.elementAt(i);
- if(child instanceof GraphicsCreator) {
- SVGElement impl = ((GraphicsCreator)child).createGraphic();
- if(impl != null) {
- if(impl instanceof SVGElementImpl)
- ((SVGElementImpl)impl).setClassName(new SVGAnimatedStringImpl(((FObj)child).getProperty("class").getString()));
- pattern.appendChild(impl);
- }
- }
- }
- switch ((this.properties.get("gradientUnits")).getEnum()) {
- case GradientUnits.USER_SPACE:
- pattern.setPatternUnits( new SVGAnimatedEnumerationImpl(
- SVGUnitTypes.SVG_UNIT_TYPE_USERSPACE));
- break;
- case GradientUnits.USER_SPACE_ON_USE:
+ int numChildren = this.children.size();
+ for (int i = 0; i < numChildren; i++) {
+ FONode child = (FONode) children.elementAt(i);
+ if (child instanceof GraphicsCreator) {
+ SVGElement impl = ((GraphicsCreator) child).createGraphic();
+ if (impl != null) {
+ if (impl instanceof SVGElementImpl)
+ ((SVGElementImpl) impl).setClassName(
+ new SVGAnimatedStringImpl(
+ ((FObj) child).getProperty(
+ "class").getString()));
+ pattern.appendChild(impl);
+ }
+ }
+ }
+ switch ((this.properties.get("patternUnits")).getEnum()) {
+ case GenericUnits.Enums.USER_SPACE_ON_USE:
pattern.setPatternUnits( new SVGAnimatedEnumerationImpl(
SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE));
break;
- case GradientUnits.OBJECT_BOUNDING_BOX:
+ case GenericUnits.Enums.OBJECT_BOUNDING_BOX:
pattern.setPatternUnits( new SVGAnimatedEnumerationImpl(
SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX));
break;
}
- return pattern;
+ return pattern;
}
}
radial.setTransform(
((SVGTransform) this.properties.get("transform")).
getTransform());
+ radial.setGradientTransform(
+ ((SVGTransform) this.properties.get("gradientTransform")).
+ getTransform());
radial.setId(this.properties.get("id").getString());
String rf = this.properties.get("xlink:href").getString();
radial.setHref(new SVGAnimatedStringImpl(rf));
radial.setFy(length == null ? null :
new SVGAnimatedLengthImpl(length));
switch ((this.properties.get("gradientUnits")).getEnum()) {
- case GradientUnits.USER_SPACE:
- radial.setGradientUnits( new SVGAnimatedEnumerationImpl(
- SVGUnitTypes.SVG_UNIT_TYPE_USERSPACE));
- break;
- case GradientUnits.USER_SPACE_ON_USE:
+ case GenericUnits.Enums.USER_SPACE_ON_USE:
radial.setGradientUnits( new SVGAnimatedEnumerationImpl(
SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE));
break;
- case GradientUnits.OBJECT_BOUNDING_BOX:
+ case GenericUnits.Enums.OBJECT_BOUNDING_BOX:
radial.setGradientUnits( new SVGAnimatedEnumerationImpl(
SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX));
break;
SVGLength h = ((SVGLengthProperty) this.properties.get("height")).
getSVGLength();
svgArea = new SVGSVGElementImpl();
- SVGAnimatedLength sal;
+ SVGAnimatedLengthImpl sal;
if (w == null)
w = new SVGLengthImpl();
sal = new SVGAnimatedLengthImpl(w);
+++ /dev/null
-/*-- $Id$ --
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "FOP" and "Apache Software Foundation" must not be used to
- endorse or promote products derived from this software without prior
- written permission. For written permission, please contact
- apache@apache.org.
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
- */
-
-package org.apache.fop.svg;
-
-import org.apache.fop.dom.svg.*;
-
-import java.util.*;
-
-/**
- *
- */
-class SVGStringList extends SVGListImpl {
- public SVGStringList(String str)
- {
- parseString(str);
- }
-
- void parseString(String str)
- {
- StringTokenizer st = new StringTokenizer(str, ", \n\r\t:;");
- while(st.hasMoreTokens()) {
- String item = st.nextToken();
- appendItem(item);
- }
- }
-
- public Object createItem()
- {
- return new String();
- }
-
-}
-/*-- $Id$ --
+/*-- $Id$ --
============================================================================
The Apache Software License, Version 1.1
============================================================================
-
+
Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
-
+
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-
+
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
-
+
4. The names "FOP" and "Apache Software Foundation" must not be used to
endorse or promote products derived from this software without prior
written permission. For written permission, please contact
apache@apache.org.
-
+
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
-
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
-
+
*/
package org.apache.fop.svg;
*/
public class Switch extends SVGObj {
- /**
- * inner class for making Line objects.
- */
- public static class Maker extends FObj.Maker {
-
- /**
- * make a Line object.
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- *
- * @return the Line object
- */
- public FObj make(FObj parent, PropertyList propertyList) throws FOPException
- {
- return new Switch(parent, propertyList);
- }
- }
-
- /**
- * returns the maker for this object.
- *
- * @return the maker for Switch objects
- */
- public static FObj.Maker maker() {
- return new Switch.Maker();
- }
-
- /**
- * constructs a Switch object (called by Maker).
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- */
- protected Switch(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
- this.name = "svg:switch";
- }
-
- public SVGElement createGraphic()
- {
- /*
- * There are two options
- * 1) add all children and select the correct one when rendering
- * 2) select the correct one now and return it rather than a switch element
- * Since renderers may have different ideas, leave it up to the renderer
- * to select the correct one.
- */
- String rf = this.properties.get("requiredFeatures").getString();
- String re = this.properties.get("requiredExtensions").getString();
- String sl = this.properties.get("systemLanguage").getString();
- SVGList strlist;
- GraphicElement graphic;
- graphic = new SVGSwitchElementImpl();
- if(!rf.equals("notpresent")) {
- strlist = new SVGStringList(rf);
- graphic.setRequiredFeatures(strlist);
- }
- if(!re.equals("notpresent")) {
- strlist = new SVGStringList(re);
- graphic.setRequiredExtensions(strlist);
- }
- if(!sl.equals("notpresent")) {
- strlist = new SVGStringList(sl);
- graphic.setSystemLanguage(strlist);
- }
-
- int numChildren = this.children.size();
- for (int i = 0; i < numChildren; i++) {
- FONode child = (FONode) children.elementAt(i);
- if(child instanceof GraphicsCreator) {
- SVGElement impl = ((GraphicsCreator)child).createGraphic();
- if(impl instanceof SVGTests) {
- SVGTests testable = (SVGTests)impl;
- rf = child.getProperty("requiredFeatures").getString();
- re = child.getProperty("requiredExtensions").getString();
- sl = child.getProperty("systemLanguage").getString();
- if(!rf.equals("notpresent")) {
- strlist = new SVGStringList(rf);
- testable.setRequiredFeatures(strlist);
- }
- if(!re.equals("notpresent")) {
- strlist = new SVGStringList(re);
- testable.setRequiredExtensions(strlist);
- }
- if(!sl.equals("notpresent")) {
- strlist = new SVGStringList(sl);
- testable.setSystemLanguage(strlist);
- }
- graphic.appendChild((GraphicElement)impl);
- }
- } else if(child instanceof Defs) {
- }
- }
-
- return graphic;
- }
+ /**
+ * inner class for making Line objects.
+ */
+ public static class Maker extends FObj.Maker {
+
+ /**
+ * make a Line object.
+ *
+ * @param parent the parent formatting object
+ * @param propertyList the explicit properties of this object
+ *
+ * @return the Line object
+ */
+ public FObj make(FObj parent,
+ PropertyList propertyList) throws FOPException {
+ return new Switch(parent, propertyList);
+ }
+ }
+
+ /**
+ * returns the maker for this object.
+ *
+ * @return the maker for Switch objects
+ */
+ public static FObj.Maker maker() {
+ return new Switch.Maker();
+ }
+
+ /**
+ * constructs a Switch object (called by Maker).
+ *
+ * @param parent the parent formatting object
+ * @param propertyList the explicit properties of this object
+ */
+ protected Switch(FObj parent, PropertyList propertyList) {
+ super(parent, propertyList);
+ this.name = "svg:switch";
+ }
+
+ public SVGElement createGraphic() {
+ /*
+ * There are two options
+ * 1) add all children and select the correct one when rendering
+ * 2) select the correct one now and return it rather than a switch element
+ * Since renderers may have different ideas, leave it up to the renderer
+ * to select the correct one.
+ */
+ String rf = this.properties.get("requiredFeatures").getString();
+ String re = this.properties.get("requiredExtensions").getString();
+ String sl = this.properties.get("systemLanguage").getString();
+ SVGStringListImpl strlist;
+ GraphicElement graphic;
+ graphic = new SVGSwitchElementImpl();
+ if (!rf.equals("notpresent")) {
+ strlist = new SVGStringListImpl(rf);
+ graphic.setRequiredFeatures(strlist);
+ }
+ if (!re.equals("notpresent")) {
+ strlist = new SVGStringListImpl(re);
+ graphic.setRequiredExtensions(strlist);
+ }
+ if (!sl.equals("notpresent")) {
+ strlist = new SVGStringListImpl(sl);
+ graphic.setSystemLanguage(strlist);
+ }
+
+ int numChildren = this.children.size();
+ for (int i = 0; i < numChildren; i++) {
+ FONode child = (FONode) children.elementAt(i);
+ if (child instanceof GraphicsCreator) {
+ SVGElement impl = ((GraphicsCreator) child).createGraphic();
+ if (impl instanceof GraphicElement) {
+ GraphicElement testable = (GraphicElement) impl;
+ rf = child.getProperty("requiredFeatures").getString();
+ re = child.getProperty(
+ "requiredExtensions").getString();
+ sl = child.getProperty("systemLanguage").getString();
+ if (!rf.equals("notpresent")) {
+ strlist = new SVGStringListImpl(rf);
+ testable.setRequiredFeatures(strlist);
+ }
+ if (!re.equals("notpresent")) {
+ strlist = new SVGStringListImpl(re);
+ testable.setRequiredExtensions(strlist);
+ }
+ if (!sl.equals("notpresent")) {
+ strlist = new SVGStringListImpl(sl);
+ testable.setSystemLanguage(strlist);
+ }
+ graphic.appendChild((GraphicElement) impl);
+ }
+ } else if (child instanceof Defs) {
+ }
+ }
+
+ return graphic;
+ }
}