UC Berkeley Group for User Interface Research
Updated November 17, 2000

edu.berkeley.guir.lib.satin.stroke
Class TimedPolygon2D

java.lang.Object
  |
  +--edu.berkeley.guir.lib.awt.geom.Polygon2D
        |
        +--edu.berkeley.guir.lib.satin.stroke.TimedPolygon2D
All Implemented Interfaces:
Cloneable, Serializable, Shape

public class TimedPolygon2D
extends Polygon2D
implements Serializable, Cloneable

A polygon that also has timing information.

This implementation is not yet optimized for space. The difficulty lies in the design decision made by Javasoft to make the arrays in Polygon directly accessible, which can improve performance but make other optimizations much more difficult since there is no abstraction.

This software is distributed under the Berkeley Software License.

 Revisions:  - SATIN-v1.0-1.0.0, Oct 06 1998, JH
               Created class
             - SATIN-v2.1-1.0.0, Aug 11 2000, JH
               Touched for SATIN release
 

Since:
JDK 1.2
Version:
SATIN-v2.1-1.0.0, Aug 11 2000
Author:
Chris Long ( allanl@cs.berkeley.edu ), Jason Hong ( jasonh@cs.berkeley.edu )
See Also:
Serialized Form

Field Summary
 long[] times
           
 
Fields inherited from class edu.berkeley.guir.lib.awt.geom.Polygon2D
npoints, xpoints, ypoints
 
Constructor Summary
TimedPolygon2D()
           
TimedPolygon2D(float[] x, float[] y, int numPoints)
           
TimedPolygon2D(float[] x, float[] y, long[] t, int numPoints)
           
TimedPolygon2D(float[] x, float[] y, long time, int numPoints)
           
TimedPolygon2D(int[] x, int[] y, int numPoints)
           
TimedPolygon2D(int[] x, int[] y, long[] t, int numPoints)
           
TimedPolygon2D(int[] x, int[] y, long time, int numPoints)
           
TimedPolygon2D(Polygon p)
          Clone the polygon, with all the times set to the current time.
TimedPolygon2D(Polygon2D p)
          Clone the polygon, with all the times set to the current time.
TimedPolygon2D(Polygon2D p, long[] t)
          Create a polygon with the specified times.
TimedPolygon2D(Polygon p, long[] t)
          Create a polygon with the specified times.
TimedPolygon2D(TimedPolygon2D p)
          Clone the specified polygon.
 
Method Summary
 void addPoint(double x, double y)
          Add a point, with the time determined by the system clock.
 void addPoint(double x, double y, long t)
          Add a point with the specified time.
 Object clone()
           
 Object clone(TimedPolygon2D p)
           
 Rectangle getBounds()
          Fixes a bug in Polygon.
 long getEndTime()
          Get the end time of this polygon.
 long getStartTime()
          Get the start time of this polygon.
 void setToShape(TimedPolygon2D poly)
           
 String toString()
           
 
Methods inherited from class edu.berkeley.guir.lib.awt.geom.Polygon2D
addPoint, clearPoints, clone, contains, contains, contains, contains, cut, getBounds2D, getPathIterator, getPathIterator, intersects, intersects, isClosed, isNormalized, main, minDistance, minDistance, normalize, paste, perimeter, setClosed, setPoly, setPoly, setToPathIterator, setToShape, simplify, transform, transformCopy, translate, trim
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

times

public long[] times
Constructor Detail

TimedPolygon2D

public TimedPolygon2D()

TimedPolygon2D

public TimedPolygon2D(int[] x,
                      int[] y,
                      int numPoints)

TimedPolygon2D

public TimedPolygon2D(int[] x,
                      int[] y,
                      long time,
                      int numPoints)

TimedPolygon2D

public TimedPolygon2D(int[] x,
                      int[] y,
                      long[] t,
                      int numPoints)

TimedPolygon2D

public TimedPolygon2D(Polygon p)
Clone the polygon, with all the times set to the current time.

TimedPolygon2D

public TimedPolygon2D(Polygon p,
                      long[] t)
Create a polygon with the specified times.

TimedPolygon2D

public TimedPolygon2D(float[] x,
                      float[] y,
                      int numPoints)

TimedPolygon2D

public TimedPolygon2D(float[] x,
                      float[] y,
                      long time,
                      int numPoints)

TimedPolygon2D

public TimedPolygon2D(float[] x,
                      float[] y,
                      long[] t,
                      int numPoints)

TimedPolygon2D

public TimedPolygon2D(Polygon2D p)
Clone the polygon, with all the times set to the current time.

TimedPolygon2D

public TimedPolygon2D(Polygon2D p,
                      long[] t)
Create a polygon with the specified times.

TimedPolygon2D

public TimedPolygon2D(TimedPolygon2D p)
Clone the specified polygon.
Method Detail

getStartTime

public long getStartTime()
Get the start time of this polygon.
Returns:
the start time of this polygon. This value is junk unless there is at least one point in the polygon.

getEndTime

public long getEndTime()
Get the end time of this polygon.
Returns:
the end time of this polygon. This value is junk unless there is at least one point in the polygon.

getBounds

public Rectangle getBounds()
Fixes a bug in Polygon.
Overrides:
getBounds in class Polygon2D

setToShape

public void setToShape(TimedPolygon2D poly)

addPoint

public void addPoint(double x,
                     double y)
Add a point, with the time determined by the system clock.
Overrides:
addPoint in class Polygon2D
Parameters:
x - is the x-coordinate of the point to add.
y - is the y-coordinate of the point to add.

addPoint

public void addPoint(double x,
                     double y,
                     long t)
Add a point with the specified time.
Parameters:
x - is the x-coordinate of the point to add.
y - is the y-coordinate of the point to add.
t - is the time for this point.

toString

public String toString()
Overrides:
toString in class Polygon2D

clone

public Object clone()
Overrides:
clone in class Polygon2D

clone

public Object clone(TimedPolygon2D p)

Copyright Information