|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.mit.sketch.ddg.DrawnObject
public class DrawnObject
An concrete object drawn from an object description. Consists of the geometric primitives which can be drawn, and provides several methds for calculating and changing properties of these primitives. Stores a mapping between the geometric parts and the primitives in the object description.
Needed Improvements:
Need better implementation of bounding box. Maybe axis of least inertia. Maybe contour or convex hull finding.
| Constructor Summary | |
|---|---|
DrawnObject()
Construct an empty drawn object |
|
DrawnObject(GeometricObjectList geometricParts,
PrimitiveList primitives)
Construct an drawnObject from a given list of geometric parts and a list of corresponding primitives. |
|
DrawnObject(GeometricObject geometricPart,
Primitive primitive)
Construct an drawnObject from a given list of geometric parts (one part) and a list of corresponding primitives (one primitive). |
|
DrawnObject(java.util.HashMap primToGeomParts)
Construct an drawnObject from a given mapping of primitives to geometric parts. |
|
| Method Summary | |
|---|---|
double |
angle()
Get the angle of the object. |
Rectangle |
axisParallelBoundingBox()
Get the axis-parallel bounding box |
Rectangle |
boundingBox()
Get the smallest possible bounding box of any orientation |
Point |
center()
Returns the center of the object, which is defined as the center of the smallest bounding box. |
java.lang.Object |
clone()
Clone the object (and the concrete geometric parts inside) |
GeometricObject |
geometricPartAt(int index)
Return the geometric part corresponding to the primitive at the given index |
GeometricObject |
geometricPartAt(Primitive primitive)
Return the geometric part corresponding to the given primitive |
GeometricObjectList |
geometricParts()
Return the geometric parts comprising this object |
DrawnObject |
getObject(Primitive primitive)
Finds the geometric object corresponding to the primitive and returns it as a DrawnObject with that geometric object in it. |
DrawnObject |
getObject(PrimitiveList primitives)
Finds the geometric object corresponding to the given list of primitives and returns it as a DrawnObject with those geometric object in it. |
double |
height()
Get the height of the object. |
double |
length()
Get the length of the object. |
void |
paint(java.awt.Graphics g)
Paint the object with the primitives labelled. |
Primitive |
primitiveAt(int index)
Return the primitive corresponding to the part at the given index |
PrimitiveList |
primitives()
Return the primitives comprising this object |
void |
remove(Primitive primitive)
Removes the geometric part corresponding to the given primitive. |
void |
rotate(Point origin,
double angle)
Rotate the object by a given angle from the x-axis, clockwise, about the given center. |
void |
scale(Point origin,
double horizontalFactor,
double verticalFactor)
Scale the object by a given factor horizontally and vertically. |
double |
thickness()
Get the thickness of the object. |
void |
translate(Point translationVector)
Translate the object by a given translation vector |
double |
width()
Get the width of the object. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DrawnObject()
public DrawnObject(GeometricObjectList geometricParts,
PrimitiveList primitives)
public DrawnObject(java.util.HashMap primToGeomParts)
public DrawnObject(GeometricObject geometricPart,
Primitive primitive)
| Method Detail |
|---|
public GeometricObjectList geometricParts()
public PrimitiveList primitives()
public DrawnObject getObject(Primitive primitive)
throws PrimitiveNotFoundException
PrimitiveNotFoundException
public DrawnObject getObject(PrimitiveList primitives)
throws PrimitiveNotFoundException
PrimitiveNotFoundException
public Primitive primitiveAt(int index)
throws java.lang.IndexOutOfBoundsException
java.lang.IndexOutOfBoundsException
public GeometricObject geometricPartAt(int index)
throws java.lang.IndexOutOfBoundsException
java.lang.IndexOutOfBoundsException
public GeometricObject geometricPartAt(Primitive primitive)
throws PrimitiveNotFoundException
PrimitiveNotFoundException
public void remove(Primitive primitive)
throws PrimitiveNotFoundException
PrimitiveNotFoundExceptionpublic void paint(java.awt.Graphics g)
public Point center()
throws ObjectEmptyException
ObjectEmptyException
public Rectangle axisParallelBoundingBox()
throws ObjectEmptyException
ObjectEmptyException
public double width()
throws ObjectEmptyException
ObjectEmptyException
public double height()
throws ObjectEmptyException
ObjectEmptyException
public Rectangle boundingBox()
throws ObjectEmptyException
ObjectEmptyException
public double thickness()
throws ObjectEmptyException
ObjectEmptyException
public double length()
throws ObjectEmptyException
ObjectEmptyException
public double angle()
throws ObjectEmptyException
ObjectEmptyExceptionpublic void translate(Point translationVector)
translate in interface Transformable
public void rotate(Point origin,
double angle)
rotate in interface Transformable
public void scale(Point origin,
double horizontalFactor,
double verticalFactor)
scale in interface Transformablepublic java.lang.Object clone()
clone in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||