From d00f4048569d662b025aa78a1a2cad3a1651ddd6 Mon Sep 17 00:00:00 2001 From: kitfox Date: Tue, 5 Jul 2011 07:47:10 +0000 Subject: Fixed problem with path CLOSE instruction not returning cursor to start of path. Fixed problem with marker-mid and marker-end ignoring the 'none' draw style. git-svn-id: https://svn.java.net/svn/svgsalamander~svn/trunk/svg-core@98 7dc7fa77-23fb-e6ad-8e2e-c86bd48ed22b --- src/main/java/com/kitfox/svg/ShapeElement.java | 14 ++++++++++---- src/main/java/com/kitfox/svg/pathcmd/BuildHistory.java | 6 ++++++ src/main/java/com/kitfox/svg/pathcmd/MoveTo.java | 1 + src/main/java/com/kitfox/svg/pathcmd/Terminal.java | 1 + 4 files changed, 18 insertions(+), 4 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/kitfox/svg/ShapeElement.java b/src/main/java/com/kitfox/svg/ShapeElement.java index 207e096..07b76cf 100644 --- a/src/main/java/com/kitfox/svg/ShapeElement.java +++ b/src/main/java/com/kitfox/svg/ShapeElement.java @@ -247,15 +247,21 @@ abstract public class ShapeElement extends RenderableElement Marker markerMid = null; if (getStyle(styleAttrib.setName("marker-mid"))) { - URI uri = styleAttrib.getURIValue(getXMLBase()); - markerMid = (Marker)diagram.getUniverse().getElement(uri); + if (!styleAttrib.getStringValue().equals("none")) + { + URI uri = styleAttrib.getURIValue(getXMLBase()); + markerMid = (Marker)diagram.getUniverse().getElement(uri); + } } Marker markerEnd = null; if (getStyle(styleAttrib.setName("marker-end"))) { - URI uri = styleAttrib.getURIValue(getXMLBase()); - markerEnd = (Marker)diagram.getUniverse().getElement(uri); + if (!styleAttrib.getStringValue().equals("none")) + { + URI uri = styleAttrib.getURIValue(getXMLBase()); + markerEnd = (Marker)diagram.getUniverse().getElement(uri); + } } diff --git a/src/main/java/com/kitfox/svg/pathcmd/BuildHistory.java b/src/main/java/com/kitfox/svg/pathcmd/BuildHistory.java index d16c11a..ff00120 100644 --- a/src/main/java/com/kitfox/svg/pathcmd/BuildHistory.java +++ b/src/main/java/com/kitfox/svg/pathcmd/BuildHistory.java @@ -41,6 +41,7 @@ public class BuildHistory { // Point2D.Float[] history = new Point2D.Float[2]; Point2D.Float[] history = {new Point2D.Float(), new Point2D.Float()}; + Point2D.Float start = new Point2D.Float(); int length = 0; /** Creates a new instance of BuildHistory */ @@ -53,6 +54,11 @@ public class BuildHistory { length = 1; } + public void setStart(float x, float y) + { + start.setLocation(x, y); + } + public void setPointAndKnot(float x, float y, float kx, float ky) { history[0].setLocation(x, y); diff --git a/src/main/java/com/kitfox/svg/pathcmd/MoveTo.java b/src/main/java/com/kitfox/svg/pathcmd/MoveTo.java index 7339607..e2246a5 100644 --- a/src/main/java/com/kitfox/svg/pathcmd/MoveTo.java +++ b/src/main/java/com/kitfox/svg/pathcmd/MoveTo.java @@ -57,6 +57,7 @@ public class MoveTo extends PathCommand { path.moveTo(x + offx, y + offy); hist.setPoint(x + offx, y + offy); + hist.setStart(x + offx, y + offy); } public int getNumKnotsAdded() diff --git a/src/main/java/com/kitfox/svg/pathcmd/Terminal.java b/src/main/java/com/kitfox/svg/pathcmd/Terminal.java index a9d1c9f..1cdacf2 100644 --- a/src/main/java/com/kitfox/svg/pathcmd/Terminal.java +++ b/src/main/java/com/kitfox/svg/pathcmd/Terminal.java @@ -47,6 +47,7 @@ public class Terminal extends PathCommand { public void appendPath(GeneralPath path, BuildHistory hist) { path.closePath(); + hist.setPoint(hist.start.x, hist.start.y); } public int getNumKnotsAdded() -- cgit v1.2.3-55-g7522