Package diva.canvas.toolbox
Class PaintedFigure
- java.lang.Object
-
- diva.canvas.AbstractFigure
-
- diva.canvas.toolbox.PaintedFigure
-
- All Implemented Interfaces:
CanvasComponent,Figure,VisibleComponent,UserObjectContainer
public class PaintedFigure extends AbstractFigure
A PaintedFigure is contains an arbitrary set of PaintedObjects in a list. This figure can be used for constructing more complex figures than classes such as BasicFigure. It contains a transform that is used for scaling the contained painted objects. (Note that, if using this class to construct a figure from an external source, the initial transform should operate on the coordinates only.)- Version:
- $Id$
- Author:
- John Reekie, Nick Zamora
-
-
Constructor Summary
Constructors Constructor Description PaintedFigure()Create a new blank figure.PaintedFigure(PaintedList objects)Create a new figure that paints itself using the given PaintedList.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(PaintedObject po)Add a new painted object to the objects displayed by this figure.java.awt.geom.Rectangle2DgetBounds()Get the bounding box of this figure.java.awt.CompositegetComposite()Get the color composition operator of this figure.java.awt.geom.Point2DgetOrigin()Return the origin, which is the point relative to which all of the contained objects are drawn.PaintedListgetPaintedList()Get the painted list of painted objects of this figure.java.awt.ShapegetShape()Get the shape of this figure.voidpaint(java.awt.Graphics2D g)Paint the figure.voidsetComposite(java.awt.Composite c)Set the color composition operator of this figure.voidtransform(java.awt.geom.AffineTransform at)Transform the figure with the supplied transform.-
Methods inherited from class diva.canvas.AbstractFigure
contains, getInteractor, getLayer, getParent, getToolTipText, getTransformContext, getUserObject, hit, intersects, isVisible, paint, repaint, repaint, setInteractor, setParent, setToolTipText, setUserObject, setVisible, translate
-
-
-
-
Constructor Detail
-
PaintedFigure
public PaintedFigure()
Create a new blank figure.
-
PaintedFigure
public PaintedFigure(PaintedList objects)
Create a new figure that paints itself using the given PaintedList.
-
-
Method Detail
-
add
public void add(PaintedObject po)
Add a new painted object to the objects displayed by this figure.
-
getPaintedList
public PaintedList getPaintedList()
Get the painted list of painted objects of this figure.
-
getBounds
public java.awt.geom.Rectangle2D getBounds()
Get the bounding box of this figure.- Specified by:
getBoundsin interfaceFigure- Overrides:
getBoundsin classAbstractFigure- Returns:
- the bounding box of this figure.
-
getOrigin
public java.awt.geom.Point2D getOrigin()
Return the origin, which is the point relative to which all of the contained objects are drawn.- Specified by:
getOriginin interfaceFigure- Overrides:
getOriginin classAbstractFigure- Returns:
- The origin.
- See Also:
AbstractFigure.getBounds()
-
getShape
public java.awt.Shape getShape()
Get the shape of this figure. This is the same as the bounding box.- Specified by:
getShapein interfaceFigure- Specified by:
getShapein classAbstractFigure- Returns:
- the outline shape of this figure
-
getComposite
public java.awt.Composite getComposite()
Get the color composition operator of this figure.
-
paint
public void paint(java.awt.Graphics2D g)
Paint the figure.- Specified by:
paintin interfaceVisibleComponent- Specified by:
paintin classAbstractFigure- Parameters:
g- The 2D graphics object that this object it to be painted upon.
-
setComposite
public void setComposite(java.awt.Composite c)
Set the color composition operator of this figure. If the composite is set to null, then the composite will not be changed when the figure is painted. By default, the composite is set to opaque.
-
transform
public void transform(java.awt.geom.AffineTransform at)
Transform the figure with the supplied transform. This can be used to perform arbitrary translation, scaling, shearing, and rotation operations.- Specified by:
transformin interfaceFigure- Specified by:
transformin classAbstractFigure- Parameters:
at- The transform to be used.
-
-