diva.sketch.recognition
Class TimedStroke

java.lang.Object
  extended by diva.util.java2d.Polyline2D
      extended by diva.util.java2d.Polyline2D.Float
          extended by diva.sketch.recognition.TimedStroke
All Implemented Interfaces:
PropertyContainer, Shape

public class TimedStroke
extends Polyline2D.Float
implements PropertyContainer

TimedStroke is a collection of points taken in the duration of a mouse pressed event and a mouse released event. A TimedStroke object contains basic stroke path information (such as the points and the timestamps in the path) and can be annotated to contain application-specific information, e.g. properties used in the recognition process.

Version:
$Revision: 1.5 $
Author:
Michael Shilman (michaels@eecs.berkeley.edu), Heloise Hse (hwawen@eecs.berkeley.edu)

Nested Class Summary
 
Nested classes/interfaces inherited from class diva.util.java2d.Polyline2D
Polyline2D.Double, Polyline2D.Float
 
Field Summary
 
Fields inherited from class diva.util.java2d.Polyline2D
_coordCount
 
Constructor Summary
TimedStroke()
          Construct a timed stroke object with an empty stroke path.
TimedStroke(int initSize)
          Construct a timed stroke object with an empty stroke path of the given initial size.
TimedStroke(TimedStroke in)
          Copy constructor for efficient copying of TimedStroke
 
Method Summary
 void addVertex(float x, float y, long timestamp)
          Add a pair of x, y coordinates in the stroke path and the corresponding timestamp.
 Object getProperty(String key)
          Return the property corresponding to the given key, or null if no such property exists.
 long getTimestamp(int i)
          Return the timestamp of the point at the given index.
 Iterator propertyNames()
          Return an iteration of the names of the properties
 void setProperty(String key, Object value)
          Set the property corresponding to the given key.
 
Methods inherited from class diva.util.java2d.Polyline2D.Float
getBounds2D, getX, getY, lineTo, moveTo, setX, setY, transform, translate
 
Methods inherited from class diva.util.java2d.Polyline2D
contains, contains, contains, contains, getBounds, getPathIterator, getPathIterator, getVertexCount, intersects, intersects, reset, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TimedStroke

public TimedStroke()
Construct a timed stroke object with an empty stroke path.


TimedStroke

public TimedStroke(TimedStroke in)
Copy constructor for efficient copying of TimedStroke


TimedStroke

public TimedStroke(int initSize)
Construct a timed stroke object with an empty stroke path of the given initial size.

Method Detail

addVertex

public void addVertex(float x,
                      float y,
                      long timestamp)
Add a pair of x, y coordinates in the stroke path and the corresponding timestamp.


getProperty

public Object getProperty(String key)
Return the property corresponding to the given key, or null if no such property exists.

Specified by:
getProperty in interface PropertyContainer

getTimestamp

public long getTimestamp(int i)
Return the timestamp of the point at the given index.


propertyNames

public Iterator propertyNames()
Return an iteration of the names of the properties

Specified by:
propertyNames in interface PropertyContainer

setProperty

public void setProperty(String key,
                        Object value)
Set the property corresponding to the given key.

Specified by:
setProperty in interface PropertyContainer


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.