edu.mit.sketch.geom
Interface GeometricObject

All Superinterfaces:
Paintable, Terminal, Translatable
All Known Implementing Classes:
GeneralPath, Line, Rectangle, Point, Polygon, Ellipse

public interface GeometricObject
extends Terminal, Translatable

All the objects who want to be Geometric must implement this interface.


Field Summary
static int CIRCLE
           
static int ELLIPSE
           
static int LINE
           
static int POINT
           
static int POLYGON
           
static int RECTANGLE
          Available GeometricObject types.
static int SQUARE
           
 
Method Summary
 boolean containsGeometricObject(GeometricObject object)
          Returns false if the argument is not completely inside this object.
 boolean containsGeometricObjects(GeometricObject[] objects)
          Returns false if the objects in the input array are completely inside this object.
 Polygon getDataPoints()
          This method is used to get the original data points that forms this GeometricObject
 Polygon getPolygonalBounds()
          This method should return a polygon that fully contains the current object.
 Rectangle getRectangularBounds()
          This method should return the Rectangular bounds of the object.
 void setDataPoints(Polygon points)
          This method is used to set the original data points that forms this GeometricObject
 int spatialRelation(GeometricObject object)
          This method should return the spatial relation of the input parameter with respect to this object.
 boolean touches(GeometricObject object)
          This method should return true if the input object touches this geometric object.
 
Methods inherited from interface edu.mit.sketch.grammar.Terminal
getTimeStamp, setTimeStamp
 
Methods inherited from interface edu.mit.sketch.ui.Paintable
getType, paint, paint, paintOriginal, setGraphicsContext
 
Methods inherited from interface edu.mit.sketch.geom.Translatable
pointIsOn, pointIsOnOriginal, translate
 

Field Detail

RECTANGLE

public static final int RECTANGLE
Available GeometricObject types.

SQUARE

public static final int SQUARE

ELLIPSE

public static final int ELLIPSE

CIRCLE

public static final int CIRCLE

POLYGON

public static final int POLYGON

LINE

public static final int LINE

POINT

public static final int POINT
Method Detail

getPolygonalBounds

public Polygon getPolygonalBounds()
This method should return a polygon that fully contains the current object. The polygon is implicity closed and the last point doesn't necessarily have to be the same as the first (zeroth) point.

touches

public boolean touches(GeometricObject object)
This method should return true if the input object touches this geometric object.

spatialRelation

public int spatialRelation(GeometricObject object)
This method should return the spatial relation of the input parameter with respect to this object. see the SpatialRelation class for a detailed list of possible spatial relations. Another version of this method should be implemented for handling spatial relations where a rotated coordinate system is to be used.

getRectangularBounds

public Rectangle getRectangularBounds()
This method should return the Rectangular bounds of the object.

containsGeometricObject

public boolean containsGeometricObject(GeometricObject object)
Returns false if the argument is not completely inside this object. Return true O/W.

containsGeometricObjects

public boolean containsGeometricObjects(GeometricObject[] objects)
Returns false if the objects in the input array are completely inside this object. Return true O/W.

setDataPoints

public void setDataPoints(Polygon points)
This method is used to set the original data points that forms this GeometricObject

getDataPoints

public Polygon getDataPoints()
This method is used to get the original data points that forms this GeometricObject