edu.mit.sketch.grammar.me
Class Spring
java.lang.Object
|
+--edu.mit.sketch.geom.Rectangle
|
+--edu.mit.sketch.grammar.me.Spring
- All Implemented Interfaces:
- GeometricObject, Paintable, Rotatable, Serializable, Terminal, Translatable
- public class Spring
- extends Rectangle
- implements Serializable
A basic Spring
- See Also:
- Serialized Form
|
Constructor Summary |
Spring(Polygon polygon)
The constructor constructs a spring that is approximated by
the input polygon. |
|
Method Summary |
Rectangle |
getRectangularBounds()
This method should return the Rectangular bounds of this
non-terminal object. |
String |
getType()
Implement Paintable |
static boolean |
isSpring(Polygon polygon)
Returns true if the input polygon looks like a Spring. |
void |
paint()
Draw the Spring |
void |
paint(Graphics g)
Draw the Spring
Can be made faster by incrementing theta in larger chunks. |
void |
paintOriginal(Graphics g)
This method is used to paint the original data points that
forms this GeometricObject |
void |
setGraphicsContext(Graphics g)
Set graphics context for this Pin object. |
void |
translate(double x,
double y)
Add the arguments to the (x, y) position of the object. |
| Methods inherited from class edu.mit.sketch.geom.Rectangle |
area, containsGeometricObject, containsGeometricObjects, getAngle, getCenter, getDataPoints, getHeight, getMajorAxisAngle, getMajorAxisDirection, getMajorAxisLength, getMinorAxisAngle, getMinorAxisLength, getPolygonalBounds, getTimeStamp, getWidth, hasOnMajorAxisDirection, isRectangle, paint, pointIsOn, pointIsOnOriginal, rotateAbout, scaleAboutCenter, setDataPoints, setRectangle, setTimeStamp, shade, shade, spatialRelation, spatialRelation, spatialRelationCartesian, toString, touches, union |
Spring
public Spring(Polygon polygon)
- The constructor constructs a spring that is approximated by
the input polygon.
paint
public void paint()
- Draw the Spring
- Overrides:
paint in class Rectangle
isSpring
public static boolean isSpring(Polygon polygon)
- Returns true if the input polygon looks like a Spring.
paint
public void paint(Graphics g)
- Draw the Spring
Can be made faster by incrementing theta in larger chunks.
- Overrides:
paint in class Rectangle
setGraphicsContext
public void setGraphicsContext(Graphics g)
- Set graphics context for this Pin object.
Must be set at least once before doing any drawing.
- Overrides:
setGraphicsContext in class Rectangle
getType
public String getType()
- Implement Paintable
- Overrides:
getType in class Rectangle
paintOriginal
public void paintOriginal(Graphics g)
- This method is used to paint the original data points that
forms this GeometricObject
- Overrides:
paintOriginal in class Rectangle
getRectangularBounds
public Rectangle getRectangularBounds()
- This method should return the Rectangular bounds of this
non-terminal object.
- Overrides:
getRectangularBounds in class Rectangle
translate
public void translate(double x,
double y)
- Add the arguments to the (x, y) position of the object.
- Overrides:
translate in class Rectangle