|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--edu.neu.ccs.gui.AbstractPaintable
|
+--edu.neu.ccs.gui.AbstractMutatablePaintable
The abstract class AbstractMutatablePaintable
defines objects that extend AbstractPaintable
and implement MutatablePaintable.
| Field Summary | |
static String |
SET_MUTATOR
Bound property name for set mutator. |
| Fields inherited from class edu.neu.ccs.gui.AbstractPaintable |
SET_DEFAULT_BOUNDS2D, SET_DEFAULT_CENTER, SET_OPACITY, SET_VISIBLE |
| Constructor Summary | |
AbstractMutatablePaintable()
|
|
| 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 using the mutated center to construct the
post-mutation. |
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 using the original center to construct the
pre-mutation. |
Rectangle2D |
getBounds2D()
Returns a copy of the 2-dimensional bounds of the mutated paintable. |
Point2D |
getCenter()
Returns a copy the center of the mutated paintable. |
AffineTransform |
getMutator()
Returns a copy of the existing mutator transform. |
AffineTransform |
getMutatorInverse()
Returns a copy of the existing mutator inverse transform. |
abstract Rectangle2D |
getOriginalBounds2D()
Returns a copy of the 2-dimensional bounds of the original paintable. |
abstract Point2D |
getOriginalCenter()
Returns a copy the center of the original paintable. |
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 class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface edu.neu.ccs.gui.Paintable |
contains, contains, getOpacity, getPreparedGraphics2D, isVisible, paint, setOpacity, setVisible |
| Field Detail |
public static final String SET_MUTATOR
| Constructor Detail |
public AbstractMutatablePaintable()
| Method Detail |
public Rectangle2D getBounds2D()
Returns a copy of the 2-dimensional bounds of the mutated paintable.
By default, this method returns the bounds rectangle of the image
of the original bounds rectangle, getOriginalBounds2D,
under the mutator transform.
This method may be overridden in a derived class if a more exact
bounds rectangle may be calculated or if the relationship between
getBounds2D and getOriginalBounds2D is
more subtle.
This method does not use the default Bounds2D rectangle as defined
by setDefaultBounds2D in AbstractPaintable.
The decision to use the default Bounds2D rectangle is left to derived
classes.
This method must not return null.
getBounds2D in interface PaintablegetBounds2D in class AbstractPaintablegetOriginalBounds2D(),
AbstractPaintable.setDefaultBounds2D(Rectangle2D),
AbstractPaintable.getDefaultBounds2D()public Point2D getCenter()
Returns a copy the center of the mutated paintable.
By default, this returns the image of getOriginalCenter()
under the mutator transform.
This method may be overridden in a derived class if a more exact center may be calculated.
This method does not use the default center as defined
by setDefaultCenter in AbstractPaintable.
The decision to use the default center is left to derived classes.
This method must not return null.
getCenter in interface PaintablegetCenter in class AbstractPaintablegetOriginalCenter(),
AbstractPaintable.setDefaultCenter(Point2D),
AbstractPaintable.getDefaultCenter()public abstract Rectangle2D getOriginalBounds2D()
Returns a copy of the 2-dimensional bounds of the original paintable.
If the current paintable is empty, this method should return new Rectangle2D.Double().
This method must not return null.
getOriginalBounds2D in interface MutatablePaintablegetBounds2D()public abstract Point2D getOriginalCenter()
Returns a copy the center of the original paintable.
If the current paintable is empty, this method should return new Point2D.Double().
This method must not return null.
getOriginalCenter in interface MutatablePaintablegetCenter()public void setMutator(AffineTransform M)
Sets the mutator transform to the given transform provided that the given transform is invertible.
If the given transform is not invertible, the method does nothing.
Fires property change: SET_MUTATOR.
This method may be overridden in a derived class if additional work must be done when the mutator is set.
setMutator in interface MutatablePaintableM - the invertible affine transform to set as the mutatoraddPreMutation(AffineTransform),
addPreMutation(Mutator.Strategy),
addPostMutation(AffineTransform),
addPostMutation(Mutator.Strategy),
getMutator(),
getMutatorInverse()public final 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 is equivalent to:
setMutator(TransformFactory.compose(getMutator(), M))
Fires property change: SET_MUTATOR.
addPreMutation in interface MutatablePaintableM - the invertible affine transform to compose on the right with
the existing mutatorsetMutator(AffineTransform),
addPreMutation(Mutator.Strategy),
addPostMutation(AffineTransform),
addPostMutation(Mutator.Strategy),
getMutator(),
getMutatorInverse()public void addPreMutation(Mutator.Strategy strategy)
Applies a Mutator.Strategy object to the paintable by
composition on the right using the original center to construct the
pre-mutation.
Fires property change: SET_MUTATOR.
This method may be overridden in a derived class if the mutator strategy will be used in a more subtle fashion. The overriding method must continue to fire the SET_MUTATOR property change.
addPreMutation in interface MutatablePaintablestrategy - the mutator strategy to applysetMutator(AffineTransform),
addPreMutation(AffineTransform),
addPostMutation(AffineTransform),
addPostMutation(Mutator.Strategy),
getMutator(),
getMutatorInverse()public final 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 is equivalent to:
setMutator(TransformFactory.compose(M, getMutator()))
Fires property change: SET_MUTATOR.
addPostMutation in interface MutatablePaintableM - the invertible affine transform to compose on the left with
the existing mutatorsetMutator(AffineTransform),
addPreMutation(AffineTransform),
addPreMutation(Mutator.Strategy),
addPostMutation(Mutator.Strategy),
getMutator(),
getMutatorInverse()public void addPostMutation(Mutator.Strategy strategy)
Applies a Mutator.Strategy object to the paintable by
composition on the left using the mutated center to construct the
post-mutation.
Fires property change: SET_MUTATOR.
This method may be overridden in a derived class if the mutator strategy will be used in a more subtle fashion. The overriding method must continue to fire the SET_MUTATOR property change.
addPostMutation in interface MutatablePaintablestrategy - the mutator strategy to applysetMutator(AffineTransform),
addPreMutation(AffineTransform),
addPreMutation(Mutator.Strategy),
addPostMutation(AffineTransform),
getMutator(),
getMutatorInverse()public final AffineTransform getMutator()
getMutator in interface MutatablePaintablesetMutator(AffineTransform),
addPreMutation(AffineTransform),
addPreMutation(Mutator.Strategy),
addPostMutation(AffineTransform),
addPostMutation(Mutator.Strategy),
getMutatorInverse()public final AffineTransform getMutatorInverse()
getMutatorInverse in interface MutatablePaintablesetMutator(AffineTransform),
addPreMutation(AffineTransform),
addPreMutation(Mutator.Strategy),
addPostMutation(AffineTransform),
addPostMutation(Mutator.Strategy),
getMutator()
public final 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.
move in interface MutatablePaintablex - the x-coordinate of the pointy - the y-coordinate of the pointpublic final 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.
move in interface MutatablePaintablep - a specified Point2D
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||