Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/edu/macalester/graphics/Arc.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
5 changes: 5 additions & 0 deletions src/edu/macalester/graphics/CanvasWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
}
6 changes: 5 additions & 1 deletion src/edu/macalester/graphics/GraphicsGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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();
}
}
5 changes: 5 additions & 0 deletions src/edu/macalester/graphics/GraphicsText.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 + "'";
}
}