Interface PatternElement


public interface PatternElement

This interface defines the methods that a class must implement in order to be managed by the CSE 142 image project code.


Method Summary
 void addTo(uwcse.graphics.GWindow gw)
          Add this pattern to a graphics window.
 uwcse.graphics.Rectangle getBoundingBox()
          Get the dimensions of the smallest box that surrounds all of the objects in this pattern.
 int getHeight()
          Get the height of the pattern's bounding box
 int getWidth()
          Get the width of the pattern's bounding box
 int getX()
          Return the X coordinate of the upper-left corner of the pattern's bounding box.
 int getY()
          Return the Y coordinate of the upper-left corner of the pattern's bounding box.
 void removeFromWindow()
          Remove this pattern from the window it is shown in.
 

Method Detail

addTo

public void addTo(uwcse.graphics.GWindow gw)
Add this pattern to a graphics window. The implementing class must go through all the Shape objects it controls and add them to the window using the Shape method addTo(GWindow gw).

Parameters:
gw - the graphics window to add this image to

removeFromWindow

public void removeFromWindow()
Remove this pattern from the window it is shown in. The implementing class must go through all the Shape objects it controls and remove them from the window using the Shape method removeFromWindow().


getBoundingBox

public uwcse.graphics.Rectangle getBoundingBox()
Get the dimensions of the smallest box that surrounds all of the objects in this pattern. The implementing class must consider all the Shape objects it controls and look at their individual bounding boxes to find the minimum and maximum x and y values. This method returns a Rectangle with the appropriate x,y,width, and height values determined by these limits.

Returns:
Return the pattern's bounding box (the smallest rectangle enclosing all the Shapes in the Pattern).

getHeight

public int getHeight()
Get the height of the pattern's bounding box

Returns:
Return the height of the pattern's bounding box

getWidth

public int getWidth()
Get the width of the pattern's bounding box

Returns:
Return the width of the pattern's bounding box

getX

public int getX()
Return the X coordinate of the upper-left corner of the pattern's bounding box.

Returns:
the X coordinate of the upper-left corner of the pattern's bounding box

getY

public int getY()
Return the Y coordinate of the upper-left corner of the pattern's bounding box.

Returns:
the Y coordinate of the upper-left corner of the pattern's bounding box