Class Ellipse

java.lang.Object
  |
  +--java.awt.geom.RectangularShape
        |
        +--java.awt.geom.Ellipse2D
              |
              +--java.awt.geom.Ellipse2D.Double
                    |
                    +--Ellipse

class Ellipse
extends java.awt.geom.Ellipse2D.Double
implements GeometricObject

This class represents an Ellipse described by its upper_left, corner width and height of the encapsulating rectangle.


Inner classes inherited from class java.awt.geom.Ellipse2D
java.awt.geom.Ellipse2D.Double, java.awt.geom.Ellipse2D.Float
 
Field Summary
 java.awt.Graphics graphics
          Graphics context for this Geometric object.
private  Polygon points
          The original data points
 long time_stamp
          Time stamp of this object.
 
Fields inherited from class java.awt.geom.Ellipse2D.Double
height, width, x, y
 
Fields inherited from interface GeometricObject
CIRCLE, ELLIPSE, LINE, POINT, POLYGON, RECTANGLE, SQUARE
 
Constructor Summary
(package private) Ellipse()
          The constructor.
(package private) Ellipse(double x, double y, double width, double height)
          The constructor.
(package private) Ellipse(Point upper_left, java.awt.Dimension d)
          The constructor.
(package private) Ellipse(Point upper_left, int width, int height)
          The constructor.
 
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 corresponds to this object.
 Rectangle getRectangularBounds()
          Supplied for completeness.
 long getTimeStamp()
          Returns the time stamp of the current Terminal
 java.lang.String getType()
          Implement GeometricObject
 java.lang.String getTypeWithTolerance(double tolerance)
          This returns "circle" if the width/height ratio is within tolerance neighborhood of 1.
 void paint()
          Draw the object
 void paint(java.awt.Graphics g)
          Draw the object
 void paintOriginal(java.awt.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 setDataPoints(Polygon points)
          This method is used to set the original data points that forms this GeometricObject
 void setGraphicsContext(java.awt.Graphics g)
          Set graphics context for this Geometric object.
 void setTimeStamp(long time_stamp)
          Sets the time stamp of the current Terminal
 int spatialRelation(GeometricObject object)
          This method should return the spatial relation of the input parameter with respect to this object.
 java.lang.String toString()
          Override toString
 boolean touches(GeometricObject object)
          This method should return true if the input objects touch.
 
Methods inherited from class java.awt.geom.Ellipse2D.Double
getBounds2D, getHeight, getWidth, getX, getY, isEmpty, setFrame
 
Methods inherited from class java.awt.geom.Ellipse2D
contains, contains, getPathIterator, intersects
 
Methods inherited from class java.awt.geom.RectangularShape
clone, contains, contains, getBounds, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, getPathIterator, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
 
Methods inherited from class java.lang.Object
, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

points

private Polygon points
The original data points

time_stamp

public long time_stamp
Time stamp of this object.

graphics

public java.awt.Graphics graphics
Graphics context for this Geometric object.
Constructor Detail

Ellipse

Ellipse()
The constructor.

Ellipse

Ellipse(double x,
        double y,
        double width,
        double height)
The constructor.

Ellipse

Ellipse(Point upper_left,
        int width,
        int height)
The constructor.

Ellipse

Ellipse(Point upper_left,
        java.awt.Dimension d)
The constructor.
Method Detail

getType

public java.lang.String getType()
Implement GeometricObject

getTypeWithTolerance

public java.lang.String getTypeWithTolerance(double tolerance)
This returns "circle" if the width/height ratio is within tolerance neighborhood of 1.

toString

public java.lang.String toString()
Override toString
Overrides:
toString in class java.lang.Object

paint

public void paint()
Draw the object

paint

public void paint(java.awt.Graphics g)
Draw the object

paintOriginal

public void paintOriginal(java.awt.Graphics g)
This method is used to paint the original data points that forms this GeometricObject

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 GeometricObject

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 GeometricObject

setGraphicsContext

public void setGraphicsContext(java.awt.Graphics g)
Set graphics context for this Geometric object. Must be set at least once before doing any drawing.

touches

public boolean touches(GeometricObject object)
This method should return true if the input objects touch. It should be optimized making use of the object type information.
Specified by:
touches in interface GeometricObject

getRectangularBounds

public Rectangle getRectangularBounds()
Supplied for completeness.
Specified by:
getRectangularBounds in interface GeometricObject

containsGeometricObject

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

getPolygonalBounds

public Polygon getPolygonalBounds()
This method should return a polygon that corresponds to this object. The polygon is implicity closed and the last point doesn't necessarily have to be the same as the first (zeroth) point. The returned polygon is a liberal approximation to the real shape of the object. Known eksik: This should be refined to return a more conservative result.
Specified by:
getPolygonalBounds in interface GeometricObject

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.
Specified by:
spatialRelation in interface GeometricObject

setTimeStamp

public void setTimeStamp(long time_stamp)
Sets the time stamp of the current Terminal

getTimeStamp

public long getTimeStamp()
Returns the time stamp of the current Terminal

setDataPoints

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

getDataPoints

public Polygon getDataPoints()
This method is used to get the original data points that forms this GeometricObject
Specified by:
getDataPoints in interface GeometricObject

containsGeometricObjects

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