summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/kitfox/svg/Group.java8
-rw-r--r--src/main/java/com/kitfox/svg/ImageSVG.java4
-rw-r--r--src/main/java/com/kitfox/svg/RenderableElement.java4
-rw-r--r--src/main/java/com/kitfox/svg/SVGDiagram.java14
-rw-r--r--src/main/java/com/kitfox/svg/ShapeElement.java8
-rw-r--r--src/main/res/res/help/about/about.html2
6 files changed, 25 insertions, 15 deletions
diff --git a/src/main/java/com/kitfox/svg/Group.java b/src/main/java/com/kitfox/svg/Group.java
index 5b4db2b..ff13629 100644
--- a/src/main/java/com/kitfox/svg/Group.java
+++ b/src/main/java/com/kitfox/svg/Group.java
@@ -93,7 +93,7 @@ public class Group extends ShapeElement {
return true;
}
- void pick(Point2D point, Vector retVec) throws SVGException
+ void pick(Point2D point, boolean boundingBox, Vector retVec) throws SVGException
{
Point2D xPoint = new Point2D.Double(point.getX(), point.getY());
if (xform != null)
@@ -116,12 +116,12 @@ public class Group extends ShapeElement {
{
RenderableElement rendEle = (RenderableElement)ele;
- rendEle.pick(xPoint, retVec);
+ rendEle.pick(xPoint, boundingBox, retVec);
}
}
}
- void pick(Rectangle2D pickArea, AffineTransform ltw, Vector retVec) throws SVGException
+ void pick(Rectangle2D pickArea, AffineTransform ltw, boolean boundingBox, Vector retVec) throws SVGException
{
if (xform != null)
{
@@ -137,7 +137,7 @@ public class Group extends ShapeElement {
{
RenderableElement rendEle = (RenderableElement)ele;
- rendEle.pick(pickArea, ltw, retVec);
+ rendEle.pick(pickArea, ltw, boundingBox, retVec);
}
}
}
diff --git a/src/main/java/com/kitfox/svg/ImageSVG.java b/src/main/java/com/kitfox/svg/ImageSVG.java
index eb61215..75aaf79 100644
--- a/src/main/java/com/kitfox/svg/ImageSVG.java
+++ b/src/main/java/com/kitfox/svg/ImageSVG.java
@@ -120,7 +120,7 @@ public class ImageSVG extends RenderableElement
public float getWidth() { return width; }
public float getHeight() { return height; }
- void pick(Point2D point, Vector retVec) throws SVGException
+ void pick(Point2D point, boolean boundingBox, Vector retVec) throws SVGException
{
if (getBoundingBox().contains(point))
{
@@ -128,7 +128,7 @@ public class ImageSVG extends RenderableElement
}
}
- void pick(Rectangle2D pickArea, AffineTransform ltw, Vector retVec) throws SVGException
+ void pick(Rectangle2D pickArea, AffineTransform ltw, boolean boundingBox, Vector retVec) throws SVGException
{
if (ltw.createTransformedShape(getBoundingBox()).intersects(pickArea))
{
diff --git a/src/main/java/com/kitfox/svg/RenderableElement.java b/src/main/java/com/kitfox/svg/RenderableElement.java
index 379afcf..7afb50b 100644
--- a/src/main/java/com/kitfox/svg/RenderableElement.java
+++ b/src/main/java/com/kitfox/svg/RenderableElement.java
@@ -85,9 +85,9 @@ abstract public class RenderableElement extends TransformableElement
abstract public void render(Graphics2D g) throws SVGException;
- abstract void pick(Point2D point, Vector retVec) throws SVGException;
+ abstract void pick(Point2D point, boolean boundingBox, Vector retVec) throws SVGException;
- abstract void pick(Rectangle2D pickArea, AffineTransform ltw, Vector retVec) throws SVGException;
+ abstract void pick(Rectangle2D pickArea, AffineTransform ltw, boolean boundingBox, Vector retVec) throws SVGException;
abstract public Rectangle2D getBoundingBox() throws SVGException;
/*
diff --git a/src/main/java/com/kitfox/svg/SVGDiagram.java b/src/main/java/com/kitfox/svg/SVGDiagram.java
index cdbfa68..41de5f5 100644
--- a/src/main/java/com/kitfox/svg/SVGDiagram.java
+++ b/src/main/java/com/kitfox/svg/SVGDiagram.java
@@ -100,24 +100,34 @@ public class SVGDiagram implements Serializable
*/
public Vector pick(Point2D point, Vector retVec) throws SVGException
{
+ return pick(point, false, retVec);
+ }
+
+ public Vector pick(Point2D point, boolean boundingBox, Vector retVec) throws SVGException
+ {
if (retVec == null)
{
retVec = new Vector();
}
- root.pick(point, retVec);
+ root.pick(point, boundingBox, retVec);
return retVec;
}
public Vector pick(Rectangle2D pickArea, Vector retVec) throws SVGException
{
+ return pick(pickArea, false, retVec);
+ }
+
+ public Vector pick(Rectangle2D pickArea, boolean boundingBox, Vector retVec) throws SVGException
+ {
if (retVec == null)
{
retVec = new Vector();
}
- root.pick(pickArea, new AffineTransform(), retVec);
+ root.pick(pickArea, new AffineTransform(), boundingBox, retVec);
return retVec;
}
diff --git a/src/main/java/com/kitfox/svg/ShapeElement.java b/src/main/java/com/kitfox/svg/ShapeElement.java
index 9bb7b27..b346b97 100644
--- a/src/main/java/com/kitfox/svg/ShapeElement.java
+++ b/src/main/java/com/kitfox/svg/ShapeElement.java
@@ -64,21 +64,21 @@ abstract public class ShapeElement extends RenderableElement
}
*/
- void pick(Point2D point, Vector retVec) throws SVGException
+ void pick(Point2D point, boolean boundingBox, Vector retVec) throws SVGException
{
StyleAttribute styleAttrib = new StyleAttribute();
// if (getStyle(styleAttrib.setName("fill")) && getShape().contains(point))
- if (getShape().contains(point))
+ if ((boundingBox ? getBoundingBox() : getShape()).contains(point))
{
retVec.add(getPath(null));
}
}
- void pick(Rectangle2D pickArea, AffineTransform ltw, Vector retVec) throws SVGException
+ void pick(Rectangle2D pickArea, AffineTransform ltw, boolean boundingBox, Vector retVec) throws SVGException
{
StyleAttribute styleAttrib = new StyleAttribute();
// if (getStyle(styleAttrib.setName("fill")) && getShape().contains(point))
- if (ltw.createTransformedShape(getShape()).intersects(pickArea))
+ if (ltw.createTransformedShape((boundingBox ? getBoundingBox() : getShape())).intersects(pickArea))
{
retVec.add(getPath(null));
}
diff --git a/src/main/res/res/help/about/about.html b/src/main/res/res/help/about/about.html
index 4f57e6c..d4196ca 100644
--- a/src/main/res/res/help/about/about.html
+++ b/src/main/res/res/help/about/about.html
@@ -13,7 +13,7 @@
http://svgsalamander.dev.java.net<br>
http://www.kitfox.com<br>
<br>
- Last built: 2007, July, 30 02:07<br>
+ Last built: 2007, August, 20 11:23<br>
</div>
</body>
</html>