[piccolo2d-dev] [piccolo2d] r1033 committed - adding javadoc API documentation, adding stroke parameter to ctrs, add...

2010-08-03 Thread piccolo2d

Revision: 1033
Author: heuermh
Date: Tue Aug  3 13:33:18 2010
Log: adding javadoc API documentation, adding stroke parameter to ctrs,  
additional unit tests

http://code.google.com/p/piccolo2d/source/detail?r=1033

Modified:
  
/piccolo2d.java/branches/ppath-refactoring/core/src/main/java/org/piccolo2d/nodes/PArea.java
  
/piccolo2d.java/branches/ppath-refactoring/core/src/main/java/org/piccolo2d/nodes/PPath.java
  
/piccolo2d.java/branches/ppath-refactoring/core/src/main/java/org/piccolo2d/nodes/PShape.java
  
/piccolo2d.java/branches/ppath-refactoring/core/src/test/java/org/piccolo2d/nodes/PAreaTest.java
  
/piccolo2d.java/branches/ppath-refactoring/core/src/test/java/org/piccolo2d/nodes/PPathDoubleTest.java
  
/piccolo2d.java/branches/ppath-refactoring/core/src/test/java/org/piccolo2d/nodes/PPathFloatTest.java


===
---  
/piccolo2d.java/branches/ppath-refactoring/core/src/main/java/org/piccolo2d/nodes/PArea.java	 
Mon Aug  2 09:49:24 2010
+++  
/piccolo2d.java/branches/ppath-refactoring/core/src/main/java/org/piccolo2d/nodes/PArea.java	 
Tue Aug  3 13:33:18 2010

@@ -36,15 +36,24 @@
 /**
  * Area node.
  */
