From 1afa79fc215299de11e68ba492c58c6eb5ec4553 Mon Sep 17 00:00:00 2001 From: Egon Willighagen Date: Sun, 17 Dec 2023 10:48:11 +0100 Subject: [PATCH] Updated for Euclid 2.6 with XOM 1.3.9 --- .../xmlcml/graphics/svg/GraphicsElement.java | 26 +++++++---- .../org/xmlcml/graphics/svg/SVGAnimate.java | 5 +-- .../graphics/svg/SVGAnimateTransform.java | 8 ++-- .../org/xmlcml/graphics/svg/SVGCircle.java | 18 ++++---- .../org/xmlcml/graphics/svg/SVGClipPath.java | 9 ++-- .../java/org/xmlcml/graphics/svg/SVGDefs.java | 5 +-- .../java/org/xmlcml/graphics/svg/SVGDesc.java | 5 +-- .../org/xmlcml/graphics/svg/SVGEllipse.java | 5 +-- .../java/org/xmlcml/graphics/svg/SVGG.java | 16 +++---- .../org/xmlcml/graphics/svg/SVGImage.java | 43 ++++++++++++------- .../java/org/xmlcml/graphics/svg/SVGLine.java | 5 +-- .../org/xmlcml/graphics/svg/SVGMarker.java | 5 +-- .../java/org/xmlcml/graphics/svg/SVGPath.java | 12 +++--- .../org/xmlcml/graphics/svg/SVGPattern.java | 5 +-- .../java/org/xmlcml/graphics/svg/SVGPoly.java | 33 ++++++++------ .../org/xmlcml/graphics/svg/SVGPolygon.java | 13 +++--- .../org/xmlcml/graphics/svg/SVGPolyline.java | 5 +-- .../java/org/xmlcml/graphics/svg/SVGRect.java | 22 ++++++---- .../java/org/xmlcml/graphics/svg/SVGSVG.java | 5 ++- .../org/xmlcml/graphics/svg/SVGScript.java | 10 ++--- .../org/xmlcml/graphics/svg/SVGSymbol.java | 5 +-- .../org/xmlcml/graphics/svg/SVGTSpan.java | 12 +++--- .../java/org/xmlcml/graphics/svg/SVGText.java | 36 ++++++++++------ .../org/xmlcml/graphics/svg/SVGTitle.java | 12 +++--- .../java/org/xmlcml/graphics/svg/SVGUse.java | 10 ++--- 25 files changed, 181 insertions(+), 149 deletions(-) diff --git a/src/main/java/org/xmlcml/graphics/svg/GraphicsElement.java b/src/main/java/org/xmlcml/graphics/svg/GraphicsElement.java index 75e0ba1..f370b9a 100755 --- a/src/main/java/org/xmlcml/graphics/svg/GraphicsElement.java +++ b/src/main/java/org/xmlcml/graphics/svg/GraphicsElement.java @@ -16,13 +16,12 @@ package org.xmlcml.graphics.svg; -import nu.xom.*; -import org.apache.log4j.Logger; -import org.xmlcml.euclid.Real2; -import org.xmlcml.euclid.Transform2; -import org.xmlcml.xml.XMLUtil; - -import java.awt.*; +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.RenderingHints; +import java.awt.Shape; +import java.awt.Stroke; import java.awt.geom.AffineTransform; import java.awt.geom.GeneralPath; import java.io.FileOutputStream; @@ -30,6 +29,17 @@ import java.util.HashMap; import java.util.Map; +import org.apache.log4j.Logger; +import org.xmlcml.euclid.Real2; +import org.xmlcml.euclid.Transform2; +import org.xmlcml.xml.XMLUtil; + +import nu.xom.Attribute; +import nu.xom.Document; +import nu.xom.Element; +import nu.xom.Node; +import nu.xom.Nodes; + /** * Base class for lightweight generic SVG element. *

@@ -186,7 +196,7 @@ public void copyChildrenFrom(Element element) { * * @return node */ - public Node copy() { + public Element copy() { return new GraphicsElement(this); } diff --git a/src/main/java/org/xmlcml/graphics/svg/SVGAnimate.java b/src/main/java/org/xmlcml/graphics/svg/SVGAnimate.java index f7ac605..4cde1ed 100755 --- a/src/main/java/org/xmlcml/graphics/svg/SVGAnimate.java +++ b/src/main/java/org/xmlcml/graphics/svg/SVGAnimate.java @@ -17,7 +17,6 @@ package org.xmlcml.graphics.svg; import nu.xom.Element; -import nu.xom.Node; /** draws a straight line. * @@ -51,9 +50,9 @@ public SVGAnimate(Element element) { /** * copy node . * - * @return Node + * @return Element */ - public Node copy() { + public Element copy() { return new SVGAnimate(this); } diff --git a/src/main/java/org/xmlcml/graphics/svg/SVGAnimateTransform.java b/src/main/java/org/xmlcml/graphics/svg/SVGAnimateTransform.java index 0f8ccdf..041adbd 100755 --- a/src/main/java/org/xmlcml/graphics/svg/SVGAnimateTransform.java +++ b/src/main/java/org/xmlcml/graphics/svg/SVGAnimateTransform.java @@ -16,10 +16,10 @@ package org.xmlcml.graphics.svg; -import nu.xom.Element; -import nu.xom.Node; import org.xmlcml.euclid.Real2; +import nu.xom.Element; + /** draws a straight line. * * @author pm286 @@ -55,9 +55,9 @@ public SVGAnimateTransform(Element element) { /** * copy node . * - * @return Node + * @return Element */ - public Node copy() { + public Element copy() { return new SVGAnimateTransform(this); } diff --git a/src/main/java/org/xmlcml/graphics/svg/SVGCircle.java b/src/main/java/org/xmlcml/graphics/svg/SVGCircle.java index 4d67e97..4058e95 100755 --- a/src/main/java/org/xmlcml/graphics/svg/SVGCircle.java +++ b/src/main/java/org/xmlcml/graphics/svg/SVGCircle.java @@ -16,19 +16,19 @@ package org.xmlcml.graphics.svg; -import nu.xom.Attribute; -import nu.xom.Element; -import nu.xom.Node; +import java.awt.Graphics2D; +import java.awt.geom.Ellipse2D; +import java.util.ArrayList; +import java.util.List; + import org.apache.log4j.Logger; import org.xmlcml.euclid.Real2; import org.xmlcml.euclid.Real2Range; import org.xmlcml.euclid.Transform2; import org.xmlcml.euclid.Util; -import java.awt.*; -import java.awt.geom.Ellipse2D; -import java.util.ArrayList; -import java.util.List; +import nu.xom.Attribute; +import nu.xom.Element; /** draws a straight line. * @@ -92,9 +92,9 @@ public static void setDefaultStyle(SVGElement circle) { /** * copy node . * - * @return Node + * @return Element */ - public Node copy() { + public Element copy() { return new SVGCircle(this); } diff --git a/src/main/java/org/xmlcml/graphics/svg/SVGClipPath.java b/src/main/java/org/xmlcml/graphics/svg/SVGClipPath.java index 2431445..654a229 100755 --- a/src/main/java/org/xmlcml/graphics/svg/SVGClipPath.java +++ b/src/main/java/org/xmlcml/graphics/svg/SVGClipPath.java @@ -23,9 +23,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import nu.xom.Element; -import nu.xom.Node; - import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.xmlcml.euclid.Real2Range; @@ -33,6 +30,8 @@ import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; +import nu.xom.Element; + /** supports clipPath (dummy at present) * * @author pm286 @@ -79,9 +78,9 @@ public SVGClipPath(Element element) { /** * copy node . * - * @return Node + * @return Element */ - public Node copy() { + public Element copy() { return new SVGClipPath(this); } diff --git a/src/main/java/org/xmlcml/graphics/svg/SVGDefs.java b/src/main/java/org/xmlcml/graphics/svg/SVGDefs.java index 253abb6..a24c36d 100755 --- a/src/main/java/org/xmlcml/graphics/svg/SVGDefs.java +++ b/src/main/java/org/xmlcml/graphics/svg/SVGDefs.java @@ -24,7 +24,6 @@ import org.xmlcml.euclid.Real2Range; import nu.xom.Element; -import nu.xom.Node; /** supports defs * @@ -62,9 +61,9 @@ public SVGDefs(Element element) { /** * copy node . * - * @return Node + * @return Element */ - public Node copy() { + public Element copy() { return new SVGDefs(this); } diff --git a/src/main/java/org/xmlcml/graphics/svg/SVGDesc.java b/src/main/java/org/xmlcml/graphics/svg/SVGDesc.java index e7d04ef..5b38916 100755 --- a/src/main/java/org/xmlcml/graphics/svg/SVGDesc.java +++ b/src/main/java/org/xmlcml/graphics/svg/SVGDesc.java @@ -17,7 +17,6 @@ package org.xmlcml.graphics.svg; import nu.xom.Element; -import nu.xom.Node; /** draws a straight line. @@ -50,9 +49,9 @@ public SVGDesc(Element element) { /** * copy node . * - * @return Node + * @return Element */ - public Node copy() { + public Element copy() { return new SVGDesc(this); } diff --git a/src/main/java/org/xmlcml/graphics/svg/SVGEllipse.java b/src/main/java/org/xmlcml/graphics/svg/SVGEllipse.java index 64a2d0d..f5d41cc 100755 --- a/src/main/java/org/xmlcml/graphics/svg/SVGEllipse.java +++ b/src/main/java/org/xmlcml/graphics/svg/SVGEllipse.java @@ -28,7 +28,6 @@ import nu.xom.Attribute; import nu.xom.Element; -import nu.xom.Node; /** draws a straight line. * NOT TESTED @@ -82,9 +81,9 @@ public static void setDefaultStyle(SVGElement ellipse) { /** * copy node . * - * @return Node + * @return Element */ - public Node copy() { + public Element copy() { return new SVGEllipse(this); } diff --git a/src/main/java/org/xmlcml/graphics/svg/SVGG.java b/src/main/java/org/xmlcml/graphics/svg/SVGG.java index de9da71..0ab4e8c 100755 --- a/src/main/java/org/xmlcml/graphics/svg/SVGG.java +++ b/src/main/java/org/xmlcml/graphics/svg/SVGG.java @@ -16,18 +16,16 @@ package org.xmlcml.graphics.svg; -import nu.xom.Attribute; -import nu.xom.Element; -import nu.xom.Node; +import java.io.File; +import java.util.ArrayList; +import java.util.List; import org.apache.log4j.Logger; import org.xmlcml.euclid.Real2Range; -import org.xmlcml.graphics.svg.text.SVGWord; import org.xmlcml.xml.XMLUtil; -import java.io.File; -import java.util.ArrayList; -import java.util.List; +import nu.xom.Attribute; +import nu.xom.Element; /** * Grouping element @@ -65,9 +63,9 @@ public SVGG(Element element) { /** * Copy node * - * @return Node + * @return Element */ - public Node copy() { + public Element copy() { return new SVGG(this); } diff --git a/src/main/java/org/xmlcml/graphics/svg/SVGImage.java b/src/main/java/org/xmlcml/graphics/svg/SVGImage.java index 5a740ae..99fa84d 100755 --- a/src/main/java/org/xmlcml/graphics/svg/SVGImage.java +++ b/src/main/java/org/xmlcml/graphics/svg/SVGImage.java @@ -16,25 +16,38 @@ package org.xmlcml.graphics.svg; -import nu.xom.Attribute; -import nu.xom.Element; -import nu.xom.Node; -import org.apache.log4j.Logger; -import org.xmlcml.euclid.*; - -import javax.imageio.ImageIO; -import javax.imageio.ImageReader; -import javax.imageio.ImageWriter; -import javax.imageio.stream.ImageOutputStream; -import java.awt.*; +import java.awt.Graphics2D; import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; -import java.io.*; -import java.util.*; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Base64; +import java.util.HashMap; +import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; +import javax.imageio.ImageIO; +import javax.imageio.ImageReader; +import javax.imageio.ImageWriter; +import javax.imageio.stream.ImageOutputStream; + +import org.apache.log4j.Logger; +import org.xmlcml.euclid.Real; +import org.xmlcml.euclid.Real2; +import org.xmlcml.euclid.Real2Range; +import org.xmlcml.euclid.RealSquareMatrix; +import org.xmlcml.euclid.Transform2; + +import nu.xom.Attribute; +import nu.xom.Element; + /** supports defs * * @author pm286 @@ -93,9 +106,9 @@ public SVGImage(Element element) { /** * copy node . * - * @return Node + * @return Element */ - public Node copy() { + public Element copy() { return new SVGImage(this); } diff --git a/src/main/java/org/xmlcml/graphics/svg/SVGLine.java b/src/main/java/org/xmlcml/graphics/svg/SVGLine.java index 890613a..f2a3e90 100755 --- a/src/main/java/org/xmlcml/graphics/svg/SVGLine.java +++ b/src/main/java/org/xmlcml/graphics/svg/SVGLine.java @@ -38,7 +38,6 @@ import nu.xom.Attribute; import nu.xom.Element; -import nu.xom.Node; import nu.xom.Nodes; /** draws a straight line. @@ -130,9 +129,9 @@ public static void setDefaultStyle(SVGElement line) { /** * copy node . * - * @return Node + * @return Element */ - public Node copy() { + public Element copy() { return new SVGLine(this); } diff --git a/src/main/java/org/xmlcml/graphics/svg/SVGMarker.java b/src/main/java/org/xmlcml/graphics/svg/SVGMarker.java index a135d2f..86990ba 100755 --- a/src/main/java/org/xmlcml/graphics/svg/SVGMarker.java +++ b/src/main/java/org/xmlcml/graphics/svg/SVGMarker.java @@ -26,7 +26,6 @@ import nu.xom.Attribute; import nu.xom.Element; -import nu.xom.Node; /** a virtual point. May not correspond completely with SVG * creates a "point", drawn by an arbitrary symbol @@ -140,9 +139,9 @@ protected void init() { /** * copy node . * - * @return Node + * @return Element */ - public Node copy() { + public Element copy() { return new SVGMarker(this); } diff --git a/src/main/java/org/xmlcml/graphics/svg/SVGPath.java b/src/main/java/org/xmlcml/graphics/svg/SVGPath.java index 2c63dd4..a1b9113 100755 --- a/src/main/java/org/xmlcml/graphics/svg/SVGPath.java +++ b/src/main/java/org/xmlcml/graphics/svg/SVGPath.java @@ -25,14 +25,9 @@ import java.util.List; import java.util.regex.Pattern; -import nu.xom.Attribute; -import nu.xom.Element; -import nu.xom.Node; - import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.xmlcml.euclid.Angle; -import org.xmlcml.euclid.Real; import org.xmlcml.euclid.Angle.Units; import org.xmlcml.euclid.Real2; import org.xmlcml.euclid.Real2Array; @@ -50,6 +45,9 @@ import org.xmlcml.xml.XMLConstants; import org.xmlcml.xml.XMLUtil; +import nu.xom.Attribute; +import nu.xom.Element; + /** * @author pm286 */ @@ -143,9 +141,9 @@ public SVGPath(PathPrimitiveList primitiveList, SVGPath reference) { /** * Copies node. * - * @return Node + * @return Element */ - public Node copy() { + public Element copy() { return new SVGPath(this); } diff --git a/src/main/java/org/xmlcml/graphics/svg/SVGPattern.java b/src/main/java/org/xmlcml/graphics/svg/SVGPattern.java index ac0c2eb..3a01169 100755 --- a/src/main/java/org/xmlcml/graphics/svg/SVGPattern.java +++ b/src/main/java/org/xmlcml/graphics/svg/SVGPattern.java @@ -17,7 +17,6 @@ package org.xmlcml.graphics.svg; import nu.xom.Element; -import nu.xom.Node; /** supports pattern (no-op at present) * @@ -52,9 +51,9 @@ public SVGPattern(Element element) { /** * copy node . * - * @return Node + * @return Element */ - public Node copy() { + public Element copy() { return new SVGPattern(this); } diff --git a/src/main/java/org/xmlcml/graphics/svg/SVGPoly.java b/src/main/java/org/xmlcml/graphics/svg/SVGPoly.java index b2f41fe..8543030 100755 --- a/src/main/java/org/xmlcml/graphics/svg/SVGPoly.java +++ b/src/main/java/org/xmlcml/graphics/svg/SVGPoly.java @@ -17,23 +17,30 @@ package org.xmlcml.graphics.svg; -import nu.xom.Attribute; -import nu.xom.Element; -import nu.xom.Node; -import org.apache.log4j.Logger; -import org.xmlcml.euclid.Axis.Axis2; -import org.xmlcml.euclid.*; -import org.xmlcml.euclid.RealArray.Monotonicity; -import org.xmlcml.graphics.svg.path.PathPrimitiveList; -import org.xmlcml.xml.XMLConstants; - -import java.awt.*; +import java.awt.BasicStroke; +import java.awt.Graphics2D; +import java.awt.Stroke; import java.awt.geom.GeneralPath; import java.awt.geom.Line2D; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import org.apache.log4j.Logger; +import org.xmlcml.euclid.ArrayBase; +import org.xmlcml.euclid.Axis.Axis2; +import org.xmlcml.euclid.Real; +import org.xmlcml.euclid.Real2; +import org.xmlcml.euclid.Real2Array; +import org.xmlcml.euclid.Real2Range; +import org.xmlcml.euclid.RealArray; +import org.xmlcml.euclid.RealArray.Monotonicity; +import org.xmlcml.euclid.Transform2; +import org.xmlcml.graphics.svg.path.PathPrimitiveList; + +import nu.xom.Attribute; +import nu.xom.Element; + /** * Represents a collection of straight lines. * @@ -99,9 +106,9 @@ public static void setDefaultStyle(SVGElement line) { /** * Copies node. * - * @return Node + * @return Element */ - public Node copy() { + public Element copy() { return new SVGPolyline(this); } diff --git a/src/main/java/org/xmlcml/graphics/svg/SVGPolygon.java b/src/main/java/org/xmlcml/graphics/svg/SVGPolygon.java index c1e9d1f..a274f15 100755 --- a/src/main/java/org/xmlcml/graphics/svg/SVGPolygon.java +++ b/src/main/java/org/xmlcml/graphics/svg/SVGPolygon.java @@ -20,15 +20,14 @@ import java.util.ArrayList; import java.util.List; -import nu.xom.Element; -import nu.xom.Node; - import org.apache.log4j.Logger; import org.xmlcml.euclid.Line2; -import org.xmlcml.euclid.Real2; -import org.xmlcml.euclid.Real2Array; import org.xmlcml.euclid.Line2AndReal2Calculator; import org.xmlcml.euclid.Real; +import org.xmlcml.euclid.Real2; +import org.xmlcml.euclid.Real2Array; + +import nu.xom.Element; /** draws a straight line. * @@ -93,9 +92,9 @@ protected void init() { /** * copy node . * - * @return Node + * @return Element */ - public Node copy() { + public Element copy() { return new SVGPolygon(this); } diff --git a/src/main/java/org/xmlcml/graphics/svg/SVGPolyline.java b/src/main/java/org/xmlcml/graphics/svg/SVGPolyline.java index bbc7bde..512bdd9 100755 --- a/src/main/java/org/xmlcml/graphics/svg/SVGPolyline.java +++ b/src/main/java/org/xmlcml/graphics/svg/SVGPolyline.java @@ -31,7 +31,6 @@ import org.xmlcml.xml.XMLUtil; import nu.xom.Element; -import nu.xom.Node; import nu.xom.ParentNode; /** @@ -108,9 +107,9 @@ public SVGPolyline(Real2Array real2Array) { /** * Copies node. * - * @return Node + * @return Element */ - public Node copy() { + public Element copy() { return new SVGPolyline(this); } diff --git a/src/main/java/org/xmlcml/graphics/svg/SVGRect.java b/src/main/java/org/xmlcml/graphics/svg/SVGRect.java index 8afb3f9..9fb4f47 100755 --- a/src/main/java/org/xmlcml/graphics/svg/SVGRect.java +++ b/src/main/java/org/xmlcml/graphics/svg/SVGRect.java @@ -16,17 +16,21 @@ package org.xmlcml.graphics.svg; -import nu.xom.Element; -import nu.xom.Node; +import java.awt.Graphics2D; +import java.awt.geom.Rectangle2D; +import java.util.ArrayList; +import java.util.List; import org.apache.log4j.Level; import org.apache.log4j.Logger; -import org.xmlcml.euclid.*; +import org.xmlcml.euclid.Angle; +import org.xmlcml.euclid.Real2; +import org.xmlcml.euclid.Real2Range; +import org.xmlcml.euclid.RealRange; +import org.xmlcml.euclid.Transform2; +import org.xmlcml.euclid.Util; -import java.awt.*; -import java.awt.geom.Rectangle2D; -import java.util.ArrayList; -import java.util.List; +import nu.xom.Element; /** draws a straight line. * @@ -79,9 +83,9 @@ public static void setDefaultStyle(SVGElement rect) { /** * copy node . * - * @return Node + * @return Element */ - public Node copy() { + public Element copy() { return new SVGRect(this); } diff --git a/src/main/java/org/xmlcml/graphics/svg/SVGSVG.java b/src/main/java/org/xmlcml/graphics/svg/SVGSVG.java index dec0def..0dc3493 100755 --- a/src/main/java/org/xmlcml/graphics/svg/SVGSVG.java +++ b/src/main/java/org/xmlcml/graphics/svg/SVGSVG.java @@ -29,6 +29,7 @@ import org.xmlcml.xml.XMLUtil; import nu.xom.Attribute; +import nu.xom.Element; import nu.xom.Node; /** container for SVG @@ -73,9 +74,9 @@ public SVGSVG(SVGSVG element) { /** * copy node . * - * @return Node + * @return Element */ - public Node copy() { + public Element copy() { return new SVGSVG(this); } diff --git a/src/main/java/org/xmlcml/graphics/svg/SVGScript.java b/src/main/java/org/xmlcml/graphics/svg/SVGScript.java index 9b2c992..787cbc0 100755 --- a/src/main/java/org/xmlcml/graphics/svg/SVGScript.java +++ b/src/main/java/org/xmlcml/graphics/svg/SVGScript.java @@ -16,13 +16,13 @@ package org.xmlcml.graphics.svg; -import nu.xom.Attribute; -import nu.xom.Element; -import nu.xom.Node; import org.xmlcml.euclid.Real2Range; import org.xmlcml.euclid.Transform2; import org.xmlcml.xml.XMLConstants; +import nu.xom.Attribute; +import nu.xom.Element; + /** supports defs * * @author pm286 @@ -54,9 +54,9 @@ public SVGScript(Element element) { /** * copy node . * - * @return Node + * @return Element */ - public Node copy() { + public Element copy() { return new SVGScript(this); } diff --git a/src/main/java/org/xmlcml/graphics/svg/SVGSymbol.java b/src/main/java/org/xmlcml/graphics/svg/SVGSymbol.java index 04886f0..257b6a2 100755 --- a/src/main/java/org/xmlcml/graphics/svg/SVGSymbol.java +++ b/src/main/java/org/xmlcml/graphics/svg/SVGSymbol.java @@ -17,7 +17,6 @@ package org.xmlcml.graphics.svg; import nu.xom.Element; -import nu.xom.Node; /** supports use/symbol @@ -64,9 +63,9 @@ protected void init() { /** * copy node . * - * @return Node + * @return Element */ - public Node copy() { + public Element copy() { return new SVGSymbol(this); } diff --git a/src/main/java/org/xmlcml/graphics/svg/SVGTSpan.java b/src/main/java/org/xmlcml/graphics/svg/SVGTSpan.java index d13979e..10a3d27 100755 --- a/src/main/java/org/xmlcml/graphics/svg/SVGTSpan.java +++ b/src/main/java/org/xmlcml/graphics/svg/SVGTSpan.java @@ -16,13 +16,13 @@ package org.xmlcml.graphics.svg; -import nu.xom.Element; -import nu.xom.Node; +import java.util.ArrayList; +import java.util.List; + import org.apache.log4j.Logger; import org.xmlcml.euclid.Real2; -import java.util.ArrayList; -import java.util.List; +import nu.xom.Element; /** draws text. * @@ -68,9 +68,9 @@ public SVGTSpan(Real2 real2, String string) { /** * copy node . * - * @return Node + * @return Element */ - public Node copy() { + public Element copy() { return new SVGTSpan(this); } diff --git a/src/main/java/org/xmlcml/graphics/svg/SVGText.java b/src/main/java/org/xmlcml/graphics/svg/SVGText.java index d2f842b..f482975 100755 --- a/src/main/java/org/xmlcml/graphics/svg/SVGText.java +++ b/src/main/java/org/xmlcml/graphics/svg/SVGText.java @@ -1,15 +1,8 @@ package org.xmlcml.graphics.svg; -import nu.xom.*; - - -import org.apache.log4j.Logger; -import org.xmlcml.euclid.*; -import org.xmlcml.graphics.svg.fonts.FontWidths; -import org.xmlcml.xml.XMLConstants; -import org.xmlcml.xml.XMLUtil; - -import java.awt.*; +import java.awt.Color; +import java.awt.Font; +import java.awt.Graphics2D; import java.awt.font.FontRenderContext; import java.awt.font.GlyphVector; import java.awt.geom.AffineTransform; @@ -18,6 +11,25 @@ import java.util.ArrayList; import java.util.List; +import org.apache.log4j.Logger; +import org.xmlcml.euclid.Angle; +import org.xmlcml.euclid.EuclidConstants; +import org.xmlcml.euclid.Real; +import org.xmlcml.euclid.Real2; +import org.xmlcml.euclid.Real2Range; +import org.xmlcml.euclid.RealSquareMatrix; +import org.xmlcml.euclid.Transform2; +import org.xmlcml.euclid.Util; +import org.xmlcml.euclid.Vector2; +import org.xmlcml.graphics.svg.fonts.FontWidths; +import org.xmlcml.xml.XMLConstants; +import org.xmlcml.xml.XMLUtil; + +import nu.xom.Element; +import nu.xom.Node; +import nu.xom.Nodes; +import nu.xom.Text; + /** * Draws text. * @@ -161,9 +173,9 @@ protected SVGText(String tag) { /** * copy node . * - * @return Node + * @return Element */ - public Node copy() { + public Element copy() { return new SVGText(this, TAG); } diff --git a/src/main/java/org/xmlcml/graphics/svg/SVGTitle.java b/src/main/java/org/xmlcml/graphics/svg/SVGTitle.java index 861e95c..b6f72d2 100755 --- a/src/main/java/org/xmlcml/graphics/svg/SVGTitle.java +++ b/src/main/java/org/xmlcml/graphics/svg/SVGTitle.java @@ -16,13 +16,13 @@ package org.xmlcml.graphics.svg; -import nu.xom.Element; -import nu.xom.Node; -import nu.xom.Text; +import java.awt.Graphics2D; + import org.apache.log4j.Logger; import org.xmlcml.euclid.Real2Array; -import java.awt.*; +import nu.xom.Element; +import nu.xom.Text; /** draws a straight line. * @@ -77,9 +77,9 @@ public static void setDefaultStyle(SVGElement line) { /** * copy node . * - * @return Node + * @return Element */ - public Node copy() { + public Element copy() { return new SVGTitle(this); } diff --git a/src/main/java/org/xmlcml/graphics/svg/SVGUse.java b/src/main/java/org/xmlcml/graphics/svg/SVGUse.java index 109edd7..7a541f7 100755 --- a/src/main/java/org/xmlcml/graphics/svg/SVGUse.java +++ b/src/main/java/org/xmlcml/graphics/svg/SVGUse.java @@ -16,12 +16,12 @@ package org.xmlcml.graphics.svg; -import nu.xom.Attribute; -import nu.xom.Element; -import nu.xom.Node; import org.xmlcml.euclid.Real2; import org.xmlcml.euclid.Real2Range; +import nu.xom.Attribute; +import nu.xom.Element; + /** supports use/symbol @@ -84,9 +84,9 @@ protected void init() { /** * copy node . * - * @return Node + * @return Element */ - public Node copy() { + public Element copy() { return new SVGUse(this); }