Skip to content

Commit

Permalink
Updated for Euclid 2.6 with XOM 1.3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
egonw committed Dec 17, 2023
1 parent dbf3b65 commit 1afa79f
Show file tree
Hide file tree
Showing 25 changed files with 181 additions and 149 deletions.
26 changes: 18 additions & 8 deletions src/main/java/org/xmlcml/graphics/svg/GraphicsElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,30 @@

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;
import java.io.IOException;
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.
* <p>
Expand Down Expand Up @@ -186,7 +196,7 @@ public void copyChildrenFrom(Element element) {
*
* @return node
*/
public Node copy() {
public Element copy() {
return new GraphicsElement(this);
}

Expand Down
5 changes: 2 additions & 3 deletions src/main/java/org/xmlcml/graphics/svg/SVGAnimate.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package org.xmlcml.graphics.svg;

import nu.xom.Element;
import nu.xom.Node;

/** draws a straight line.
*
Expand Down Expand Up @@ -51,9 +50,9 @@ public SVGAnimate(Element element) {
/**
* copy node .
*
* @return Node
* @return Element
*/
public Node copy() {
public Element copy() {
return new SVGAnimate(this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -55,9 +55,9 @@ public SVGAnimateTransform(Element element) {
/**
* copy node .
*
* @return Node
* @return Element
*/
public Node copy() {
public Element copy() {
return new SVGAnimateTransform(this);
}

Expand Down
18 changes: 9 additions & 9 deletions src/main/java/org/xmlcml/graphics/svg/SVGCircle.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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);
}

Expand Down
9 changes: 4 additions & 5 deletions src/main/java/org/xmlcml/graphics/svg/SVGClipPath.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,15 @@
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;

import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;

import nu.xom.Element;

/** supports clipPath (dummy at present)
*
* @author pm286
Expand Down Expand Up @@ -79,9 +78,9 @@ public SVGClipPath(Element element) {
/**
* copy node .
*
* @return Node
* @return Element
*/
public Node copy() {
public Element copy() {
return new SVGClipPath(this);
}

Expand Down
5 changes: 2 additions & 3 deletions src/main/java/org/xmlcml/graphics/svg/SVGDefs.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.xmlcml.euclid.Real2Range;

import nu.xom.Element;
import nu.xom.Node;

/** supports defs
*
Expand Down Expand Up @@ -62,9 +61,9 @@ public SVGDefs(Element element) {
/**
* copy node .
*
* @return Node
* @return Element
*/
public Node copy() {
public Element copy() {
return new SVGDefs(this);
}

Expand Down
5 changes: 2 additions & 3 deletions src/main/java/org/xmlcml/graphics/svg/SVGDesc.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package org.xmlcml.graphics.svg;

import nu.xom.Element;
import nu.xom.Node;


/** draws a straight line.
Expand Down Expand Up @@ -50,9 +49,9 @@ public SVGDesc(Element element) {
/**
* copy node .
*
* @return Node
* @return Element
*/
public Node copy() {
public Element copy() {
return new SVGDesc(this);
}

Expand Down
5 changes: 2 additions & 3 deletions src/main/java/org/xmlcml/graphics/svg/SVGEllipse.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

import nu.xom.Attribute;
import nu.xom.Element;
import nu.xom.Node;

/** draws a straight line.
* NOT TESTED
Expand Down Expand Up @@ -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);
}

Expand Down
16 changes: 7 additions & 9 deletions src/main/java/org/xmlcml/graphics/svg/SVGG.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -65,9 +63,9 @@ public SVGG(Element element) {
/**
* Copy node
*
* @return Node
* @return Element
*/
public Node copy() {
public Element copy() {
return new SVGG(this);
}

Expand Down
43 changes: 28 additions & 15 deletions src/main/java/org/xmlcml/graphics/svg/SVGImage.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -93,9 +106,9 @@ public SVGImage(Element element) {
/**
* copy node .
*
* @return Node
* @return Element
*/
public Node copy() {
public Element copy() {
return new SVGImage(this);
}

Expand Down
5 changes: 2 additions & 3 deletions src/main/java/org/xmlcml/graphics/svg/SVGLine.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@

import nu.xom.Attribute;
import nu.xom.Element;
import nu.xom.Node;
import nu.xom.Nodes;

/** draws a straight line.
Expand Down Expand Up @@ -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);
}

Expand Down
5 changes: 2 additions & 3 deletions src/main/java/org/xmlcml/graphics/svg/SVGMarker.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 <marker>
* creates a "point", drawn by an arbitrary symbol
Expand Down Expand Up @@ -140,9 +139,9 @@ protected void init() {
/**
* copy node .
*
* @return Node
* @return Element
*/
public Node copy() {
public Element copy() {
return new SVGMarker(this);
}

Expand Down
12 changes: 5 additions & 7 deletions src/main/java/org/xmlcml/graphics/svg/SVGPath.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -50,6 +45,9 @@
import org.xmlcml.xml.XMLConstants;
import org.xmlcml.xml.XMLUtil;

import nu.xom.Attribute;
import nu.xom.Element;

/**
* @author pm286
*/
Expand Down Expand Up @@ -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);
}

Expand Down
Loading

0 comments on commit 1afa79f

Please sign in to comment.