edu.neu.ccs.gui
Interface MutatablePaintable

All Superinterfaces:
Paintable
All Known Implementing Classes:
AbstractMutatablePaintable

public interface MutatablePaintable
extends Paintable

MutatablePaintable describes a Paintable that may be mutated using an invertible AffineTransform. The MutatablePaintable object must maintain its current mutator so that additional mutations may be performed.

By convention, the information supplied by the methods in the interface Paintable apply to the object after mutation.

To obtain the corresponding information for the object before mutation, use the methods with the keyword Original.

Since:
2.3

Method Summary
 void addPostMutation(AffineTransform M)
          Composes the existing mutator on the left with the given transform provided that the given transform is invertible.
 void addPostMutation(Mutator.Strategy strategy)
          Applies a Mutator.Strategy object to the paintable by composition on the left.
 void addPreMutation(AffineTransform M)
          Composes the existing mutator on the right with the given transform provided that the given transform is invertible.
 void addPreMutation(Mutator.Strategy strategy)
          Applies a Mutator.Strategy object to the paintable by composition on the right.
 AffineTransform getMutator()
          Returns a copy of the existing mutator transform.
 AffineTransform getMutatorInverse()
          Returns a copy of the existing mutator inverse transform.
 Rectangle2D getOriginalBounds2D()
          Returns a copy of the 2-dimensional bounds of the paint region before mutation.
 Point2D getOriginalCenter()
          Returns a copy of the center of the paint region before mutation.
 void move(double x, double y)
          Moves the mutatable by a translation using the data in the point specified by coordinates.
 void move(Point2D p)
          Moves the mutatable by a translation using the data in the point.
 void setMutator(AffineTransform M)
          Sets the mutator transform to the given transform provided that the given transform is invertible.
 
Methods inherited from interface edu.neu.ccs.gui.Paintable
contains, contains, getBounds2D, getCenter, getOpacity, getPreparedGraphics2D, isVisible, paint, setOpacity, setVisible
 

Method Detail

getOriginalBounds2D

public Rectangle2D getOriginalBounds2D()
Returns a copy of the 2-dimensional bounds of the paint region before mutation.

Returns:
a copy of the 2-dimensional bounds of the paint region

getOriginalCenter

public Point2D getOriginalCenter()
Returns a copy of the center of the paint region before mutation.

Returns:
a copy of the center of the paint region before mutation

setMutator

public void setMutator(AffineTransform M)
Sets the mutator transform to the given transform provided that the given transform is invertible.

Parameters:
M - the invertible affine transform to set as the mutator

addPreMutation

public void addPreMutation(AffineTransform M)

Composes the existing mutator on the right with the given transform provided that the given transform is invertible.

The action of the new mutator will be to apply the given transform and then to apply the old mutator.

This method should be equivalent to:

setMutator(TransformFactory.compose(getMutator(), M))

Parameters:
M - the invertible affine transform to compose on the right with the existing mutator

addPreMutation

public void addPreMutation(Mutator.Strategy strategy)

Applies a Mutator.Strategy object to the paintable by composition on the right. The specific manner is which this is done will depend on the particular object.

Parameters:
strategy - the mutator strategy to apply

addPostMutation

public void addPostMutation(AffineTransform M)

Composes the existing mutator on the left with the given transform provided that the given transform is invertible.

The action of the new mutator will be to apply the old mutator and then to apply the given transform.

This method should be equivalent to:

setMutator(TransformFactory.compose(M, getMutator()))

Parameters:
M - the invertible affine transform to compose on the left with the existing mutator

addPostMutation

public void addPostMutation(Mutator.Strategy strategy)

Applies a Mutator.Strategy object to the paintable by composition on the left. The specific manner is which this is done will depend on the particular object.

Parameters:
strategy - the mutator strategy to apply

getMutator

public AffineTransform getMutator()
Returns a copy of the existing mutator transform.

Returns:
a copy of the existing mutator transform

getMutatorInverse

public AffineTransform getMutatorInverse()
Returns a copy of the existing mutator inverse transform.

Returns:
a copy of the existing mutator inverse transform

move

public void move(double x,
                 double y)

Moves the mutatable by a translation using the data in the point specified by coordinates.

This method should act as a convenience method that performs an addPostMutation operation using a translation defined by the given point.

Parameters:
x - the x-coordinate of the point
y - the y-coordinate of the point

move

public void move(Point2D p)

Moves the mutatable by a translation using the data in the point.

This method should act as a convenience method that performs an addPostMutation operation using a translation defined by the given point.

If the point is null, this method should do nothing.

Parameters:
p - a specified Point2D