-public final class PArea extends PShape
-{
+public final class PArea extends PShape {
+
+/** Area for this area node. */
 private transient Area area;


+/**
+ * Create a new area node with an empty area.
+ */
 public PArea() {
 area = new Area();
 }

+/**
+ * Create a new area node with the specified shape.
+ *
+ * @param shape shape, must not be null
+ */
 public PArea(final Shape shape) {
 if (shape == null) {
 throw new NullPointerException(shape must not be null);
@@ -52,6 +61,11 @@
 this.area = new Area(shape);
 }

+/**
+ * Create a new area node with the specified area.
+ *
+ * @param area area, must not be null
+ */
 public PArea(final Area area) {
 if (area == null) {
 throw new NullPointerException(area must not be null);
@@ -61,34 +75,103 @@
 }


+/**
+ * Add the shape of the specified area to the shape of this area node.
+ * The resulting shape of this area node will include the union of  
both shapes,
+ * or all areas that were contained in either this or the specified  
area.

+ *
+ * @param area area to add, must not be null
+ * @throws NullPointerException if area is null
+ */
 public void add(final Area area) {
 this.area.add(area);
 updateBoundsFromShape();
 }

+/**
+ * Set the shape of this area node to be the combined area of its  
current
+ * shape and the shape of the specified area, minus their  
intersection. The
+ * resulting shape of this area node will include only areas that were  
contained

+ * in either this area node or in the specified area, but not in both.
+ *
+ * @param area area to exclusive or, must not be null
+ * @throws NullPointerException if area is null
+ */
 public void exclusiveOr(final Area area) {
 this.area.exclusiveOr(area);
 updateBoundsFromShape();
 }

+/**
+ * Set the shape of this area node to the intersection of its current  
shape
+ * and the shape of the specified area. The resulting shape of this  
area node
+ * will include only areas that were contained in both this area node  
and also

+ * in the specified area.
+ *
+ * @param area area to intersect, must not be null
+ * @throws NullPointerException if area is null
+ */
 public void intersect(final Area area) {
 this.area.intersect(area);
 updateBoundsFromShape();
 }

+/**
+ * Subtract the shape of the specified area from the shape of this  
area node.
+ * The resulting shape of this area node will include areas that were  
contained

+ * only in this area node and not in the specified area.
+ *
+ * @param area area to subtract, must not be null
+ * @throws NullPointerException if area is null
+ */
 public void subtract(final Area area) {
 this.area.subtract(area);
 updateBoundsFromShape();
 }

+/**
+ * Removes all of the geometry from this area node and restores it to  
an empty area.

+ */
+public void reset() {
+area.reset();
+updateBoundsFromShape();
+}
+
+/**
+ * Return true if this area node represents an empty area.
+ *
+ * @return true if this area node represents an empty area
+ */
+public boolean isEmpty() {
+return area.isEmpty();
+}
+
+/**
+ * Return true if this area node consists entirely of straight-edged  
polygonal geometry.

+ *
+ * @return true if this area node consists entirely of straight-edged  
polygonal geometry

+ */
 public boolean isPolygonal() {
 return area.isPolygonal();
 }

+/**
+ * Return true if this area node is rectangular in shape.
+  

[piccolo2d-dev] Re: Issue 152 in piccolo2d: Refactor PPath to use Path2D on JDK 1.6+

2010-08-03 Thread piccolo2d

Issue 152: Refactor PPath to use Path2D on JDK 1.6+
http://code.google.com/p/piccolo2d/issues/detail?id=152

This issue is now blocking issue 153.
See http://code.google.com/p/piccolo2d/issues/detail?id=153

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en


[piccolo2d-dev] Re: Issue 153 in piccolo2d: PArea, a wrapper for java.awt.geom.Area to allow Constructive Area Geometry (CAG) operations

2010-08-03 Thread piccolo2d

Updates:
Labels: -Milestone-2.0

Comment #5 on issue 153 by heue...@gmail.com: PArea, a wrapper for  
java.awt.geom.Area to allow Constructive Area Geometry (CAG) operations

http://code.google.com/p/piccolo2d/issues/detail?id=153

(No comment was entered for this change.)

--
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en


[piccolo2d-dev] [piccolo2d] r1034 committed - add default paint, intersects, fullIntersects unit tests, fixed PPickP...

2010-08-03 Thread piccolo2d

Revision: 1034
Author: heuermh
Date: Tue Aug  3 15:03:26 2010
Log: add default paint, intersects, fullIntersects unit tests, fixed  
PPickPath unit test failure

http://code.google.com/p/piccolo2d/source/detail?r=1034

Modified:
  
/piccolo2d.java/branches/ppath-refactoring/core/src/main/java/org/piccolo2d/nodes/PArea.java
  
/piccolo2d.java/branches/ppath-refactoring/core/src/main/java/org/piccolo2d/nodes/PShape.java
  
/piccolo2d.java/branches/ppath-refactoring/core/src/test/java/org/piccolo2d/nodes/AbstractPShapeTest.java
  
/piccolo2d.java/branches/ppath-refactoring/core/src/test/java/org/piccolo2d/nodes/PAreaTest.java
  
/piccolo2d.java/branches/ppath-refactoring/core/src/test/java/org/piccolo2d/nodes/PPathTest.java


===
---  
/piccolo2d.java/branches/ppath-refactoring/core/src/main/java/org/piccolo2d/nodes/PArea.java	 
Tue Aug  3 13:33:18 2010
+++  
/piccolo2d.java/branches/ppath-refactoring/core/src/main/java/org/piccolo2d/nodes/PArea.java	 
Tue Aug  3 15:03:26 2010

@@ -178,7 +178,6 @@

 // todo:
 //area property change events?
-//static methods
 //should modifiers return this to allow chaining, e.g.  
add(area0).intersect(area1)
 //test serialization, may have to add custom code to serialize  
areas


===
---  
/piccolo2d.java/branches/ppath-refactoring/core/src/main/java/org/piccolo2d/nodes/PShape.java	 
Tue Aug  3 13:33:18 2010
+++  
/piccolo2d.java/branches/ppath-refactoring/core/src/main/java/org/piccolo2d/nodes/PShape.java	 
Tue Aug  3 15:03:26 2010

@@ -53,6 +53,9 @@
 /** Stroke paint for this shape node, defaults to {...@link  
#DEFAULT_STROKE_PAINT}. */

 private Paint strokePaint = DEFAULT_STROKE_PAINT;

+/** Default paint for this shape node, codeColor.WHITE/code. */
+public static final Paint DEFAULT_PAINT = Color.WHITE;
+
 /** Default stroke, a basic stroke of width code1.0f/code. */
 public static final Stroke DEFAULT_STROKE = new BasicStroke(1.0f);

@@ -65,6 +68,7 @@
  */
 protected PShape() {
 super();
+setPaint(DEFAULT_PAINT);
 }


===
---  
/piccolo2d.java/branches/ppath-refactoring/core/src/test/java/org/piccolo2d/nodes/AbstractPShapeTest.java	 
Fri Jul 23 12:41:40 2010
+++  
/piccolo2d.java/branches/ppath-refactoring/core/src/test/java/org/piccolo2d/nodes/AbstractPShapeTest.java	 
Tue Aug  3 15:03:26 2010

@@ -51,4 +51,19 @@
 public void testCreateShapeNode() {
 assertNotNull(createShapeNode());
 }
-}
+
+public void testDefaultPaint() {
+PShape shape = createShapeNode();
+assertEquals(PShape.DEFAULT_PAINT, shape.getPaint());
+}
+
+public void testDefaultStroke() {
+PShape shape = createShapeNode();
+assertEquals(PShape.DEFAULT_STROKE, shape.getStroke());
+}
+
+public void testDefaultStrokePaint() {
+PShape shape = createShapeNode();
+assertEquals(PShape.DEFAULT_STROKE_PAINT, shape.getStrokePaint());
+}
+}
===
---  
/piccolo2d.java/branches/ppath-refactoring/core/src/test/java/org/piccolo2d/nodes/PAreaTest.java	 
Tue Aug  3 13:33:18 2010
+++  
/piccolo2d.java/branches/ppath-refactoring/core/src/test/java/org/piccolo2d/nodes/PAreaTest.java	 
Tue Aug  3 15:03:26 2010

@@ -93,12 +93,32 @@
 assertEquals(151.0d, area.getWidth(), TOLERANCE);
 assertEquals(101.0, area.getHeight(), TOLERANCE);
 assertTrue(area.intersects(new Rectangle2D.Double(10.0d, 95.0d,  
10.0d, 10.0d)));
+assertTrue(area.intersects(new Rectangle2D.Double(25.0, 25.0d,  
2.0d, 2.0d)));
 assertTrue(area.intersects(new Rectangle2D.Double(60.0d, 95.0d,  
10.0d, 10.0d)));
 assertTrue(area.intersects(new Rectangle2D.Double(110.0d, 95.0d,  
10.0d, 10.0d)));

 }

-public void testAddNoStroke() {
+public void testAddNullPaint() {
 PArea area = new PArea();
+area.setPaint(null);
+assertEquals(0.0d, area.getWidth(), TOLERANCE);
+assertEquals(0.0d, area.getHeight(), TOLERANCE);
+
+Area rect0 = new Area(new Rectangle2D.Double(0.0d, 0.0d, 100.0d,  
100.0d));

+area.add(rect0);
+Area rect1 = new Area(new Rectangle2D.Double(50.0d, 0.0d, 100.0d,  
100.0d));

+area.add(rect1);
+
+assertEquals(151.0d, area.getWidth(), TOLERANCE);
+assertEquals(101.0, area.getHeight(), TOLERANCE);
+assertTrue(area.intersects(new Rectangle2D.Double(10.0d, 95.0d,  
10.0d, 10.0d)));
+assertFalse(area.intersects(new Rectangle2D.Double(25.0, 25.0d,  
2.0d, 2.0d)));
+assertTrue(area.intersects(new Rectangle2D.Double(60.0d, 95.0d,  
10.0d, 10.0d)));
+assertTrue(area.intersects(new Rectangle2D.Double(110.0d, 95.0d,  
10.0d, 10.0d)));

+}
+
+public void testAddNullStroke() {
+PArea area = new PArea();
 area.setStroke(null);
 assertEquals(0.0d, 

[piccolo2d-dev] Issue 185 in piccolo2d: Memory leak - PActivityScheduler keeps processed activities in reference

2010-08-03 Thread piccolo2d

Status: New
Owner: 

New issue 185 by atdixon: Memory leak - PActivityScheduler keeps processed  
activities in reference

http://code.google.com/p/piccolo2d/issues/detail?id=185

Piccolo's PActivityScheduler keeps activities in reference even after they  
are processed. This also means that any state that activities reference  
(nodes, e.g.) will also stay in reference and not get garbage collected.


This example demonstrates the problem:  
http://github.com/atdixon/piccolo2d-examples/blob/master/src/main/java/atdixon/piccolo/example/ActivityMemoryLeakExample.java


This applies to Piccolo2d/Java, trunk and 1.3.

User group thread:  
http://groups.google.com/group/piccolo2d-users/browse_thread/thread/6e906b3afa5fd749




--
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en


[piccolo2d-dev] Re: Issue 185 in piccolo2d: Memory leak - PActivityScheduler keeps processed activities in reference

2010-08-03 Thread piccolo2d


Comment #1 on issue 185 by atdixon: Memory leak - PActivityScheduler keeps  
processed activities in reference

http://code.google.com/p/piccolo2d/issues/detail?id=185

Attaching patch that fixes 185.

Attachments:
Piccolo2D_Java_185.patch  542 bytes

--
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en