|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rit.draw.item.DrawingItem
edu.rit.draw.item.Group
public class Group
Class Group provides a DrawingItem that consists of a group of other DrawingItems. To add drawing items to a group, call the group's append() and prepend() methods.
The group can be scaled as a unit by calling the xScale() and yScale() methods. The group can be sheared as a unit by calling the xShear() and yShear() methods. The group can be rotated as a unit by calling the rotationAngle() method; the group is always rotated around its center point. The order in which these transforms are applied is first scaling, then shearing, then rotation.
The group's "bounding box" is the smallest rectangle that encloses all the contained drawing items' bounding boxes, after applying the scale, shear, and rotation transforms if any. The nw(), n(), ne(), w(), c(), e(), sw(), s(), and se() methods refer to points on the group's bounding box. The setter versions of these methods translate the group so the designated point on the group's bounding box coincides with the point specified as the argument. The getter versions of these methods return the designated point on the group's bounding box.
The group's "original bounding box" is the smallest rectangle that encloses all the contained drawing items' bounding boxes, before applying the scale, shear, and rotation transforms if any. The orig_nw(), orig_n(), orig_ne(), orig_w(), orig_c(), orig_e(), orig_sw(), orig_s(), and orig_se() methods refer to points on the group's original bounding box. The setter versions of these methods translate the group so the designated point on the group's original bounding box coincides with the point specified as the argument. The getter versions of these methods return the designated point on the group's original bounding box.
The transform() method takes a point, applies the group's scaling, shearing, rotation, and translation transforms to the point, and returns the transformed point. You can use this method, for example, to find out where a point defined before applying transforms to the group would end up after applying transforms to the group.
| Field Summary | |
|---|---|
static double |
NORMAL_ROTATION_ANGLE
The normal rotation angle (0). |
static double |
NORMAL_X_SCALE
The normal X scale factor (1). |
static double |
NORMAL_X_SHEAR
The normal X shear factor (0). |
static double |
NORMAL_Y_SCALE
The normal Y scale factor (1). |
static double |
NORMAL_Y_SHEAR
The normal Y shear factor (0). |
| Constructor Summary | |
|---|---|
Group()
Construct a new empty group. |
|
Group(Group theGroup)
Construct a new group that contains the same drawing items, has the same transforms, and is at the same location, as the given group. |
|
| Method Summary | |
|---|---|
Group |
add()
Add this group to the end of the default drawing's sequence of drawing items. |
Group |
add(Drawing theDrawing)
Add this group to the end of the given drawing's sequence of drawing items. |
Group |
addFirst()
Add this group to the beginning of the default drawing's sequence of drawing items. |
Group |
addFirst(Drawing theDrawing)
Add this group to the beginning of the given drawing's sequence of drawing items. |
Group |
append(DrawingItem theItem)
Add the given drawing item to the end of this group's list of drawing items. |
Group |
c(double x,
double y)
Set the center point of this group's bounding box. |
Group |
c(Point thePoint)
Set the center point of this group's bounding box. |
Group |
clear()
Clear this group. |
Point |
content_c()
Returns the center point of this group's original bounding box, without applying the group's transformations if any. |
Point |
content_e()
Returns the east center point of this group's original bounding box, without applying the group's transformations if any. |
Point |
content_n()
Returns the north center point of this group's original bounding box, without applying the group's transformations if any. |
Point |
content_ne()
Returns the northeast corner point of this group's original bounding box, without applying the group's transformations if any. |
Point |
content_nw()
Returns the northwest corner point of this group's original bounding box, without applying the group's transformations if any. |
Point |
content_s()
Returns the south center point of this group's original bounding box, without applying the group's transformations if any. |
Point |
content_se()
Returns the southeast corner point of this group's original bounding box, without applying the group's transformations if any. |
Point |
content_sw()
Returns the southwest corner point of this group's original bounding box, without applying the group's transformations if any. |
Point |
content_w()
Returns the west center point of this group's original bounding box, without applying the group's transformations if any. |
static double |
defaultRotationAngle()
Returns the default rotation angle. |
static void |
defaultRotationAngle(double theAngle)
Set the default rotation angle. |
static double |
defaultXScale()
Returns the default X scale factor. |
static void |
defaultXScale(double theXScale)
Set the default X scale factor. |
static double |
defaultXShear()
Returns the default X shear factor. |
static void |
defaultXShear(double theXShear)
Set the default X shear factor. |
static double |
defaultYScale()
Returns the default Y scale factor. |
static void |
defaultYScale(double theYScale)
Set the default Y scale factor. |
static double |
defaultYShear()
Returns the default Y shear factor. |
static void |
defaultYShear(double theYShear)
Set the default Y shear factor. |
void |
draw(Graphics2D g2d)
Draw this drawing item in the given graphics context. |
Group |
e(double x,
double y)
Set the east middle point of this group's bounding box. |
Group |
e(Point thePoint)
Set the east middle point of this group's bounding box. |
double |
height()
Returns the height of this group's bounding box. |
Group |
n(double x,
double y)
Set the north middle point of this group's bounding box. |
Group |
n(Point thePoint)
Set the north middle point of this group's bounding box. |
Group |
ne(double x,
double y)
Set the northeast corner point of this group's bounding box. |
Group |
ne(Point thePoint)
Set the northeast corner point of this group's bounding box. |
Point |
nw()
Returns the northwest corner point of this group's bounding box. |
Group |
nw(double x,
double y)
Set the northwest corner point of this group's bounding box. |
Group |
nw(Point thePoint)
Set the northwest corner point of this group's bounding box. |
Point |
orig_c()
Returns the center point of this group's original bounding box, after applying the group's transformations if any. |
Group |
orig_c(double x,
double y)
Set the center point of this group's original bounding box, after applying the group's transformations if any. |
Group |
orig_c(Point thePoint)
Set the center point of this group's original bounding box, after applying the group's transformations if any. |
Point |
orig_e()
Returns the east center point of this group's original bounding box, after applying the group's transformations if any. |
Group |
orig_e(double x,
double y)
Set the east center point of this group's original bounding box, after applying the group's transformations if any. |
Group |
orig_e(Point thePoint)
Set the east center point of this group's original bounding box, after applying the group's transformations if any. |
Point |
orig_n()
Returns the north center point of this group's original bounding box, after applying the group's transformations if any. |
Group |
orig_n(double x,
double y)
Set the north center point of this group's original bounding box, after applying the group's transformations if any. |
Group |
orig_n(Point thePoint)
Set the north center point of this group's original bounding box, after applying the group's transformations if any. |
Point |
orig_ne()
Returns the northeast corner point of this group's original bounding box, after applying the group's transformations if any. |
Group |
orig_ne(double x,
double y)
Set the northeast corner point of this group's original bounding box, after applying the group's transformations if any. |
Group |
orig_ne(Point thePoint)
Set the northeast corner point of this group's original bounding box, after applying the group's transformations if any. |
Point |
orig_nw()
Returns the northwest corner point of this group's original bounding box, after applying the group's transformations if any. |
Group |
orig_nw(double x,
double y)
Set the northwest corner point of this group's original bounding box, after applying the group's transformations if any. |
Group |
orig_nw(Point thePoint)
Set the northwest corner point of this group's original bounding box, after applying the group's transformations if any. |
Point |
orig_s()
Returns the south center point of this group's original bounding box, after applying the group's transformations if any. |
Group |
orig_s(double x,
double y)
Set the south center point of this group's original bounding box, after applying the group's transformations if any. |
Group |
orig_s(Point thePoint)
Set the south center point of this group's original bounding box, after applying the group's transformations if any. |
Point |
orig_se()
Returns the southeast corner point of this group's original bounding box, after applying the group's transformations if any. |
Group |
orig_se(double x,
double y)
Set the southeast corner point of this group's original bounding box, after applying the group's transformations if any. |
Group |
orig_se(Point thePoint)
Set the southeast corner point of this group's original bounding box, after applying the group's transformations if any. |
Point |
orig_sw()
Returns the southwest corner point of this group's original bounding box, after applying the group's transformations if any. |
Group |
orig_sw(double x,
double y)
Set the southwest corner point of this group's original bounding box, after applying the group's transformations if any. |
Group |
orig_sw(Point thePoint)
Set the southwest corner point of this group's original bounding box, after applying the group's transformations if any. |
Point |
orig_w()
Returns the west center point of this group's original bounding box, after applying the group's transformations if any. |
Group |
orig_w(double x,
double y)
Set the west center point of this group's original bounding box, after applying the group's transformations if any. |
Group |
orig_w(Point thePoint)
Set the west center point of this group's original bounding box, after applying the group's transformations if any. |
Group |
prepend(DrawingItem theItem)
Add the given drawing item to the beginning of this group's list of drawing items. |
void |
readExternal(ObjectInput in)
Read this group from the given object input stream. |
double |
rotationAngle()
Returns this group's rotation angle. |
Group |
rotationAngle(double theAngle)
Set this group's rotation angle. |
Group |
s(double x,
double y)
Set the south middle point of this group's bounding box. |
Group |
s(Point thePoint)
Set the south middle point of this group's bounding box. |
Group |
se(double x,
double y)
Set the southeast corner point of this group's bounding box. |
Group |
se(Point thePoint)
Set the southeast corner point of this group's bounding box. |
Size |
size()
Returns the size of this group's bounding box. |
Group |
sw(double x,
double y)
Set the southwest corner point of this group's bounding box. |
Group |
sw(Point thePoint)
Set the southwest corner point of this group's bounding box. |
Point |
transform(Point thePoint)
Transform the given point by applying this group's scaling, shearing, rotation, and translation transforms. |
Group |
w(double x,
double y)
Set the west middle point of this group's bounding box. |
Group |
w(Point thePoint)
Set the west middle point of this group's bounding box. |
double |
width()
Returns the width of this group's bounding box. |
void |
writeExternal(ObjectOutput out)
Write this group to the given object output stream. |
double |
xScale()
Returns this group's X scale factor. |
Group |
xScale(double theXScale)
Set this group's X scale factor. |
double |
xShear()
Returns this group's X shear factor. |
Group |
xShear(double theXShear)
Set this group's X shear factor. |
double |
yScale()
Returns this group's Y scale factor. |
Group |
yScale(double theYScale)
Set this group's Y scale factor. |
double |
yShear()
Returns this group's Y shear factor. |
Group |
yShear(double theYShear)
Set this group's Y shear factor. |
| Methods inherited from class edu.rit.draw.item.DrawingItem |
|---|
boundingBox, c, e, n, ne, s, se, sw, w |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final double NORMAL_X_SCALE
public static final double NORMAL_Y_SCALE
public static final double NORMAL_X_SHEAR
public static final double NORMAL_Y_SHEAR
public static final double NORMAL_ROTATION_ANGLE
| Constructor Detail |
|---|
public Group()
public Group(Group theGroup)
theGroup - Group.
NullPointerException - (unchecked exception) Thrown if theGroup is null.| Method Detail |
|---|
public static double defaultXScale()
public static void defaultXScale(double theXScale)
theXScale - Default X scale factor.public static double defaultYScale()
public static void defaultYScale(double theYScale)
theYScale - Default Y scale factor.public static double defaultXShear()
public static void defaultXShear(double theXShear)
theXShear - Default X shear factor.public static double defaultYShear()
public static void defaultYShear(double theYShear)
theYShear - Default Y shear factor.public static double defaultRotationAngle()
public static void defaultRotationAngle(double theAngle)
theAngle - Default rotation angle.public double xScale()
public Group xScale(double theXScale)
theXScale - X scale factor.
public double yScale()
public Group yScale(double theYScale)
theYScale - Y scale factor.
public double xShear()
public Group xShear(double theXShear)
theXShear - X shear factor.
public double yShear()
public Group yShear(double theYShear)
theYShear - Y shear factor.
public double rotationAngle()
public Group rotationAngle(double theAngle)
theAngle - Rotation angle.
public Group clear()
public Group append(DrawingItem theItem)
theItem - Drawing item.
NullPointerException - (unchecked exception) Thrown if theItem is null.public Group prepend(DrawingItem theItem)
theItem - Drawing item.
NullPointerException - (unchecked exception) Thrown if theItem is null.public Size size()
size in class DrawingItempublic double width()
width in class DrawingItempublic double height()
height in class DrawingItempublic Point nw()
nw in class DrawingItem
public Group nw(double x,
double y)
x - X coordinate of northwest corner point.y - Y coordinate of northwest corner point.
public Group nw(Point thePoint)
thePoint - Northwest corner point.
NullPointerException - (unchecked exception) Thrown if thePoint is null.
public Group n(double x,
double y)
x - X coordinate of north middle point.y - Y coordinate of north middle point.
public Group n(Point thePoint)
thePoint - North middle point.
NullPointerException - (unchecked exception) Thrown if thePoint is null.
public Group ne(double x,
double y)
x - X coordinate of northeast corner point.y - Y coordinate of northeast corner point.
public Group ne(Point thePoint)
thePoint - Northeast corner point.
NullPointerException - (unchecked exception) Thrown if thePoint is null.
public Group w(double x,
double y)
x - X coordinate of west middle point.y - Y coordinate of west middle point.
public Group w(Point thePoint)
thePoint - West middle point.
NullPointerException - (unchecked exception) Thrown if thePoint is null.
public Group c(double x,
double y)
x - X coordinate of center point.y - Y coordinate of center point.
public Group c(Point thePoint)
thePoint - Center point.
NullPointerException - (unchecked exception) Thrown if thePoint is null.
public Group e(double x,
double y)
x - X coordinate of east middle point.y - Y coordinate of east middle point.
public Group e(Point thePoint)
thePoint - East middle point.
NullPointerException - (unchecked exception) Thrown if thePoint is null.
public Group sw(double x,
double y)
x - X coordinate of southwest corner point.y - Y coordinate of southwest corner point.
public Group sw(Point thePoint)
thePoint - Southwest corner point.
NullPointerException - (unchecked exception) Thrown if thePoint is null.
public Group s(double x,
double y)
x - X coordinate of south middle point.y - Y coordinate of south middle point.
public Group s(Point thePoint)
thePoint - South middle point.
NullPointerException - (unchecked exception) Thrown if thePoint is null.
public Group se(double x,
double y)
x - X coordinate of southeast corner point.y - Y coordinate of southeast corner point.
public Group se(Point thePoint)
thePoint - Southeast corner point.
NullPointerException - (unchecked exception) Thrown if thePoint is null.public Point orig_nw()
public Group orig_nw(double x,
double y)
x - X coordinate of northwest corner point.y - Y coordinate of northwest corner point.
public Group orig_nw(Point thePoint)
thePoint - Northwest corner point.
NullPointerException - (unchecked exception) Thrown if thePoint is null.public Point orig_n()
public Group orig_n(double x,
double y)
x - X coordinate of north center point.y - Y coordinate of north center point.
public Group orig_n(Point thePoint)
thePoint - North center point.
NullPointerException - (unchecked exception) Thrown if thePoint is null.public Point orig_ne()
public Group orig_ne(double x,
double y)
x - X coordinate of northeast corner point.y - Y coordinate of northeast corner point.
public Group orig_ne(Point thePoint)
thePoint - Northeast corner point.
NullPointerException - (unchecked exception) Thrown if thePoint is null.public Point orig_w()
public Group orig_w(double x,
double y)
x - X coordinate of west center point.y - Y coordinate of west center point.
public Group orig_w(Point thePoint)
thePoint - West center point.
NullPointerException - (unchecked exception) Thrown if thePoint is null.public Point orig_c()
public Group orig_c(double x,
double y)
x - X coordinate of center point.y - Y coordinate of center point.
public Group orig_c(Point thePoint)
thePoint - Center point.
NullPointerException - (unchecked exception) Thrown if thePoint is null.public Point orig_e()
public Group orig_e(double x,
double y)
x - X coordinate of east center point.y - Y coordinate of east center point.
public Group orig_e(Point thePoint)
thePoint - East center point.
NullPointerException - (unchecked exception) Thrown if thePoint is null.public Point orig_sw()
public Group orig_sw(double x,
double y)
x - X coordinate of southwest corner point.y - Y coordinate of southwest corner point.
public Group orig_sw(Point thePoint)
thePoint - Southwest corner point.
NullPointerException - (unchecked exception) Thrown if thePoint is null.public Point orig_s()
public Group orig_s(double x,
double y)
x - X coordinate of south center point.y - Y coordinate of south center point.
public Group orig_s(Point thePoint)
thePoint - South center point.
NullPointerException - (unchecked exception) Thrown if thePoint is null.public Point orig_se()
public Group orig_se(double x,
double y)
x - X coordinate of southeast corner point.y - Y coordinate of southeast corner point.
public Group orig_se(Point thePoint)
thePoint - Southeast corner point.
NullPointerException - (unchecked exception) Thrown if thePoint is null.public Point content_nw()
public Point content_n()
public Point content_ne()
public Point content_w()
public Point content_c()
public Point content_e()
public Point content_sw()
public Point content_s()
public Point content_se()
public Group add()
add in class DrawingItemNullPointerException - (unchecked exception) Thrown if there is no default drawing.Drawing.defaultDrawing()public Group add(Drawing theDrawing)
add in class DrawingItemtheDrawing - Drawing.
NullPointerException - (unchecked exception) Thrown if theDrawing is null.public Group addFirst()
addFirst in class DrawingItemNullPointerException - (unchecked exception) Thrown if there is no default drawing.Drawing.defaultDrawing()public Group addFirst(Drawing theDrawing)
addFirst in class DrawingItemtheDrawing - Drawing.
NullPointerException - (unchecked exception) Thrown if theDrawing is null.
public void writeExternal(ObjectOutput out)
throws IOException
writeExternal in interface ExternalizablewriteExternal in class DrawingItemout - Object output stream.
IOException - Thrown if an I/O error occurred.
public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
readExternal in interface ExternalizablereadExternal in class DrawingItemin - Object input stream.
IOException - Thrown if an I/O error occurred.
ClassNotFoundException - Thrown if any class needed to deserialize this group cannot be found.public void draw(Graphics2D g2d)
draw in class DrawingItemg2d - 2-D graphics context.public Point transform(Point thePoint)
thePoint - Point before applying transforms.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||