diff --git a/src/edu/macalester/graphics/Arc.java b/src/edu/macalester/graphics/Arc.java index 845b3f1..dac98ad 100644 --- a/src/edu/macalester/graphics/Arc.java +++ b/src/edu/macalester/graphics/Arc.java @@ -103,4 +103,9 @@ public Rectangle2D getBounds() { protected Object getEqualityAttributes() { return shape; } + + @Override + public String toString() { + return "Arc at position " + getX() + ", " + getY() + ", of size " + (int)getWidth() + " by " + (int)getHeight() + " starting at angle " + shape.getAngleStart() + " sweeping through an angle of " + shape.getAngleExtent(); + } } diff --git a/src/edu/macalester/graphics/CanvasWindow.java b/src/edu/macalester/graphics/CanvasWindow.java index ebbe0be..2f376a9 100644 --- a/src/edu/macalester/graphics/CanvasWindow.java +++ b/src/edu/macalester/graphics/CanvasWindow.java @@ -750,4 +750,9 @@ public void performEventAction(Runnable action) { draw(); }); } + + public String toString() { + return "CanvasWindow of size " + canvas.getWidth() + " by " + canvas.getHeight() + + " containing " + content.numChildren() + " GraphicsObjects"; + } } diff --git a/src/edu/macalester/graphics/GraphicsGroup.java b/src/edu/macalester/graphics/GraphicsGroup.java index 1d8ff0f..ddf5819 100644 --- a/src/edu/macalester/graphics/GraphicsGroup.java +++ b/src/edu/macalester/graphics/GraphicsGroup.java @@ -132,6 +132,10 @@ public GraphicsObject getElementAtLocalCoordinates(double x, double y) { return null; } + public int numChildren() { + return children.size(); + } + @Override protected void drawInLocalCoordinates(Graphics2D gc) { for (GraphicsObject obj : children) { @@ -212,6 +216,6 @@ protected Object getEqualityAttributes() { @Override public String toString() { - return "A graphics group at position (" + getX() + ", " + getY() + ") with size=" + getSize(); + return "GraphicsGroup at position (" + getX() + ", " + getY() + ") with size=" + getSize(); } } diff --git a/src/edu/macalester/graphics/GraphicsText.java b/src/edu/macalester/graphics/GraphicsText.java index baa8347..86fdf9f 100644 --- a/src/edu/macalester/graphics/GraphicsText.java +++ b/src/edu/macalester/graphics/GraphicsText.java @@ -385,4 +385,9 @@ public Rectangle2D getBounds() { protected Object getEqualityAttributes() { return List.of(font, text); } + + @Override + public String toString() { + return "GraphicsText at " + getPosition() + " with text '" + text + "'"; + } }