de.softpro.signdocmobile.foundations
Class TabletTrace

java.lang.Object
  extended by de.softpro.signdocmobile.foundations.TabletTrace
All Implemented Interfaces:
java.io.Serializable

public class TabletTrace
extends java.lang.Object
implements java.io.Serializable

TabletTrace represents a single pen stroke

TabletTrace the class used to record the trajectory of a pen as the user writes. These recordings describe sequences of connected TabletPoints. A TabletTrace starts when after a pen down event, and when the user lifts from the surface the current TabletTrace ends.

See Also:
Serialized Form

Nested Class Summary
static class TabletTrace.WritingInstrument
           
 
Constructor Summary
TabletTrace()
          TabletTrace constructs an empty TabletTrace
TabletTrace(TabletTrace aSrc)
          TabletTrace copy constructor
 
Method Summary
 void addPoint(float x, float y, float p, long time)
          Add an point to the current trace
 void addPoint(TabletPoint p)
          Add an TabletPoint to the current trace
 void copy(TabletTrace src)
          Copy an existing TabletTrace
 void endTrace(long time)
          Mark the current trace finished, during a pen up event.
 TabletPoint getPoint(int index)
          Get a TabletPoint contained in the trace by index
 java.util.List<TabletPoint> getPoints()
          Get a list of the points in the trace
 int getSize()
          The number of points in the trace
 TabletTrace.WritingInstrument getWritingInstrument()
          Get the writing instrument
 boolean isEqual(TabletTrace b)
          Check if two traces are equal
 void setWritingInstrument(TabletTrace.WritingInstrument aWritingInstrument)
          Set the writing instrument
 java.lang.String toString()
           
 java.lang.String toString(int numlines)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TabletTrace

public TabletTrace()
TabletTrace constructs an empty TabletTrace


TabletTrace

public TabletTrace(TabletTrace aSrc)
TabletTrace copy constructor

Parameters:
src - TabletTrace to copy
Method Detail

copy

public void copy(TabletTrace src)
Copy an existing TabletTrace

Parameters:
src - TabletTrace to copy

addPoint

public void addPoint(TabletPoint p)
Add an TabletPoint to the current trace

Parameters:
p - TabletPoint to add to trace

addPoint

public void addPoint(float x,
                     float y,
                     float p,
                     long time)
Add an point to the current trace

Parameters:
x - X -coordinate
y - Y -coordinate
p - pressure
time - time

getPoints

public java.util.List<TabletPoint> getPoints()
Get a list of the points in the trace

Returns:
list of TabletPoint

getPoint

public TabletPoint getPoint(int index)
Get a TabletPoint contained in the trace by index

Returns:
TabletPoint or null of index is our of bounds
See Also:
getSize()

getSize

public int getSize()
The number of points in the trace

Returns:
size of trace

endTrace

public void endTrace(long time)
Mark the current trace finished, during a pen up event.


toString

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

toString

public java.lang.String toString(int numlines)

setWritingInstrument

public void setWritingInstrument(TabletTrace.WritingInstrument aWritingInstrument)
Set the writing instrument

Parameters:
aWritingInstrument - the writing instrument to set

getWritingInstrument

public TabletTrace.WritingInstrument getWritingInstrument()
Get the writing instrument

Returns:
writing instrument

isEqual

public boolean isEqual(TabletTrace b)
Check if two traces are equal

Parameters:
b - trace to compare to
Returns:
true if equal