diff options
Diffstat (limited to 'src/java/org/apache/poi/sl/draw/geom/ArcToCommand.java')
-rw-r--r-- | src/java/org/apache/poi/sl/draw/geom/ArcToCommand.java | 75 |
1 files changed, 64 insertions, 11 deletions
diff --git a/src/java/org/apache/poi/sl/draw/geom/ArcToCommand.java b/src/java/org/apache/poi/sl/draw/geom/ArcToCommand.java index 9ff57e6da9..4c6c14d09b 100644 --- a/src/java/org/apache/poi/sl/draw/geom/ArcToCommand.java +++ b/src/java/org/apache/poi/sl/draw/geom/ArcToCommand.java @@ -24,28 +24,64 @@ import static org.apache.poi.sl.draw.geom.Formula.OOXML_DEGREE; import java.awt.geom.Arc2D; import java.awt.geom.Path2D; import java.awt.geom.Point2D; +import java.util.Objects; -import org.apache.poi.sl.draw.binding.CTPath2DArcTo; import org.apache.poi.util.Internal; /** * ArcTo command within a shape path in DrawingML: - * {@code <arcTo wR="wr" hR="hr" stAng="stAng" swAng="swAng"/>}<p> - * - * Where {@code wr} and {@code wh} are the height and width radiuses + * {@code <arcTo wR="wr" hR="hr" stAng="stAng" swAng="swAng"/>} + * <p> + * Where {@code wr} and {@code wh} are the height and width radii * of the supposed circle being used to draw the arc. This gives the circle * a total height of (2 * hR) and a total width of (2 * wR) - * + * <p> * stAng is the {@code start} angle and {@code swAng} is the swing angle + * <p> + * Java class for CT_Path2DArcTo complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType name="CT_Path2DArcTo"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <attribute name="wR" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_AdjCoordinate" /> + * <attribute name="hR" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_AdjCoordinate" /> + * <attribute name="stAng" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_AdjAngle" /> + * <attribute name="swAng" use="required" type="{http://schemas.openxmlformats.org/drawingml/2006/main}ST_AdjAngle" /> + * </restriction> + * </complexContent> + * </complexType> + * </pre> */ +// @XmlAccessorType(XmlAccessType.FIELD) +// @XmlType(name = "CT_Path2DArcTo") public class ArcToCommand implements PathCommand { - private String hr, wr, stAng, swAng; - ArcToCommand(CTPath2DArcTo arc){ - hr = arc.getHR(); - wr = arc.getWR(); - stAng = arc.getStAng(); - swAng = arc.getSwAng(); + // @XmlAttribute(name = "wR", required = true) + private String wr; + // @XmlAttribute(name = "hR", required = true) + private String hr; + // @XmlAttribute(name = "stAng", required = true) + private String stAng; + // @XmlAttribute(name = "swAng", required = true) + private String swAng; + + public void setHR(String hr) { + this.hr = hr; + } + + public void setWR(String wr) { + this.wr = wr; + } + + public void setStAng(String stAng) { + this.stAng = stAng; + } + + public void setSwAng(String swAng) { + this.swAng = swAng; } @Override @@ -141,4 +177,21 @@ public class ArcToCommand implements PathCommand { awtAngle = Math.toDegrees(Math.atan2(Math.tan(Math.toRadians(awtAngle2)), aspect)) + awtAngle3; return awtAngle; } + + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof ArcToCommand)) return false; + ArcToCommand that = (ArcToCommand) o; + return Objects.equals(wr, that.wr) && + Objects.equals(hr, that.hr) && + Objects.equals(stAng, that.stAng) && + Objects.equals(swAng, that.swAng); + } + + @Override + public int hashCode() { + return Objects.hash(wr, hr, stAng, swAng); + } } |