edu.mit.sketch.grammar.me
Class Ground

java.lang.Object
  |
  +--edu.mit.sketch.grammar.me.Ground
All Implemented Interfaces:
NonTerminal, Paintable, Rotatable, Serializable, Translatable

public class Ground
extends Object
implements Rotatable, NonTerminal, Serializable

A basic Ground object with shading and edges.

See Also:
Serialized Form

Field Summary
 Graphics graphics
          Graphics context for this Geometric object.
 
Constructor Summary
Ground(Shade shade, Polygon edge)
          The constructor.
 
Method Summary
 double getAngle()
          Returns the angle of the Ground WRT the x axis in radians.
 Vector getChildren()
          This method should return a vector containing the children of this object.
 Polygon[] getPolygonalBoundsArray()
          This method should return the polygonal array bounds of this non-terminal object.
 Rectangle getRectangularBounds()
          This method should return the Rectangular bounds of this non-terminal object.
 String getType()
          Implement Paintable
 void paint()
          Draw the Ground
 void paint(Graphics g)
          Draw the Ground
 void paintOriginal(Graphics g)
          This method is used to paint the original data points that forms this GeometricObject
 boolean pointIsOn(Point p, int radius)
          Returns true if the point is within +-radius distance from the curve defining the object.
 boolean pointIsOnOriginal(Point p, int radius)
          Returns true if the point is within +-radius distance from the original curve defining the object.
 void setGraphicsContext(Graphics g)
          Set graphics context for this Ground object.
 void translate(double x, double y)
          Add the arguments to the (x, y) position of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

graphics

public transient Graphics graphics
Graphics context for this Geometric object.
Constructor Detail

Ground

public Ground(Shade shade,
              Polygon edge)
The constructor.
Method Detail

getAngle

public double getAngle()
Returns the angle of the Ground WRT the x axis in radians.
Specified by:
getAngle in interface Rotatable

paint

public void paint()
Draw the Ground
Specified by:
paint in interface Paintable

paint

public void paint(Graphics g)
Draw the Ground
Specified by:
paint in interface Paintable

paintOriginal

public void paintOriginal(Graphics g)
This method is used to paint the original data points that forms this GeometricObject
Specified by:
paintOriginal in interface Paintable

setGraphicsContext

public void setGraphicsContext(Graphics g)
Set graphics context for this Ground object. Must be set at least once before doing any drawing.
Specified by:
setGraphicsContext in interface Paintable

getType

public String getType()
Implement Paintable
Specified by:
getType in interface Paintable

getRectangularBounds

public Rectangle getRectangularBounds()
This method should return the Rectangular bounds of this non-terminal object.
Specified by:
getRectangularBounds in interface NonTerminal

getPolygonalBoundsArray

public Polygon[] getPolygonalBoundsArray()
This method should return the polygonal array bounds of this non-terminal object. This is a rough approximation of the constituents of the object.
Specified by:
getPolygonalBoundsArray in interface NonTerminal

getChildren

public Vector getChildren()
This method should return a vector containing the children of this object. Children are the Terminal or NonTerminal constituents of this object.
Specified by:
getChildren in interface NonTerminal

translate

public void translate(double x,
                      double y)
Add the arguments to the (x, y) position of the object.
Specified by:
translate in interface Translatable

pointIsOn

public boolean pointIsOn(Point p,
                         int radius)
Returns true if the point is within +-radius distance from the curve defining the object. Returns false o/w.
Specified by:
pointIsOn in interface Translatable

pointIsOnOriginal

public boolean pointIsOnOriginal(Point p,
                                 int radius)
Returns true if the point is within +-radius distance from the original curve defining the object. Returns false o/w.
Specified by:
pointIsOnOriginal in interface Translatable